use of freemarker.ext.jsp.TaglibFactory.MetaInfTldSource in project freemarker by apache.
the class FreemarkerServlet method parseAsMetaInfTldLocations.
private List parseAsMetaInfTldLocations(String value) throws ParseException {
List /*<MetaInfTldSource>*/
metaInfTldSources = null;
List /*<String>*/
values = InitParamParser.parseCommaSeparatedList(value);
for (Iterator it = values.iterator(); it.hasNext(); ) {
final String itemStr = (String) it.next();
final MetaInfTldSource metaInfTldSource;
if (itemStr.equals(META_INF_TLD_LOCATION_WEB_INF_PER_LIB_JARS)) {
metaInfTldSource = WebInfPerLibJarMetaInfTldSource.INSTANCE;
} else if (itemStr.startsWith(META_INF_TLD_LOCATION_CLASSPATH)) {
String itemRightSide = itemStr.substring(META_INF_TLD_LOCATION_CLASSPATH.length()).trim();
if (itemRightSide.length() == 0) {
metaInfTldSource = new ClasspathMetaInfTldSource(Pattern.compile(".*", Pattern.DOTALL));
} else if (itemRightSide.startsWith(":")) {
final String regexpStr = itemRightSide.substring(1).trim();
if (regexpStr.length() == 0) {
throw new ParseException("Empty regular expression after \"" + META_INF_TLD_LOCATION_CLASSPATH + ":\"", -1);
}
metaInfTldSource = new ClasspathMetaInfTldSource(Pattern.compile(regexpStr));
} else {
throw new ParseException("Invalid \"" + META_INF_TLD_LOCATION_CLASSPATH + "\" value syntax: " + value, -1);
}
} else if (itemStr.startsWith(META_INF_TLD_LOCATION_CLEAR)) {
metaInfTldSource = ClearMetaInfTldSource.INSTANCE;
} else {
throw new ParseException("Item has no recognized source type prefix: " + itemStr, -1);
}
if (metaInfTldSources == null) {
metaInfTldSources = new ArrayList();
}
metaInfTldSources.add(metaInfTldSource);
}
return metaInfTldSources;
}
Aggregations