public class RegexProxyMapping extends AbstractProxyMapping
ProxyMapping implementation.
For example, suppose this should cover the following mapping cases:
localPattern: "^/portals/([A-Za-z]+)/(.*)$"remoteReplace: "http://portals.apache.org/$1/$2"remotePattern: "^http://portals\\.apache\\.org/([A-Za-z]+)/(.*)$"localReplace: "/portals/$1/$2"
Note:
The localPattern and remoteReplace properties are used
in order to translate the local request path info to a remote target URI, whereas
the remotePattern and localReplace properties are used
in order to translate the remote location URI (e.g, redirection location) to a local
request path info.
| Constructor and Description |
|---|
RegexProxyMapping()
Zero-argument default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getLocalPattern()
Returns the regular expression to evaluate a local request path info.
|
String |
getLocalReplace()
Returns the replace string to translate to a local request path info based on the regular expression
result from
getRemotePattern(). |
String |
getRemotePattern()
Returns the regular expression to evaluate a remote URL.
|
String |
getRemoteReplace()
Returns the replace string to translate to a remote URI based on the regular expression
result from
getLocalPattern(). |
boolean |
matchesLocal(String localPath)
Returns true the
localPath can be mapped by this proxy mapping. |
boolean |
matchesRemote(URI remoteURI)
Returns true the
remoteURI can be mapped by this proxy mapping. |
String |
resolveLocalFromRemote(URI remoteURI)
Resolves the
remoteURI to a local request path info. |
String |
resolveRemoteFromLocal(String localPath)
Resolves the
localPath to a remote target URI. |
void |
setLocalPattern(String localPattern)
Sets the regular expression to evaluate a local request path info.
|
void |
setLocalReplace(String localReplace)
Sets the replace string to translate to a local request path info based on the regular expression
result from
getRemotePattern(). |
void |
setRemotePattern(String remotePattern)
Sets the regular expression to evaluate a remote URL.
|
void |
setRemoteReplace(String remoteReplace)
Sets the replace string to translate to a remote URI based on the regular expression
result from
getLocalPattern(). |
getAttribute, getAttributesMap, getContentRewriter, getContentRewriters, removeAttribute, setAttribute, setAttributesMap, setContentRewriterspublic String getLocalPattern()
public void setLocalPattern(String localPattern)
localPattern - public String getRemoteReplace()
getLocalPattern().public void setRemoteReplace(String remoteReplace)
getLocalPattern().remoteReplace - public String getRemotePattern()
public void setRemotePattern(String remotePattern)
remotePattern - public String getLocalReplace()
getRemotePattern().public void setLocalReplace(String localReplace)
getRemotePattern().localReplace - public boolean matchesLocal(String localPath)
localPath can be mapped by this proxy mapping.
Otherwise, it should return false.public String resolveRemoteFromLocal(String localPath)
localPath to a remote target URI.public boolean matchesRemote(URI remoteURI)
remoteURI can be mapped by this proxy mapping.
Otherwise, it should return false.Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.