portals-portalapps-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r1620488 - in /portals/applications/webcontent/trunk: portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/ reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/
Date Tue, 26 Aug 2014 00:15:39 GMT
Author: woonsan
Date: Tue Aug 26 00:15:39 2014
New Revision: 1620488

URL: http://svn.apache.org/r1620488
Log:
APA-66: code clean ups in portlets

Modified:
    portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/DefaultReverseProxyPortlet.java
    portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/PortletRequestContext.java
    portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/SimpleReverseProxyPortlet.java
    portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/DefaultReverseProxyServlet.java

Modified: portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/DefaultReverseProxyPortlet.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/DefaultReverseProxyPortlet.java?rev=1620488&r1=1620487&r2=1620488&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/DefaultReverseProxyPortlet.java
(original)
+++ portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/DefaultReverseProxyPortlet.java
Tue Aug 26 00:15:39 2014
@@ -16,7 +16,15 @@
  */
 package org.apache.portals.applications.webcontent2.portlet.proxy;
 
+import java.io.IOException;
+
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.portals.applications.webcontent2.proxy.ReverseProxyException;
 import org.apache.portals.applications.webcontent2.proxy.ReverseProxyService;
+import org.apache.portals.applications.webcontent2.proxy.impl.ProxyContext;
 import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
 
 public class DefaultReverseProxyPortlet extends GenericVelocityPortlet
@@ -38,4 +46,36 @@ public class DefaultReverseProxyPortlet 
     {
         this.proxyService = proxyService;
     }
+
+    @Override
+    public void doView(RenderRequest request, RenderResponse response) throws PortletException,
IOException
+    {
+        response.setContentType("text/html");
+
+        try
+        {
+            PortletRequestContext requestContext = new PortletRequestContext(request, response);
+            ProxyContext proxyContext = new ProxyContext(requestContext);
+            getProxyService().invoke(proxyContext);
+        }
+        catch (ReverseProxyException e)
+        {
+            if (e.getStatusCode() > 0)
+            {
+                throw new PortletException("Response proxy processing exception status: "
+ e.getStatusCode(), e);
+            }
+            else
+            {
+                throw new PortletException(e);
+            }
+        }
+        catch (IOException e)
+        {
+            throw e;
+        }
+        catch (Exception e)
+        {
+            throw new PortletException(e);
+        }
+    }
 }

Modified: portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/PortletRequestContext.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/PortletRequestContext.java?rev=1620488&r1=1620487&r2=1620488&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/PortletRequestContext.java
(original)
+++ portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/PortletRequestContext.java
Tue Aug 26 00:15:39 2014
@@ -38,18 +38,14 @@ public class PortletRequestContext imple
 
     private final PortletRequest request;
     private final PortletResponse response;
-    private final String requestBasePath;
-    private final String pathInfo;
     private int responseStatus;
     private List<Cookie> responseCookies;
     private Sink sink;
 
-    public PortletRequestContext(final PortletRequest request, final PortletResponse response,
final String requestBasePath, final String pathInfo)
+    public PortletRequestContext(final PortletRequest request, final PortletResponse response)
     {
         this.request = request;
         this.response = response;
-        this.requestBasePath = requestBasePath;
-        this.pathInfo = pathInfo;
     }
 
     public boolean isSecure()
@@ -79,12 +75,12 @@ public class PortletRequestContext imple
 
     public String getRequestBasePath()
     {
-        return requestBasePath;
+        return null;
     }
 
     public String getPathInfo()
     {
-        return pathInfo;
+        return null;
     }
 
     public Object getAttribute(String name)

Modified: portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/SimpleReverseProxyPortlet.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/SimpleReverseProxyPortlet.java?rev=1620488&r1=1620487&r2=1620488&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/SimpleReverseProxyPortlet.java
(original)
+++ portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/SimpleReverseProxyPortlet.java
Tue Aug 26 00:15:39 2014
@@ -88,7 +88,8 @@ public class SimpleReverseProxyPortlet e
     }
 
     @Override
-    public void destroy() {
+    public void destroy()
+    {
         ProxyCommandUtils.destroyAllCommands(proxyServiceCommand);
         super.destroy();
     }

Modified: portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/DefaultReverseProxyServlet.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/DefaultReverseProxyServlet.java?rev=1620488&r1=1620487&r2=1620488&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/DefaultReverseProxyServlet.java
(original)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/DefaultReverseProxyServlet.java
Tue Aug 26 00:15:39 2014
@@ -88,7 +88,7 @@ public class DefaultReverseProxyServlet 
             {
                 ServletRequestContext requestContext = new ServletRequestContext(request,
response);
                 ProxyContext proxyContext = new ProxyContext(requestContext);
-                proxyService.invoke(proxyContext);
+                getProxyService().invoke(proxyContext);
             }
             catch (ReverseProxyException e)
             {



Mime
View raw message