| Method from com.opensymphony.module.sitemesh.factory.BaseFactory Detail: |
protected void addExcludeUrl(String path) {
excludeUrls.put("", path);
}
|
protected void clearDecoratorMappers() {
decoratorMapper = null;
}
Clear all current DecoratorMappers. |
protected void clearExcludeUrls() {
excludeUrls = new PathMapper();
}
|
protected void clearParserMappings() {
pageParsers = new HashMap();
}
Clear all PageParser mappings. |
public DecoratorMapper getDecoratorMapper() {
return decoratorMapper;
}
Return instance of DecoratorMapper. |
public PageParser getPageParser(String contentType) {
return (PageParser) pageParsers.get(contentType);
}
Create a PageParser suitable for the given content-type.
For example, if the supplied parameter is text/html
a parser shall be returned that can parse HTML accordingly. Returns
null if no parser can be found for the supplied content type. |
public boolean isPathExcluded(String path) {
return excludeUrls.get(path) != null;
}
Returns true if the supplied path matches one of the exclude
URLs specified in sitemesh.xml, otherwise returns false. |
public static Class loadClass(String className,
Class callingClass) throws ClassNotFoundException {
try {
return Thread.currentThread().getContextClassLoader().loadClass(className);
} catch (ClassNotFoundException e) {
try {
return Class.forName(className);
} catch (ClassNotFoundException ex) {
try {
return BaseFactory.class.getClassLoader().loadClass(className);
} catch (ClassNotFoundException exc) {
return callingClass.getClassLoader().loadClass(className);
}
}
}
}
|
protected void mapParser(String contentType,
String className) {
if (className.endsWith(".DefaultPageParser")) {
return; // Backwards compatability - this can safely be ignored.
}
try {
PageParser pp = (PageParser) Class.forName(className).newInstance();
// Store the parser even if the content type is NULL. [This
// is most probably the legacy default page parser which
// we no longer have a use for]
pageParsers.put(contentType, pp);
}
catch (ClassNotFoundException e) {
report("Could not load PageParser class : " + className, e);
}
catch (Exception e) {
report("Could not instantiate PageParser : " + className, e);
}
}
Map new PageParser to given content-type. contentType = null signifies default
PageParser for unknown content-types. |
protected void pushDecoratorMapper(String className,
Properties properties) {
try {
Class decoratorMapperClass = null;
try {
decoratorMapperClass = loadClass(className, getClass());
}
catch (NoClassDefFoundError e) {
decoratorMapperClass = Class.forName(className, true, Thread.currentThread().getContextClassLoader());
}
DecoratorMapper newMapper = (DecoratorMapper) decoratorMapperClass.newInstance();
newMapper.init(config, properties, decoratorMapper);
decoratorMapper = newMapper;
}
catch (ClassNotFoundException e) {
report("Could not load DecoratorMapper class : " + className, e);
}
catch (Exception e) {
report("Could not initialize DecoratorMapper : " + className, e);
}
}
Push new DecoratorMapper onto end of chain. |
public boolean shouldParsePage(String contentType) {
return pageParsers.containsKey(contentType);
}
Determine whether a Page of given content-type should be parsed or not. |