remm        2003/12/10 14:26:28

  Modified:    catalina/src/share/org/apache/coyote/tomcat5
                        CoyoteConnector.java CoyoteRequest.java
                        mbeans-descriptors.xml
  Log:
  - Add a flag to allow using the encoding specified in the contentType for
    the URI paramters. This is disabled by default, not compliant with the standards,
    but present for compatibility.
  
  Revision  Changes    Path
  1.34      +31 -1     
jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- CoyoteConnector.java      17 Nov 2003 00:43:54 -0000      1.33
  +++ CoyoteConnector.java      10 Dec 2003 22:26:28 -0000      1.34
  @@ -375,6 +375,12 @@
        private String URIEncoding = null;
   
   
  +     /**
  +      * URI encoding as body.
  +      */
  +     private boolean useBodyEncodingForURI = false;
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -1124,6 +1130,30 @@
   
            this.URIEncoding = URIEncoding;
            setProperty("uRIEncoding", URIEncoding);
  +
  +     }
  +
  +
  +     /**
  +      * Return the true if the entity body encoding should be used for the URI.
  +      */
  +     public boolean getUseBodyEncodingForURI() {
  +
  +         return (this.useBodyEncodingForURI);
  +
  +     }
  +
  +
  +     /**
  +      * Set if the entity body encoding should be used for the URI.
  +      *
  +      * @param useBodyEncodingForURI The new value for the flag.
  +      */
  +     public void setUseBodyEncodingForURI(boolean useBodyEncodingForURI) {
  +
  +         this.useBodyEncodingForURI = useBodyEncodingForURI;
  +         setProperty
  +             ("useBodyEncodingForURI", String.valueOf(useBodyEncodingForURI));
   
        }
   
  
  
  
  1.27      +15 -7     
jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java
  
  Index: CoyoteRequest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- CoyoteRequest.java        4 Dec 2003 13:49:28 -0000       1.26
  +++ CoyoteRequest.java        10 Dec 2003 22:26:28 -0000      1.27
  @@ -481,7 +481,7 @@
       /**
        * Associated Catalina connector.
        */
  -    protected Connector connector;
  +    protected CoyoteConnector connector;
   
       /**
        * Return the Connector through which this Request was received.
  @@ -496,7 +496,7 @@
        * @param connector The new connector
        */
       public void setConnector(Connector connector) {
  -        this.connector = connector;
  +        this.connector = (CoyoteConnector) connector;
       }
   
   
  @@ -2324,11 +2324,19 @@
           Parameters parameters = coyoteRequest.getParameters();
   
           String enc = coyoteRequest.getCharacterEncoding();
  +        boolean useBodyEncodingForURI = connector.getUseBodyEncodingForURI();
           if (enc != null) {
               parameters.setEncoding(enc);
  +            if (useBodyEncodingForURI) {
  +                parameters.setQueryStringEncoding(enc);
  +            }
           } else {
               parameters.setEncoding
                   (org.apache.coyote.Constants.DEFAULT_CHARACTER_ENCODING);
  +            if (useBodyEncodingForURI) {
  +                parameters.setQueryStringEncoding
  +                    (org.apache.coyote.Constants.DEFAULT_CHARACTER_ENCODING);
  +            }
           }
   
           parameters.handleQueryParameters();
  @@ -2354,7 +2362,7 @@
           int len = getContentLength();
   
           if (len > 0) {
  -            int maxPostSize = ((CoyoteConnector) connector).getMaxPostSize();
  +            int maxPostSize = connector.getMaxPostSize();
               if ((maxPostSize > 0) && (len > maxPostSize)) {
                   log(sm.getString("coyoteRequest.postTooLarge"));
                   throw new IllegalStateException("Post too large");
  
  
  
  1.10      +4 -0      
jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/mbeans-descriptors.xml
  
  Index: mbeans-descriptors.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/mbeans-descriptors.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mbeans-descriptors.xml    16 Nov 2003 21:19:49 -0000      1.9
  +++ mbeans-descriptors.xml    10 Dec 2003 22:26:28 -0000      1.10
  @@ -173,6 +173,10 @@
             description="Character encoding used to decode the URI"
                    type="java.lang.String"/>
   
  +    <attribute   name="useBodyEncodingForURI"
  +          description="Should the body encoding be used for URI parameters"
  +                 type="boolean"/>
  +
       <attribute    name="xpoweredBy"
              description="Is generation of X-Powered-By response header 
enabled/disabled?"
                       is="true"
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to