/** * @see org.springframework.extensions.webscripts.ScriptContent#getPathDescription() */ public String getPathDescription() { return getBasePath() + '/' + this.scriptPath; }
public String[] getDescriptionDocumentPaths() throws IOException { return getDocumentPaths("/", true, DESC_PATH_PATTERN); }
protected String getRoot() { return getPath(); }
public boolean hasDocument(String documentPath) { boolean has = false; if (!isForbidden(documentPath)) { String resourcePath = toResourcePath(documentPath); Resource resource = this.resolver.getResource(resourcePath); has = resource.exists(); } return has; }
private Reader getReader(String encoding) throws IOException { Reader reader = null; String resourcePath = toResourcePath(templatePath); Resource resource = getResourceResolver().getResource(resourcePath); if (resource.exists()) { reader = encoding != null ? new java.io.InputStreamReader(resource.getInputStream(), encoding) : new java.io.InputStreamReader(resource.getInputStream()); } return reader; } }
public String getBasePath() { return getRoot(); }
/** * @see freemarker.cache.TemplateLoader#findTemplateSource(java.lang.String) */ public Object findTemplateSource(String name) throws IOException { WebApplicationStoreTemplateSource source = null; if (hasDocument(name)) { source = new WebApplicationStoreTemplateSource(name); } return source; }
public String[] getAllDocumentPaths() { String[] paths; try { List<String> documentPaths = matchDocumentPaths("/**/*"); paths = documentPaths.toArray(new String[documentPaths.size()]); } catch (IOException e) { // Note: Ignore: no documents found paths = new String[0]; } return paths; }
private long lastModified() { try { return ResourceStore.this.lastModified(templatePath); } catch (IOException e) { return -1; } }
public boolean exists() { return getRootResource().exists(); }
public void init() { this.resolver = getResourceResolver(); if (this.root == null) { this.root = "/"; } }
public boolean hasDocument(String documentPath) { boolean has = false; if (!isForbidden(documentPath)) { String resourcePath = toResourcePath(documentPath); Resource resource = this.resolver.getResource(resourcePath); has = resource.exists(); } return has; }
private Reader getReader(String encoding) throws IOException { Reader reader = null; String resourcePath = toResourcePath(templatePath); Resource resource = getResourceResolver().getResource(resourcePath); if (resource.exists()) { reader = encoding != null ? new java.io.InputStreamReader(resource.getInputStream(), encoding) : new java.io.InputStreamReader(resource.getInputStream()); } return reader; } }
public String getBasePath() { return getRoot(); }
/** * @see freemarker.cache.TemplateLoader#findTemplateSource(java.lang.String) */ public Object findTemplateSource(String name) throws IOException { WebApplicationStoreTemplateSource source = null; if (hasDocument(name)) { source = new WebApplicationStoreTemplateSource(name); } return source; }
public String[] getAllDocumentPaths() { String[] paths; try { List<String> documentPaths = matchDocumentPaths("/**/*"); paths = documentPaths.toArray(new String[documentPaths.size()]); } catch (IOException e) { // Note: Ignore: no documents found paths = new String[0]; } return paths; }
private long lastModified() { try { return ResourceStore.this.lastModified(templatePath); } catch (IOException e) { return -1; } }
public boolean exists() { return getRootResource().exists(); }
public void init() { this.resolver = getResourceResolver(); if (this.root == null) { this.root = "/"; } }
public InputStream getDocument(String documentPath) throws IOException { if (isForbidden(documentPath)) { throw new IOException("Document path: " + documentPath + " is within a protected directory, cannot retrieve input stream"); } String resourcePath = toResourcePath(documentPath); Resource resource = this.resolver.getResource(resourcePath); return resource.getInputStream(); }