/** * Get this patterns pattern parser instance. */ public URLPatternParser getPatternParser() { if ((parser == null) && (pattern != null)) { this.parser = new URLPatternParser(pattern); } return parser; }
public int compare(final UrlMapping l, final UrlMapping r) { if (l.getPatternParser().getParameterCount() < r.getPatternParser().getParameterCount()) { return 1; } else if (l.getPatternParser().getParameterCount() > r.getPatternParser().getParameterCount()) { return -1; } return 0; } };
/** * Test this mapping against a given URL. * * @return True if this mapping matches the URL, false if not. */ public boolean matches(final URL url) { return getPatternParser().matches(url); }
List<PathParameter> parameters = parser.getPathParameters(); List<String> parameterValues = new ArrayList<String>(); for (PathParameter injection : parameters) result = parser.getMappedURL(parameterValues);
@Override public Map<String, String[]> getAdditionalParameters(final ServletRequest request, final ServletResponse response) { PrettyContext context = PrettyContext.getCurrentInstance((HttpServletRequest)request); PrettyConfig config = context.getConfig(); URL url = context.getRequestURL(); if (config.isURLMapped(url)) { List<PathParameter> params = context.getCurrentMapping().getPatternParser().parse(url); QueryString query = QueryString.build(params); return query.getParameterMap(); } return null; }
List<PathParameter> pathParams = m.getPatternParser().getPathParameters();
/** * Search through all currently configured {@link UrlMapping} objects for the first one that matches the given URL. * * @return the first appropriate {@link UrlMapping} for a given URL. */ public UrlMapping getMappingForUrl(final URL url) { final String mappingKey = url.toURL(); if (cachedMappings.containsKey(mappingKey)) { return cachedMappings.get(mappingKey); } for (UrlMapping mapping : getMappings()) { if (mapping.matches(url)) { if (!mapping.getPatternParser().isElPattern()) { cachedMappings.put(mappingKey, mapping); } return mapping; } } return null; }
URL url = parser.getMappedURL(firstParam.getValue()); return url.toURL(); URL url = parser.getMappedURL(list); return url.toURL(); URL mappedURL = parser.getMappedURL(pathParams.toArray());
List<PathParameter> parameters = parser.getPathParameters(); List<String> parameterValues = new ArrayList<String>(); for (PathParameter injection : parameters) result = parser.getMappedURL(parameterValues);
List<PathParameter> params = mapping.getPatternParser().parse(url); for (PathParameter param : params)
List<PathParameter> pathParams = m.getPatternParser().getPathParameters();
/** * Search through all currently configured {@link UrlMapping} objects for the first one that matches the given URL. * * @return the first appropriate {@link UrlMapping} for a given URL. */ public UrlMapping getMappingForUrl(final URL url) { final String mappingKey = url.toURL(); if (cachedMappings.containsKey(mappingKey)) { return cachedMappings.get(mappingKey); } for (UrlMapping mapping : getMappings()) { if (mapping.matches(url)) { if (!mapping.getPatternParser().isElPattern()) { cachedMappings.put(mappingKey, mapping); } return mapping; } } return null; }
URL url = parser.getMappedURL(firstParam.getValue()); return url.toURL(); URL url = parser.getMappedURL(list); return url.toURL(); URL mappedURL = parser.getMappedURL(pathParams.toArray());
List<PathParameter> parameters = parser.getPathParameters(); List<String> parameterValues = new ArrayList<String>(); for (PathParameter injection : parameters) result = parser.getMappedURL(parameterValues).encode();
/** * Return true if this parser matches the given URL, otherwise, return false. */ @Deprecated public boolean matches(final String target) { URL url = new URL(target); return matches(url); }
List<PathParameter> params = mapping.getPatternParser().parse(url); for (PathParameter param : params)
public int compare(final UrlMapping l, final UrlMapping r) { if (l.getPatternParser().getParameterCount() < r.getPatternParser().getParameterCount()) { return 1; } else if (l.getPatternParser().getParameterCount() > r.getPatternParser().getParameterCount()) { return -1; } return 0; } };
List<PathParameter> pathParams = m.getPatternParser().getPathParameters();
/** * Get this patterns pattern parser instance. */ public URLPatternParser getPatternParser() { if ((parser == null) && (pattern != null)) { this.parser = new URLPatternParser(pattern); } return parser; }
/** * Search through all currently configured {@link UrlMapping} objects for the first one that matches the given URL. * * @return the first appropriate {@link UrlMapping} for a given URL. */ public UrlMapping getMappingForUrl(final URL url) { final String mappingKey = url.toURL(); if (cachedMappings.containsKey(mappingKey)) { return cachedMappings.get(mappingKey); } for (UrlMapping mapping : getMappings()) { if (mapping.matches(url)) { if (!mapping.getPatternParser().isElPattern()) { cachedMappings.put(mappingKey, mapping); } return mapping; } } return null; }