/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
Map<String, String> urlParams = convertParametersList(parseParameters(uri.getEscapedQuery())); for (Entry<String, String> param : urlParams.entrySet()) { if (this.structuralParameters.contains(param.getKey())) {
Map<String, String> urlParams = convertParametersList(parseParameters(uri.getEscapedQuery())); List<String> keys = new ArrayList<String>(urlParams.keySet()); Collections.sort(keys);
/** * Returns the URL parameters for the given URL based on the parser associated with the * first context found that includes the URL, or the default parser if it is not * in a context * @param uri * @return * @throws URIException */ public Map<String, String> getUrlParams(URI uri) throws URIException { Map<String, String> map = new HashMap<>(); for (NameValuePair parameter : getUrlParamParser(uri.toString()).parseParameters(uri.getEscapedQuery())) { String value = parameter.getValue(); if (value == null) { value = ""; } map.put(parameter.getName(), value); } return map; }
/** * @throws IllegalArgumentException if any of the parameters is {@code null} or if the given {@code type} is not * {@link org.parosproxy.paros.network.HtmlParameter.Type#url url} or * {@link org.parosproxy.paros.network.HtmlParameter.Type#form form}. */ @Override public List<NameValuePair> getParameters(HttpMessage msg, Type type) { if (msg == null) { throw new IllegalArgumentException("Parameter msg must not be null."); } if (type == null) { throw new IllegalArgumentException("Parameter type must not be null."); } switch (type) { case form: return parseParameters(msg.getRequestBody().toString()); case url: String query = msg.getRequestHeader().getURI().getEscapedQuery(); if (query == null) { return new ArrayList<>(0); } return parseParameters(query); default: throw new IllegalArgumentException("The provided type is not supported: " + type); } }
@Override public Map<String, String> getParams(HttpMessage msg, HtmlParameter.Type type) { if (msg == null) { return new HashMap<>(); } switch (type) { case form: return this.parse(msg.getRequestBody().toString()); case url: return convertParametersList(parseParameters(msg.getRequestHeader().getURI().getEscapedQuery())); default: throw new InvalidParameterException("Type not supported: " + type); } }
/** * Returns true if the API call has a valid key * @param msg the message * @return true if the API call has a valid key * @since 2.6.0 */ public boolean hasValidKey(HttpMessage msg) { try { return this.hasValidKey(msg.getRequestHeader(), getParams(msg.getRequestHeader().getURI().getEscapedQuery())); } catch (ApiException e) { logger.error(e.getMessage(), e); return false; } }
createBaseUriWithCleanedPath(uri, handleParameters, handleODataParametersVisited)); String cleanedQuery = getCleanedQuery(uri.getEscapedQuery());
/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ @Override public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
JSONObject params = getParams(requestHeader.getURI().getEscapedQuery());