public URL getResource(String path) throws MalformedURLException { URL url = null; ServerResource resource = getServerResource(path); if(null != resource){ url = resource.getURL(); } return url; }
public void setAttribute(String name, Object object) { // TODO - inform listeners if (null == object) { removeAttribute(name); } else { Object oldValue = attributes.put(name, object); ServletContextAttributeEvent event = new ServletContextAttributeEvent(this,name,object); if(null != oldValue){ valueReplaced(event); } else { valueBound(event); } } }
public void removeAttribute(String name) { // TODO - inform listeners Object removed = attributes.remove(name); if(null != removed){ valueUnbound(new ServletContextAttributeEvent(this,name,removed)); } }
URL resource = context.getResource(path); if (null != resource) {
context.addInitParameters(initParameters);
URL resource = context.getResource(path); if (null != resource) {
context.addInitParameters(initParameters);
public void setAttribute(String name, Object object) { // TODO - inform listeners if (null == object) { removeAttribute(name); } else { Object oldValue = attributes.put(name, object); ServletContextAttributeEvent event = new ServletContextAttributeEvent(this,name,object); if(null != oldValue){ valueReplaced(event); } else { valueBound(event); } } }
public InputStream getResourceAsStream(String path) { ServerResource resource = getServerResource(path); if(null != resource){ try { return resource.getAsStream(); } catch (IOException e) { return null; } } return null; }
public void removeAttribute(String name) { // TODO - inform listeners Object removed = attributes.remove(name); if(null != removed){ valueUnbound(new ServletContextAttributeEvent(this,name,removed)); } }
public InputStream getResourceAsStream(String path) { ServerResource resource = getServerResource(path); if(null != resource){ try { return resource.getAsStream(); } catch (IOException e) { return null; } } return null; }
public URL getResource(String path) throws MalformedURLException { URL url = null; ServerResource resource = getServerResource(path); if(null != resource){ url = resource.getURL(); } return url; }
@SuppressWarnings("unchecked") public Set getResourcePaths(String path) { HashSet result=null; ServerResource resource = getServerResource(path); if(null == resource && !path.endsWith("/")){ path+="/"; resource = getServerResource(path); } if(null != resource){ Set<String> paths = resource.getPaths(); if(null != paths && paths.size()>0){ result = new HashSet(paths.size()); for (String resourcePath : paths) { result.add(path+resourcePath); } } } return result; }
@SuppressWarnings("unchecked") public Set getResourcePaths(String path) { HashSet result=null; ServerResource resource = getServerResource(path); if(null == resource && !path.endsWith("/")){ path+="/"; resource = getServerResource(path); } if(null != resource){ Set<String> paths = resource.getPaths(); if(null != paths && paths.size()>0){ result = new HashSet(paths.size()); for (String resourcePath : paths) { result.add(path+resourcePath); } } } return result; }