public PathSegmentImpl(String path, boolean decode) { this.path = decode ? HttpUtils.pathDecode(path) : path; }
public PathSegmentImpl(String path, boolean decode) { this.path = decode ? HttpUtils.pathDecode(path) : path; }
public static String decodeValue(String value, boolean decode, ParameterType param) { if (!decode) { return value; } if (param == ParameterType.PATH || param == ParameterType.MATRIX) { return HttpUtils.pathDecode(value); } return HttpUtils.urlDecode(value); }
public static String decodeValue(String value, boolean decode, ParameterType param) { if (!decode) { return value; } if (param == ParameterType.PATH || param == ParameterType.MATRIX) { return HttpUtils.pathDecode(value); } else { return HttpUtils.urlDecode(value); } }
private String doGetPath(boolean decode, boolean addSlash) { String path = HttpUtils.getPathToMatch(message, addSlash); return decode ? HttpUtils.pathDecode(path) : path; }
private String doGetPath(boolean decode, boolean addSlash) { String path = HttpUtils.getPathToMatch(message, addSlash); return decode ? HttpUtils.pathDecode(path) : path; }
private static String createMatchedPath(String uri, List<? extends Object> vars, boolean decode) { String uriPath = UriBuilder.fromPath(uri).buildFromEncoded(vars.toArray()).getRawPath(); uriPath = decode ? HttpUtils.pathDecode(uriPath) : uriPath; if (uriPath.startsWith("/")) { uriPath = uriPath.substring(1); } return uriPath; } private String doGetPath(boolean decode, boolean addSlash) {
public MultivaluedMap<String, String> getPathParameters(boolean decode) { MetadataMap<String, String> values = new MetadataMap<>(); if (templateParams == null) { return values; } for (Map.Entry<String, List<String>> entry : templateParams.entrySet()) { if (entry.getKey().equals(URITemplate.FINAL_MATCH_GROUP)) { continue; } values.add(entry.getKey(), decode ? HttpUtils.pathDecode(entry.getValue().get(0)) : entry .getValue().get(0)); } return values; }
public MultivaluedMap<String, String> getPathParameters(boolean decode) { MetadataMap<String, String> values = new MetadataMap<String, String>(); if (templateParams == null) { return values; } for (Map.Entry<String, List<String>> entry : templateParams.entrySet()) { if (entry.getKey().equals(URITemplate.FINAL_MATCH_GROUP)) { continue; } values.add(entry.getKey(), decode ? HttpUtils.pathDecode(entry.getValue().get(0)) : entry .getValue().get(0)); } return values; }
private static void addStructuredPartToMap(MultivaluedMap<String, String> queries, String sep, String name, String value, boolean decode, boolean decodePlus) { if (value != null) { if (decodePlus && value.contains("+")) { value = value.replace('+', ' '); } if (decode) { value = (";".equals(sep)) ? HttpUtils.pathDecode(value) : HttpUtils.urlDecode(value); } } queries.add(HttpUtils.urlDecode(name), value); }
public static void getStructuredParams(MultivaluedMap<String, String> queries, String query, String sep, boolean decode, boolean decodePlus) { if (!StringUtils.isEmpty(query)) { List<String> parts = Arrays.asList(StringUtils.split(query, sep)); for (String part : parts) { int index = part.indexOf('='); String name = null; String value = null; if (index == -1) { name = part; value = ""; } else { name = part.substring(0, index); value = index < part.length() ? part.substring(index + 1) : ""; if (decodePlus && value.contains("+")) { value = value.replace('+', ' '); } if (decode) { value = (";".equals(sep)) ? HttpUtils.pathDecode(value) : HttpUtils.urlDecode(value); } } queries.add(HttpUtils.urlDecode(name), value); } } }
public List<String> getMatchedURIs(boolean decode) { if (stack != null) { List<String> objects = new ArrayList<String>(); List<String> uris = new LinkedList<String>(); StringBuilder sum = new StringBuilder(""); for (MethodInvocationInfo invocation : stack) { OperationResourceInfo ori = invocation.getMethodInfo(); URITemplate[] paths = { ori.getClassResourceInfo().getURITemplate(), ori.getURITemplate() }; for (URITemplate t : paths) { if (t != null) { String v = t.getValue(); sum.append("/" + (decode ? HttpUtils.pathDecode(v) : v)); } } UriBuilder ub = UriBuilder.fromPath(sum.toString()); objects.addAll(invocation.getTemplateValues()); uris.add(0, ub.build(objects.toArray()).normalize().getRawPath()); } return uris; } LOG.fine("No resource stack information, returning empty list"); return Collections.emptyList(); }