@Override public UriBuilder replaceMatrix(String matrixValues) throws IllegalArgumentException { this.matrix = JAXRSUtils.getStructuredParams(matrixValues, ";", true, false); return this; }
@Override public UriBuilder replaceQuery(String queryValue) throws IllegalArgumentException { if (queryValue != null) { // workaround to do with a conflicting and confusing requirement where spaces // passed as part of replaceQuery are encoded as %20 while those passed as part // of quertyParam are encoded as '+' queryValue = queryValue.replace(" ", "%20"); } query = JAXRSUtils.getStructuredParams(queryValue, "&", false, true); return this; }
@Override public UriBuilder replaceQuery(String queryValue) throws IllegalArgumentException { if (queryValue != null) { // workaround to do with a conflicting and confusing requirement where spaces // passed as part of replaceQuery are encoded as %20 while those passed as part // of quertyParam are encoded as '+' queryValue = queryValue.replace(" ", "%20"); } query = JAXRSUtils.getStructuredParams(queryValue, "&", false, true); return this; }
public static MultivaluedMap<String, String> getMatrixParams(String path, boolean decode) { int index = path.indexOf(';'); return index == -1 ? new MetadataMap<String, String>() : JAXRSUtils.getStructuredParams(path.substring(index + 1), ";", decode, false); }
public static MultivaluedMap<String, String> getMatrixParams(String path, boolean decode) { int index = path.indexOf(';'); return index == -1 ? new MetadataMap<String, String>() : JAXRSUtils.getStructuredParams(path.substring(index + 1), ";", decode, false); }
/** * Retrieve map of query parameters from the passed in message * @param message * @return a Map of query parameters. */ public static MultivaluedMap<String, String> getStructuredParams(String query, String sep, boolean decode, boolean decodePlus) { MultivaluedMap<String, String> map = new MetadataMap<>(new LinkedHashMap<String, List<String>>()); getStructuredParams(map, query, sep, decode, decodePlus); return map; }
@Override public UriBuilder replaceMatrix(String matrixValues) throws IllegalArgumentException { String encodedMatrixValues = matrixValues != null ? HttpUtils.pathEncode(matrixValues) : null; this.matrix = JAXRSUtils.getStructuredParams(encodedMatrixValues, ";", true, false); return this; }
/** * Retrieve map of query parameters from the passed in message * @param message * @return a Map of query parameters. */ public static MultivaluedMap<String, String> getStructuredParams(String query, String sep, boolean decode, boolean decodePlus) { MultivaluedMap<String, String> map = new MetadataMap<String, String>(new LinkedHashMap<String, List<String>>()); getStructuredParams(map, query, sep, decode, decodePlus); return map; }
public MultivaluedMap<String, String> getQueryParameters(boolean decode) { if (!caseInsensitiveQueries) { return JAXRSUtils.getStructuredParams((String)message.get(Message.QUERY_STRING), "&", decode, decode); } MultivaluedMap<String, String> queries = new MetadataMap<String, String>(false, true); JAXRSUtils.getStructuredParams(queries, (String)message.get(Message.QUERY_STRING), "&", decode, decode); return queries; }
private void setUriParts(URI uri) { if (uri == null) { throw new IllegalArgumentException("uri is null"); } String theScheme = uri.getScheme(); if (theScheme != null) { scheme = theScheme; } String rawPath = uri.getRawPath(); if (!uri.isOpaque() && (theScheme != null || rawPath != null && rawPath.startsWith("/"))) { port = uri.getPort(); host = uri.getHost(); if (rawPath != null) { setPathAndMatrix(uri.getRawPath()); } String rawQuery = uri.getRawQuery(); if (rawQuery != null) { query = JAXRSUtils.getStructuredParams(rawQuery, "&", false, true); } userInfo = uri.getUserInfo(); schemeSpecificPart = null; } else { schemeSpecificPart = uri.getSchemeSpecificPart(); } String theFragment = uri.getFragment(); if (theFragment != null) { fragment = theFragment; } }
query = JAXRSUtils.getStructuredParams(rawQuery, "&", false, true);
protected String getCallbackValue(Message message) { String theQuery = (String)message.get(Message.QUERY_STRING); String callback = JAXRSUtils.getStructuredParams(theQuery, "&", false, false).getFirst(callbackParam); if (StringUtils.isEmpty(callback)) { String httpAcceptType = (String)message.get(Message.ACCEPT_CONTENT_TYPE); if (httpAcceptType != null && mediaType.equals(httpAcceptType)) { return defaultCallback; } } return callback; }
protected String getCallbackValue(Message message) { String theQuery = (String)message.get(Message.QUERY_STRING); String callback = JAXRSUtils.getStructuredParams(theQuery, "&", false, false).getFirst(callbackParam); if (StringUtils.isEmpty(callback)) { String httpAcceptType = (String)message.get(Message.ACCEPT_CONTENT_TYPE); if (httpAcceptType != null && mediaType.equals(httpAcceptType)) { return defaultCallback; } } return callback; }
protected String getCallbackValue(Message message) { String theQuery = (String)message.get(Message.QUERY_STRING); String callback = JAXRSUtils.getStructuredParams(theQuery, "&", false, false).getFirst(callbackParam); if (StringUtils.isEmpty(callback)) { String httpAcceptType = (String)message.get(Message.ACCEPT_CONTENT_TYPE); if (httpAcceptType != null && mediaType.equals(httpAcceptType)) { return defaultCallback; } } return callback; }
public static void getStructuredParams(MultivaluedMap<String, String> queries, String query, String sep, boolean decode, boolean decodePlus, boolean valueIsCollection) { if (!StringUtils.isEmpty(query)) { for (String part : query.split(sep)) { // fastpath expected int index = part.indexOf('='); final String name; String value = null; if (index == -1) { name = part; } else { name = part.substring(0, index); value = index < part.length() ? part.substring(index + 1) : ""; } if (valueIsCollection) { for (String s : value.split(",")) { addStructuredPartToMap(queries, sep, name, s, decode, decodePlus); } } else { addStructuredPartToMap(queries, sep, name, value, decode, decodePlus); } } } }
public MultivaluedMap<String, String> getQueryParameters(boolean decode) { MultivaluedMap<String, String> queries = !caseInsensitiveQueries ? new MetadataMap<String, String>() : new MetadataMap<String, String>(false, true); JAXRSUtils.getStructuredParams(queries, (String)message.get(Message.QUERY_STRING), "&", decode, decode, queryValueIsCollection); return queries; }
protected SAML2ReceivedResponseTO extract( final String spEntityID, final String urlContext, final String clientAddress, final InputStream response) throws IOException { String strForm = IOUtils.toString(response); MultivaluedMap<String, String> params = JAXRSUtils.getStructuredParams(strForm, "&", false, false); String samlResponse = params.getFirst(SSOConstants.SAML_RESPONSE); if (StringUtils.isNotBlank(samlResponse)) { samlResponse = URLDecoder.decode(samlResponse, StandardCharsets.UTF_8); LOG.debug("Received SAML Response: {}", samlResponse); } String relayState = params.getFirst(SSOConstants.RELAY_STATE); LOG.debug("Received Relay State: {}", relayState); SAML2ReceivedResponseTO receivedResponseTO = new SAML2ReceivedResponseTO(); receivedResponseTO.setSpEntityID(spEntityID); receivedResponseTO.setUrlContext(urlContext); receivedResponseTO.setSamlResponse(samlResponse); receivedResponseTO.setRelayState(relayState); return receivedResponseTO; } }
@Override public void filter(ContainerRequestContext ct) throws IOException { String httpMethod = ct.getMethod(); if (HttpMethod.GET.equals(httpMethod) && !supportPostBinding) { MultivaluedMap<String, String> params = ct.getUriInfo().getQueryParameters(); processParams(ct, params, false); } else if (HttpMethod.POST.equals(httpMethod) && supportPostBinding && MediaType.APPLICATION_FORM_URLENCODED_TYPE.isCompatible(ct.getMediaType())) { String strForm = IOUtils.toString(ct.getEntityStream()); MultivaluedMap<String, String> params = JAXRSUtils.getStructuredParams(strForm, "&", false, false); if (!processParams(ct, params, true)) { // restore the stream ct.setEntityStream(new ByteArrayInputStream(strForm.getBytes())); } } }
public String getSearchExpression() { String queryStr = (String)message.get(Message.QUERY_STRING); if (queryStr != null) { if (MessageUtils.getContextualBoolean(message, USE_ALL_QUERY_COMPONENT)) { return queryStr; } boolean encoded = PropertyUtils.isTrue(getKeepEncodedProperty()); MultivaluedMap<String, String> params = JAXRSUtils.getStructuredParams(queryStr, "&", !encoded, false); String customQueryParamName = (String)message.getContextualProperty(CUSTOM_SEARCH_QUERY_PARAM_NAME); if (customQueryParamName != null) { return params.getFirst(customQueryParamName); } if (queryStr.contains(SHORT_SEARCH_QUERY) || queryStr.contains(SEARCH_QUERY)) { if (params.containsKey(SHORT_SEARCH_QUERY)) { return params.getFirst(SHORT_SEARCH_QUERY); } return params.getFirst(SEARCH_QUERY); } else if (MessageUtils.getContextualBoolean(message, USE_PLAIN_QUERY_PARAMETERS)) { return convertPlainQueriesToFiqlExp(params); } } return null; }
public String getSearchExpression() { String queryStr = (String)message.get(Message.QUERY_STRING); if (queryStr != null) { if (MessageUtils.isTrue(message.getContextualProperty(USE_ALL_QUERY_COMPONENT))) { return queryStr; } boolean encoded = PropertyUtils.isTrue(getKeepEncodedProperty()); MultivaluedMap<String, String> params = JAXRSUtils.getStructuredParams(queryStr, "&", !encoded, false); String customQueryParamName = (String)message.getContextualProperty(CUSTOM_SEARCH_QUERY_PARAM_NAME); if (customQueryParamName != null) { return params.getFirst(customQueryParamName); } if (queryStr.contains(SHORT_SEARCH_QUERY) || queryStr.contains(SEARCH_QUERY)) { if (params.containsKey(SHORT_SEARCH_QUERY)) { return params.getFirst(SHORT_SEARCH_QUERY); } else { return params.getFirst(SEARCH_QUERY); } } else if (MessageUtils.isTrue(message.getContextualProperty(USE_PLAIN_QUERY_PARAMETERS))) { return convertPlainQueriesToFiqlExp(params); } } return null; }