if (!enabled) {
chain.doFilter(request, response);
return;
}
UrlRewriter urlRewriter = urlRewriteService.getEngine();
final HttpServletRequest hsRequest = (HttpServletRequest) request;
HttpServletResponse hsResponse = outboundRulesEnabled ? new UrlRewriteWrappedResponse(
(HttpServletResponse) response, hsRequest, urlRewriter)
: (HttpServletResponse) response;
hsResponse = new SessionidRemovalResponseWrapper(hsRequest, hsResponse);
// check for status request
String uri = hsRequest.getRequestURI();
logger.debug("Handling {}", uri);
if (statusEnabled
&& uri != null
&& uri.startsWith(hsRequest.getContextPath() + statusPath)
&& (statusServerNameMatcher == null || statusServerNameMatcher.isMatch(request
.getServerName()))) {
showStatus(hsRequest, hsResponse);
return;
}
if (!urlRewriteService.prepareInbound(hsRequest, hsResponse)) {
chain.doFilter(hsRequest, hsResponse);
return;
}
// if no rewrite has taken place continue as normal
if (!urlRewriter.processRequest(hsRequest, hsResponse, chain)) {
chain.doFilter(hsRequest, hsResponse);
} else if (hsRequest.getAttribute("UrlRewriteFilter.sendError") != null) {
// workaround: call sendError with the specified error code
hsResponse.sendError(Integer.valueOf((String) hsRequest.getAttribute("UrlRewriteFilter.sendError")));
}