public class UrlRewriter extends Object
Constructor and Description |
---|
UrlRewriter()
Rewrites urls from the response for the client or from the request to the target server.
|
Modifier and Type | Method and Description |
---|---|
CharSequence |
rewriteHtml(CharSequence input,
String requestUrl,
String baseUrlParam,
String visibleBaseUrl,
boolean absolute)
Fixes all resources urls and returns the result.
|
String |
rewriteReferer(String referer,
String baseUrl,
String visibleBaseUrl)
Fixes a referer url in a request.
|
String |
rewriteRefresh(String input,
String requestUrl,
String baseUrl,
String visibleBaseUrl)
Rewrites a "Refresh" HTTP header or a <meta http-equiv="refresh"... tag.
|
String |
rewriteUrl(String url,
String requestUrl,
String baseUrl,
String visibleBaseUrl,
boolean absolute)
Fixes an url according to the chosen mode.
|
public UrlRewriter()
public String rewriteReferer(String referer, String baseUrl, String visibleBaseUrl)
referer
- the url to fix (can be anything found in an html page, relative, absolute, empty...)baseUrl
- The base URL selected for this request.visibleBaseUrl
- The base URL viewed by the browser.public String rewriteUrl(String url, String requestUrl, String baseUrl, String visibleBaseUrl, boolean absolute)
Note: urls starting with an ESI variable are not rewriten.
url
- the url to fix (can be anything found in an html page, relative, absolute, empty...)requestUrl
- The incoming request URL (could be absolute or relative to visible base url).baseUrl
- The base URL selected for this request.visibleBaseUrl
- The base URL viewed by the browser.absolute
- Should the rewritten urls contain the scheme host and portpublic CharSequence rewriteHtml(CharSequence input, String requestUrl, String baseUrlParam, String visibleBaseUrl, boolean absolute)
input
- The html to be processed.requestUrl
- The request URL.baseUrlParam
- The base URL selected for this request.visibleBaseUrl
- The base URL viewed by the browser.absolute
- Should the rewritten urls contain the scheme host and portpublic String rewriteRefresh(String input, String requestUrl, String baseUrl, String visibleBaseUrl)
input
- The refresh value to be rewritten.requestUrl
- The request URL.baseUrl
- The base URL selected for this request.visibleBaseUrl
- The base URL viewed by the browser.Copyright © 2008–2018. All rights reserved.