You are viewing a plain text version of this content. The canonical link for it is here.
Posted to portalapps-dev@portals.apache.org by wo...@apache.org on 2014/07/21 01:21:08 UTC
svn commit: r1612173 - in /portals/applications/webcontent/trunk: ./
content-rewriter/ portlets/
portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/
portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/prox...
Author: woonsan
Date: Sun Jul 20 23:21:07 2014
New Revision: 1612173
URL: http://svn.apache.org/r1612173
Log:
APA-64: rewriting WebContentPortlet to use reverse proxy service internally.
TODO: content-rewriter config/use and testing in portal.
Added:
portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/WebContentPortlet.java
portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/
portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/MimeResponseSink.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
Modified:
portals/applications/webcontent/trunk/content-rewriter/pom.xml
portals/applications/webcontent/trunk/pom.xml
portals/applications/webcontent/trunk/portlets/pom.xml
portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/WebContentHistoryPage.java
portals/applications/webcontent/trunk/reverse-proxy/pom.xml
portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/ReverseProxyService.java
portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/impl/DefaultReverseProxyService.java
portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/impl/ProxyContext.java
portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/DefaultReverseProxyServlet.java
portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/SimpleReverseProxyServlet.java
portals/applications/webcontent/trunk/war/pom.xml
Modified: portals/applications/webcontent/trunk/content-rewriter/pom.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/content-rewriter/pom.xml?rev=1612173&r1=1612172&r2=1612173&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/content-rewriter/pom.xml (original)
+++ portals/applications/webcontent/trunk/content-rewriter/pom.xml Sun Jul 20 23:21:07 2014
@@ -31,22 +31,11 @@
<dependencies>
<dependency>
- <groupId>org.apache.portals</groupId>
- <artifactId>portlet-api_2.0_spec</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
- <groupId>nekohtml</groupId>
- <artifactId>nekohtml</artifactId>
- </dependency>
-
- <dependency>
<groupId>net.sourceforge.htmlcleaner</groupId>
<artifactId>htmlcleaner</artifactId>
</dependency>
@@ -67,11 +56,6 @@
</dependency>
<dependency>
- <groupId>org.codehaus.castor</groupId>
- <artifactId>castor</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
Modified: portals/applications/webcontent/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/pom.xml?rev=1612173&r1=1612172&r2=1612173&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/pom.xml (original)
+++ portals/applications/webcontent/trunk/pom.xml Sun Jul 20 23:21:07 2014
@@ -33,7 +33,6 @@
<description>Web Content Application</description>
<properties>
- <portlet-api.version>1.0</portlet-api.version>
<portals.portlet2-api-spec.version>1.0</portals.portlet2-api-spec.version>
<javax.servlet.version>2.4</javax.servlet.version>
<org.apache.portals.bridges.common.version>2.0</org.apache.portals.bridges.common.version>
@@ -41,20 +40,14 @@
<slf4j.version>1.5.6</slf4j.version>
<junit.version>4.11</junit.version>
<easymock.version>3.2</easymock.version>
- <nekohtml.version>0.9.5</nekohtml.version>
<htmlcleaner.version>2.8</htmlcleaner.version>
- <castor.version>1.1.1</castor.version>
<httpcomponents-httpcore.version>4.0.1</httpcomponents-httpcore.version>
<httpcomponents-httpclient.version>4.0</httpcomponents-httpclient.version>
<jcip-annotations.version>1.0</jcip-annotations.version>
<commons-lang.version>2.4</commons-lang.version>
<commons-io.version>1.4</commons-io.version>
- <commons-httpclient.version>3.0.1</commons-httpclient.version>
<commons-beanutils.version>1.8.0</commons-beanutils.version>
- <commons-configuration.version>1.6</commons-configuration.version>
- <commons-digester.version>1.8</commons-digester.version>
<commons-chain.version>1.2</commons-chain.version>
- <oro.version>2.0.8</oro.version>
<velocity.version>1.6.3</velocity.version>
<velocity-tools.version>1.3</velocity-tools.version>
@@ -117,53 +110,6 @@
</dependency>
<dependency>
- <groupId>org.codehaus.castor</groupId>
- <artifactId>castor</artifactId>
- <version>${castor.version}</version>
- <exclusions>
- <!-- we only use/need the XML handling: excluding all other, non-test, dependencies -->
- <exclusion>
- <groupId>cglib</groupId>
- <artifactId>cglib-full</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>oro</groupId>
- <artifactId>oro</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta-regexp</groupId>
- <artifactId>jakarta-regexp</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ldapsdk</groupId>
- <artifactId>ldapsdk</artifactId>
- </exclusion>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xerces</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>nekohtml</groupId>
- <artifactId>nekohtml</artifactId>
- <version>${nekohtml.version}</version>
- </dependency>
-
- <dependency>
<groupId>net.sourceforge.htmlcleaner</groupId>
<artifactId>htmlcleaner</artifactId>
<version>${htmlcleaner.version}</version>
@@ -207,35 +153,6 @@
</dependency>
<dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>${commons-digester.version}</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>${commons-httpclient.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons-beanutils.version}</version>
@@ -248,34 +165,12 @@
</dependency>
<dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <version>${commons-configuration.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
<groupId>commons-chain</groupId>
<artifactId>commons-chain</artifactId>
<version>${commons-chain.version}</version>
</dependency>
<dependency>
- <groupId>oro</groupId>
- <artifactId>oro</artifactId>
- <version>${oro.version}</version>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
Modified: portals/applications/webcontent/trunk/portlets/pom.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/portlets/pom.xml?rev=1612173&r1=1612172&r2=1612173&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/portlets/pom.xml (original)
+++ portals/applications/webcontent/trunk/portlets/pom.xml Sun Jul 20 23:21:07 2014
@@ -65,33 +65,6 @@
</dependency>
<dependency>
- <groupId>org.codehaus.castor</groupId>
- <artifactId>castor</artifactId>
- </dependency>
-
- <dependency>
- <groupId>nekohtml</groupId>
- <artifactId>nekohtml</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- </dependency>
-
- <!-- jcip-annotations is required to compile with httpclient and Java 1.5. See HTTPCLIENT-866. -->
- <dependency>
- <groupId>net.jcip</groupId>
- <artifactId>jcip-annotations</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </dependency>
-
- <dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
@@ -102,23 +75,14 @@
</dependency>
<dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
</dependency>
<dependency>
- <groupId>oro</groupId>
- <artifactId>oro</artifactId>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity-tools</artifactId>
+ <scope>runtime</scope>
</dependency>
<dependency>
@@ -139,17 +103,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity-tools</artifactId>
- <scope>runtime</scope>
- </dependency>
-
</dependencies>
</project>
Modified: portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/WebContentHistoryPage.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/WebContentHistoryPage.java?rev=1612173&r1=1612172&r2=1612173&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/WebContentHistoryPage.java (original)
+++ portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/WebContentHistoryPage.java Sun Jul 20 23:21:07 2014
@@ -18,10 +18,9 @@ package org.apache.portals.applications.
import java.io.Serializable;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
-import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
/**
@@ -31,69 +30,82 @@ import org.apache.commons.lang.ArrayUtil
* @version $Id$
*/
-public class WebContentHistoryPage extends Object
- implements Serializable
+public class WebContentHistoryPage implements Serializable
{
+
+ private static final long serialVersionUID = 1L;
+
+ private String method;
private String url;
- private Map params;
- private boolean is_post;
+ private Map<String, String[]> params;
- // Constructors
-
public WebContentHistoryPage(String url)
{
this(url, null, null);
}
- public WebContentHistoryPage(String url, Map params, String method)
- {
- super();
+ public WebContentHistoryPage(String url, Map<String, String[]> params, String method)
+ {
// guarantee non-null, so that equals() is well-behaved
- if (url==null)
+ if (url == null)
+ {
throw new IllegalArgumentException("WebContentHistoryPage() - url required");
-
+ }
+
this.url = url;
- this.params = params != null ? params : new HashMap();
- this.is_post = method != null && method.equalsIgnoreCase("post");
+ this.params = (params != null ? params : new HashMap<String, String[]>());
+ this.method = method;
}
-
- // Base Class Protocol
-
- public boolean equals(Object o)
- {
- if (o == null || !(o instanceof WebContentHistoryPage))
- return false ;
- WebContentHistoryPage page = (WebContentHistoryPage)o;
-
- return page.url.equals(this.url) && page.params.equals(this.params) && page.isPost() == this.isPost() ;
+ public String getMethod()
+ {
+ return method;
}
- public String toString()
+
+ public void setMethod(String method)
{
- StringBuffer buff = new StringBuffer();
- buff.append( "[" ).append(isPost() ? "POST: " : "GET: ").append( getUrl() ).append( ", " ).append( getParams().size() ).append(" params: {");
- Iterator iter = getParams().entrySet().iterator();
- while ( iter.hasNext() )
- {
- Map.Entry entry = (Map.Entry)iter.next();
- buff.append("(").append(entry.getKey()).append(" . ").append(ArrayUtils.toString(entry.getKey())).append(")");
- }
- buff.append("}]");
- return buff.toString();
+ this.method = method;
}
-
- // Data Access
-
+
public String getUrl()
{
- return this.url;
+ return url;
+ }
+
+ public void setUrl(String url)
+ {
+ this.url = url;
+ }
+
+ public Map<String, String[]> getParams()
+ {
+ return params;
}
- public Map getParams()
+
+ public void setParams(Map<String, String[]> params)
+ {
+ this.params = params;
+ }
+
+ @Override
+ public boolean equals(Object o)
{
- return this.params;
+ if (o == null || !(o instanceof WebContentHistoryPage))
+ {
+ return false;
+ }
+
+ WebContentHistoryPage page = (WebContentHistoryPage) o;
+
+ return (StringUtils.equals(page.url, this.url) && page.params.equals(this.params) && StringUtils.equals(page.method, this.method));
}
- public boolean isPost()
+
+ @Override
+ public String toString()
{
- return this.is_post;
+ StringBuilder sb = new StringBuilder();
+ sb.append( "[" ).append(method).append(": ").append(url).append(", params: ").append(params).append("]");
+ return sb.toString();
}
+
}
Added: portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/WebContentPortlet.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/WebContentPortlet.java?rev=1612173&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/WebContentPortlet.java (added)
+++ portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/WebContentPortlet.java Sun Jul 20 23:21:07 2014
@@ -0,0 +1,255 @@
+/*
+ * 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.portlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.portals.applications.webcontent2.portlet.proxy.PortletRequestContext;
+import org.apache.portals.applications.webcontent2.portlet.proxy.SimpleReverseProxyPortlet;
+import org.apache.portals.applications.webcontent2.proxy.impl.ProxyContext;
+import org.apache.portals.messaging.PortletMessaging;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * WebContentPortlet * WebContentPortlet Allows navigation inside the portlet
+ * and caches the latest URL
+ *
+ * TODO: Preferences, cache stream instead of URL *
+ *
+ * @author <a href="mailto:rogerrutr@apache.org">Roger Ruttimann </a>
+ * @version $Id: WebContentPortlet.java 891414 2009-12-16 20:19:02Z rwatler $
+ */
+
+public class WebContentPortlet extends SimpleReverseProxyPortlet
+{
+
+ private static Logger log = LoggerFactory.getLogger(WebContentPortlet.class);
+
+ public static final String ACTION_PARAMETER_URL = "_AP_URL";
+ public static final String ACTION_PARAMETER_METHOD = "_AP_METHOD";
+
+ /**
+ * Configuration constants.
+ */
+ public static final String VIEW_SOURCE_PARAM = "viewSource";
+ public static final String EDIT_SOURCE_PARAM = "editSource";
+
+ // ...browser action buttons
+ public static final String BROWSER_ACTION_PARAM = "wcBrowserAction";
+ public static final String BROWSER_ACTION_PREVIOUS_PAGE = "previousPage";
+ public static final String BROWSER_ACTION_REFRESH_PAGE = "refreshPage";
+ public static final String BROWSER_ACTION_NEXT_PAGE = "nextPage";
+
+ // WebContent session data
+ public static final String HISTORY = "webcontent.history";
+ public static final String HTTP_STATE = "webcontent.http.state";
+
+ public final static String defaultEncoding = "UTF-8";
+
+ public static final String FORM_POST_METHOD = "post";
+ public static final String FORM_GET_METHOD = "get";
+ public static final String FORM_MULTIPART_METHOD = "multipart";
+
+ public static final String NO_URL = "<p>URL source not specified. Go to edit mode and specify an URL.</p>";
+
+ /**
+ * processAction() Checks action initiated by the WebContent portlet which
+ * means that a user has clicked on an URL
+ *
+ * @param actionRequest
+ * @param actionResponse
+ * @throws PortletException
+ * @throws IOException
+ */
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException,
+ IOException
+ {
+ // check to see if it is a meta-navigation command
+ String browserAction = actionRequest.getParameter(BROWSER_ACTION_PARAM);
+
+ if (browserAction != null)
+ {
+ if (!browserAction.equalsIgnoreCase(BROWSER_ACTION_REFRESH_PAGE))
+ {
+ // for Refresh, there is nothing special to do - current history page will be re-displayed
+ WebContentHistoryList history = (WebContentHistoryList)PortletMessaging.receive(actionRequest, HISTORY);
+
+ if (browserAction.equalsIgnoreCase(BROWSER_ACTION_PREVIOUS_PAGE))
+ {
+ if (history.hasPreviousPage())
+ {
+ history.getPreviousPage();
+ }
+ }
+ else if (browserAction.equalsIgnoreCase(BROWSER_ACTION_NEXT_PAGE))
+ {
+ if (history.hasNextPage())
+ {
+ history.getNextPage();
+ }
+ }
+ }
+
+ return ; // proceed to doView() with adjusted history
+ }
+
+ // Check if an action parameter was defined
+ String webContentURL = actionRequest.getParameter(ACTION_PARAMETER_URL);
+ String webContentMethod = actionRequest.getParameter(ACTION_PARAMETER_METHOD);
+ Map<String, String[]> webContentParams = new HashMap<String, String[]>(actionRequest.getParameterMap()) ;
+
+ // defaults
+ if (webContentMethod == null)
+ {
+ webContentMethod = "" ; // default to GET
+ }
+
+ // parameter map includes the URL (as ACTION_PARAMETER_URL), but all actual params as well
+ webContentParams.remove(ACTION_PARAMETER_URL);
+ webContentParams.remove(ACTION_PARAMETER_METHOD);
+
+ if (webContentURL == null || actionRequest.getPortletMode() == PortletMode.EDIT)
+ {
+ processPreferencesAction(actionRequest, actionResponse);
+
+ webContentURL = actionRequest.getPreferences().getValue("SRC", "http://portals.apache.org");
+
+ // parameters are for the EDIT mode form, and should not be propagated to the subsequent GET in doView
+ webContentParams.clear();
+ }
+
+ /*
+ * If the webContentParameter is not empty attach the URL to the session
+ */
+ if (webContentURL != null && webContentURL.length() > 0)
+ {
+ // new page visit - make it the current page in the history
+ WebContentHistoryList history = (WebContentHistoryList)PortletMessaging.receive(actionRequest, HISTORY);
+
+ if (history == null)
+ {
+ history = new WebContentHistoryList();
+ }
+
+ history.visitPage(new WebContentHistoryPage(webContentURL,webContentParams,webContentMethod));
+ PortletMessaging.publish(actionRequest, HISTORY, history);
+ }
+ }
+
+ /**
+ * doView Renders the URL in the following order 1) SESSION_PARAMETER
+ * 2)cached version 3) defined for preference SRC
+ */
+ public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ String viewPage = (String) request.getAttribute(PARAM_VIEW_PAGE);
+
+ if (viewPage != null)
+ {
+ super.doView(request, response);
+ return;
+ }
+
+ // view the current page in the history
+ WebContentHistoryList history = (WebContentHistoryList) PortletMessaging.receive(request, HISTORY);
+
+ if (history == null)
+ {
+ history = new WebContentHistoryList();
+ }
+
+ WebContentHistoryPage currentPage = history.getCurrentPage();
+
+ if (currentPage == null)
+ {
+ String sourceURL = request.getPreferences().getValue("SRC", "");
+
+ if (sourceURL == null)
+ {
+ response.getWriter().print(NO_URL);
+ return;
+ }
+
+ currentPage = new WebContentHistoryPage(sourceURL);
+ }
+
+ try
+ {
+ // write the meta-control navigation header
+ PrintWriter out = response.getWriter();
+ out.println("<block>");
+
+ if (history.hasPreviousPage())
+ {
+ PortletURL prevAction = response.createActionURL() ;
+ prevAction.setParameter(BROWSER_ACTION_PARAM, BROWSER_ACTION_PREVIOUS_PAGE);
+ out.print(" [<a href=\"" + prevAction.toString() +"\">Previous Page</a>] ");
+ }
+
+ PortletURL refreshAction = response.createActionURL() ;
+ refreshAction.setParameter(BROWSER_ACTION_PARAM, BROWSER_ACTION_REFRESH_PAGE);
+ out.print(" [<a href=\"" + refreshAction.toString() +"\">Refresh Page</a>] ");
+
+ if (history.hasNextPage())
+ {
+ PortletURL nextAction = response.createActionURL() ;
+ nextAction.setParameter(BROWSER_ACTION_PARAM, BROWSER_ACTION_NEXT_PAGE);
+ out.print(" [<a href=\"" + nextAction.toString() +"\">Next Page</a>] ");
+ }
+
+ out.println("</block><hr/>");
+ // get content from current page
+ response.setContentType("text/html");
+
+ try
+ {
+ ProxyContext proxyContext = new ProxyContext(new PortletRequestContext(request, response, "", ""));
+ getProxyService().invoke(proxyContext);
+ }
+ catch (Exception e)
+ {
+ out.println("Error retrieveing web content:" + e);
+ return;
+ }
+ }
+ finally
+ {
+ // done, cache results in the history and save the history
+ history.visitPage(currentPage);
+ PortletMessaging.publish(request, HISTORY, history);
+ }
+ }
+
+ public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ response.setContentType("text/html");
+ doPreferencesEdit(request, response);
+ }
+
+}
Added: portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/MimeResponseSink.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/MimeResponseSink.java?rev=1612173&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/MimeResponseSink.java (added)
+++ portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/MimeResponseSink.java Sun Jul 20 23:21:07 2014
@@ -0,0 +1,46 @@
+/*
+ * 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.portlet.proxy;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.portlet.MimeResponse;
+
+import org.apache.portals.applications.webcontent2.rewriter.Sink;
+
+public class MimeResponseSink implements Sink
+{
+
+ private final MimeResponse response;
+
+ public MimeResponseSink(final MimeResponse response)
+ {
+ this.response = response;
+ }
+
+ public OutputStream getOutputStream() throws IOException
+ {
+ return response.getPortletOutputStream();
+ }
+
+ public Writer getWriter() throws IOException
+ {
+ return response.getWriter();
+ }
+}
Added: 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=1612173&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/PortletRequestContext.java (added)
+++ portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/PortletRequestContext.java Sun Jul 20 23:21:07 2014
@@ -0,0 +1,187 @@
+/*
+ * 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.portlet.proxy;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.ClientDataRequest;
+import javax.portlet.MimeResponse;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.servlet.http.Cookie;
+
+import org.apache.portals.applications.webcontent2.proxy.RequestContext;
+import org.apache.portals.applications.webcontent2.rewriter.Sink;
+
+public class PortletRequestContext implements RequestContext
+{
+
+ 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)
+ {
+ this.request = request;
+ this.response = response;
+ this.requestBasePath = requestBasePath;
+ this.pathInfo = pathInfo;
+ }
+
+ public boolean isSecure()
+ {
+ return request.isSecure();
+ }
+
+ public String getServerName()
+ {
+ return request.getServerName();
+ }
+
+ public int getServerPort()
+ {
+ return request.getServerPort();
+ }
+
+ public String getMethod()
+ {
+ if (request instanceof ClientDataRequest)
+ {
+ return ((ClientDataRequest) request).getMethod();
+ }
+
+ return "GET";
+ }
+
+ public String getRequestBasePath()
+ {
+ return requestBasePath;
+ }
+
+ public String getPathInfo()
+ {
+ return pathInfo;
+ }
+
+ public Object getAttribute(String name)
+ {
+ return request.getAttribute(name);
+ }
+
+ public String getQueryString()
+ {
+ return null;
+ }
+
+ public Enumeration getHeaderNames()
+ {
+ return request.getPropertyNames();
+ }
+
+ public Enumeration getHeaders(String name)
+ {
+ return request.getProperties(name);
+ }
+
+ public String getHeader(String name)
+ {
+ return request.getProperty(name);
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ if (request instanceof ClientDataRequest)
+ {
+ return ((ClientDataRequest) request).getPortletInputStream();
+ }
+
+ return null;
+ }
+
+ public void setStatus(int sc)
+ {
+ this.responseStatus = sc;
+ }
+
+ public int getStatus()
+ {
+ return this.responseStatus;
+ }
+
+ public void sendRedirect(String location) throws IOException
+ {
+ if (response instanceof ActionResponse)
+ {
+ ((ActionResponse) response).sendRedirect(location);
+ }
+ }
+
+ public void setHeader(String name, String value)
+ {
+ response.setProperty(name, value);
+ }
+
+ public void setIntHeader(String name, int value)
+ {
+ response.setProperty(name, Integer.toString(value));
+ }
+
+ public void addCookie(Cookie cookie)
+ {
+ if (responseCookies == null)
+ {
+ responseCookies = new ArrayList<Cookie>();
+ }
+
+ responseCookies.add(cookie);
+ }
+
+ public List<Cookie> getCookies()
+ {
+ if (responseCookies == null)
+ {
+ return Collections.emptyList();
+ }
+
+ return Collections.unmodifiableList(responseCookies);
+ }
+
+ public Sink getSink()
+ {
+ if (sink == null)
+ {
+ if (!(response instanceof MimeResponseSink))
+ {
+ throw new IllegalStateException("MimeResponse is required to create a sink.");
+ }
+
+ sink = new MimeResponseSink((MimeResponse) response);
+ }
+
+ return sink;
+ }
+}
Added: 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=1612173&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/SimpleReverseProxyPortlet.java (added)
+++ portals/applications/webcontent/trunk/portlets/src/main/java/org/apache/portals/applications/webcontent2/portlet/proxy/SimpleReverseProxyPortlet.java Sun Jul 20 23:21:07 2014
@@ -0,0 +1,192 @@
+/*
+ * 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.portlet.proxy;
+
+import java.util.List;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.params.ConnManagerParamBean;
+import org.apache.http.conn.scheme.PlainSocketFactory;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpParams;
+import org.apache.portals.applications.webcontent2.proxy.ProxyMappingRegistry;
+import org.apache.portals.applications.webcontent2.proxy.ReverseProxyService;
+import org.apache.portals.applications.webcontent2.proxy.command.AddCookiesToResponseCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.AddHeaderToHttpRequestCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.AddHeadersToResponseCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.CleanupCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.ExecuteHttpClientCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.HandleNotModifiedCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.HandleRedirectionCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.InitHttpClientCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.InitHttpRequestCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.InitializationCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.ResolveContentRewriterCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.ResolveLocalPathCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.ResolveProxyMappingCommand;
+import org.apache.portals.applications.webcontent2.proxy.command.ResolveRemoteURICommand;
+import org.apache.portals.applications.webcontent2.proxy.command.SerializeHttpEntityContentCommand;
+import org.apache.portals.applications.webcontent2.proxy.impl.AbstractProxyCommand;
+import org.apache.portals.applications.webcontent2.proxy.impl.DefaultProxyMappingRegistry;
+import org.apache.portals.applications.webcontent2.proxy.impl.DefaultReverseProxyService;
+import org.apache.portals.applications.webcontent2.proxy.impl.DefaultURICleaner;
+import org.apache.portals.applications.webcontent2.proxy.impl.ProxyProcessingChain;
+import org.apache.portals.applications.webcontent2.proxy.impl.SimpleProxyMapping;
+import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SimpleReverseProxyPortlet extends GenericVelocityPortlet
+{
+
+ private static Logger log = LoggerFactory.getLogger(SimpleReverseProxyPortlet.class);
+
+ private ReverseProxyService proxyService;
+
+ private ProxyProcessingChain proxyServiceCommand;
+
+ public SimpleReverseProxyPortlet()
+ {
+ }
+
+ public ReverseProxyService getProxyService()
+ {
+ return proxyService;
+ }
+
+ public void setProxyService(ReverseProxyService proxyService)
+ {
+ this.proxyService = proxyService;
+ }
+
+
+ @Override
+ public void init(PortletConfig portletConfig) throws PortletException
+ {
+ super.init(portletConfig);
+
+ proxyServiceCommand = createProxyServiceCommand(portletConfig);
+
+ List<AbstractProxyCommand> allProxyCommands = proxyServiceCommand.getAllProxyCommands();
+
+ for (AbstractProxyCommand proxyCommand : allProxyCommands)
+ {
+ proxyCommand.initialize();
+ }
+
+ DefaultReverseProxyService proxyService = new DefaultReverseProxyService(proxyServiceCommand);
+ setProxyService(proxyService);
+ }
+
+ @Override
+ public void destroy() {
+ List<AbstractProxyCommand> allProxyCommands = proxyServiceCommand.getAllProxyCommands();
+
+ for (AbstractProxyCommand proxyCommand : allProxyCommands)
+ {
+ try
+ {
+ proxyCommand.destroy();
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to destroy proxy command, " + proxyCommand, e);
+ }
+ }
+
+ super.destroy();
+ }
+
+ protected ProxyProcessingChain createProxyServiceCommand(final PortletConfig portletConfig)
+ {
+ ProxyProcessingChain preprocessingChain = new ProxyProcessingChain();
+
+ InitializationCommand initializationCommand = new InitializationCommand();
+
+ preprocessingChain.addCommand(initializationCommand);
+
+ ProxyProcessingChain processingChain = new ProxyProcessingChain();
+
+ ResolveLocalPathCommand resolveLocalPathCommand = new ResolveLocalPathCommand();
+
+ // TODO: read config
+ ProxyMappingRegistry proxyMappingRegistry = new DefaultProxyMappingRegistry();
+ proxyMappingRegistry.addProxyMapping(new SimpleProxyMapping("/", "http://portals.apache.org/", null));
+ ResolveProxyMappingCommand resolveProxyMappingCommand = new ResolveProxyMappingCommand(proxyMappingRegistry);
+
+ ResolveRemoteURICommand resolveRemoteURICommand = new ResolveRemoteURICommand();
+ resolveRemoteURICommand.setUriCleaner(new DefaultURICleaner());
+ ResolveContentRewriterCommand resolveContentRewriterCommand = new ResolveContentRewriterCommand();
+
+ InitHttpClientCommand initHttpClientCommand = new InitHttpClientCommand();
+ SchemeRegistry schemeRegistry = new SchemeRegistry();
+ schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
+ schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
+ HttpParams connManagerParams = new BasicHttpParams();
+ ConnManagerParamBean connManagerParamBean = new ConnManagerParamBean(connManagerParams);
+ connManagerParamBean.setMaxTotalConnections(400);
+ connManagerParamBean.setTimeout(10000L);
+ ClientConnectionManager clientConnectionManager = new ThreadSafeClientConnManager(connManagerParams, schemeRegistry);
+ initHttpClientCommand.setClientConnectionManager(clientConnectionManager);
+ initHttpClientCommand.setHttpClientParams(new BasicHttpParams());
+
+ InitHttpRequestCommand initHttpRequestCommand = new InitHttpRequestCommand();
+ AddHeaderToHttpRequestCommand addHeaderToHttpRequestCommand = new AddHeaderToHttpRequestCommand();
+ ExecuteHttpClientCommand executeHttpClientCommand = new ExecuteHttpClientCommand();
+ HandleRedirectionCommand handleRedirectionCommand = new HandleRedirectionCommand();
+ HandleNotModifiedCommand handleNotModifiedCommand = new HandleNotModifiedCommand();
+ AddHeadersToResponseCommand addHeadersToResponseCommand = new AddHeadersToResponseCommand();
+ AddCookiesToResponseCommand addCookiesToResponseCommand = new AddCookiesToResponseCommand();
+ SerializeHttpEntityContentCommand serializeHttpEntityContentCommand = new SerializeHttpEntityContentCommand();
+
+ processingChain.addCommand(resolveLocalPathCommand);
+ processingChain.addCommand(resolveProxyMappingCommand);
+ processingChain.addCommand(resolveRemoteURICommand);
+ processingChain.addCommand(resolveContentRewriterCommand);
+ processingChain.addCommand(initHttpClientCommand);
+ processingChain.addCommand(initHttpRequestCommand);
+ processingChain.addCommand(addHeaderToHttpRequestCommand);
+ processingChain.addCommand(executeHttpClientCommand);
+ processingChain.addCommand(handleRedirectionCommand);
+ processingChain.addCommand(handleNotModifiedCommand);
+ processingChain.addCommand(addHeadersToResponseCommand);
+ processingChain.addCommand(addCookiesToResponseCommand);
+ processingChain.addCommand(serializeHttpEntityContentCommand);
+
+ ProxyProcessingChain postprocessingChain = new ProxyProcessingChain();
+
+ CleanupCommand cleanupCommand = new CleanupCommand();
+
+ postprocessingChain.addCommand(cleanupCommand);
+
+ ProxyProcessingChain proxyServiceChain = new ProxyProcessingChain();
+
+ proxyServiceChain.addCommand(preprocessingChain);
+ proxyServiceChain.addCommand(processingChain);
+ proxyServiceChain.addCommand(postprocessingChain);
+
+ return proxyServiceChain;
+ }
+
+}
Modified: portals/applications/webcontent/trunk/reverse-proxy/pom.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/pom.xml?rev=1612173&r1=1612172&r2=1612173&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/pom.xml (original)
+++ portals/applications/webcontent/trunk/reverse-proxy/pom.xml Sun Jul 20 23:21:07 2014
@@ -37,12 +37,6 @@
</dependency>
<dependency>
- <groupId>org.apache.portals</groupId>
- <artifactId>portlet-api_2.0_spec</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
@@ -81,31 +75,11 @@
</dependency>
<dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- </dependency>
-
- <dependency>
<groupId>commons-chain</groupId>
<artifactId>commons-chain</artifactId>
</dependency>
<dependency>
- <groupId>oro</groupId>
- <artifactId>oro</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
Modified: portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/ReverseProxyService.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/ReverseProxyService.java?rev=1612173&r1=1612172&r2=1612173&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/ReverseProxyService.java (original)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/ReverseProxyService.java Sun Jul 20 23:21:07 2014
@@ -18,8 +18,7 @@ package org.apache.portals.applications.
import java.io.IOException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import org.apache.portals.applications.webcontent2.proxy.impl.ProxyContext;
/**
* Reverse Proxy Service interface
@@ -27,6 +26,6 @@ import javax.servlet.http.HttpServletRes
public interface ReverseProxyService
{
- public void invoke(HttpServletRequest request, HttpServletResponse response) throws ReverseProxyException, IOException;
+ public void invoke(ProxyContext proxyContext) throws ReverseProxyException, IOException;
}
Modified: portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/impl/DefaultReverseProxyService.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/impl/DefaultReverseProxyService.java?rev=1612173&r1=1612172&r2=1612173&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/impl/DefaultReverseProxyService.java (original)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/impl/DefaultReverseProxyService.java Sun Jul 20 23:21:07 2014
@@ -3,9 +3,6 @@ package org.apache.portals.applications.
import java.io.IOException;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.apache.portals.applications.webcontent2.proxy.ReverseProxyException;
import org.apache.portals.applications.webcontent2.proxy.ReverseProxyService;
import org.slf4j.Logger;
@@ -23,17 +20,15 @@ public class DefaultReverseProxyService
this.proxyProcessingChain = proxyProcessingChain;
}
- public void invoke(HttpServletRequest request, HttpServletResponse response) throws ReverseProxyException, IOException
+ public void invoke(ProxyContext proxyContext) throws ReverseProxyException, IOException
{
- ProxyContext context = new ProxyContext();
- context.setRequestContext(new ServletRequestContext(request, response));
- proxyProcessingChain.execute(context);
+ proxyProcessingChain.execute(proxyContext);
- if (context.hasException())
+ if (proxyContext.hasException())
{
- logExceptions(context.getExceptions());
+ logExceptions(proxyContext.getExceptions());
- Exception e = context.getExceptions().get(0);
+ Exception e = proxyContext.getExceptions().get(0);
if (e instanceof ReverseProxyException)
{
Modified: portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/impl/ProxyContext.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/impl/ProxyContext.java?rev=1612173&r1=1612172&r2=1612173&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/impl/ProxyContext.java (original)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/impl/ProxyContext.java Sun Jul 20 23:21:07 2014
@@ -34,7 +34,7 @@ public class ProxyContext extends Contex
private static final long serialVersionUID = 1L;
- private RequestContext requestContext;
+ private final RequestContext requestContext;
private ProxyMappingRegistry proxyMappingRegistry;
private ProxyMapping resolvedMapping;
private String localPath;
@@ -46,14 +46,16 @@ public class ProxyContext extends Contex
private List<Exception> exceptions;
- public ProxyContext()
+ public ProxyContext(final RequestContext requestContext)
{
super();
+ this.requestContext = requestContext;
}
- public ProxyContext(Map map)
+ public ProxyContext(final RequestContext requestContext, Map map)
{
super(map);
+ this.requestContext = requestContext;
}
public RequestContext getRequestContext()
@@ -61,11 +63,6 @@ public class ProxyContext extends Contex
return requestContext;
}
- public void setRequestContext(RequestContext requestContext)
- {
- this.requestContext = requestContext;
- }
-
public ProxyMappingRegistry getProxyMappingRegistry()
{
return proxyMappingRegistry;
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=1612173&r1=1612172&r2=1612173&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 Sun Jul 20 23:21:07 2014
@@ -35,6 +35,8 @@ import org.apache.http.client.methods.Ht
import org.apache.http.client.methods.HttpTrace;
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.applications.webcontent2.proxy.impl.ServletRequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,7 +82,8 @@ public class DefaultReverseProxyServlet
{
try
{
- proxyService.invoke(request, response);
+ ProxyContext proxyContext = new ProxyContext(new ServletRequestContext(request, response));
+ proxyService.invoke(proxyContext);
}
catch (ReverseProxyException e)
{
Modified: portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/SimpleReverseProxyServlet.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/SimpleReverseProxyServlet.java?rev=1612173&r1=1612172&r2=1612173&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/SimpleReverseProxyServlet.java (original)
+++ portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/servlet/SimpleReverseProxyServlet.java Sun Jul 20 23:21:07 2014
@@ -85,7 +85,7 @@ public class SimpleReverseProxyServlet e
setProxyService(proxyService);
}
- private ProxyProcessingChain createProxyServiceCommand(final ServletConfig servletConfig)
+ protected ProxyProcessingChain createProxyServiceCommand(final ServletConfig servletConfig)
{
ProxyProcessingChain preprocessingChain = new ProxyProcessingChain();
Modified: portals/applications/webcontent/trunk/war/pom.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/war/pom.xml?rev=1612173&r1=1612172&r2=1612173&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/war/pom.xml (original)
+++ portals/applications/webcontent/trunk/war/pom.xml Sun Jul 20 23:21:07 2014
@@ -58,12 +58,6 @@
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <scope>runtime</scope>
- </dependency>
-
</dependencies>
<build>