List of usage examples for org.apache.commons.lang.text StrLookup lookup
public abstract String lookup(String key);
From source file:com.siberhus.web.ckeditor.utils.WebVarLookup.java
@Override public String lookup(String key) { StrLookup lookup = new RequestVarLookup(request); String value = null;/*from ww w . j a v a 2 s .c om*/ if ((value = lookup.lookup(key)) == null) { lookup = new SessionVarLookup(request.getSession()); if ((value = lookup.lookup(key)) == null) { lookup = new ApplicationVarLookup(servletContext); return lookup.lookup(key); } } return value; }
From source file:org.sindice.analytics.servlet.ServletConfigurationContextListener.java
private XMLConfiguration createXMLConfiguration(final ServletContext context) { final XMLConfiguration config = new XMLConfiguration(); ConfigurationInterpolator interpolator = config.getInterpolator(); final StrLookup defaultLookup = interpolator.getDefaultLookup(); interpolator.setDefaultLookup(new StrLookup() { @Override// w ww . j a va2 s .c o m public String lookup(String key) { if (context.getAttribute(key) != null) { return context.getAttribute(key).toString(); } if (context.getInitParameter(key) != null) { return context.getInitParameter(key); } return defaultLookup.lookup(key); } }); return config; }
From source file:org.sindice.core.analytics.commons.webapps.SparqledContextListener.java
private XMLConfiguration createXMLConfiguration(final ServletContext context) { final XMLConfiguration config = new XMLConfiguration(); final ConfigurationInterpolator interpolator = config.getInterpolator(); final StrLookup defaultLookup = interpolator.getDefaultLookup(); interpolator.setDefaultLookup(new StrLookup() { @Override//from w w w. j a va2 s .com public String lookup(String key) { if (context.getAttribute(key) != null) { return context.getAttribute(key).toString(); } if (context.getInitParameter(key) != null) { return context.getInitParameter(key); } return defaultLookup.lookup(key); } }); return config; }