|
Spiffy UI Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.spiffyui.client.rest.RESTOptions
public final class RESTOptions
This Java Bean provides options for making REST calls.
All of the set
methods in this bean support chaining so
it is possible to call new RESTOptions().setURL("/api/foo").setCallback(this)
.
Constructor Summary | |
---|---|
RESTOptions()
|
Method Summary | |
---|---|
RESTCallback |
getCallback()
Get the callback for when this request is completed. |
JSONValue |
getData()
Get the JSON data sent to the server during the REST request. |
java.lang.String |
getDataString()
Get the JSON data sent to the server during the REST request as a string. |
java.lang.String |
getEtag()
Get the etag for this REST request. |
java.util.Map<java.lang.String,java.lang.String> |
getHeaders()
Set the HTTP headers map for this request. |
RESTility.HTTPMethod |
getMethod()
Get the method of this REST request. |
java.lang.String |
getURL()
Get the URL for this REST request. |
boolean |
isLoginRequest()
Set if this request is a login request or not. |
RESTOptions |
setCallback(RESTCallback callback)
Set the callback for this REST request. |
RESTOptions |
setData(JSONValue data)
Set the data for this REST request. |
RESTOptions |
setEtag(java.lang.String etag)
Set the etag for this REST request. |
RESTOptions |
setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Set the HTTP headers for this REST request. |
RESTOptions |
setIsLoginRequest(boolean isLoginRequest)
Set this REST request as a login request. |
RESTOptions |
setMethod(RESTility.HTTPMethod method)
Set the REST request method. |
RESTOptions |
setShouldReplay(boolean shouldReplay)
Set if this REST request should be replayed. |
RESTOptions |
setURL(java.lang.String url)
Set the URL for this REST request. |
boolean |
shouldReplay()
Set if this REST request should be replayed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RESTOptions()
Method Detail |
---|
public java.lang.String getURL()
public RESTOptions setURL(java.lang.String url)
url
- the full URL for the request including all parameters
public JSONValue getData()
Get the JSON data sent to the server during the REST request.
JSON data can only be passed for POST and PUT requests and will be ignored for all other request methods.
public java.lang.String getDataString()
Get the JSON data sent to the server during the REST request as a string.
public RESTOptions setData(JSONValue data)
Set the data for this REST request.
JSON data can only be passed for POST and PUT requests and will be ignored for all other request methods.
data
- the data to send to the server with this request
public RESTility.HTTPMethod getMethod()
public RESTOptions setMethod(RESTility.HTTPMethod method)
method
- the HTTP method for this REST request
public RESTCallback getCallback()
public RESTOptions setCallback(RESTCallback callback)
callback
- the REST request callback
public boolean isLoginRequest()
Set if this request is a login request or not.
When the server returns a 401 as the response to a REST request and the application is following the Spiffy UI authentication recommendations then RESTility will handle the authentication and part of that authentication includes making further REST requests for the login. Those requests are handled specially since they are part of the authentication exchange.
By default this value is false. This value should only be true if this request is part of the login for a custom authentication handler.
public RESTOptions setIsLoginRequest(boolean isLoginRequest)
isLoginRequest
- true if this is a login request and false otherwise
public boolean shouldReplay()
Set if this REST request should be replayed.
When the client makes a REST request which results in a 401 RESTility must perform authentication and get a token before it can continue with the request. After the authentication completes successfully RESTility replays the original request and any requests which have come in during the authentication process so they can complete for the calling code transparent of any authentication requirements.
This value controls if the request should replay in that case. The default is true.
public RESTOptions setShouldReplay(boolean shouldReplay)
Set if this REST request should be replayed.
When the client makes a REST request which results in a 401 RESTility must perform authentication and get a token before it can continue with the request. After the authentication completes successfully RESTility replays the original request and any requests which have come in during the authentication process so they can complete for the calling code transparent of any authentication requirements.
This value controls if the request should replay in that case. The default is true.
shouldReplay
- true if the request should replay and false otherwise
public java.lang.String getEtag()
public RESTOptions setEtag(java.lang.String etag)
Set the etag for this REST request.
Etags are a common mechanism for handling concurrency checking and RESTility handles them specially since they are part of the built in Spiffy UI optimistic concurrency mechanism.
The ETag set in this method will override the If-Match
set in the headers
map if it is present.
For more information see HTTP 1.1 header field definitions sections 14.19.
etag
- the etag for this request
ConcurrentRESTCallback
public java.util.Map<java.lang.String,java.lang.String> getHeaders()
Set the HTTP headers map for this request.
setEtag
,
getEtag
public RESTOptions setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Set the HTTP headers for this REST request.
This method gives a client the option to specify defined and custom HTTP headers for the request request. These headers will override all values except for the following headers:
Accept-Language
- always set to the preferred language from GWTAuthorization
- set with the authentication token from the
authentication providerTS-URL
- this custom token is set to the token server URL from
the authenciation provider.If-Match
- set with the value from the ETagContent-Type
- always sets the content type to use JSON since
RESTility requires JSON formatted data.
headers
- the HTTP headers for this REST request
|
Spiffy UI Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |