public class SimpleReverseProxyPortlet extends GenericReverseProxyPortlet
HtmlCleanerContentRewriter
as the default ContentRewriter
.
And this is given as an example and a base class to be overriden.
This portlet reads XPATH_EXPRESSION_PARAM_NAME
parameter value (//body
by default)
to select only the specified DOM element and its descendants.
Also, this portlet can transform the content by using HtmlCleaner
transformation rules.
Finally, this portlet can use TagNodeVisitor
s to give custom TagNodeVisitor
s a chance
to transform the selected content.
REMOTE_URI_PARAM_NAME
PORTLET_BRIDGE_CONTEXT
allowPreferences, defaultActionPage, defaultCustomPage, defaultEditPage, defaultHelpPage, defaultViewPage, PARAM_ACTION_PAGE, PARAM_ALLOW_PREFERENCES, PARAM_CUSTOM_PAGE, PARAM_EDIT_PAGE, PARAM_HELP_PAGE, PARAM_MAX_PAGE, PARAM_VIEW_PAGE
Constructor and Description |
---|
SimpleReverseProxyPortlet()
Zero-argument default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.http.impl.client.HttpClientBuilder |
createHttpClientBuilder()
Creates
HttpClientBuilder instance. |
protected ProxyProcessingChain |
createProxyServiceCommand()
#init(PortletConfig) method invokes this method to
create the root reverse proxy processing chain ({@link ProxyProcessingChain}).
|
protected org.apache.http.conn.socket.LayeredConnectionSocketFactory |
createSslSocketFactory()
Creates the default internal SSL Socket Connection Factory (
LayeredConnectionSocketFactory ). |
void |
destroy() |
protected String[] |
getCleanerTransformationStringArray()
Returns
HtmlCleaner transformation string array. |
protected Map<String,ContentRewriter> |
getContentRewriters()
Returns a map containing only a
ContentRewriter for text/html content
by default. |
org.apache.http.conn.ssl.X509HostnameVerifier |
getHostnameVerifier()
Returns the internal SSL Hostname Verifier.
|
org.apache.http.impl.client.HttpClientBuilder |
getHttpClientBuilder()
Returns the internal
HttpClientBuilder instance. |
HttpClientContextBuilder |
getHttpClientContextBuilder()
Returns the internal
HttpClientContextBuilder instance. |
protected ProxyMapping |
getProxyMapping()
Returns a
ProxyMapping instance (PortletAnyProxyMapping by default). |
ProxyMappingRegistry |
getProxyMappingRegistry()
Returns the internal
ProxyMappingRegistry instance. |
org.apache.http.conn.socket.LayeredConnectionSocketFactory |
getSslSocketFactory()
Returns the internal SSL Socket Connection Factory (
LayeredConnectionSocketFactory ). |
protected List<TagNodeVisitor> |
getTagNodeVisitors()
Returns a list of
TagNodeVisitor s which are given a chance to visit all the tag nodes. |
protected String |
getXpathExpression()
Returns the XPath expression to select only the specific DOM element and its descendants from the remote content document.
|
void |
init(javax.portlet.PortletConfig portletConfig) |
protected void |
initHostnameVerifier(javax.portlet.PortletConfig portletConfig)
Initializes SSL hostnameVerifier (type of
X509HostnameVerifier )
from the init parameter, "ssl-hostname-verifier". |
protected boolean |
isInnerElementsOnly()
Returns the flag whether or not only the inner elements should be selected by the XPath expression.
|
void |
setHostnameVerifier(org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier)
Sets the internal SSL Hostname Verifier.
|
void |
setHttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder)
Sets the internal
HttpClientBuilder instance. |
void |
setHttpClientContextBuilder(HttpClientContextBuilder httpClientContextBuilder)
Sets the internal
HttpClientContextBuilder instance. |
void |
setProxyMappingRegistry(ProxyMappingRegistry proxyMappingRegistry)
Sets the internal
ProxyMappingRegistry instance. |
void |
setSslSocketFactory(org.apache.http.conn.socket.LayeredConnectionSocketFactory sslSocketFactory)
Sets the internal SSL Socket Connection Factory (
LayeredConnectionSocketFactory ). |
doView, getProxyService, invokeProxyService, processAction, serveResource, setProxyService
doCustom, doEdit, doHelp, doPreferencesEdit, getContext, getContext, render, setupPreferencesEdit
getDefaultActionPage, getDefaultCustomPage, getDefaultEditPage, getDefaultHelpPage, getDefaultViewPage, processPreferencesAction, setDefaultActionPage, setDefaultCustomPage, setDefaultEditPage, setDefaultHelpPage, setDefaultViewPage
doDispatch, doHeaders, getContainerRuntimeOptions, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getPortletContext, getPortletName, getProcessingEventQNames, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, getTitle, init, processEvent
public SimpleReverseProxyPortlet()
public void init(javax.portlet.PortletConfig portletConfig) throws javax.portlet.PortletException
init
in interface javax.portlet.Portlet
init
in class org.apache.portals.bridges.velocity.GenericVelocityPortlet
javax.portlet.PortletException
protected void initHostnameVerifier(javax.portlet.PortletConfig portletConfig)
X509HostnameVerifier
)
from the init parameter, "ssl-hostname-verifier".
The init parameter can be any of "ALLOW_ALL_HOSTNAME_VERIFIER", "BROWSER_COMPATIBLE_HOSTNAME_VERIFIER" or "STRICT_HOSTNAME_VERIFIER", case-insensitively. The default value is "BROWSER_COMPATIBLE_HOSTNAME_VERIFIER".
servletConfig
- public ProxyMappingRegistry getProxyMappingRegistry()
ProxyMappingRegistry
instance.public void setProxyMappingRegistry(ProxyMappingRegistry proxyMappingRegistry)
ProxyMappingRegistry
instance.proxyMappingRegistry
- public org.apache.http.impl.client.HttpClientBuilder getHttpClientBuilder()
HttpClientBuilder
instance.public void setHttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder)
HttpClientBuilder
instance.httpClientBuilder
- public HttpClientContextBuilder getHttpClientContextBuilder()
HttpClientContextBuilder
instance.public void setHttpClientContextBuilder(HttpClientContextBuilder httpClientContextBuilder)
HttpClientContextBuilder
instance.httpClientContextBuilder
- public org.apache.http.conn.socket.LayeredConnectionSocketFactory getSslSocketFactory()
LayeredConnectionSocketFactory
).
If not set, it invokes createSslSocketFactory()
to create a default one.public void setSslSocketFactory(org.apache.http.conn.socket.LayeredConnectionSocketFactory sslSocketFactory)
LayeredConnectionSocketFactory
).sslSocketFactory
- public org.apache.http.conn.ssl.X509HostnameVerifier getHostnameVerifier()
public void setHostnameVerifier(org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier)
hostnameVerifier
- public void destroy()
destroy
in interface javax.portlet.Portlet
destroy
in class javax.portlet.GenericPortlet
protected ProxyProcessingChain createProxyServiceCommand()
protected ProxyMapping getProxyMapping()
ProxyMapping
instance (PortletAnyProxyMapping
by default).protected Map<String,ContentRewriter> getContentRewriters()
ContentRewriter
for text/html
content
by default. The ContentRewriter
for HTML content is HtmlCleanerContentRewriter
, by default,
which is implemented with HtmlCleander
library.protected String getXpathExpression()
//body
by default.protected boolean isInnerElementsOnly()
protected String[] getCleanerTransformationStringArray()
HtmlCleaner
transformation string array.protected List<TagNodeVisitor> getTagNodeVisitors()
TagNodeVisitor
s which are given a chance to visit all the tag nodes.
Custom s can be used to translate the selected content from the remote content.protected org.apache.http.impl.client.HttpClientBuilder createHttpClientBuilder()
HttpClientBuilder
instance.
This method is invoked by getHttpClientBuilder()
if an HttpClientBuilder
instance was not set before.protected org.apache.http.conn.socket.LayeredConnectionSocketFactory createSslSocketFactory()
LayeredConnectionSocketFactory
).Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.