Package org.hisp.dhis.util
Class HttpUtils
java.lang.Object
org.hisp.dhis.util.HttpUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns the string representing the given URI.static URIbuild(org.apache.hc.core5.net.URIBuilder uriBuilder) Builds on URI without throwing checked exceptions.static StringgetUriAsString(org.apache.hc.core5.http.message.BasicHttpRequest request) Returns the string representing the URI the given HTTP request.static <T extends org.apache.hc.client5.http.classic.methods.HttpUriRequestBase>
TwithAuth(T request, Dhis2Config config) Adds a HTTP header for authentication based on theAuthenticationof the givenDhis2Config.
-
Constructor Details
-
HttpUtils
public HttpUtils()
-
-
Method Details
-
withAuth
public static <T extends org.apache.hc.client5.http.classic.methods.HttpUriRequestBase> T withAuth(T request, Dhis2Config config) Adds a HTTP header for authentication based on theAuthenticationof the givenDhis2Config.- Type Parameters:
T- the request class type.- Parameters:
request- theHttpUriRequestBase.config- theDhis2Config.- Returns:
- the request object.
-
build
Builds on URI without throwing checked exceptions.- Parameters:
uriBuilder- theURIBuilder.- Returns:
- a
URI.
-
asString
Returns the string representing the given URI. The URI is decoded.- Parameters:
uri- theURI.- Returns:
- a URI string.
-
getUriAsString
Returns the string representing the URI the given HTTP request. The URI is decoded.- Parameters:
request- theBasicHttpRequest.- Returns:
- a URI string.
-