Package org.gcube.common.gxrest.request
Class GXWebTargetAdapterRequest
- java.lang.Object
-
- org.gcube.common.gxrest.request.GXWebTargetAdapterRequest
-
- All Implemented Interfaces:
org.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>
public class GXWebTargetAdapterRequest extends Object implements org.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>
A GX request based on JAX-RS. It requires a runtime implementation of JAX-RS on the classpath (e.g. Jersey) to work.- Author:
- Manuele Simi (ISTI CNR)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GXWebTargetAdapterRequestconfigProperty(String name, String value)Sets a new property in the request.GXInboundResponseconnect()GXInboundResponsedelete()GXWebTargetAdapterRequestfrom(String agent)Sets the identity user agent associated to the request.GXInboundResponseget()GXInboundResponsehead()GXWebTargetAdapterRequestheader(String name, Object value)Add an arbitrary header.voidisExternalCall(boolean ext)static GXWebTargetAdapterRequestnewHTTPSRequest(String address)Creates a new request.static GXWebTargetAdapterRequestnewHTTPSRequest(String address, String tslprotocol)Creates a new secure request.static GXWebTargetAdapterRequestnewRequest(String address)Creates a new request.GXInboundResponseoptions()GXInboundResponsepatch()GXWebTargetAdapterRequestpath(String path)Adds a positional path parameter to the request.GXInboundResponsepost()GXInboundResponsepost(javax.ws.rs.client.Entity<?> body)GXInboundResponseput()GXInboundResponseput(javax.ws.rs.client.Entity<?> body)GXWebTargetAdapterRequestqueryParams(Map<String,Object[]> parameters)Sets the query parameters for the request.GXWebTargetAdapterRequestregister(Class<?> component)Registers a class of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this request.GXWebTargetAdapterRequestregister(Object component)Registers an instance of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this request.GXWebTargetAdapterRequestsetAcceptedResponseType(javax.ws.rs.core.MediaType... acceptedResponseTypes)Defines the accepted response media types.voidsetSecurityToken(String token)Overrides the default security token.GXInboundResponsetrace()
-
-
-
Method Detail
-
newRequest
public static GXWebTargetAdapterRequest newRequest(String address)
Creates a new request.- Parameters:
address- the address of the web app to call- Returns:
- the request
-
newHTTPSRequest
public static GXWebTargetAdapterRequest newHTTPSRequest(String address, String tslprotocol)
Creates a new secure request.- Parameters:
address- the address of the web app to calltslprotocol- the secure socket protocol to use in the call- Returns:
- the request
-
newHTTPSRequest
public static GXWebTargetAdapterRequest newHTTPSRequest(String address)
Creates a new request.- Parameters:
address- the address of the web app to call- Returns:
- the request
-
setSecurityToken
public void setSecurityToken(String token)
Overrides the default security token.- Specified by:
setSecurityTokenin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Parameters:
token- the new token
-
from
public GXWebTargetAdapterRequest from(String agent)
Sets the identity user agent associated to the request.- Parameters:
agent-- Returns:
- the request
-
configProperty
public GXWebTargetAdapterRequest configProperty(String name, String value)
Sets a new property in the request.- Parameters:
name- the name of the propertyvalue- the value of the property- Returns:
- the request
-
register
public GXWebTargetAdapterRequest register(Object component)
Registers an instance of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this request.- Parameters:
component- the component to register- Returns:
- the request
-
register
public GXWebTargetAdapterRequest register(Class<?> component)
Registers a class of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this request.- Parameters:
component- the class of the component to register- Returns:
- the request
-
path
public GXWebTargetAdapterRequest path(String path) throws UnsupportedEncodingException
Adds a positional path parameter to the request.- Parameters:
path- the new token in the path- Returns:
- the request
- Throws:
UnsupportedEncodingException
-
queryParams
public GXWebTargetAdapterRequest queryParams(Map<String,Object[]> parameters) throws UnsupportedEncodingException
Sets the query parameters for the request.- Parameters:
parameters- the parameters that go in the URL after the address and the path params.- Returns:
- the request
- Throws:
UnsupportedEncodingException
-
setAcceptedResponseType
public GXWebTargetAdapterRequest setAcceptedResponseType(javax.ws.rs.core.MediaType... acceptedResponseTypes)
Defines the accepted response media types.- Parameters:
acceptedResponseTypes- accepted response media types.- Returns:
- builder for a request targeted at the URI referenced by this target instance.
-
delete
public GXInboundResponse delete() throws Exception
- Specified by:
deletein interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
head
public GXInboundResponse head() throws Exception
- Specified by:
headin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
get
public GXInboundResponse get() throws Exception
- Specified by:
getin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
header
public GXWebTargetAdapterRequest header(String name, Object value)
Add an arbitrary header.- Returns:
- the builder
-
put
public GXInboundResponse put(javax.ws.rs.client.Entity<?> body) throws Exception
- Specified by:
putin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
put
public GXInboundResponse put() throws Exception
- Specified by:
putin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
post
public GXInboundResponse post(javax.ws.rs.client.Entity<?> body) throws Exception
- Specified by:
postin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
post
public GXInboundResponse post() throws Exception
- Specified by:
postin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
trace
public GXInboundResponse trace() throws Exception
- Specified by:
tracein interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
patch
public GXInboundResponse patch() throws Exception
- Specified by:
patchin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
options
public GXInboundResponse options() throws Exception
- Specified by:
optionsin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
connect
public GXInboundResponse connect() throws Exception
- Specified by:
connectin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>- Throws:
Exception
-
isExternalCall
public void isExternalCall(boolean ext)
- Specified by:
isExternalCallin interfaceorg.gcube.common.gxhttp.reference.GXHTTP<javax.ws.rs.client.Entity<?>,GXInboundResponse>
-
-