| Method from org.apache.struts.tiles.TilesUtilImpl Detail: |
protected DefinitionsFactory createDefinitionFactoryInstance(String classname) throws DefinitionsFactoryException {
try {
Class factoryClass = RequestUtils.applicationClass(classname);
Object factory = factoryClass.newInstance();
// Backward compatibility : if factory classes implements old interface,
// provide appropriate wrapper
if (factory instanceof ComponentDefinitionsFactory) {
factory =
new ComponentDefinitionsFactoryWrapper(
(ComponentDefinitionsFactory) factory);
}
return (DefinitionsFactory) factory;
} catch (ClassCastException ex) { // Bad classname
throw new DefinitionsFactoryException(
"Error - createDefinitionsFactory : Factory class '"
+ classname
+ " must implement 'TilesDefinitionsFactory'.",
ex);
} catch (ClassNotFoundException ex) { // Bad classname
throw new DefinitionsFactoryException(
"Error - createDefinitionsFactory : Bad class name '"
+ classname
+ "'.",
ex);
} catch (InstantiationException ex) { // Bad constructor or error
throw new DefinitionsFactoryException(ex);
} catch (IllegalAccessException ex) {
throw new DefinitionsFactoryException(ex);
}
}
|
public DefinitionsFactory createDefinitionsFactory(ServletContext servletContext,
DefinitionsFactoryConfig factoryConfig) throws DefinitionsFactoryException {
// Create configurable factory
DefinitionsFactory factory =
createDefinitionFactoryInstance(factoryConfig.getFactoryClassname());
factory.init(factoryConfig, servletContext);
// Make factory accessible from jsp tags (push it in appropriate context)
makeDefinitionsFactoryAccessible(factory, servletContext);
return factory;
}
|
public void doForward(String uri,
HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext) throws IOException, ServletException {
request.getRequestDispatcher(uri).forward(request, response);
}
Do a forward using request dispatcher.
This method is used by the Tiles package anytime a forward is required. |
public void doInclude(String uri,
PageContext pageContext) throws IOException, ServletException {
pageContext.include(uri);
}
Do an include using PageContext.include().
This method is used by the Tiles package when an include is required.
The Tiles package can use indifferently any form of this method. |
public void doInclude(String uri,
HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext) throws IOException, ServletException {
request.getRequestDispatcher(uri).include(request, response);
}
Do an include using request dispatcher.
This method is used by the Tiles package when an include is required.
The Tiles package can use indifferently any form of this method. |
public DefinitionsFactory getDefinitionsFactory(ServletRequest request,
ServletContext servletContext) {
return (DefinitionsFactory) servletContext.getAttribute(DEFINITIONS_FACTORY);
}
Get definition factory from appropriate servlet context. |
protected void makeDefinitionsFactoryAccessible(DefinitionsFactory factory,
ServletContext servletContext) {
servletContext.setAttribute(DEFINITIONS_FACTORY, factory);
}
Make definition factory accessible to Tags.
Factory is stored in servlet context. |