portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject svn commit: r329253 - in /portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet: ServletRequestFactoryImpl.java ServletResponseFactoryImpl.java
Date Fri, 28 Oct 2005 17:16:40 GMT
Author: weaver
Date: Fri Oct 28 10:16:37 2005
New Revision: 329253

URL: http://svn.apache.org/viewcvs?rev=329253&view=rev
Log:
Added checks to prevent unwanted "re-wrapping"

Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet/ServletRequestFactoryImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet/ServletResponseFactoryImpl.java

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet/ServletRequestFactoryImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet/ServletRequestFactoryImpl.java?rev=329253&r1=329252&r2=329253&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet/ServletRequestFactoryImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet/ServletRequestFactoryImpl.java
Fri Oct 28 10:16:37 2005
@@ -18,7 +18,6 @@
 import java.io.UnsupportedEncodingException;
 import java.util.Map;
 
-import javax.servlet.ServletConfig;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.jetspeed.PortalReservedParameters;
@@ -32,13 +31,11 @@
  */
 public class ServletRequestFactoryImpl
     implements ServletRequestFactory
-{
-    private ServletConfig servletConfig;
+{    
     
     public void init(javax.servlet.ServletConfig config, Map properties) 
     throws Exception
-    {
-        servletConfig = config;
+    {        
     }
     
     public void destroy()
@@ -53,23 +50,31 @@
     
     public HttpServletRequest getServletRequest(HttpServletRequest request, PortletWindow
window)
     {
-        HttpServletRequest servletRequest = createRequest(request, window);
-        
-        // Set page encoding in order to parse the form data correctly        
-        String preferedEnc = (String) request.getAttribute(PortalReservedParameters.PREFERED_CHARACTERENCODING_ATTRIBUTE);
-        if (preferedEnc != null)
+        // May have already been wrapped, no need to re-wrap.
+        if (!(request instanceof ServletRequestImpl))
         {
-            try
-            {
-                servletRequest.setCharacterEncoding(preferedEnc);
-            }
-            catch (UnsupportedEncodingException e)
+            HttpServletRequest servletRequest = createRequest(request, window);
+
+            // Set page encoding in order to parse the form data correctly
+            String preferedEnc = (String) request
+                    .getAttribute(PortalReservedParameters.PREFERED_CHARACTERENCODING_ATTRIBUTE);
+            if (preferedEnc != null)
             {
-                ;
+                try
+                {
+                    servletRequest.setCharacterEncoding(preferedEnc);
+                }
+                catch (UnsupportedEncodingException e)
+                {
+                    ;
+                }
             }
+            return servletRequest;
         }
-
-        return servletRequest;
+        else
+        {
+            return request;
+        }        
     }
     
 }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet/ServletResponseFactoryImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet/ServletResponseFactoryImpl.java?rev=329253&r1=329252&r2=329253&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet/ServletResponseFactoryImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/servlet/ServletResponseFactoryImpl.java
Fri Oct 28 10:16:37 2005
@@ -16,37 +16,39 @@
 package org.apache.jetspeed.engine.servlet;
 
 import java.util.Map;
-import javax.servlet.ServletConfig;
 
+import javax.servlet.ServletConfig;
 import javax.servlet.http.HttpServletResponse;
 
 /**
  * Factory implementation for creating HTTP Response Wrappers
- *
+ * 
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id$
+ * @version $Id: ServletResponseFactoryImpl.java 185962 2004-03-08 01:03:33Z
+ *          jford $
  */
-public class ServletResponseFactoryImpl
-    implements ServletResponseFactory
+public class ServletResponseFactoryImpl implements ServletResponseFactory
 {
-    private ServletConfig servletConfig;
-    
-    public void init(ServletConfig config, Map properties) 
-    throws Exception
+
+    public void init(ServletConfig config, Map properties) throws Exception
     {
-        servletConfig = config;
     }
-    
-    public void destroy()
-    throws Exception
-    {
 
+    public void destroy() throws Exception
+    {
     }
 
-    public javax.servlet.http.HttpServletResponse getServletResponse(HttpServletResponse
response)
+    public HttpServletResponse getServletResponse(HttpServletResponse response)
     {
-        HttpServletResponse servletResponse = new ServletResponseImpl(response);
-        return servletResponse;
+        if (!(response instanceof ServletResponseImpl))
+        {
+            return new ServletResponseImpl(response);
+            
+        }
+        else
+        {
+            return response;
+        }
     }
-    
+
 }



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


Mime
View raw message