@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; }
/** * Must create instance through the initialize() method */ protected PrettyContext(final HttpServletRequest request) { Assert.notNull(request, "HttpServletRequest argument was null"); config = (PrettyConfig) request.getAttribute(CONFIG_KEY); if (config == null) { config = new PrettyConfig(); } contextPath = request.getContextPath(); String requestUrl = stripContextPath(request.getRequestURI()); Matcher sessionIdMatcher = JSESSIONID_PATTERN.matcher(requestUrl); if (sessionIdMatcher.matches()) { requestUrl = sessionIdMatcher.replaceFirst(JSESSIONID_REPLACEMENT); } String encoding = request.getCharacterEncoding() == null ? DEFAULT_ENCODING : request.getCharacterEncoding(); requestURL = new URL(requestUrl); requestURL.setEncoding(encoding); requestURL = requestURL.decode(); requestQuery = QueryString.build(request.getQueryString()); log.trace("Initialized PrettyContext"); }
/** * Must create instance through the initialize() method */ protected PrettyContext(final HttpServletRequest request) { Assert.notNull(request, "HttpServletRequest argument was null"); config = (PrettyConfig) request.getAttribute(CONFIG_KEY); if (config == null) { config = new PrettyConfig(); } contextPath = request.getContextPath(); String requestUrl = stripContextPath(request.getRequestURI()); Matcher sessionIdMatcher = JSESSIONID_PATTERN.matcher(requestUrl); if (sessionIdMatcher.matches()) { requestUrl = sessionIdMatcher.replaceFirst(JSESSIONID_REPLACEMENT); } String encoding = request.getCharacterEncoding() == null ? DEFAULT_ENCODING : request.getCharacterEncoding(); requestURL = new URL(requestUrl); requestURL.setEncoding(encoding); requestURL = requestURL.decode(); requestQuery = QueryString.build(request.getQueryString()); log.trace("Initialized PrettyContext"); }
/** * Must create instance through the initialize() method */ protected PrettyContext(final HttpServletRequest request) { Assert.notNull(request, "HttpServletRequest argument was null"); // attribute is set by PrettyFacesRewriteLifecycleListener before config = (PrettyConfig) request.getAttribute(CONFIG_KEY); // not sure if this can happen any more, but we'll keep it for now if (config == null) { config = new PrettyConfig(); } contextPath = request.getContextPath(); String requestUrl = stripContextPath(request.getRequestURI()); Matcher sessionIdMatcher = JSESSIONID_PATTERN.matcher(requestUrl); if (sessionIdMatcher.matches()) { requestUrl = sessionIdMatcher.replaceFirst(JSESSIONID_REPLACEMENT); } String encoding = request.getCharacterEncoding() == null ? DEFAULT_ENCODING : request.getCharacterEncoding(); requestURL = new URL(requestUrl); requestURL.setEncoding(encoding); requestURL = requestURL.decode(); requestQuery = QueryString.build(request.getQueryString()); log.trace("Initialized PrettyContext"); }
/** * Must create instance through the initialize() method */ protected PrettyContext(final HttpServletRequest request) { Assert.notNull(request, "HttpServletRequest argument was null"); config = (PrettyConfig) request.getAttribute(CONFIG_KEY); if (config == null) { config = new PrettyConfig(); } contextPath = request.getContextPath(); String requestUrl = stripContextPath(request.getRequestURI()); Matcher sessionIdMatcher = JSESSIONID_PATTERN.matcher(requestUrl); if (sessionIdMatcher.matches()) { requestUrl = sessionIdMatcher.replaceFirst(JSESSIONID_REPLACEMENT); } String encoding = request.getCharacterEncoding() == null ? DEFAULT_ENCODING : request.getCharacterEncoding(); requestURL = new URL(requestUrl); requestURL.setEncoding(encoding); requestURL = requestURL.decode(); requestQuery = QueryString.build(request.getQueryString()); log.trace("Initialized PrettyContext"); }
@Override public boolean evaluate(final Rewrite event, final EvaluationContext context) { if (event instanceof HttpInboundServletRewrite && rule.isInbound() && PFUtil.isRewritingEnabled(event)) { HttpServletRewrite httpRewrite = (HttpServletRewrite) event; String path = httpRewrite.getInboundAddress().getPath(); String url = URL.build(path).decode().toURL() + QueryString.build(httpRewrite.getInboundAddress().getQuery()).toQueryString(); String contextPath = httpRewrite.getContextPath(); if (!contextPath.equals("/") && url.startsWith(contextPath)) url = url.substring(contextPath.length()); if (rule.matches(url)) { return true; } } return false; }
String originalUrl = httpRewrite.getInboundAddress().getPath(); originalUrl = URL.build(originalUrl).decode().toURL() + QueryString.build(httpRewrite.getInboundAddress().getQuery()).toQueryString();
if (url.decode().toURL().equals(viewId))