Author: woonsan
Date: Tue Oct  6 10:06:26 2009
New Revision: 822185

URL: http://svn.apache.org/viewvc?rev=822185&view=rev
Log:
APA-17: Adding configuration example of apache site for https

Modified:
    
portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/proxy/TestProxyPathMappings.java
    
portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/proxy/TestReverseProxyLinkRewritingParserAaptor.java
    
portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/conf/reverseproxy.properties

Modified: 
portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/proxy/TestProxyPathMappings.java
URL: 
http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/proxy/TestProxyPathMappings.java?rev=822185&r1=822184&r2=822185&view=diff
==============================================================================
--- 
portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/proxy/TestProxyPathMappings.java
 (original)
+++ 
portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/proxy/TestProxyPathMappings.java
 Tue Oct  6 10:06:26 2009
@@ -46,8 +46,10 @@
         proxyPathMappers.add(new 
DefaultHttpReverseProxyPathMapperImpl("localhost", "/localhost/", 
"http://www.localhost.com/";, null));
         proxyPathMappers.add(new 
DefaultHttpReverseProxyPathMapperImpl("localhost1", "/localhost/path1/", 
"http://www.localhost.com/path1/";, null));
         proxyPathMappers.add(new 
DefaultHttpReverseProxyPathMapperImpl("localhost2", "/localhost/path1/path2/", 
"http://www.localhost.com/path1/path2/";, null));
+        proxyPathMappers.add(new 
DefaultHttpReverseProxyPathMapperImpl("apache0", "/apache/", 
"http://apache.org/";, null));
         proxyPathMappers.add(new 
DefaultHttpReverseProxyPathMapperImpl("apache", "/*_apache/", 
"http://$1.apache.org/";, null));
-        proxyPathMappers.add(new 
DefaultHttpReverseProxyPathMapperImpl("apache", "/*.google.*/", 
"http://$1.google.$2/";, null));
+        proxyPathMappers.add(new 
DefaultHttpReverseProxyPathMapperImpl("secure_apache", "/secure/*_apache/", 
"https://$1.apache.org/";, null));
+        proxyPathMappers.add(new 
DefaultHttpReverseProxyPathMapperImpl("google", "/*.google.*/", 
"http://$1.google.$2/";, null));
         pathMapperProvider = new 
DefaultHttpReverseProxyPathMapperProviderImpl(proxyPathMappers, 
rewriterControllerMap, rewriterRulesetMap);
         pathMapperProvider.setMaxMatchingPathPartCount(3);
     }
@@ -68,12 +70,23 @@
         assertEquals("http://www.apache.org/index.html";, 
mapper.getRemoteURL("/www_apache/index.html"));
         assertEquals("/www_apache/index.html", 
mapper.getLocalPath("http://www.apache.org/index.html";));
         
+        mapper = pathMapperProvider.findMapper("/apache/index.html");
+        assertEquals("apache0", mapper.getName());
+        assertEquals("http://apache.org/index.html";, 
mapper.getRemoteURL("/apache/index.html"));
+        
         mapper = pathMapperProvider.findMapper("/portals_apache/index.html");
         assertEquals("apache:/portals_apache/", mapper.getName());
         mapper = 
pathMapperProvider.findMapperByRemoteURL("http://portals.apache.org/index.html";);
         assertEquals("apache:/portals_apache/", mapper.getName());
         assertEquals("http://portals.apache.org/index.html";, 
mapper.getRemoteURL("/portals_apache/index.html"));
         assertEquals("/portals_apache/index.html", 
mapper.getLocalPath("http://portals.apache.org/index.html";));
+
+        mapper = 
pathMapperProvider.findMapper("/secure/www_apache/index.html");
+        assertEquals("secure_apache:/secure/www_apache/", mapper.getName());
+        mapper = 
pathMapperProvider.findMapperByRemoteURL("https://blogs.apache.org/index.html";);
+        assertEquals("secure_apache:/secure/blogs_apache/", mapper.getName());
+        assertEquals("https://blogs.apache.org/index.html";, 
mapper.getRemoteURL("/secure/blogs_apache/index.html"));
+        assertEquals("/secure/blogs_apache/index.html", 
mapper.getLocalPath("https://blogs.apache.org/index.html";));
     }
     
     public void testProxyURLMappings() throws Exception
@@ -84,6 +97,12 @@
         mapper = 
pathMapperProvider.findMapperByRemoteURL("http://portals.apache.org/index.html";);
         assertEquals("/portals_apache/", mapper.getLocalBasePath());
         
+        mapper = 
pathMapperProvider.findMapperByRemoteURL("https://www.apache.org/index.html";);
+        assertEquals("/secure/www_apache/", mapper.getLocalBasePath());
+        
+        mapper = 
pathMapperProvider.findMapperByRemoteURL("https://blogs.apache.org/index.html";);
+        assertEquals("/secure/blogs_apache/", mapper.getLocalBasePath());
+        
         mapper = 
pathMapperProvider.findMapperByRemoteURL("http://www.localhost.com/path1/path2/index.html";);
         assertEquals("/localhost/path1/path2/", mapper.getLocalBasePath());
         

Modified: 
portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/proxy/TestReverseProxyLinkRewritingParserAaptor.java
URL: 
http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/proxy/TestReverseProxyLinkRewritingParserAaptor.java?rev=822185&r1=822184&r2=822185&view=diff
==============================================================================
--- 
portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/proxy/TestReverseProxyLinkRewritingParserAaptor.java
 (original)
+++ 
portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/proxy/TestReverseProxyLinkRewritingParserAaptor.java
 Tue Oct  6 10:06:26 2009
@@ -57,22 +57,30 @@
         "href=\"/docs/\">Docs</a> and <a 
href='/documents/'>Documents</a></p>\n" +
         "<p><a \n" +
         "href=\"http://www.localhost.com/manager/list\";>Application 
Management</a></p>\n" +
+        "<p><a href=\"https://blogs.apache.org/index.html\";>Apache 
Blogs</a></p>\n" +
+        "<p><a href=\"http://apache.org/index.html\";>Apache Software 
Foundation</a></p>\n" +
         "</html>";
     
     private HttpReverseProxyPathMapperProvider proxyPathMapperProvider;
     private HttpReverseProxyPathMapper apacheProxyPathMapper;
+    private HttpReverseProxyPathMapper apache0ProxyPathMapper;
+    private HttpReverseProxyPathMapper securedApacheProxyPathMapper;
     private HttpReverseProxyPathMapper localhostProxyPathMapper;
     
     @Override
     public void setUp()
     {
         apacheProxyPathMapper = new 
DefaultHttpReverseProxyPathMapperImpl("apache", "/*_apache/", 
"http://$1.apache.org/";, null);
+        apache0ProxyPathMapper = new 
DefaultHttpReverseProxyPathMapperImpl("apache0", "/apache/", 
"http://apache.org/";, null);
+        securedApacheProxyPathMapper = new 
DefaultHttpReverseProxyPathMapperImpl("secure_apache", "/secure/*_apache/", 
"https://$1.apache.org/";, null);
         localhostProxyPathMapper = new 
DefaultHttpReverseProxyPathMapperImpl("localhost", "/localhost/", 
"http://www.localhost.com/";, null);
         
         Map<HttpReverseProxyPathMapper, RewriterController> 
rewriterControllerMap = new HashMap<HttpReverseProxyPathMapper, 
RewriterController>();
         Map<HttpReverseProxyPathMapper, Ruleset> rewriterRulesetMap = new 
HashMap<HttpReverseProxyPathMapper, Ruleset>();
         List<HttpReverseProxyPathMapper> proxyPathMappers = new 
ArrayList<HttpReverseProxyPathMapper>();
         proxyPathMappers.add(apacheProxyPathMapper);
+        proxyPathMappers.add(apache0ProxyPathMapper);
+        proxyPathMappers.add(securedApacheProxyPathMapper);
         proxyPathMappers.add(localhostProxyPathMapper);
         
         proxyPathMapperProvider = new 
DefaultHttpReverseProxyPathMapperProviderImpl(proxyPathMappers, 
rewriterControllerMap, rewriterRulesetMap);
@@ -109,6 +117,8 @@
         assertTrue("Wrong rewriting: " + lines.get(5), 
StringUtils.contains(lines.get(5), 
"href='/webcontent/rproxy/localhost/manager/start'"));
         assertTrue("Wrong rewriting: " + lines.get(7), 
StringUtils.contains(lines.get(7), 
"href=\"/webcontent/rproxy/www_apache/docs/\""));
         assertTrue("Wrong rewriting: " + lines.get(9), 
StringUtils.contains(lines.get(9), 
"href=\"/webcontent/rproxy/localhost/manager/list\""));
+        assertTrue("Wrong rewriting: " + lines.get(10), 
StringUtils.contains(lines.get(10), 
"href=\"/webcontent/rproxy/secure/blogs_apache/index.html\""));
+        assertTrue("Wrong rewriting: " + lines.get(11), 
StringUtils.contains(lines.get(11), 
"href=\"/webcontent/rproxy/apache/index.html\""));
     }
     
 }

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=822185&r1=822184&r2=822185&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
 Tue Oct  6 10:06:26 2009
@@ -68,7 +68,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, localhost, somewhere
+proxy.reverse.pass = apache, all_apache, secure_apache, all_secure_apache, 
localhost, somewhere
 # ... Set cache count of proxy path mappers which are dynamically created by 
glob style mappings.
 proxy.reverse.pass.dynamicProxyPathMapperCacheCount = 1000
 # ... Set max matching path part count
@@ -76,14 +76,38 @@
 
 # ... Sets detail attributes for each path item.
 
-proxy.reverse.pass.apache.local = /*_apache/
-proxy.reverse.pass.apache.remote = http://$1.apache.org/
+proxy.reverse.pass.apache.local = /apache/
+proxy.reverse.pass.apache.remote = http://apache.org/
 proxy.reverse.pass.apache.rewriter.basic = 
org.apache.portals.applications.webcontent.rewriter.WebContentRewriter
 proxy.reverse.pass.apache.rewriter.parserAdaptor = html
 proxy.reverse.pass.apache.rewriter.parserAdaptor.html = 
org.apache.portals.applications.webcontent.proxy.impl.DefaultReverseProxyLinkRewritingParserAaptor
 proxy.reverse.pass.apache.rewriter.parserAdaptor.html.mimeType = text/html
 
proxy.reverse.pass.apache.rewriter.parserAdaptor.html.property.lookUpAllMappings
 = true
 
+proxy.reverse.pass.all_apache.local = /*_apache/
+proxy.reverse.pass.all_apache.remote = http://$1.apache.org/
+proxy.reverse.pass.all_apache.rewriter.basic = 
org.apache.portals.applications.webcontent.rewriter.WebContentRewriter
+proxy.reverse.pass.all_apache.rewriter.parserAdaptor = html
+proxy.reverse.pass.all_apache.rewriter.parserAdaptor.html = 
org.apache.portals.applications.webcontent.proxy.impl.DefaultReverseProxyLinkRewritingParserAaptor
+proxy.reverse.pass.all_apache.rewriter.parserAdaptor.html.mimeType = text/html
+proxy.reverse.pass.all_apache.rewriter.parserAdaptor.html.property.lookUpAllMappings
 = true
+
+proxy.reverse.pass.secure_apache.local = /secure/apache/
+proxy.reverse.pass.secure_apache.remote = https://apache.org/
+proxy.reverse.pass.secure_apache.rewriter.basic = 
org.apache.portals.applications.webcontent.rewriter.WebContentRewriter
+proxy.reverse.pass.secure_apache.rewriter.parserAdaptor = html
+proxy.reverse.pass.secure_apache.rewriter.parserAdaptor.html = 
org.apache.portals.applications.webcontent.proxy.impl.DefaultReverseProxyLinkRewritingParserAaptor
+proxy.reverse.pass.secure_apache.rewriter.parserAdaptor.html.mimeType = 
text/html
+proxy.reverse.pass.secure_apache.rewriter.parserAdaptor.html.property.lookUpAllMappings
 = true
+
+proxy.reverse.pass.all_secure_apache.local = /secure/*_apache/
+proxy.reverse.pass.all_secure_apache.remote = https://$1.apache.org/
+proxy.reverse.pass.all_secure_apache.rewriter.basic = 
org.apache.portals.applications.webcontent.rewriter.WebContentRewriter
+proxy.reverse.pass.all_secure_apache.rewriter.parserAdaptor = html
+proxy.reverse.pass.all_secure_apache.rewriter.parserAdaptor.html = 
org.apache.portals.applications.webcontent.proxy.impl.DefaultReverseProxyLinkRewritingParserAaptor
+proxy.reverse.pass.all_secure_apache.rewriter.parserAdaptor.html.mimeType = 
text/html
+proxy.reverse.pass.all_secure_apache.rewriter.parserAdaptor.html.property.lookUpAllMappings
 = true
+
 proxy.reverse.pass.localhost.local = /localhost/
 proxy.reverse.pass.localhost.remote = http://localhost:8080/
 


Reply via email to