tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mindbri...@apache.org
Subject cvs commit: jakarta-tapestry/framework/src/org/apache/tapestry/multipart DefaultMultipartDecoder.java
Date Thu, 06 Nov 2003 18:09:31 GMT
mindbridge    2003/11/06 10:09:31

  Modified:    framework/src/org/apache/tapestry/jsp URLRetriever.java
                        AbstractTapestryTag.java AbstractLinkTag.java
               framework/src/org/apache/tapestry/engine AbstractEngine.java
               junit/src/org/apache/tapestry/junit/mock MockSession.java
               framework/src/org/apache/tapestry/multipart
                        DefaultMultipartDecoder.java
  Log:
  Making the framework compatible with Servlet API 2.2
  The unit tests now run correctly with 2.2 as well.
  
  PR: 24467 Compatibility of the AbstractEngine to servlet-api 2.2 by Michael.Frericks@sparkassen-informatik.de

  
  Revision  Changes    Path
  1.6       +3 -5      jakarta-tapestry/framework/src/org/apache/tapestry/jsp/URLRetriever.java
  
  Index: URLRetriever.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/jsp/URLRetriever.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- URLRetriever.java	22 Jun 2003 02:55:23 -0000	1.5
  +++ URLRetriever.java	6 Nov 2003 18:09:30 -0000	1.6
  @@ -125,14 +125,12 @@
           catch (IOException ex)
           {
               throw new JspException(
  -                Tapestry.format("URLRetriever.io-exception", servletPath, ex.getMessage()),
  -                ex);
  +                Tapestry.format("URLRetriever.io-exception", servletPath, ex.getMessage()));
           }
           catch (ServletException ex)
           {
               throw new JspException(
  -                Tapestry.format("URLRetriever.servlet-exception", servletPath, ex.getMessage()),
  -                ex);
  +                Tapestry.format("URLRetriever.servlet-exception", servletPath, ex.getMessage()));
           }
           finally
           {
  
  
  
  1.5       +2 -3      jakarta-tapestry/framework/src/org/apache/tapestry/jsp/AbstractTapestryTag.java
  
  Index: AbstractTapestryTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/jsp/AbstractTapestryTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractTapestryTag.java	28 May 2003 13:41:41 -0000	1.4
  +++ AbstractTapestryTag.java	6 Nov 2003 18:09:30 -0000	1.5
  @@ -198,8 +198,7 @@
                   Tapestry.format(
                       "AbstractTapestryTag.unable-to-evaluate-expression",
                       expression,
  -                    t.getMessage()),
  -                t);
  +                    t.getMessage()));
           }
       }
   }
  
  
  
  1.4       +2 -3      jakarta-tapestry/framework/src/org/apache/tapestry/jsp/AbstractLinkTag.java
  
  Index: AbstractLinkTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/jsp/AbstractLinkTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractLinkTag.java	28 May 2003 13:41:41 -0000	1.3
  +++ AbstractLinkTag.java	6 Nov 2003 18:09:30 -0000	1.4
  @@ -108,8 +108,7 @@
           catch (IOException ex)
           {
               throw new JspException(
  -                Tapestry.format("AbstractLinkTag.io-exception", ex.getMessage()),
  -                ex);
  +                Tapestry.format("AbstractLinkTag.io-exception", ex.getMessage()));
           }
   
           return EVAL_PAGE;
  
  
  
  1.22      +15 -8     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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- AbstractEngine.java	19 Oct 2003 14:51:58 -0000	1.21
  +++ AbstractEngine.java	6 Nov 2003 18:09:30 -0000	1.22
  @@ -882,16 +882,18 @@
           {
               try
               {
  -                String serviceName = extractServiceName(context);
  +                String serviceName;
  +                
  +                try
  +                {
  +                    serviceName = extractServiceName(context);
   
  -                if (StringUtils.isEmpty(serviceName))
  -                    serviceName = Tapestry.HOME_SERVICE;
  +                    if (StringUtils.isEmpty(serviceName))
  +                        serviceName = Tapestry.HOME_SERVICE;
   
  -                // Must have a service to create the request cycle.
  -                // Must have a request cycle to report an exception.
  +                    // Must have a service to create the request cycle.
  +                    // Must have a request cycle to report an exception.
   
  -                try
  -                {
                       service = getService(serviceName);
                   }
                   catch (Exception ex)
  @@ -1439,6 +1441,11 @@
               {
                   throw new IllegalArgumentException(
                       Tapestry.format("illegal-encoding", encoding));
  +            }
  +            catch (NoSuchMethodError e)
  +            {
  +                // Servlet API 2.2 compatibility
  +                // Behave okay if the setCharacterEncoding() method is unavailable
               }
           }
       }
  
  
  
  1.3       +2 -2      jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/MockSession.java
  
  Index: MockSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/MockSession.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MockSession.java	8 Mar 2003 17:08:38 -0000	1.2
  +++ MockSession.java	6 Nov 2003 18:09:31 -0000	1.3
  @@ -152,7 +152,7 @@
           if (value instanceof HttpSessionBindingListener)
           {
               HttpSessionBindingListener listener = (HttpSessionBindingListener) value;
  -            HttpSessionBindingEvent event = new HttpSessionBindingEvent(this, name, value);
  +            HttpSessionBindingEvent event = new HttpSessionBindingEvent(this, name);
   
               listener.valueBound(event);
           }
  
  
  
  1.9       +9 -8      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultMultipartDecoder.java	19 Oct 2003 14:51:58 -0000	1.8
  +++ DefaultMultipartDecoder.java	6 Nov 2003 18:09:31 -0000	1.9
  @@ -184,11 +184,6 @@
           // The encoding that will be used to decode the string parameters
           // It should NOT be null at this point
           String encoding = request.getCharacterEncoding();
  -        if (encoding == null)
  -        {
  -            throw new ApplicationRuntimeException(
  -                Tapestry.getMessage("DefaultMultipartDecoder.encoding-not-set"));
  -        }
   
           // DiskFileUpload is not quite threadsafe, so we create a new instance
           // for each request.
  @@ -219,14 +214,20 @@
                   try
                   {
                       String name = uploadItem.getFieldName();
  +                    String value;
  +                    if (encoding == null)
  +                        value = uploadItem.getString();
  +                    else
  +                        value = uploadItem.getString(encoding);
  +                        
                       ValuePart valuePart = (ValuePart) partMap.get(name);
                       if (valuePart != null)
                       {
  -                        valuePart.add(uploadItem.getString(encoding));
  +                        valuePart.add(value);
                       }
                       else
                       {
  -                        valuePart = new ValuePart(uploadItem.getString(encoding));
  +                        valuePart = new ValuePart(value);
                           partMap.put(name, valuePart);
                       }
                   }
  
  
  

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


Mime
View raw message