C
- the type of data used to configure the load from the proxypublic class HttpProxy<C> extends Object implements DataProxy<C,String>
A DataProxy
that retrieves data using a RequestBuilder
instance.
When using a load config object that implements LoadConfig or ModelData, all properties and property values will be sent as request parameters in the load request.
RequestBuilder
,
ScriptTagProxy
Modifier and Type | Field and Description |
---|---|
protected RequestBuilder |
builder
The request builder used by this data proxy.
|
protected String |
initUrl
The URL of the HTTP service, initialized from
RequestBuilder#getUrl() and used by load(C, <any>) as the base part
of the URL when appending encoded parameters for an HTTP GET request. |
protected DataWriter<C,String> |
writer |
Constructor and Description |
---|
HttpProxy(RequestBuilder builder)
Creates a new HttpProxy.
|
Modifier and Type | Method and Description |
---|---|
protected String |
generateUrl(C loadConfig)
Encodes the load config into a format that can be used for a GET query
string or a POST url-encoded body.
|
DataWriter<C,String> |
getWriter()
Returns the data writer for this proxy.
|
void |
load(C loadConfig,
<any> callback)
Data should be retrieved using the specified load config.
|
protected void |
setUrl(RequestBuilder rb,
String url) |
void |
setWriter(DataWriter<C,String> writer)
Sets the data writer for this proxy.
|
protected boolean |
shouldUseBody()
Decides if the config data should be written to the body or to the querystring.
|
protected RequestBuilder builder
protected String initUrl
RequestBuilder#getUrl()
and used by load(C, <any>)
as the base part
of the URL when appending encoded parameters for an HTTP GET request.protected DataWriter<C,String> writer
public HttpProxy(RequestBuilder builder)
builder
- the request builder. The URL must be set to the URL of the
service. For requests that use the HTTP GET method, the URL should
be set to the base part of the URL. It will be updated
automatically to include the encoded request.public DataWriter<C,String> getWriter()
public void load(C loadConfig, <any> callback)
DataProxy
protected boolean shouldUseBody()
POST
or PUT
requests, and the querystring for
all other requests. Can be overridden to change this behavior.public void setWriter(DataWriter<C,String> writer)
writer
- the data writerprotected String generateUrl(C loadConfig)
setWriter(com.sencha.gxt.data.shared.writer.DataWriter<C, java.lang.String>)
to set the data
writer responsible for encoding the load config. If it is not set the load
config is assumed to require no further encoding and its value is retrieved
using its toString method.loadConfig
- the load config to encodeprotected void setUrl(RequestBuilder rb, String url)
Copyright © 2020. All rights reserved.