portals-portalapps-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r1620110 [2/2] - in /portals/applications/webcontent/trunk: content-rewriter/src/main/java/org/apache/portals/applications/webcontent2/rewriter/impl/ content-rewriter/src/test/java/org/apache/portals/applications/webcontent2/rewriter/ portl...
Date Sun, 24 Aug 2014 05:28:34 GMT
Added: portals/applications/webcontent/trunk/reverse-proxy/src/test/java/org/apache/portals/applications/webcontent2/proxy/rewriter/DefaultReverseProxyTextLineContentRewriterTest.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/test/java/org/apache/portals/applications/webcontent2/proxy/rewriter/DefaultReverseProxyTextLineContentRewriterTest.java?rev=1620110&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/test/java/org/apache/portals/applications/webcontent2/proxy/rewriter/DefaultReverseProxyTextLineContentRewriterTest.java
(added)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/test/java/org/apache/portals/applications/webcontent2/proxy/rewriter/DefaultReverseProxyTextLineContentRewriterTest.java
Sun Aug 24 05:28:33 2014
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.applications.webcontent2.proxy.rewriter;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.List;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.portals.applications.webcontent2.proxy.ProxyMapping;
+import org.apache.portals.applications.webcontent2.proxy.ProxyMappingRegistry;
+import org.apache.portals.applications.webcontent2.proxy.impl.DefaultProxyMappingRegistry;
+import org.apache.portals.applications.webcontent2.proxy.impl.ProxyContext;
+import org.apache.portals.applications.webcontent2.proxy.impl.RegexProxyMapping;
+import org.apache.portals.applications.webcontent2.proxy.impl.ServletRequestContext;
+import org.apache.portals.applications.webcontent2.proxy.impl.SimpleProxyMapping;
+import org.apache.portals.applications.webcontent2.rewriter.ContentRewriter;
+import org.apache.portals.applications.webcontent2.rewriter.ContentRewritingContext;
+import org.apache.portals.applications.webcontent2.rewriter.Sink;
+import org.apache.portals.applications.webcontent2.rewriter.Source;
+import org.apache.portals.applications.webcontent2.rewriter.impl.SimpleContentRewritingContext;
+import org.apache.portals.applications.webcontent2.rewriter.impl.StreamSink;
+import org.apache.portals.applications.webcontent2.rewriter.impl.StreamSource;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultReverseProxyTextLineContentRewriterTest
+{
+
+    private static Logger log = LoggerFactory.getLogger(DefaultReverseProxyTextLineContentRewriterTest.class);
+
+    private static final String BASE_REQUEST_PATH = "/app1/rproxyservlet";
+    private static final String BASE_PORTALS_LOCAL_PATH = "/portals/";
+    private static final String BASE_REMOTE_URI = "http://portals.apache.org/";
+    private static final String CURRENT_BASE_PATHINFO = "some/path/";
+
+    private ContentRewritingContext rewritingContext;
+
+    private ContentRewriter contentRewriter;
+    private String htmlSource1;
+
+    @Before
+    public void before() throws Exception
+    {
+        rewritingContext = new SimpleContentRewritingContext();
+
+        ServletRequestContext requestContext = new ServletRequestContext(null, null);
+        requestContext.setRequestBasePath(BASE_REQUEST_PATH);
+        ProxyContext proxyContext = new ProxyContext(requestContext);
+        proxyContext.setRemoteURI(URI.create(BASE_REMOTE_URI + CURRENT_BASE_PATHINFO + "page.html"));
+
+        DefaultProxyMappingRegistry registry = new DefaultProxyMappingRegistry();
+
+        SimpleProxyMapping currentMapping = new SimpleProxyMapping();
+        currentMapping.setLocal(BASE_PORTALS_LOCAL_PATH);
+        currentMapping.setRemote(URI.create(BASE_REMOTE_URI));
+        registry.addProxyMapping(currentMapping);
+
+        RegexProxyMapping regexMapping = new RegexProxyMapping();
+        regexMapping.setLocalPattern("^/apache/([^/]+)/(.*)$");
+        regexMapping.setRemoteReplace("http://$1.apache.org/$2");
+        regexMapping.setRemotePattern("^http://(\\w+)\\.apache\\.org/(.*)$");
+        regexMapping.setLocalReplace("/apache/$1/$2");
+        registry.addProxyMapping(regexMapping);
+
+        SimpleProxyMapping simpleMapping = new SimpleProxyMapping();
+        simpleMapping.setLocal("/apache/");
+        simpleMapping.setRemote(URI.create("http://apache.org/"));
+        registry.addProxyMapping(simpleMapping);
+
+        rewritingContext.setAttribute(ProxyContext.class.getName(), proxyContext);
+        rewritingContext.setAttribute(ProxyMapping.class.getName(), currentMapping);
+        rewritingContext.setAttribute(ProxyMappingRegistry.class.getName(), registry);
+
+        contentRewriter = new DefaultReverseProxyTextLineContentRewriter();
+        htmlSource1 = IOUtils.toString(getClass().getResource("content-rewriter-test1.html"));
+    }
+
+    @Test
+    public void testSimple() throws Exception {
+        Source source = new StreamSource(new StringReader(htmlSource1));
+        StringWriter sw = new StringWriter();
+        Sink sink = new StreamSink(sw);
+
+        contentRewriter.rewrite(source, sink, rewritingContext);
+
+        log.debug("SINK: {}", sw);
+
+        List<String> sourceLines = IOUtils.readLines(new StringReader(htmlSource1));
+        List<String> rewrittenLines = IOUtils.readLines(new StringReader(sw.toString()));
+
+        int lineNum = 21;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ "skin/css/screen1.css\""));
+        lineNum = 22;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ "skin/css/screen2.css\""));
+        lineNum = 24;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("url('" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ "skin/css/import1.css');"));
+        lineNum = 25;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("url( \"" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ "skin/css/import2.css\" );"));
+        lineNum = 29;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ CURRENT_BASE_PATHINFO + "mission.html\""));
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href='" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ CURRENT_BASE_PATHINFO + "about.html'"));
+        lineNum = 30;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ "docs/\""));
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href='" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ "documents/'"));
+        lineNum = 31;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"" + BASE_REQUEST_PATH + "/apache/projects/\""));
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ "apa.html\""));
+        lineNum = 32;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"" + BASE_REQUEST_PATH + "/apache/www/events.html\""));
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href='" + BASE_REQUEST_PATH + "/apache/www/apachecon.html'"));
+        lineNum = 33;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"http://www.example.com/manager/list\""));
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href='http://www.example.com/manager/start'"));
+        lineNum = 35;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ "docs/\""));
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href='" + BASE_REQUEST_PATH + BASE_PORTALS_LOCAL_PATH
+ "documents/'"));
+        lineNum = 37;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"http://www.example.com/manager/list\""));
+        lineNum = 38;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"https://blogs.apache.org/index.html\""));
+        lineNum = 39;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("href=\"" + BASE_REQUEST_PATH + "/apache/index.html\""));
+        lineNum = 40;
+        assertTrue("Wrong rewriting: \n\t" + sourceLines.get(lineNum) + "\n\t" + rewrittenLines.get(lineNum),

+                   rewrittenLines.get(lineNum).contains("<script>new AjaxUpdate('/lazyLoader');</script>"));
+    }
+}

Modified: portals/applications/webcontent/trunk/reverse-proxy/src/test/java/org/apache/portals/applications/webcontent2/proxy/util/YamlConfigUtilsTest.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/test/java/org/apache/portals/applications/webcontent2/proxy/util/YamlConfigUtilsTest.java?rev=1620110&r1=1620109&r2=1620110&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/test/java/org/apache/portals/applications/webcontent2/proxy/util/YamlConfigUtilsTest.java
(original)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/test/java/org/apache/portals/applications/webcontent2/proxy/util/YamlConfigUtilsTest.java
Sun Aug 24 05:28:33 2014
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
+import java.net.URI;
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
 import java.util.List;
@@ -29,6 +30,7 @@ import java.util.List;
 import org.apache.portals.applications.webcontent2.proxy.ProxyMapping;
 import org.apache.portals.applications.webcontent2.proxy.impl.RegexProxyMapping;
 import org.apache.portals.applications.webcontent2.proxy.impl.SimpleProxyMapping;
+import org.apache.portals.applications.webcontent2.rewriter.ContentRewritingContext;
 import org.apache.portals.applications.webcontent2.rewriter.ContentRewritingException;
 import org.apache.portals.applications.webcontent2.rewriter.impl.AbstractTextLineContentRewriter;
 import org.junit.Test;
@@ -52,7 +54,8 @@ public class YamlConfigUtilsTest
                     + "--- !simple\n"
                     + "local: /\n"
                     + "remote: http://www.apache.org/\n"
-                    + "contentRewriter: !!" + NOOPTextLineContentRewriter.class.getName()
+ " []\n";
+                    + "contentRewriters:\n"
+                    + "    text/html: !!" + NOOPTextLineContentRewriter.class.getName() +
" []\n";
 
     private static final String REGEX_MAPPINGS = "\n"
                     + "--- !regex\n"
@@ -66,7 +69,8 @@ public class YamlConfigUtilsTest
                     + "remoteReplace: http://www.apache.org/$1\n"
                     + "remotePattern: ^http://www.apache.org/(.*)$\n"
                     + "localReplace: /$1\n"
-                    + "contentRewriter: !!" + LineNumberingTextLineContentRewriter.class.getName()
+ " [ 00000 ]\n";
+                    + "contentRewriters:\n"
+                    + "    text/html: !!" + LineNumberingTextLineContentRewriter.class.getName()
+ " [ 00000 ]\n";
 
     @Test
     public void testSimpleMappings() throws Exception
@@ -81,40 +85,40 @@ public class YamlConfigUtilsTest
 
         int index = 0;
         assertEquals("/portals/applications/", ((SimpleProxyMapping) mappings.get(index)).getLocal());
-        assertEquals("http://portals.apache.org/applications/", ((SimpleProxyMapping) mappings.get(index)).getRemote());
+        assertEquals(URI.create("http://portals.apache.org/applications/"), ((SimpleProxyMapping)
mappings.get(index)).getRemote());
         assertEquals("/portals/applications/a1/b1/c1",
-                     mappings.get(index).resolveLocalFromRemote("http://portals.apache.org/applications/a1/b1/c1"));
+                     mappings.get(index).resolveLocalFromRemote(URI.create("http://portals.apache.org/applications/a1/b1/c1")));
         assertEquals("http://portals.apache.org/applications/a2/b2/c2",
                      mappings.get(index).resolveRemoteFromLocal("/portals/applications/a2/b2/c2"));
-        assertNull(mappings.get(index).getContentRewriter());
+        assertNull(mappings.get(index).getContentRewriter("text/html"));
 
         ++index;
         assertEquals("/portals/bridges/", ((SimpleProxyMapping) mappings.get(index)).getLocal());
-        assertEquals("http://portals.apache.org/bridges/", ((SimpleProxyMapping) mappings.get(index)).getRemote());
+        assertEquals(URI.create("http://portals.apache.org/bridges/"), ((SimpleProxyMapping)
mappings.get(index)).getRemote());
         assertEquals("/portals/bridges/a1/b1/c1",
-                     mappings.get(index).resolveLocalFromRemote("http://portals.apache.org/bridges/a1/b1/c1"));
+                     mappings.get(index).resolveLocalFromRemote(URI.create("http://portals.apache.org/bridges/a1/b1/c1")));
         assertEquals("http://portals.apache.org/bridges/a2/b2/c2",
                      mappings.get(index).resolveRemoteFromLocal("/portals/bridges/a2/b2/c2"));
-        assertNull(mappings.get(index).getContentRewriter());
+        assertNull(mappings.get(index).getContentRewriter("text/html"));
 
         ++index;
         assertEquals("/portals/", ((SimpleProxyMapping) mappings.get(index)).getLocal());
-        assertEquals("http://portals.apache.org/", ((SimpleProxyMapping) mappings.get(index)).getRemote());
+        assertEquals(URI.create("http://portals.apache.org/"), ((SimpleProxyMapping) mappings.get(index)).getRemote());
         assertEquals("/portals/a1/b1/c1",
-                     mappings.get(index).resolveLocalFromRemote("http://portals.apache.org/a1/b1/c1"));
+                     mappings.get(index).resolveLocalFromRemote(URI.create("http://portals.apache.org/a1/b1/c1")));
         assertEquals("http://portals.apache.org/a2/b2/c2",
                      mappings.get(index).resolveRemoteFromLocal("/portals/a2/b2/c2"));
-        assertNull(mappings.get(index).getContentRewriter());
+        assertNull(mappings.get(index).getContentRewriter("text/html"));
 
         ++index;
         assertEquals("/", ((SimpleProxyMapping) mappings.get(index)).getLocal());
-        assertEquals("http://www.apache.org/", ((SimpleProxyMapping) mappings.get(index)).getRemote());
+        assertEquals(URI.create("http://www.apache.org/"), ((SimpleProxyMapping) mappings.get(index)).getRemote());
         assertEquals("/a1/b1/c1",
-                     mappings.get(index).resolveLocalFromRemote("http://www.apache.org/a1/b1/c1"));
+                     mappings.get(index).resolveLocalFromRemote(URI.create("http://www.apache.org/a1/b1/c1")));
         assertEquals("http://www.apache.org/a2/b2/c2",
                      mappings.get(index).resolveRemoteFromLocal("/a2/b2/c2"));
-        assertNotNull(mappings.get(index).getContentRewriter());
-        assertNotNull(mappings.get(index).getContentRewriter() instanceof NOOPTextLineContentRewriter);
+        assertNotNull(mappings.get(index).getContentRewriter("text/html"));
+        assertNotNull(mappings.get(index).getContentRewriter("text/html") instanceof NOOPTextLineContentRewriter);
     }
 
     @Test
@@ -130,35 +134,35 @@ public class YamlConfigUtilsTest
 
         int index = 0;
         assertEquals("/portals/applications/a1/b1/c1",
-                     mappings.get(index).resolveLocalFromRemote("http://portals.apache.org/applications/a1/b1/c1"));
+                     mappings.get(index).resolveLocalFromRemote(URI.create("http://portals.apache.org/applications/a1/b1/c1")));
         assertEquals("http://portals.apache.org/applications/a2/b2/c2",
                      mappings.get(index).resolveRemoteFromLocal("/portals/applications/a2/b2/c2"));
 
         assertEquals("/portals/bridges/a1/b1/c1",
-                     mappings.get(index).resolveLocalFromRemote("http://portals.apache.org/bridges/a1/b1/c1"));
+                     mappings.get(index).resolveLocalFromRemote(URI.create("http://portals.apache.org/bridges/a1/b1/c1")));
         assertEquals("http://portals.apache.org/bridges/a2/b2/c2",
                      mappings.get(index).resolveRemoteFromLocal("/portals/bridges/a2/b2/c2"));
 
         assertEquals("/portals/a1/b1/c1",
-                     mappings.get(index).resolveLocalFromRemote("http://portals.apache.org/a1/b1/c1"));
+                     mappings.get(index).resolveLocalFromRemote(URI.create("http://portals.apache.org/a1/b1/c1")));
         assertEquals("http://portals.apache.org/a2/b2/c2",
                      mappings.get(index).resolveRemoteFromLocal("/portals/a2/b2/c2"));
 
-        assertNull(mappings.get(index).getContentRewriter());
+        assertNull(mappings.get(index).getContentRewriter("text/html"));
 
         ++index;
         assertEquals("/a1/b1/c1",
-                     mappings.get(index).resolveLocalFromRemote("http://www.apache.org/a1/b1/c1"));
+                     mappings.get(index).resolveLocalFromRemote(URI.create("http://www.apache.org/a1/b1/c1")));
         assertEquals("http://www.apache.org/a2/b2/c2",
                      mappings.get(index).resolveRemoteFromLocal("/a2/b2/c2"));
-        assertNotNull(mappings.get(index).getContentRewriter());
-        assertNotNull(mappings.get(index).getContentRewriter() instanceof LineNumberingTextLineContentRewriter);
+        assertNotNull(mappings.get(index).getContentRewriter("text/html"));
+        assertNotNull(mappings.get(index).getContentRewriter("text/html") instanceof LineNumberingTextLineContentRewriter);
     }
 
     public static class NOOPTextLineContentRewriter extends AbstractTextLineContentRewriter
     {
         @Override
-        protected String rewriteLine(String line) throws ContentRewritingException, IOException
+        protected String rewriteLine(String line, ContentRewritingContext context) throws
ContentRewritingException, IOException
         {
             return line;
         }
@@ -175,7 +179,7 @@ public class YamlConfigUtilsTest
         }
 
         @Override
-        protected String rewriteLine(String line) throws ContentRewritingException, IOException
+        protected String rewriteLine(String line, ContentRewritingContext context) throws
ContentRewritingException, IOException
         {
             return "" + numberFormat.format(++lineNum) + ": " + line;
         }

Added: portals/applications/webcontent/trunk/reverse-proxy/src/test/resources/org/apache/portals/applications/webcontent2/proxy/rewriter/content-rewriter-test1.html
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/test/resources/org/apache/portals/applications/webcontent2/proxy/rewriter/content-rewriter-test1.html?rev=1620110&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/test/resources/org/apache/portals/applications/webcontent2/proxy/rewriter/content-rewriter-test1.html
(added)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/test/resources/org/apache/portals/applications/webcontent2/proxy/rewriter/content-rewriter-test1.html
Sun Aug 24 05:28:33 2014
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<html>
+<head>
+<link type="text/css" rel="stylesheet" href="/skin/css/screen1.css" media="all">
+<link type="text/css" rel="stylesheet" href="http://portals.apache.org/skin/css/screen2.css"
media="all">
+<style>
+@import url('/skin/css/import1.css');
+@import url( "http://portals.apache.org/skin/css/import2.css" );
+</style>
+</head>
+<body>
+<p><a href="mission.html">Mission</a> and <a href='about.html'>About</a></p>
+<p><a href="/docs/">Docs</a> and <a href='/documents/'>Documents</a></p>
+<p><a href="http://projects.apache.org" title="Apache Projects">Projects</a>
<a href="http://portals.apache.org/apa.html">Applications</a></p>
+<p><a href="http://www.apache.org/events.html">Events</a> <a href='http://www.apache.org/apachecon.html'>Apache
Con</a></p>
+<p><a href="http://www.example.com/manager/list">Application Management</a>
<a href='http://www.example.com/manager/start'>Start Application</a></p>
+<p><a 
+href="/docs/">Docs</a> and <a href='/documents/'>Documents</a></p>
+<p><a 
+href="http://www.example.com/manager/list">Application Management</a></p>
+<p><a href="https://blogs.apache.org/index.html">Apache Blogs</a></p>
+<p><a href="http://apache.org/index.html">Apache Software Foundation</a></p>
+<script>new AjaxUpdate('/lazyLoader');</script>
+</body>
+</html>

Added: portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/WEB-INF/ReverseProxyServlet-mappings.yaml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/WEB-INF/ReverseProxyServlet-mappings.yaml?rev=1620110&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/WEB-INF/ReverseProxyServlet-mappings.yaml
(added)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/WEB-INF/ReverseProxyServlet-mappings.yaml
Sun Aug 24 05:28:33 2014
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+--- !simple
+local: /portals/applications/
+remote: http://portals.apache.org/applications/
+contentRewriters:
+    text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter
[]
+
+--- !simple
+local: /portals/bridges/
+remote: http://portals.apache.org/bridges/
+contentRewriters:
+    text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter
[]
+
+--- !regex
+localPattern: ^/apache/(\w+)/(.*)$
+remoteReplace: http://$1.apache.org/$2
+remotePattern: ^http://(\w+)\.apache\.org/(.*)$
+localReplace: /apache/$1/$2
+contentRewriters:
+    text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter
[]
+
+--- !simple
+local: /
+remote: http://apache.org/
+contentRewriters:
+    text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter
[]

Modified: portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/WEB-INF/web.xml?rev=1620110&r1=1620109&r2=1620110&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/WEB-INF/web.xml (original)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/WEB-INF/web.xml Sun
Aug 24 05:28:33 2014
@@ -28,21 +28,7 @@
     <init-param>
       <param-name>mappings</param-name>
       <param-value>
---- !simple
-local: /portals/applications/
-remote: http://portals.apache.org/applications/
-
---- !simple
-local: /portals/bridges/
-remote: http://portals.apache.org/bridges/
-
---- !simple
-local: /portals/
-remote: http://portals.apache.org/
-
---- !simple
-local: /
-remote: http://www.apache.org/
+        /WEB-INF/ReverseProxyServlet-mappings.yaml
       </param-value>
     </init-param>
     <load-on-startup>0</load-on-startup>

Modified: portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/index.jsp
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/index.jsp?rev=1620110&r1=1620109&r2=1620110&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/index.jsp (original)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/test/webapp/index.jsp Sun Aug
24 05:28:33 2014
@@ -26,10 +26,10 @@ limitations under the License.
 <hr/>
 
 <ul>
-  <li><a href="/rproxyservlet/portals/applications/" target="_blank">Apache Portals
Applications (reverse proxied)</a></li>
-  <li><a href="/rproxyservlet/portals/bridges/" target="_blank">Apache Portals
Bridges (reverse proxied)</a></li>
-  <li><a href="/rproxyservlet/portals/" target="_blank">Apache Portals (reverse
proxied)</a></li>
-  <li><a href="/rproxyservlet/" target="_blank">Apache Software Foundation (reverse
proxied)</a></li>
+  <li><a href="/webcontent2/rproxyservlet/portals/applications/" target="_blank">Apache
Portals Applications (reverse proxied)</a></li>
+  <li><a href="/webcontent2/rproxyservlet/portals/bridges/" target="_blank">Apache
Portals Bridges (reverse proxied)</a></li>
+  <li><a href="/webcontent2/rproxyservlet/apache/portals/" target="_blank">Apache
Portals (reverse proxied)</a></li>
+  <li><a href="/webcontent2/rproxyservlet/" target="_blank">Apache Software Foundation
(reverse proxied)</a></li>
   <li><a href="portals-includes.jsp" target="_blank">JSP Include for Apache Portals
Applications (reverse proxied)</a></li>
 </ul>
 



Mime
View raw message