@Override public Entity getParent() { Entity result = null; int index = this.fullName.lastIndexOf("/"); if (index != -1) { result = new ServletWarEntity(getServletContext(), this.fullName .substring(0, index + 1)); } return result; }
@Override public Representation getRepresentation(MediaType defaultMediaType, int timeToLive) { Representation result = null; InputStream ris = getServletContext().getResourceAsStream(path); if (ris != null) { result = new InputRepresentation(ris, defaultMediaType); // Sets the modification date String realPath = getServletContext().getRealPath(path); if (realPath != null) { File file = new File(realPath); if (file != null) { result.setModificationDate(new Date(file.lastModified())); } } } return result; }
this.directory = true; this.fullName = path.substring(0, path.length() - 1); Set childPaths = getServletContext().getResourcePaths(path); Set childPaths = getServletContext().getResourcePaths(path);
@Override public boolean exists() { boolean result = false; try { result = (isDirectory() && getChildren() != null) || (isNormal() && getServletContext() .getResource(this.path) != null); } catch (MalformedURLException e) { Context.getCurrentLogger().log(Level.WARNING, "Unable to test the existence of the WAR resource", e); } return result; }