List of usage examples for org.apache.commons.collections ExtendedProperties getStringArray
public String[] getStringArray(String key)
From source file:org.sakaiproject.hierarchy.tool.vm.spring.WebappLoader.java
/** * This is abstract in the base class, so we need it. * <br>/*from ww w . ja va 2 s . c o m*/ * NOTE: this expects that the ServletContext has already * been placed in the runtime's application attributes * under its full class name (i.e. "javax.servlet.ServletContext"). * * @param configuration the {@link ExtendedProperties} associated with * this resource loader. */ public void init(ExtendedProperties configuration) { rsvc.debug("WebappLoader : initialization starting."); /* get configured paths */ paths = configuration.getStringArray("path"); if (paths == null || paths.length == 0) { paths = new String[1]; paths[0] = "/"; } else { /* make sure the paths end with a '/' */ for (int i = 0; i < paths.length; i++) { if (!paths[i].endsWith("/")) { paths[i] += '/'; } if (paths[i].startsWith("./")) { paths[i] = paths[i].substring(1); } rsvc.info("WebappLoader : added template path - '" + paths[i] + "'"); } } /* get the ServletContext */ Object obj = rsvc.getApplicationAttribute(ServletContext.class.getName()); if (obj instanceof ServletContext) { servletContext = (ServletContext) obj; } else { rsvc.error("WebappLoader : unable to retrieve ServletContext"); } /* init the template paths map */ templatePaths = new HashMap(); rsvc.debug("WebappLoader : initialization complete."); }
From source file:org.sakaiproject.login.impl.velocity.WebappLoader.java
/** * This is abstract in the base class, so we need it. <br> * NOTE: this expects that the ServletContext has already been placed in the * runtime's application attributes under its full class name (i.e. * "javax.servlet.ServletContext")./*from www .j a va 2 s . c o m*/ * * @param configuration * the {@link ExtendedProperties} associated with this resource * loader. */ @Override public void init(ExtendedProperties configuration) { rsvc.debug("WebappLoader : initialization starting."); /* get configured paths */ paths = configuration.getStringArray("path"); if (paths == null || paths.length == 0) { paths = new String[1]; paths[0] = "/"; } else { /* make sure the paths end with a '/' */ for (int i = 0; i < paths.length; i++) { if (!paths[i].endsWith("/")) { paths[i] += '/'; } if (paths[i].startsWith("./")) { paths[i] = paths[i].substring(1); } rsvc.info("WebappLoader : added template path - '" + paths[i] + "'"); } } /* get the ServletContext */ Object obj = rsvc.getApplicationAttribute(ServletContext.class.getName()); if (obj instanceof ServletContext) { servletContext = (ServletContext) obj; } else { rsvc.error("WebappLoader : unable to retrieve ServletContext"); } /* init the template paths map */ templatePaths = new HashMap(); rsvc.debug("WebappLoader : initialization complete."); }