A portlet application dedicated to the development of Web Content rewriting and IFrame based web content. The portlet applications here are designed to host content from another web site or local servlet inside of a portlet window.
The Web Content portet application consists of three portlets that have similiar functionality, but different approaches:
The IFrame Portet achieves this by embedding an HTML iframe within a portlet.
The ReverseProxy IFrame Portlet behaves in the same way as IFrame Portlet does, except that it uses Reverse Proxy URLs instead of the original SRC URLs. By using Reverse Proxy service component, more sophisticated content can be served by setting content rewriting configurations or Cross-Domain Scripting can be enabled. The Web Content Application includes Reverse Proxy Service servlet and component.
The Web Content portlet takes a more complicated approach: it actually embeds the content of the remote website inside the HTML payload delivered by the portal, without the help of the browser. This approach is more complicated since it may require rewriting all links within the hosted website, that is, if you want to keep the website navigation inside the portlet window. While a noble cause, this approach is far from perfect and does not always work correctly.
If you are interested in secure versions of these portlets, see the Jetspeed-specific versions of the IFrame, ReverseProxyIFrame, or WebContent portlets found at the Jetspeed J2-Admin website. The SSOIFrame, SSOReverseProxyIFrame and SSOWebContent portlets leverage the Jetspeed SSO Services, and are not portable to other portal servers.
Here are the classes to declare when using the portlets:
<portlet-class>org.apache.portals.applications.webcontent.portlet.IFrameGenericPortlet</portlet-class>
Note: The ReverseProxyIFramePortlet uses the same class, but has different preferences configurations.
or
<portlet-class>org.apache.portals.applications.webcontent.portlet.WebContentPortlet</portlet-class>
| Name | Example Value | Description |
|---|---|---|
| SRC | http://www.google.com | The URL of the remote or local site to be hosted. |
| Name | Example Value | Description |
|---|---|---|
| SRC |
http://portals.apache.org/index.html |
The URL of the remote or local site to be hosted.
You can use predefined variables, ${serverName}, ${serverPort} or ${contextPath}, to set local URLs.
|
| AUTORESIZE | true | If this preference value is set to true, then this portlet tries to resize the height of the IFRAME tag based on the rendered content. However, this option is applied only when the 'SRC' url is in the same domain of the portal URL. |
| VISITLASTPAGE | true | If this preference value is set to true, then this last visited page in this portlet is stored in the session and the page will be revisited when the portlet is rendered again. However, this option is applied only when the 'SRC' url is in the same domain of the portal URL. |
| HEIGHT | 300 | The height of the IFrame window when in Normal Window State |
| WIDTH | 100% | The width of the IFrame window when in Normal Window State. Can be a percentage of available space to the portlet, or a constant value |
| MAX-HEIGHT | 800 | The height of the IFrame window when in Maximized Window State |
| MAX-WIDTH | 100% | The width of the IFrame window when in Maximized Window State. Can be a percentage of available space to the portlet, or a constant value |
| SCROLLING | AUTO | YES | NO | Specifies whether or not to display scrollbars in an iframe |
| Name | Example Value | Description |
|---|---|---|
| SRC | http://portals.apache.org/index.html |
The URL of the remote or local site to be hosted.
You can use predefined variables, ${serverName}, ${serverPort} or ${contextPath}, to set local URLs.
|
| PROXYREMOTEURL | http://portals.apache.org/ |
The base URL of the remote site.
If 'PROXYREMOTEURL' and 'PROXYLOCALPATH' are set,
then this portlet translates the 'SRC' url into a reverse proxy url
by replacing the value of 'PROXYREMOTEURL' by the value of 'PROXYLOCALPATH'.
If you use the default reverse proxy component, then you should configure
the path mappings in the configuration file. (e.g., /WEB-INF/conf/reverseproxy.properties)
You can use predefined variables, ${serverName}, ${serverPort} or ${contextPath}, to set local URLs.
|
| PROXYLOCALPATH | ${contextPath}/rproxy/portals/ |
The base URL of the local proxy URL.
If the value of 'PROXYLOCALPATH' doesn't starts with '/', then
this portlet prepends the context path of the local servlet application.
By default, this web application contains reverse proxy servlet mapped by '/rproxy' path.
For some cases, you can use other external proxy server by setting a context relative path
or absolute url such as '/apache' or 'http://www.localhost.com/apache'.
If you use the default reverse proxy component, then you should configure
the path mappings in the configuration file. (e.g., /WEB-INF/conf/reverseproxy.properties)
You can use the predefined variable, ${contextPath}, to set local paths.
|
| AUTORESIZE | true | If this preference value is set to true, then this portlet tries to resize the height of the IFRAME tag based on the rendered content. However, this option is applied only when the 'SRC' url is in the same domain of the portal URL. Also, if 'PROXYREMOTEURL' and 'PROXYLOCALPATH' are set to use a proxy url in the same domain, then this option can be applied as well. |
| VISITLASTPAGE | true | If this preference value is set to true, then this last visited page in this portlet is stored in the session and the page will be revisited when the portlet is rendered again. However, this option is applied only when the 'SRC' url is in the same domain of the portal URL. Also, if 'PROXYREMOTEURL' and 'PROXYLOCALPATH' are set to use a proxy url in the same domain, then this option can be applied as well. |
| HEIGHT | 300 | The height of the IFrame window when in Normal Window State |
| WIDTH | 100% | The width of the IFrame window when in Normal Window State. Can be a percentage of available space to the portlet, or a constant value |
| MAX-HEIGHT | 800 | The height of the IFrame window when in Maximized Window State |
| MAX-WIDTH | 100% | The width of the IFrame window when in Maximized Window State. Can be a percentage of available space to the portlet, or a constant value |
| SCROLLING | AUTO | YES | NO | Specifies whether or not to display scrollbars in an iframe |
Note: The ReverseProxyService should be able to access application level session attribute
shared by a portlet of IFrameGenericPortlet or its descendant, which is conforming
with the Portlet Specification.
If you are using Tomcat, then be sure to set the following in the server.xml to enable
this proper Portlet API session management requirements.
Modify the Connector element (default on port 8080) by adding the folowing attribute:
emptySessionPath="true"
The ReverseProxyService component is initialized by the ReverseProxyServlet configured in the web.xml as follows:
<!-- Default Reverse Proxy Servlet -->
<servlet>
<servlet-name>ReverseProxyServlet</servlet-name>
<servlet-class>org.apache.portals.applications.webcontent.proxy.impl.DefaultHttpReverseProxyServlet</servlet-class>
<init-param>
<param-name>reverseproxy.configuration</param-name>
<param-value>/WEB-INF/conf/reverseproxy.properties</param-value>
</init-param>
<init-param>
<param-name>reverseproxy.configuration.refresh.delay</param-name>
<param-value>60000</param-value>
</init-param>
<load-on-startup>11</load-on-startup>
</servlet>
<!-- Map /rproxy path to the Default Reverse Proxy Servlet -->
<servlet-mapping>
<servlet-name>ReverseProxyServlet</servlet-name>
<url-pattern>/rproxy/*</url-pattern>
</servlet-mapping>
The above servlet can have the following init parameters:
| Name | Example Value | Description |
|---|---|---|
| reverseproxy.configuration | /WEB-INF/conf/reverseproxy.properties | The context relative path of the configuration properties file. |
| reverseproxy.configuration.refresh.delay | 60000 | The milliseconds of automatic refreshing interval. If this value is set to a positive number, then the servlet checks if the configuration file has been modified and it tries to reload the configuration if there's any changes. By default, this value is set to zero without automatic refreshment. |
In the above servlet mapping configuration, the entry path mapping of this reverse proxy servlet is set to '/rproxy/*'. So, the remaining local path info after the '/rproxy' is used to map the path to the remote url. This mapping configurations and other sophisticated http parameters are configured in '/WEB-INF/conf/reverseproxy.properties' by default. A simple configuration example can be as follows:
# A very simple configuration of reverseproxy.properties
#
# Proxy Pass Reverse Mapping configurations for each category
# ... Put the path item names here. Each path item will be evaluated by the order.
proxy.reverse.pass = apache, portals
proxy.reverse.pass.apache.local = /apache/
proxy.reverse.pass.apache.remote = http://www.apache.org/
proxy.reverse.pass.portals.local = /portals/
proxy.reverse.pass.portals.remote = http://portals.apache.org/
In the above example, just two path mappings are defined: One for http://www.apache.org/ and the other for http://portals.apache.org/. For http://www.apache.org/, the local path, /apache/, is mapped. And for http://portals.apache.org/, the local path, /portals/, is mapped. So, if you visit the reverse proxy url like 'http://localhost:8080/webcontent/rproxy/portals/index.html in your browser, then you can browse the Apache Portals homepage via the reverse proxy component!
Here are full descriptions for configuration properties.
Note: The previously defined property variables are automatically expanded when the configuration has
the variable references wrapped by '${property.name}' like the following example:
defaults.parserAdaptor.html = org.apache.portals.applications.webcontent.rewriter.html.neko.NekoParserAdaptor
proxy.reverse.pass.somewhere.rewriter.parserAdaptor.html = ${defaults.parserAdaptor.html}
| Property | Default Value | Example Value | Description |
|---|---|---|---|
| proxy.http.client.param.allowCircularRedirects | false | false | Flag whether the internal http client object should allow circular redirects. |
| proxy.http.client.param.cookiePolicy | best-match | netscape | Flag whether the internal http client object should allow circular redirects. Please see the documentation of httpclient 4.x on cookie policies. |
| proxy.http.connManager.param.maxTotalConnections | 2 | 200 | The maximum http connection counts. If there's any http connections available, then it will block the request until it gets a connection. |
| proxy.http.connManager.param.timeout | 0 | 10000 | The maximum waiting time to create http connection. If this is set to zero, it waits without timeout option, so it depends on the system configuration. |
| proxy.http.route.param.defaultMaxPerRoute | 20 | The default maximum http connection count per route. | |
| proxy.http.route | apache, portals | The comma delimited HTTP route names. Each route name should be used in the following configuration properties to set detailed http connection options for each route. | |
| proxy.http.route.<routename>.target.hostname | portals.apache.org |
<routename> should be replaced by the real route name.
With this example, you may use 'apache' or 'portals'.
The host name of the target of this route. |
|
| proxy.http.route.<routename>.target.port | 80 |
<routename> should be replaced by the real route name.
With this example, you may use 'apache' or 'portals'.
The port number of the target of this route. If you don't set this property, it means ANY port is allowed for this route. |
|
| proxy.http.route.<routename>.target.scheme | http |
<routename> should be replaced by the real route name.
With this example, you may use 'apache' or 'portals'.
The scheme of the target of this route. If you don't set this property, it means ANY scheme is allowed for this route. |
|
| proxy.http.route.<routename>.maxConnections | 40 |
<routename> should be replaced by the real route name.
With this example, you may use 'apache' or 'portals'.
The maximum http connection count of the target of this route. |
|
| proxy.http.route.<routename>.local |
<routename> should be replaced by the real route name.
With this example, you may use 'apache' or 'portals'.
The local address to connect from. |
||
| proxy.http.route.<routename>.secure | false |
<routename> should be replaced by the real route name.
With this example, you may use 'apache' or 'portals'.
Whether the route is (supposed to be) secure. |
|
| proxy.http.route.<routename>.tunnelled | plain | tunneled |
<routename> should be replaced by the real route name.
With this example, you may use 'apache' or 'portals'.
Whether the the route is tunnelled through the proxy. |
| proxy.http.route.<routename>.layered | plain | layered |
<routename> should be replaced by the real route name.
With this example, you may use 'apache' or 'portals'.
Whether the route is layered. |
| proxy.http.route.<routename>.proxy | proxyserver1, proxyserver2 | The comma delimited HTTP proxy names. Each proxy name should be used in the following configuration properties to set detailed http connection options for each proxy. | |
| proxy.http.route.<routename>.proxy.<proxyname>.hostname | proxyserver1 |
<routename> and <proxyname> should be replaced by the real route name and proxy name.
With this example, you may use 'apache' or 'portals' for <routename>
and you may use 'proxyserver1' or 'proxyserver2' for <proxyname>.
The host name of the target of this proxy. |
|
| proxy.http.route.<routename>.proxy.<proxyname>.port | 10080 |
<routename> and <proxyname> should be replaced by the real route name and proxy name.
With this example, you may use 'apache' or 'portals' for <routename>
and you may use 'proxyserver1' or 'proxyserver2' for <proxyname>.
The port number of the target of this proxy. If you don't set this property, it means ANY port is allowed for this proxy. |
|
| proxy.http.route.<routename>.proxy.<proxyname>.scheme | http |
<routename> and <proxyname> should be replaced by the real route name and proxy name.
With this example, you may use 'apache' or 'portals' for <routename>
and you may use 'proxyserver1' or 'proxyserver2' for <proxyname>.
The scheme of the target of this proxy. If you don't set this property, it means ANY scheme is allowed for this proxy. |
|
| proxy.reverse.pass | apache, portals | The comma delimited path names for reverse proxy mappings. Each path name should be used in the following configuration properties to set detailed reverse proxy path mappings. | |
| proxy.reverse.pass.<pathname>.local | /portals/ |
<pathname> should be replaced by the real path name.
With this example, you may use 'apache' or 'portals' for <pathname>.
The base local path info of the reverse proxy mapping. For example, if the relative url is '/webcontent/rproxy/portals/index.html', then because the path info is '/portals/index.html', this path mapping is selected. |
|
| proxy.reverse.pass.<pathname>.remote | http://portals.apache.org/ |
<pathname> should be replaced by the real path name.
With this example, you may use 'apache' or 'portals' for <pathname>.
The base remote url of the reverse proxy mapping. For example, if the relative url is '/webcontent/rproxy/portals/index.html', then because the path info is '/portals/index.html', this path mapping is selected and the translated remote url can be 'http://portals.apache.org/index.html'. |
|
| proxy.reverse.pass.<pathname>.rewriter.basic | org.apache.portals.applications. webcontent.rewriter. WebContentRewriter |
<pathname> should be replaced by the real path name.
With this example, you may use 'apache' or 'portals' for <pathname>.
The basic content rewriter class name. |
|
| proxy.reverse.pass.<pathname>.rewriter.rulebased | org.apache.portals.applications. webcontent.rewriter. WebContentRewriter |
<pathname> should be replaced by the real path name.
With this example, you may use 'apache' or 'portals' for <pathname>.
The rule-based content rewriter class name. |
|
| proxy.reverse.pass.<pathname>.rewriter.parserAdaptor | html, xml |
<pathname> should be replaced by the real path name.
With this example, you may use 'apache' or 'portals' for <pathname>.
The comma delimited parser adaptor names. Each parser adaptor name should be used in the following configuration properties to set detailed parser adaptor properties. |
|
| proxy.reverse.pass.<pathname>.rewriter.parserAdaptor.<parserAdaptorName> | org.apache.portals.applications .webcontent.rewriter.html.neko .NekoParserAdaptor |
<pathname> and <parserAdaptorName> should be replaced by the real path name.
With this example, you may use 'apache' or 'portals' for <pathname>
and you may use 'html' or 'xml' for <parserAdaptorName>.
The parser adaptor class name. |
|
| proxy.reverse.pass.<pathname>.rewriter.parserAdaptor.<parserAdaptorName>.mimeType | text/html |
<pathname> and <parserAdaptorName> should be replaced by the real path name.
With this example, you may use 'apache' or 'portals' for <pathname>
and you may use 'html' or 'xml' for <parserAdaptorName>.
The mime type which this parser adaptor concerns. |
|
| proxy.reverse.pass.<pathname>.rewriter.ruleMappings | /WEB-INF/conf/rewriter-rules-mapping.xml |
<pathname> should be replaced by the real path name.
With this example, you may use 'apache' or 'portals' for <pathname>.
The rewriting rule mappings configuration and rewriter rule definition. |
|
| proxy.reverse.pass.<pathname>.rewriter.rules | /WEB-INF/conf/default-rewriter-rules.xml |
<pathname> should be replaced by the real path name.
With this example, you may use 'apache' or 'portals' for <pathname>.
The rewriter rules definition. |
Here are examples of the Web Content and IFrame Portlets:

