private String rewrite(final String url) { String result = ""; if (url != null) { String strippedUrl = stripContextPath(url); if (!strippedUrl.equals(url)) { result = contextPath; } try { for (RewriteRule c : prettyConfig.getGlobalRewriteRules()) { strippedUrl = rewriteEngine.processOutbound(request, this, c, strippedUrl); } result += strippedUrl; } catch (Exception e) { throw new PrettyException("Error occurred during canonicalization of request <[" + url + "]>", e); } } return result; }
private String rewrite(final String url) { String result = ""; if (url != null) { String strippedUrl = stripContextPath(url); if (!strippedUrl.equals(url)) { result = contextPath; } try { for (RewriteRule c : prettyConfig.getGlobalRewriteRules()) { strippedUrl = rewriteEngine.processOutbound(request, this, c, strippedUrl); } result += strippedUrl; } catch (Exception e) { throw new PrettyException("Error occurred during canonicalization of request <[" + url + "]>", e); } } return result; }
private String rewrite(final String url) { String result = ""; if (url != null) { String strippedUrl = stripContextPath(url); if (!strippedUrl.equals(url)) { result = contextPath; } try { for (RewriteRule c : prettyConfig.getGlobalRewriteRules()) { strippedUrl = rewriteEngine.processOutbound(request, this, c, strippedUrl); } result += strippedUrl; } catch (Exception e) { throw new PrettyException("Error occurred during canonicalization of request <[" + url + "]>", e); } } return result; }
private String rewrite(final String url) { String result = ""; if (url != null) { String strippedUrl = stripContextPath(url); if (!strippedUrl.equals(url)) { result = contextPath; } try { for (RewriteRule c : prettyConfig.getGlobalRewriteRules()) { strippedUrl = rewriteEngine.processOutbound(request, this, c, strippedUrl); } result += strippedUrl; } catch (Exception e) { throw new PrettyException("Error occurred during canonicalization of request <[" + url + "]>", e); } } return result; }
@Override public void perform(final Rewrite event, final EvaluationContext context) { RewriteEngine engine = new RewriteEngine(); HttpOutboundServletRewrite outbound = (HttpOutboundServletRewrite) event; String url = outbound.getOutboundAddress().toString(); String strippedUrl = stripContextPath(outbound.getContextPath(), url); String result = ""; if (!strippedUrl.equals(url)) { result = outbound.getContextPath(); } strippedUrl = engine.processOutbound(((HttpServletRewrite) event).getRequest(), ((HttpServletRewrite) event).getResponse(), rule, strippedUrl); result += strippedUrl; outbound.setOutboundAddress(AddressBuilder.create(result)); }