public enum DSProtocol extends java.lang.Enum<DSProtocol> implements ValueEnum
OperationBinding.dataProtocol
affects how the data in
the DSRequest (DSRequest.data
)
is sent to the DataSource.dataURL
. Listed below are the valid
values for
OperationBinding.dataProtocol
and their behavior.
Note that, when using the Smart GWT server, data is automatically translated from
JavaScript to Java according to the rules described here
;
dataProtocol does not apply and is ignored.
If you are integrating with a REST
server that requires the more
obscure RPCRequest.httpMethod
s of "PUT", "DELETE" or "HEAD",
you can specify these
httpMethod settings via OperationBinding.requestProperties
. dataProtocol settings
that mention "GET" or "POST" are compatible with these additional HTTP methods as well.
Typical operationBindings
for a REST server that uses
"PUT" and "DELETE" are as follows:
operationBindings:[ {operationType:"fetch", dataProtocol:"getParams"}, {operationType:"add", dataProtocol:"postParams"}, {operationType:"remove", dataProtocol:"getParams", requestProperties:{httpMethod:"DELETE"}}, {operationType:"update", dataProtocol:"postParams", requestProperties:{httpMethod:"PUT"}} ],
Enum Constant and Description |
---|
CLIENTCUSTOM
This setting entirely bypasses the Smart GWT comm system.
|
GETPARAMS
Data is added to the dataURL, with each property in the data becoming an HTTP parameter, eg
http://service.com/search?keyword=foo
|
POSTJSON
Data is serialized as a JSON string and POST'd to the dataURL.
|
POSTMESSAGE
dsRequest.data is assumed to be a String set up by
DataSource.transformRequest() and is POST'd as the HTTP request body. |
POSTPARAMS
Data is POST'd to the dataURL, with each property becoming an HTTP parameter, exactly as an HTML form would submit them
if it had one input field per property in the data.
|
POSTXML
Data is serialized as XML via
DataSource.xmlSerialize() and
POST'd as the HTTP request body with contentType "text/xml". |
SOAP
Data is serialized as XML via
DataSource.xmlSerialize() ,
wrapped in a SOAP envelope, and POST'd as the HTTP request body with contentType "text/xml". |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getValue() |
static DSProtocol |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static DSProtocol[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DSProtocol GETPARAMS
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "getParams".
public static final DSProtocol POSTPARAMS
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "postParams".
public static final DSProtocol POSTJSON
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "postJSON".
public static final DSProtocol POSTXML
DataSource.xmlSerialize()
and
POST'd as the HTTP request body with contentType "text/xml".
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "postXML".
public static final DSProtocol SOAP
DataSource.xmlSerialize()
,
wrapped in a SOAP envelope, and POST'd as the HTTP request body with contentType "text/xml". Generally only used in
connection with a WSDL web service
.
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "soap".
public static final DSProtocol POSTMESSAGE
DataSource.transformRequest()
and is POST'd as the HTTP request body.
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "postMessage".
public static final DSProtocol CLIENTCUSTOM
DataSource.transformRequest()
to perform their own custom logic, and then call DataSource.processResponse()
to handle the results of this action.
This dataProtocol
setting can be used to implement access to in-browser resources such as HTML5
"localStorage", native APIs available to applications packaged as
native applications
, or to implement the DataSource Facade pattern
.
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "clientCustom".
public static DSProtocol[] values()
for (DSProtocol c : DSProtocol.values()) System.out.println(c);
public static DSProtocol valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null