public class DefaultRestRequestBuilderFactory extends Object implements RestRequestBuilderFactory
RestRequestBuilderFactory
.Modifier and Type | Method and Description |
---|---|
<A extends RestAction<?>> |
build(A action,
String securityToken)
Build a
RequestBuilder object for the given action. |
protected boolean |
canSerialize(String bodyType)
Verify if the provided
bodyType can be serialized. |
protected String |
encodePathParam(String value)
Encodes the given
RestParameter as a path parameter. |
protected String |
encodeQueryParam(String value)
Encodes the given
RestParameter as a query parameter. |
protected String |
serialize(Object object,
String bodyType)
Serialize the given object.
|
public <A extends RestAction<?>> RequestBuilder build(A action, String securityToken) throws ActionException
RestRequestBuilderFactory
RequestBuilder
object for the given action.build
in interface RestRequestBuilderFactory
A
- the action type.action
- the RestAction
for which to build the request.securityToken
- the security token to add to the RequestBuilder
. Usually the value bound to
@XsrfHeaderName
.RequestBuilder
object.ActionException
- if an exception occured while creating the RequestBuilder
.protected String encodePathParam(String value) throws ActionException
RestParameter
as a path parameter. The default implementation delegates to
UrlUtils.encodePathSegment(String)
.value
- the value to encode.ActionException
- if an exception occurred while encoding the path parameter.#encode(com.gwtplatform.dispatch.rest.shared.RestParameter)
protected String encodeQueryParam(String value) throws ActionException
RestParameter
as a query parameter. The default implementation delegates to
UrlUtils.encodeQueryString(String)
.value
- the value to encode.ActionException
- if an exception occurred while encoding the query parameter.#encode(com.gwtplatform.dispatch.rest.shared.RestParameter)
protected boolean canSerialize(String bodyType)
bodyType
can be serialized.bodyType
- the parameterized type to verify if it can be serialized.true
if bodyType
can be serialized, otherwise false
.protected String serialize(Object object, String bodyType)
canSerialize(String)
returns true
or a runtime
exception may be thrown.object
- the object to serialize.bodyType
- The parameterized type of the object to serialize.Copyright © 2010-2014 ArcBees. All Rights Reserved.