cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/acting RequestParamAction.java
Date Thu, 07 Aug 2003 12:37:04 GMT
joerg       2003/08/07 05:37:04

  Modified:    src/java/org/apache/cocoon/acting RequestParamAction.java
  Log:
  code formatting
  
  Revision  Changes    Path
  1.2       +32 -38    cocoon-2.1/src/java/org/apache/cocoon/acting/RequestParamAction.java
  
  Index: RequestParamAction.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/acting/RequestParamAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestParamAction.java	9 Mar 2003 00:08:39 -0000	1.1
  +++ RequestParamAction.java	7 Aug 2003 12:37:04 -0000	1.2
  @@ -50,20 +50,18 @@
   */
   package org.apache.cocoon.acting;
   
  -/*
  - * Standard imports
  - */
  +import java.util.Enumeration;
  +import java.util.HashMap;
  +import java.util.Map;
  +
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.avalon.framework.thread.ThreadSafe;
  +
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.SourceResolver;
   
  -import java.util.Enumeration;
  -import java.util.HashMap;
  -import java.util.Map;
  -
   /**
    * This action makes some request details available to the sitemap via parameter
    * substitution.
  @@ -125,13 +123,11 @@
       public final static String MAP_QUERY       = "requestQuery";
       public final static String MAP_CONTEXTPATH = "context";
   
  -    public final static String PARAM_PARAMETERS = "parameters";
  +    public final static String PARAM_PARAMETERS     = "parameters";
       public final static String PARAM_DEFAULT_PREFIX = "default.";
   
  -
  -    public Map act( Redirector redirector, SourceResolver resolver, Map objectModel, String
source, Parameters param )
  -        throws Exception
  -    {
  +    public Map act(Redirector redirector, SourceResolver resolver, Map objectModel,
  +                   String source, Parameters param) throws Exception {
   
           Request request = ObjectModelHelper.getRequest(objectModel);
   
  @@ -140,37 +136,35 @@
           map.put(MAP_URI, request.getRequestURI());
   
           String query = request.getQueryString();
  -        if (query != null && query.length() > 0){
  -          map.put(MAP_QUERY, "?" + query);
  -        }
  -        else{
  -          map.put(MAP_QUERY, "");
  +        if (query != null && query.length() > 0) {
  +            map.put(MAP_QUERY, "?" + query);
  +        } else {
  +            map.put(MAP_QUERY, "");
           }
   
           map.put(MAP_CONTEXTPATH, request.getContextPath());
   
  -        if ("true".equalsIgnoreCase(param.getParameter(PARAM_PARAMETERS, null))){
  -          Enumeration e = request.getParameterNames();
  -          while(e.hasMoreElements()){
  -            String name = (String) e.nextElement();
  -            String value = request.getParameter(name);
  -
  -            if (value != null && !map.containsKey(name)){
  -              map.put(name, value);
  +        if ("true".equalsIgnoreCase(param.getParameter(PARAM_PARAMETERS, null))) {
  +            Enumeration e = request.getParameterNames();
  +            while (e.hasMoreElements()) {
  +                String name = (String)e.nextElement();
  +                String value = request.getParameter(name);
  +
  +                if (value != null && !map.containsKey(name)) {
  +                    map.put(name, value);
  +                }
               }
  -          }
  -
  -      String[] paramNames = param.getNames();
  -          for (int i=0; i< paramNames.length; i++) {
  -          if (paramNames[i].startsWith(PARAM_DEFAULT_PREFIX) &&
  -          (request.getParameter(paramNames[i].substring(PARAM_DEFAULT_PREFIX.length()))
== null)) {
  -          map.put(paramNames[i].substring(PARAM_DEFAULT_PREFIX.length()), param.getParameter(paramNames[i]));
  -          }
  -      }
  -
   
  +            String[] paramNames = param.getNames();
  +            for (int i = 0; i < paramNames.length; i++) {
  +                if (paramNames[i].startsWith(PARAM_DEFAULT_PREFIX)
  +                        && (request.getParameter(paramNames[i].substring(PARAM_DEFAULT_PREFIX.length()))
== null)) {
  +                    map.put(paramNames[i].substring(PARAM_DEFAULT_PREFIX.length()),
  +                            param.getParameter(paramNames[i]));
  +                }
  +            }
           }
  -
  -        return(map);
  +        return (map);
       }
  +
   }
  
  
  

Mime
View raw message