/** * Return true if the given URL corresponds to one or more mappings in the * current configuration. Strips context path information if necessary. */ public boolean isURLMapped(final String url) { return getConfig().isURLMapped(stripContextPath(url)); }
/** * Determine if this request URL is mapped by PrettyFaces */ public boolean isPrettyRequest() { return getConfig().isURLMapped(stripContextPath(originalUri)); }
/** * 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"); }
/** * 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"); }
public void injectParameters(final FacesContext context) { PrettyContext prettyContext = PrettyContext.getCurrentInstance(); String url = prettyContext.stripContextPath(prettyContext.getOriginalUri()); for (PrettyUrlMapping mapping : prettyContext.getConfig().getMappings()) { UrlPatternParser parser = new UrlPatternParser(mapping.getPattern()); if (parser.matches(url)) { injectParams(context, url, mapping, parser); injectQueryParams(context, mapping); } } }
result = context.stripContextPath(result);
String currentUri = stripContextPath(originalUri); PrettyUrlMapping urlMapping = getConfig().getMappingForUrl(currentUri); if (urlMapping != null)
result = context.stripContextPath(result);
result = context.stripContextPath(result);
result = context.stripContextPath(result);