public class HttpUtils extends Object
| Constructor and Description |
|---|
HttpUtils() |
| Modifier and Type | Method and Description |
|---|---|
static List<org.apache.http.NameValuePair> |
getParameters(org.apache.http.HttpRequest httpRequest)
Returns a
List containing the parameters associated to the provided httpRequest. |
static String |
getParameterValue(String parameterName,
List<org.apache.http.NameValuePair> parameters)
Returns the value associated to the provided
parameterName from the given parameters list. |
static String |
getPath(org.apache.http.HttpRequest httpRequest)
Returns the path associated to the provided
httpRequest. |
static org.apache.http.client.utils.URIBuilder |
getURIBuilderFrom(org.apache.http.HttpRequest httpRequest)
Returns a
URIBuilder from the provided httpRequest. |
public static org.apache.http.client.utils.URIBuilder getURIBuilderFrom(@Nonnull org.apache.http.HttpRequest httpRequest) throws URISyntaxException
URIBuilder from the provided httpRequest.httpRequest - the HttpRequest to get an URIBuilder fromURIBuilderURISyntaxException - if the provided httpRequest's URI is invalidpublic static String getPath(@Nonnull org.apache.http.HttpRequest httpRequest) throws URISyntaxException
httpRequest.
The returned path corresponds to the target of the provided httpRequest without the requests
parameters. For example, calling this method on a request with the URI /target?param=value will return
/target.
httpRequest - the HttpRequest to get the path fromhttpRequestURISyntaxException - if the provided httpRequest's URI is invalidpublic static List<org.apache.http.NameValuePair> getParameters(@Nonnull org.apache.http.HttpRequest httpRequest) throws URISyntaxException
List containing the parameters associated to the provided httpRequest.
Calling this method on a httpRequest instance that does not define any parameter in its request URI
returns an empty List.
httpRequest - the HttpRequest to get the parameters fromList containing the parameters associated to the provided httpRequestURISyntaxException - if the provided httpRequest's URI is invalid@Nullable public static String getParameterValue(@Nonnull String parameterName, @Nonnull List<org.apache.http.NameValuePair> parameters)
parameterName from the given parameters list.parameterName - the name of the parameter to retrieve the value ofparameters - the list of parameters to search inparameterName from the given parameters listCopyright © 2020 SOM Research Lab. All rights reserved.