public class RestClient extends Object
Constructor and Description |
---|
RestClient() |
Modifier and Type | Method and Description |
---|---|
static <T,R> T |
create(Class<T> remoteService,
RemoteCallback<R> callback,
Integer... successCodes)
Creates a client/proxy for the provided JAX-RS resource interface.
|
static <T,R> T |
create(Class<T> remoteService,
RemoteCallback<R> callback,
RequestCallback requestCallback,
Integer... successCodes)
Creates a client/proxy for the provided JAX-RS resource interface.
|
static <T,R> T |
create(Class<T> remoteService,
RemoteCallback<R> callback,
RestErrorCallback errorCallback,
Integer... successCodes)
Creates a client/proxy for the provided JAX-RS resource interface.
|
static <T,R> T |
create(Class<T> remoteService,
RemoteCallback<R> callback,
RestErrorCallback errorCallback,
RequestCallback requestCallback,
Integer... successCodes)
Creates a client/proxy for the provided JAX-RS resource interface.
|
static <T,R> T |
create(Class<T> remoteService,
String baseUrl,
RemoteCallback<R> callback,
Integer... successCodes)
Creates a client/proxy for the provided JAX-RS resource interface.
|
static <T,R> T |
create(Class<T> remoteService,
String baseUrl,
RemoteCallback<R> callback,
RestErrorCallback errorCallback,
Integer... successCodes)
Creates a client/proxy for the provided JAX-RS resource interface.
|
static <T,R> T |
create(Class<T> remoteService,
String baseUrl,
RemoteCallback<R> callback,
RestErrorCallback errorCallback,
RequestCallback requestCallback,
Integer... successCodes)
Creates a client/proxy for the provided JAX-RS resource interface.
|
static String |
getApplicationRoot()
Returns the configured JAX-RS default application root path.
|
static boolean |
isJacksonMarshallingActive()
Checks if a jackson compatible JSON format should be used instead of Errai
JSON.
|
static void |
setApplicationRoot(String path)
Configures the JAX-RS default application root path.
|
static void |
setCookie(String cookieName,
String cookieValue)
Set a cookie for the domain and path returned by
getApplicationRoot() . |
static void |
setJacksonMarshallingActive(boolean active)
Activates/Deactivates jackson conform JSON marshalling.
|
public static <T,R> T create(Class<T> remoteService, RemoteCallback<R> callback, Integer... successCodes)
remoteService
- the JAX-RS resource interface. Must not be null.callback
- the asynchronous callback to use. Must not be null.successCodes
- optional HTTP status codes used to determine whether the request
was successful. If omitted, all 2xx status codes are interpreted
as success for this request.public static <T,R> T create(Class<T> remoteService, RemoteCallback<R> callback, RequestCallback requestCallback, Integer... successCodes)
remoteService
- the JAX-RS resource interface. Must not be null.callback
- the asynchronous callback to use. Must not be null.requestCallback
- the request callback that provides access to the
Request
.successCodes
- optional HTTP status codes used to determine whether the request
was successful. If omitted, all 2xx status codes are interpreted
as success for this request.public static <T,R> T create(Class<T> remoteService, String baseUrl, RemoteCallback<R> callback, Integer... successCodes)
remoteService
- the JAX-RS resource interface. Must not be null.baseUrl
- the base URL overriding the default application root pathcallback
- the asynchronous callback to use. Must not be null.successCodes
- optional HTTP status codes used to determine whether the request
was successful. If omitted, all 2xx status codes are interpreted
as success for this request.public static <T,R> T create(Class<T> remoteService, RemoteCallback<R> callback, RestErrorCallback errorCallback, Integer... successCodes)
remoteService
- the JAX-RS resource interface. Must not be null.callback
- the asynchronous callback to use. Must not be null.errorCallback
- the error callback to usesuccessCodes
- optional HTTP status codes used to determine whether the request
was successful. If omitted, all 2xx status codes are interpreted
as success for this request.public static <T,R> T create(Class<T> remoteService, RemoteCallback<R> callback, RestErrorCallback errorCallback, RequestCallback requestCallback, Integer... successCodes)
remoteService
- the JAX-RS resource interface. Must not be null.callback
- the asynchronous callback to use. Must not be null.errorCallback
- the error callback to userequestCallback
- the request callback that provides access to the
Request
.successCodes
- optional HTTP status codes used to determine whether the request
was successful. If omitted, all 2xx status codes are interpreted
as success for this request.public static <T,R> T create(Class<T> remoteService, String baseUrl, RemoteCallback<R> callback, RestErrorCallback errorCallback, Integer... successCodes)
remoteService
- the JAX-RS resource interface. Must not be null.baseUrl
- the base URL overriding the default application root pathcallback
- the asynchronous callback to use. Must not be null.errorCallback
- the error callback to usesuccessCodes
- optional HTTP status codes used to determine whether the request
was successful. If omitted, all 2xx status codes are interpreted
as success for this request.public static <T,R> T create(Class<T> remoteService, String baseUrl, RemoteCallback<R> callback, RestErrorCallback errorCallback, RequestCallback requestCallback, Integer... successCodes)
remoteService
- the JAX-RS resource interface. Must not be null.baseUrl
- the base URL overriding the default application root pathcallback
- the asynchronous callback to use. Must not be null.errorCallback
- the error callback to userequestCallback
- the request callback that provides access to the
Request
.successCodes
- optional HTTP status codes used to determine whether the request
was successful. If omitted, all 2xx status codes are interpreted
as success for this request.public static String getApplicationRoot()
public static void setApplicationRoot(String path)
path
- path to use when sending requests to the JAX-RS endpointpublic static boolean isJacksonMarshallingActive()
public static void setJacksonMarshallingActive(boolean active)
active
- true if jackson marshalling should be activated, otherwise false.public static void setCookie(String cookieName, String cookieValue)
getApplicationRoot()
.cookieName
- The name of the cookie to set.cookieValue
- The value of the cookie to set.Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.