/** * Rewrite the given URL using the provided {@link RewriteRule} object. Process the URL only if the rule is set to * outbound="true" * * @return The rewritten URL, or the unchanged URL if no action was taken. */ public String processOutbound(final HttpServletRequest request, final HttpServletResponse response, final RewriteRule rule, final String url) { String result = url; if ((rule != null) && rule.isOutbound() && rule.matches(url)) { for (Processor p : processors) { result = p.processOutbound(request, response, rule, result); } } return result; }
/** * Rewrite the given URL using the provided {@link RewriteRule} object. Process the URL only if the rule is set to * outbound="true" * * @return The rewritten URL, or the unchanged URL if no action was taken. */ public String processOutbound(final HttpServletRequest request, final HttpServletResponse response, final RewriteRule rule, final String url) { String result = url; if ((rule != null) && rule.isOutbound() && rule.matches(url)) { for (Processor p : processors) { result = p.processOutbound(request, response, rule, result); } } return result; }
/** * Rewrite the given URL using the provided {@link RewriteRule} object. Process the URL only if the rule is set to * outbound="true" * * @return The rewritten URL, or the unchanged URL if no action was taken. */ public String processOutbound(final HttpServletRequest request, final HttpServletResponse response, final RewriteRule rule, final String url) { String result = url; if ((rule != null) && rule.isOutbound() && rule.matches(url)) { for (Processor p : processors) { result = p.processOutbound(request, response, rule, result); } } return result; }
/** * Rewrite the given URL using the provided {@link RewriteRule} object. Process the URL only if the rule is set to * outbound="true" * * @return The rewritten URL, or the unchanged URL if no action was taken. */ public String processOutbound(final HttpServletRequest request, final HttpServletResponse response, final RewriteRule rule, final String url) { String result = url; if ((rule != null) && rule.isOutbound() && rule.matches(url)) { for (Processor p : processors) { result = p.processOutbound(request, response, rule, result); } } return result; }
@Override public boolean evaluate(final Rewrite event, final EvaluationContext context) { if ((event instanceof HttpOutboundServletRewrite) && rule.isOutbound()) { Address outboundResource = ((HttpOutboundServletRewrite) event).getAddress(); String outboundUrl = outboundResource.toString(); String contextPath = ((HttpServletRewrite) event).getContextPath(); if (!contextPath.equals("/") && outboundUrl.startsWith(contextPath)) outboundUrl = outboundUrl.substring(contextPath.length()); if (rule.matches(URL.build(outboundUrl).decode().toURL())) return true; } return false; }