A WebResource implementation that represents a non-existent resource. All methods return values indicating the resource does not exist.
| 31 | * All methods return values indicating the resource does not exist. |
| 32 | */ |
| 33 | public class EmptyResource implements WebResource { |
| 34 | |
| 35 | private final WebResourceRoot root; |
| 36 | private final String webAppPath; |
| 37 | private final File file; |
| 38 | |
| 39 | /** |
| 40 | * Creates a new empty resource for the given path. |
| 41 | * |
| 42 | * @param root the web resource root |
| 43 | * @param webAppPath the path within the web application |
| 44 | */ |
| 45 | public EmptyResource(WebResourceRoot root, String webAppPath) { |
| 46 | this(root, webAppPath, null); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Creates a new empty resource for the given path and file. |
| 51 | * |
| 52 | * @param root the web resource root |
| 53 | * @param webAppPath the path within the web application |
| 54 | * @param file the associated file, may be {@code null} |
| 55 | */ |
| 56 | public EmptyResource(WebResourceRoot root, String webAppPath, File file) { |
| 57 | this.root = root; |
| 58 | this.webAppPath = webAppPath; |
| 59 | this.file = file; |
| 60 | } |
| 61 | |
| 62 | @Override |
| 63 | public long getLastModified() { |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | @Override |
| 68 | public String getLastModifiedHttp() { |
| 69 | return null; |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | public boolean exists() { |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | @Override |
| 78 | public boolean isVirtual() { |
| 79 | return false; |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public boolean isDirectory() { |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | public boolean isFile() { |
| 89 | return false; |
| 90 | } |
nothing calls this directly
no outgoing calls
no test coverage detected