rleland 2002/11/07 20:59:49 Modified: src/share/org/apache/struts/action RequestProcessor.java src/share/org/apache/struts/tiles TilesRequestProcessor.java src/share/org/apache/struts/util RequestUtils.java Log: Bug 14054 Checked in More ApplicationConfig->ModuleConfig Revision Changes Path 1.21 +30 -23 jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java Index: RequestProcessor.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- RequestProcessor.java 5 Nov 2002 14:10:07 -0000 1.20 +++ RequestProcessor.java 8 Nov 2002 04:59:49 -0000 1.21 @@ -76,7 +76,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts.config.ActionConfig; -import org.apache.struts.config.ApplicationConfig; +import org.apache.struts.config.ModuleConfig; import org.apache.struts.config.ExceptionConfig; import org.apache.struts.config.ForwardConfig; import org.apache.struts.upload.MultipartRequestWrapper; @@ -131,9 +131,15 @@ /** - * The ApplicationConfiguration we are associated with. + * The ModuleConfiguration we are associated with. + * @deprecated use moduleConfig instead. */ - protected ApplicationConfig appConfig = null; + protected ModuleConfig appConfig = null; + + /** + * The ModuleConfiguration we are associated with. + */ + protected ModuleConfig moduleConfig = null; /** @@ -173,18 +179,19 @@ * Initialize this request processor instance. * * @param servlet The ActionServlet we are associated with - * @param appConfig The ApplicationConfig we are associated with. + * @param moduleConfig The ModuleConfig we are associated with. * @throws ServletException If an error occor during initialization */ public void init(ActionServlet servlet, - ApplicationConfig appConfig) + ModuleConfig moduleConfig) throws ServletException { synchronized (actions) { actions.clear(); } this.servlet = servlet; - this.appConfig = appConfig; + this.appConfig = moduleConfig; + this.moduleConfig = moduleConfig; } @@ -347,7 +354,7 @@ // Create (if necessary a form bean to use ActionForm instance = RequestUtils.createActionForm - (request, mapping, appConfig, servlet); + (request, mapping, moduleConfig, servlet); if (instance == null) { return (null); } @@ -375,7 +382,7 @@ * mechanism. * * This method takes the old ActionForward object as parameter. User should - * use {@link processForwardConfig} when possible. + * use {@link #processForwardConfig(HttpServletRequest, HttpServletResponse,ForwardConfig)} when possible. * @param request The servlet request we are processing * @param response The servlet response we are creating * @param forward The ActionForward controlling where we go next @@ -474,7 +481,7 @@ protected void processContent(HttpServletRequest request, HttpServletResponse response) { - String contentType = appConfig.getControllerConfig().getContentType(); + String contentType = moduleConfig.getControllerConfig().getContentType(); if (contentType != null) { response.setContentType(contentType); } @@ -594,7 +601,7 @@ HttpServletResponse response) { // Are we configured to select the Locale automatically? - if (!appConfig.getControllerConfig().getLocale()) { + if (!moduleConfig.getControllerConfig().getLocale()) { return; } @@ -634,14 +641,14 @@ // Is there a directly defined mapping for this path? ActionMapping mapping = (ActionMapping) - appConfig.findActionConfig(path); + moduleConfig.findActionConfig(path); if (mapping != null) { request.setAttribute(Action.MAPPING_KEY, mapping); return (mapping); } // Locate the mapping for unknown paths (if any) - ActionConfig configs[] = appConfig.findActionConfigs(); + ActionConfig configs[] = moduleConfig.findActionConfigs(); for (int i = 0; i < configs.length; i++) { if (configs[i].getUnknown()) { mapping = (ActionMapping) configs[i]; @@ -694,7 +701,7 @@ protected void processNoCache(HttpServletRequest request, HttpServletResponse response) { - if (appConfig.getControllerConfig().getNocache()) { + if (moduleConfig.getControllerConfig().getNocache()) { response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", 1); @@ -734,7 +741,7 @@ if (path == null) { path = request.getServletPath(); } - String prefix = appConfig.getPrefix(); + String prefix = moduleConfig.getPrefix(); if (!path.startsWith(prefix)) { log.error(getInternal().getMessage("processPath", request.getRequestURI())); @@ -900,7 +907,7 @@ log.debug(" Validating input form properties"); } ActionErrors errors = form.validate(mapping, request); - if ((errors == null) || errors.empty()) { + if ((errors == null) || errors.isEmpty()) { if (log.isTraceEnabled()) { log.trace(" No errors detected, accepting input"); } @@ -932,8 +939,8 @@ log.debug(" Validation failed, returning to '" + input + "'"); } request.setAttribute(Action.ERROR_KEY, errors); - String uri = null; - if (appConfig.getControllerConfig().getInputForward()) { + + if (moduleConfig.getControllerConfig().getInputForward()) { ForwardConfig forward = mapping.findForward(input); processForwardConfig( request, response, forward); } else { @@ -960,7 +967,7 @@ throws IOException, ServletException { // Construct a request dispatcher for the specified path - uri = appConfig.getPrefix() + uri; + uri = moduleConfig.getPrefix() + uri; // Delegate the processing of this request // FIXME - exception handling? @@ -986,7 +993,7 @@ throws IOException, ServletException { // Construct a request dispatcher for the specified path - uri = appConfig.getPrefix() + uri; + uri = moduleConfig.getPrefix() + uri; // Delegate the processing of this request // FIXME - exception handling? 1.10 +5 -5 jakarta-struts/src/share/org/apache/struts/tiles/TilesRequestProcessor.java Index: TilesRequestProcessor.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesRequestProcessor.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- TilesRequestProcessor.java 5 Nov 2002 14:08:29 -0000 1.9 +++ TilesRequestProcessor.java 8 Nov 2002 04:59:49 -0000 1.10 @@ -129,14 +129,14 @@ if(log.isErrorEnabled()) { log.error( "Definition Factory not found for module '" - + appConfig.getPrefix() + "'. " + + moduleConfig.getPrefix() + "'. " + "Have you declared the appropriate plugin in struts-config.xml ?" ); } return; } if(log.isInfoEnabled()) { - log.info("Tiles definition factory found for request processor '" + appConfig.getPrefix() + "'."); + log.info("Tiles definition factory found for request processor '" + moduleConfig.getPrefix() + "'."); } } 1.68 +8 -7 jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java Index: RequestUtils.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- RequestUtils.java 5 Nov 2002 14:07:09 -0000 1.67 +++ RequestUtils.java 8 Nov 2002 04:59:49 -0000 1.68 @@ -101,6 +101,7 @@ import org.apache.struts.config.ApplicationConfig; import org.apache.struts.config.FormBeanConfig; import org.apache.struts.config.ForwardConfig; +import org.apache.struts.config.ModuleConfig; import org.apache.struts.taglib.html.Constants; import org.apache.struts.upload.MultipartRequestHandler; @@ -536,13 +537,13 @@ * * @param request The servlet request we are processing * @param mapping The action mapping for this request - * @param appConfig The application configuration for this module + * @param moduleConfig The application configuration for this module * @param servlet The action servlet * @return ActionForm instance associated with this request */ public static ActionForm createActionForm(HttpServletRequest request, ActionMapping mapping, - ApplicationConfig appConfig, + ModuleConfig moduleConfig, ActionServlet servlet) { // Is there a form bean associated with this mapping? @@ -553,7 +554,7 @@ // Look up the form bean configuration information to use String name = mapping.getName(); - FormBeanConfig config = appConfig.findFormBeanConfig(name); + FormBeanConfig config = moduleConfig.findFormBeanConfig(name); if (config == null) { return (null); }
-- To unsubscribe, e-mail: <mailto:struts-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>