You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by mi...@apache.org on 2003/10/19 16:51:58 UTC

cvs commit: jakarta-tapestry/framework/src/org/apache/tapestry/multipart DefaultMultipartDecoder.java

mindbridge    2003/10/19 07:51:58

  Modified:    framework/src/org/apache/tapestry TapestryStrings.properties
                        AbstractMarkupWriter.java
               framework/src/org/apache/tapestry/engine AbstractEngine.java
                        EngineServiceLink.java
               framework/src/org/apache/tapestry/multipart
                        DefaultMultipartDecoder.java
  Log:
  PR: 23511 Problem with URL encodings at EngineServiceLink.java by FRiDeRMaN
  
  Tapestry now uses jakarta-commons-codec and encodes the URLs correctly
  
  Revision  Changes    Path
  1.35      +2 -4      jakarta-tapestry/framework/src/org/apache/tapestry/TapestryStrings.properties
  
  Index: TapestryStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/TapestryStrings.properties,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- TapestryStrings.properties	18 Oct 2003 15:54:12 -0000	1.34
  +++ TapestryStrings.properties	19 Oct 2003 14:51:58 -0000	1.35
  @@ -27,6 +27,7 @@
   render-only-property=Property ''{0}'' of {1} may only be accessed while the component is rendering.
   unsupported-property=Property ''{1}'' is not supported by {0}.
   must-be-contained-by-body={0} components must be contained by a Body component.
  +illegal-encoding=The encoding ''{0}'' is not recognized.
   
   # org.apache.tapestry
   
  @@ -41,7 +42,6 @@
   
   AbstractMarkupWriter.missing-constructor-parameters=Incomplete parameters to AbstractMarkupWriter constructor.
   AbstractMarkupWriter.tag-not-open=A tag must be open before attributes may be set in an IMarkupWriter.
  -AbstractMarkupWriter.illegal-encoding=The encoding ''{0}'' is not recognized.
   
   ApplicationServlet.could-not-locate-engine=Could not locate an engine to service this request.
   ApplicationServlet.could-not-parse-spec=Unable to parse application specification {0}.
  @@ -135,7 +135,6 @@
   AbstractEngine.exception-during-cleanup=Exception during post-request cleanup.
   AbstractEngine.exception-during-cache-clear=Exception while clearing caches after request.
   AbstractEngine.validate-cycle=A validate cycle during page activation was detected: {0}.
  -AbstractEngine.illegal-encoding=The encoding ''{0}'' is not recognized.
   
   ActionService.context-parameters=Service action requires either three or four service contect parameters.
   ActionService.action-component-wrong-type=Component {0} dopes not implement the IAction interface.
  @@ -276,7 +275,6 @@
   
   DefaultMultipartDecoder.unable-to-decode=Unable to decode request: {0}
   DefaultMultipartDecoder.encoding-not-set=No encoding has been set for this request.
  -DefaultMultipartDecoder.unsupported-encoding=The encoding ''{0}'' is not recognized.
   
   # org.apache.tapestry.pageload
   
  
  
  
  1.10      +2 -2      jakarta-tapestry/framework/src/org/apache/tapestry/AbstractMarkupWriter.java
  
  Index: AbstractMarkupWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/AbstractMarkupWriter.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractMarkupWriter.java	17 Oct 2003 18:53:51 -0000	1.9
  +++ AbstractMarkupWriter.java	19 Oct 2003 14:51:58 -0000	1.10
  @@ -331,7 +331,7 @@
           catch (UnsupportedEncodingException e)
           {
               throw new IllegalArgumentException(
  -                Tapestry.format("AbstractMarkupWriter.illegal-encoding", encoding));
  +                Tapestry.format("illegal-encoding", encoding));
           }
       }
   
  
  
  
  1.21      +2 -2      jakarta-tapestry/framework/src/org/apache/tapestry/engine/AbstractEngine.java
  
  Index: AbstractEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/engine/AbstractEngine.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- AbstractEngine.java	1 Oct 2003 13:22:35 -0000	1.20
  +++ AbstractEngine.java	19 Oct 2003 14:51:58 -0000	1.21
  @@ -1438,7 +1438,7 @@
               catch (UnsupportedEncodingException e)
               {
                   throw new IllegalArgumentException(
  -                    Tapestry.format("AbstractEngine.illegal-encoding", encoding));
  +                    Tapestry.format("illegal-encoding", encoding));
               }
           }
       }
  
  
  
  1.6       +11 -10    jakarta-tapestry/framework/src/org/apache/tapestry/engine/EngineServiceLink.java
  
  Index: EngineServiceLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/engine/EngineServiceLink.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EngineServiceLink.java	28 May 2003 13:41:39 -0000	1.5
  +++ EngineServiceLink.java	19 Oct 2003 14:51:58 -0000	1.6
  @@ -55,11 +55,13 @@
   
   package org.apache.tapestry.engine;
   
  -import java.net.URLEncoder;
  +import java.io.UnsupportedEncodingException;
   import java.util.ArrayList;
   import java.util.List;
   
  +import org.apache.commons.codec.net.URLCodec;
   import org.apache.commons.lang.builder.ToStringBuilder;
  +import org.apache.tapestry.ApplicationRuntimeException;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
   import org.apache.tapestry.request.RequestContext;
  @@ -82,6 +84,7 @@
   public class EngineServiceLink implements ILink
   {
       private static final int DEFAULT_HTTP_PORT = 80;
  +    private static final URLCodec _urlCodec = new URLCodec();
   
       private IRequestCycle _cycle;
       private String _service;
  @@ -217,19 +220,17 @@
                   buffer.append(Tapestry.PARAMETERS_QUERY_PARAMETER_NAME);
                   buffer.append('=');
   
  +                String encoding = _cycle.getEngine().getOutputEncoding();
                   try
                   {
  -                    // We use the older, deprecated version of this method, which is compatible
  -                    // with the JDK 1.2.2.
  -
  -                    String encoded = URLEncoder.encode(_parameters[i]);
  -
  +                    String encoded = _urlCodec.encode(_parameters[i], encoding);
                       buffer.append(encoded);
                   }
  -                catch (Exception ex)
  +                catch (UnsupportedEncodingException e)
                   {
  -                    // JDK1.2.2 claims this throws Exception.  It doesn't
  -                    // and we ignore it.
  +                    throw new ApplicationRuntimeException(
  +                        Tapestry.format("illegal-encoding", encoding),
  +                        e);
                   }
               }
           }
  
  
  
  1.8       +2 -2      jakarta-tapestry/framework/src/org/apache/tapestry/multipart/DefaultMultipartDecoder.java
  
  Index: DefaultMultipartDecoder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/multipart/DefaultMultipartDecoder.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultMultipartDecoder.java	3 Jul 2003 02:37:14 -0000	1.7
  +++ DefaultMultipartDecoder.java	19 Oct 2003 14:51:58 -0000	1.8
  @@ -233,7 +233,7 @@
                   catch (UnsupportedEncodingException ex)
                   {
                       throw new ApplicationRuntimeException(
  -                        Tapestry.format("DefaultMultipartDecoder.unsupported-encoding", encoding),
  +                        Tapestry.format("illegal-encoding", encoding),
                           ex);
                   }
               }
  
  
  

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