portals-portalapps-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r818865 - in /portals/applications/webcontent/trunk: webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/ webcontent-war/src/main/webapp/WEB-INF/conf/
Date Fri, 25 Sep 2009 14:50:21 GMT
Author: woonsan
Date: Fri Sep 25 14:50:20 2009
New Revision: 818865

URL: http://svn.apache.org/viewvc?rev=818865&view=rev
Log:
APA-17: Adding one more example pass mapping and make it safer.

Modified:
    portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpProxyPathMapperImpl.java
    portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpReverseProxyPathMapperProviderImpl.java
    portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpReverseProxyServlet.java
    portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/conf/reverseproxy.properties

Modified: portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpProxyPathMapperImpl.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpProxyPathMapperImpl.java?rev=818865&r1=818864&r2=818865&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpProxyPathMapperImpl.java
(original)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpProxyPathMapperImpl.java
Fri Sep 25 14:50:20 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.portals.applications.webcontent.proxy.impl;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.portals.applications.webcontent.proxy.HttpReverseProxyPathMapper;
 
 /**
@@ -46,7 +47,7 @@
 
     public String getRemoteURL(String localPath)
     {
-        if (localPath.startsWith(localBasePath))
+        if (StringUtils.startsWith(localPath, localBasePath))
         {
             return remoteBaseURL + localPath.substring(localBasePath.length());
         }
@@ -56,7 +57,7 @@
     
     public String getLocalPath(String remoteURL)
     {
-        if (remoteURL.startsWith(remoteBaseURL))
+        if (StringUtils.startsWith(remoteURL, remoteBaseURL))
         {
             return localBasePath + remoteURL.substring(remoteBaseURL.length());
         }

Modified: portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpReverseProxyPathMapperProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpReverseProxyPathMapperProviderImpl.java?rev=818865&r1=818864&r2=818865&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpReverseProxyPathMapperProviderImpl.java
(original)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpReverseProxyPathMapperProviderImpl.java
Fri Sep 25 14:50:20 2009
@@ -21,6 +21,7 @@
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.commons.collections.KeyValue;
+import org.apache.commons.lang.StringUtils;
 import org.apache.portals.applications.webcontent.proxy.HttpReverseProxyPathMapper;
 import org.apache.portals.applications.webcontent.proxy.HttpReverseProxyPathMapperProvider;
 import org.apache.portals.applications.webcontent.rewriter.Rewriter;
@@ -64,7 +65,7 @@
         
         for (HttpReverseProxyPathMapper proxyPathMapper : proxyPathMappers)
         {
-            if (pathInfo.startsWith(proxyPathMapper.getLocalBasePath()))
+            if (StringUtils.startsWith(pathInfo, proxyPathMapper.getLocalBasePath()))
             {
                 return proxyPathMapper;
             }
@@ -79,7 +80,7 @@
         {
             for (HttpReverseProxyPathMapper proxyPathMapper : proxyPathMappers)
             {
-                if (remoteURL.startsWith(proxyPathMapper.getRemoteBaseURL()))
+                if (StringUtils.startsWith(remoteURL, proxyPathMapper.getRemoteBaseURL()))
                 {
                     return proxyPathMapper;
                 }
@@ -95,7 +96,7 @@
         
         for (KeyValue pair : rewriterControllerPairs)
         {
-            if (pathInfo.startsWith((String) pair.getKey()))
+            if (StringUtils.startsWith(pathInfo, (String) pair.getKey()))
             {
                 return (RewriterController) pair.getValue();
             }
@@ -110,7 +111,7 @@
         
         for (KeyValue pair : rewriterPairs)
         {
-            if (pathInfo.startsWith((String) pair.getKey()))
+            if (StringUtils.startsWith(pathInfo, (String) pair.getKey()))
             {
                 return (Rewriter) pair.getValue();
             }

Modified: portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpReverseProxyServlet.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpReverseProxyServlet.java?rev=818865&r1=818864&r2=818865&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpReverseProxyServlet.java
(original)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/proxy/impl/DefaultHttpReverseProxyServlet.java
Fri Sep 25 14:50:20 2009
@@ -286,15 +286,20 @@
     
     public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException,
ServletException
     {
-        proxyService.invoke(request, response);
-        
         try
         {
-            // dummy read for refreshing... 
-            configuration.getString("proxy.reverse.pass");
+            proxyService.invoke(request, response);
         }
-        catch (Exception e)
+        finally
         {
+            try
+            {
+                // dummy read for refreshing... 
+                configuration.getString("proxy.reverse.pass");
+            }
+            catch (Exception e)
+            {
+            }
         }
     }
     

Modified: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/conf/reverseproxy.properties
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/conf/reverseproxy.properties?rev=818865&r1=818864&r2=818865&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/conf/reverseproxy.properties
(original)
+++ portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/conf/reverseproxy.properties
Fri Sep 25 14:50:20 2009
@@ -55,7 +55,8 @@
 proxy.http.connManager.param.timeout = 10000
 
 
-# HTTP Connection parameters per route
+# HTTP Connection parameters per route. 
+# ... If you don't specify here for a route, then the default values are applied.
 # ... Put the route item names here.
 proxy.http.route = apache, portals, somewhere
 proxy.http.route.param.defaultMaxPerRoute = 20
@@ -85,7 +86,7 @@
 
 # Proxy Pass Reverse Mapping configurations for each category
 # ... Put the path item names here. Each path item will be evaluated by the order. 
-proxy.reverse.pass = apache, portals, somewhere 
+proxy.reverse.pass = apache, portals, localhost, somewhere 
 
 # ... Sets detail attributes for each path item.
 
@@ -95,6 +96,9 @@
 proxy.reverse.pass.portals.local = /portals/
 proxy.reverse.pass.portals.remote = http://portals.apache.org/
 
+proxy.reverse.pass.localhost.local = /localhost/
+proxy.reverse.pass.localhost.remote = http://localhost:8080/
+
 # ... 'somewhere' is just an example to show the full configurable items...
 proxy.reverse.pass.somewhere.local = /somewhere/
 proxy.reverse.pass.somewhere.remote = http://somewhere.localhost.com/



Mime
View raw message