struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/util RequestUtils.java
Date Sat, 02 Aug 2003 21:16:54 GMT
dgraham     2003/08/02 14:16:54

  Modified:    src/share/org/apache/struts/tiles
                        TilesUtilStrutsModulesImpl.java
               src/share/org/apache/struts/util RequestUtils.java
  Log:
  Replace RequestUtils calls with ModuleUtils.
  
  Revision  Changes    Path
  1.6       +8 -7      jakarta-struts/src/share/org/apache/struts/tiles/TilesUtilStrutsModulesImpl.java
  
  Index: TilesUtilStrutsModulesImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesUtilStrutsModulesImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TilesUtilStrutsModulesImpl.java	9 Jul 2003 00:24:00 -0000	1.5
  +++ TilesUtilStrutsModulesImpl.java	2 Aug 2003 21:16:54 -0000	1.6
  @@ -71,7 +71,7 @@
   
   import org.apache.struts.Globals;
   import org.apache.struts.config.ModuleConfig;
  -import org.apache.struts.util.RequestUtils;
  +import org.apache.struts.util.ModuleUtils;
   
   /**
    * Implementation of TilesUtil for Struts multi modules.
  @@ -198,12 +198,13 @@
           HttpServletRequest request,
           ServletContext servletContext) {
   
  -        ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig(request);
  +        ModuleConfig moduleConfig =
  +            ModuleUtils.getInstance().getRequestModuleConfig(request);
   
           if (moduleConfig == null) {
               // ModuleConfig not found in current request. Select it.
  -            RequestUtils.selectModule(request, servletContext);
  -            moduleConfig = RequestUtils.getRequestModuleConfig(request);
  +            ModuleUtils.getInstance().selectModule(request, servletContext);
  +            moduleConfig = ModuleUtils.getInstance().getRequestModuleConfig(request);
           }
   
           return moduleConfig;
  
  
  
  1.133     +20 -8     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.132
  retrieving revision 1.133
  diff -u -r1.132 -r1.133
  --- RequestUtils.java	2 Aug 2003 21:03:41 -0000	1.132
  +++ RequestUtils.java	2 Aug 2003 21:16:54 -0000	1.133
  @@ -899,13 +899,16 @@
               }
           }
   
  -        ModuleConfig moduleConfig = getRequestModuleConfig(request);
  +        ModuleConfig moduleConfig =
  +            ModuleUtils.getInstance().getRequestModuleConfig(request);
  +            
           multipartClass = moduleConfig.getControllerConfig().getMultipartClass();
   
           // Try to initialize the global request handler
           if (multipartClass != null) {
               try {
                   multipartHandler = (MultipartRequestHandler) applicationInstance(multipartClass);
  +                
               } catch (ClassNotFoundException cnfe) {
                   throw new ServletException(
                       "Cannot find multipart class \""
  @@ -913,6 +916,7 @@
                           + "\""
                           + ", exception: "
                           + cnfe.getMessage());
  +                        
               } catch (InstantiationException ie) {
                   throw new ServletException(
                       "InstantiaionException when instantiating "
  @@ -920,6 +924,7 @@
                           + multipartClass
                           + "\", exception: "
                           + ie.getMessage());
  +                        
               } catch (IllegalAccessException iae) {
                   throw new ServletException(
                       "IllegalAccessException when instantiating "
  @@ -1049,15 +1054,19 @@
           if (pattern.endsWith("/*")) {
               sb.append(pattern.substring(0, pattern.length() - 2));
               sb.append(action.getPath());
  +            
           } else if (pattern.startsWith("*.")) {
  -            ModuleConfig appConfig = getRequestModuleConfig(request);
  +            ModuleConfig appConfig =
  +                ModuleUtils.getInstance().getRequestModuleConfig(request);
               sb.append(appConfig.getPrefix());
               sb.append(action.getPath());
               sb.append(pattern.substring(1));
  +            
           } else {
               throw new IllegalArgumentException(pattern);
           }
  -        return (sb.toString());
  +        
  +        return sb.toString();
   
       }
   
  @@ -1117,7 +1126,8 @@
           }
   
           // Calculate a context relative path for this ForwardConfig
  -        ModuleConfig moduleConfig = getRequestModuleConfig(request);
  +        ModuleConfig moduleConfig =
  +            ModuleUtils.getInstance().getRequestModuleConfig(request);
           String forwardPattern = moduleConfig.getControllerConfig().getForwardPattern();
           if (forwardPattern == null) {
               // Performance optimization for previous default behavior
  @@ -1127,6 +1137,7 @@
                   sb.append("/");
               }
               sb.append(path);
  +            
           } else {
               boolean dollar = false;
               for (int i = 0; i < forwardPattern.length(); i++) {
  @@ -1158,6 +1169,7 @@
                   }
               }
           }
  +        
           return (sb.toString());
   
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message