|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectGenericServlet
HttpServlet
ActionServlet
AutoRegisterActionServlet
public class AutoRegisterActionServlet
ActionServlet that dynamically registers requested modules based on registered module
configuration file locators. The user may specify AutoRegisterActionServlet.ModuleConfigLocator
classes
in web.xml, using the "moduleConfigLocators" init-parameter; this allows the user to
define patterns for auto-registered Struts modules.
Nested Class Summary | |
---|---|
static interface |
AutoRegisterActionServlet.ModuleConfigLocator
Interface for specifying alternate locations for auto-registered Struts modules. |
Field Summary | |
---|---|
static String |
MODULE_CONFIG_LOCATOR_CLASS_ATTR
Deprecated. To register AutoRegisterActionServlet.ModuleConfigLocator s, use the module-config-locators element
in pageflow-config of /WEB-INF/netui-config.xml. |
Fields inherited from class ActionServlet |
---|
config, configDigester, convertNull, dataSources, internal, internalName, log, processor, registrations, servletMapping, servletName |
Constructor Summary | |
---|---|
AutoRegisterActionServlet()
|
Method Summary | |
---|---|
void |
clearRegisteredModules()
Clear the internal map of registered modules. |
void |
destroy()
|
ModuleConfig |
ensureModuleRegistered(String modulePath,
ServletRequest request)
Ensures that the Struts module for the given path is registered (dynamically, if necessary). |
protected URL |
getConfigResource(String path)
Get a resource URL for a module configuration file. |
protected InputStream |
getConfigResourceAsStream(String path)
Get a resource stream for a module configuration file. |
protected AutoRegisterActionServlet.ModuleConfigLocator[] |
getDefaultModuleConfigLocators()
Get the base list of ModuleConfigLocators, to specify locations for auto-registered Struts modules. |
String |
getInitParameter(String s)
|
Enumeration |
getInitParameterNames()
|
protected ModuleConfig |
getModuleConfig(String modulePath,
ServletRequest request,
ServletResponse response)
Get the Struts ModuleConfig for the given module path. |
AutoRegisterActionServlet.ModuleConfigLocator[] |
getModuleConfigLocators()
Get the current list of registered ModuleConfigLocators. |
String |
getModuleConfPath(String modulePath)
Get the webapp-relative path to the Struts module configration file for a given module path, based on registered ModuleConfigLocators. |
void |
init()
|
protected Digester |
initConfigDigester()
|
protected ModuleConfig |
initModuleConfig(String prefix,
String paths)
This method is almost exactly the same as the base class initModuleConfig. |
protected void |
process(HttpServletRequest request,
HttpServletResponse response)
This override of the base class process() registers a Struts module on the fly if the config file can be found in our standard place (named in our standard way), regardless of whether the module is configured in web.xml. |
protected boolean |
processUnhandledAction(HttpServletRequest request,
HttpServletResponse response,
String uri)
Last chance to handle an unhandled action URI. |
protected ModuleConfig |
registerModule(String modulePath,
String configFilePath)
Register a Struts module, initialized by the given configuration file. |
Methods inherited from class ActionServlet |
---|
addServletMapping, destroyConfigDigester, destroyInternal, destroyModules, doGet, doPost, getInternal, getModuleConfig, getRequestProcessor, initInternal, initModuleConfigFactory, initModuleDataSources, initModuleMessageResources, initModulePlugIns, initModulePrefixes, initOther, initServlet, parseModuleConfigFile |
Methods inherited from class HttpServlet |
---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class GenericServlet |
---|
getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String MODULE_CONFIG_LOCATOR_CLASS_ATTR
AutoRegisterActionServlet.ModuleConfigLocator
s, use the module-config-locators
element
in pageflow-config
of /WEB-INF/netui-config.xml.Constructor Detail |
---|
public AutoRegisterActionServlet()
Method Detail |
---|
public void init() throws ServletException
init
in class ActionServlet
ServletException
protected AutoRegisterActionServlet.ModuleConfigLocator[] getDefaultModuleConfigLocators()
public AutoRegisterActionServlet.ModuleConfigLocator[] getModuleConfigLocators()
getDefaultModuleConfigLocators()
public String getModuleConfPath(String modulePath)
modulePath
- the Struts module path.
null
if no appropriate configuration file is found.getDefaultModuleConfigLocators()
public String getInitParameter(String s)
getInitParameter
in interface ServletConfig
getInitParameter
in class GenericServlet
public Enumeration getInitParameterNames()
getInitParameterNames
in interface ServletConfig
getInitParameterNames
in class GenericServlet
protected ModuleConfig initModuleConfig(String prefix, String paths) throws ServletException
initModuleConfig
in class ActionServlet
ServletException
protected URL getConfigResource(String path) throws MalformedURLException
path
- the path to the resource.
null
if the resource is not found.
MalformedURLException
protected InputStream getConfigResourceAsStream(String path)
path
- the path to the resource.
null
if the resource is not found.protected ModuleConfig registerModule(String modulePath, String configFilePath) throws ServletException
modulePath
- the module path, starting at the webapp root, e.g., "/info/help".configFilePath
- the path, starting at the webapp root, to the module configuration
file (e.g., "/WEB-INF/my-generated-struts-config-info-help.xml").
ServletException
protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
process
in class ActionServlet
IOException
ServletException
protected Digester initConfigDigester() throws ServletException
initConfigDigester
in class ActionServlet
ServletException
public void destroy()
destroy
in interface Servlet
destroy
in class ActionServlet
protected ModuleConfig getModuleConfig(String modulePath, ServletRequest request, ServletResponse response) throws IOException, ServletException
modulePath
- the module path, from the request URI.request
- the current ServletRequestresponse
- the current HttpServletResponse
modulePath
IOException
ServletException
public ModuleConfig ensureModuleRegistered(String modulePath, ServletRequest request) throws IOException, ServletException
modulePath
- the module path, from the request URI.request
- the current ServletRequest
IOException
ServletException
public void clearRegisteredModules()
protected boolean processUnhandledAction(HttpServletRequest request, HttpServletResponse response, String uri) throws IOException, ServletException
true
if this method handled it (by forwarding somewhere or writing to the response).
IOException
ServletException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |