Class HttpClient
java.lang.Object
org.gcube.social_networking.social_networking_client_library.utils.HttpClient
Jersey client with post and get methods.
Timeouts (milliseconds, 0 = infinite, the default) can be set with the system properties "social.client.connect.timeout.ms" and "social.client.read.timeout.ms".
Failures surface as WebApplicationException: HTTP status >= 300, empty
or malformed body, success=false in the response bean (the message of
the service is kept), or I/O errors including timeouts (the cause is kept).
- Author:
- Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <R> Rget(jakarta.ws.rs.core.GenericType<org.gcube.social_networking.socialnetworking.model.output.ResponseBean<R>> returnType, String requestUrl) Executes a get requeststatic <R> Rpost(jakarta.ws.rs.core.GenericType<org.gcube.social_networking.socialnetworking.model.output.ResponseBean<R>> returnType, String requestUrl, Object obj) Executes a post requeststatic <R> RpostFormData(jakarta.ws.rs.core.GenericType<org.gcube.social_networking.socialnetworking.model.output.ResponseBean<R>> returnType, String requestUrl, jakarta.ws.rs.core.Form form) Executes a post request
-
Field Details
-
CONNECT_TIMEOUT_PROPERTY
- See Also:
-
READ_TIMEOUT_PROPERTY
- See Also:
-
-
Constructor Details
-
HttpClient
public HttpClient()
-
-
Method Details
-
get
public static <R> R get(jakarta.ws.rs.core.GenericType<org.gcube.social_networking.socialnetworking.model.output.ResponseBean<R>> returnType, String requestUrl) Executes a get request- Type Parameters:
R- the generic type- Parameters:
returnType- the return typerequestUrl- the request url- Returns:
- the result
-
post
public static <R> R post(jakarta.ws.rs.core.GenericType<org.gcube.social_networking.socialnetworking.model.output.ResponseBean<R>> returnType, String requestUrl, Object obj) Executes a post request- Type Parameters:
R- the generic type- Parameters:
returnType- the return typerequestUrl- the request urlobj- the object to post- Returns:
- the result
-
postFormData
public static <R> R postFormData(jakarta.ws.rs.core.GenericType<org.gcube.social_networking.socialnetworking.model.output.ResponseBean<R>> returnType, String requestUrl, jakarta.ws.rs.core.Form form) Executes a post request- Type Parameters:
R- the generic type- Parameters:
returnType- the return typerequestUrl- the request urlform- the form to post- Returns:
- the result
-