com.smartgwt.client.rpc
Class RPCRequest

java.lang.Object
  extended by com.smartgwt.client.core.JsObject
      extended by com.smartgwt.client.core.DataClass
          extended by com.smartgwt.client.rpc.RPCRequest
Direct Known Subclasses:
DSRequest, WSRequest

public class RPCRequest
extends DataClass

Encapsulates a client/server RPC request. You'll need to provide an instance of this class (or a constructor for it) to the RPCManager.sendRequest method. If you use the RPCManager.send method, an instance of RPCRequest will be created for you.

See Also:
RPCManager.send(java.lang.String, com.smartgwt.client.rpc.RPCCallback, com.smartgwt.client.rpc.RPCRequest), RPCManager.sendRequest(com.smartgwt.client.rpc.RPCRequest)

Field Summary
 
Fields inherited from class com.smartgwt.client.core.JsObject
jsObj
 
Constructor Summary
RPCRequest()
           
RPCRequest(JavaScriptObject jsObj)
           
 
Method Summary
static void create()
          RPCRequest shouldn't be created directly.
 String getActionURL()
          Overrides RPCManager.actionURL for this request only.
 Boolean getAllowIE9Leak()
          Advanced flag to avoid a potential memory leak in Internet Explorer 9 for requests with JSON formatted responses.
 Boolean getBypassCache()
          For xmlHttp transport + httpMethod: "GET" only, set to true to force a conditional GET request even if the browser thinks it has a current cached response.
 String getCallbackParam()
          For use only with the scriptInclude transport, this attribute specifies the name of the URL parameter which is used to specify the callback function that the server is expected to call by writing out JavaScript code.
 Boolean getContainsCredentials()
          For use during Relogin, this property marks this request an attempt to login, therefore a response containing the loginRequiredMarker is a normal condition and should result in the status code STATUS_LOGIN_INCORRECT rather than a call to loginRequired().
 String getContentType()
          Valid with the xmlHttpRequest transport only and only when httpMethod is set to "POST".
 JavaScriptObject getData()
           
 String getDataAsString()
           
 Boolean getDownloadResult()
          If enabled, causes the RPCRequest to download the requested resource as a file, either showing the browser's Save dialog or displaying the file-content in a new browser window.
 Boolean getDownloadToNewWindow()
          When downloadResult is true, setting this attribute to true causes the content of the downloaded file to be displayed in a new browser window.
 Boolean getEvalResult()
          This works similarly to serverOutputAsString except the resulting String is automatically evaluated as JavaScript.
 Map getHttpHeaders()
          HTTP headers to send, as a mapping Header name -> Header value, eg { "Content-Type" : "text/xml" }
 String getHttpMethod()
          Selects the HTTP method that will be used for the request.
 Boolean getIgnoreTimeout()
          When set to true, no reply is expected from the server.
 Boolean getOmitNullMapValuesInResponse()
          If enabled, the server omits any key/value pairs in map that have null values from the response.
static RPCRequest getOrCreateRef(JavaScriptObject jsObj)
           
 String getPrompt()
          Overrides RPCManager.defaultPrompt for this request only.
 String getPromptCursor()
          Controls the cursor shown when promptStyle is set to "cursor" for this request only.
 PromptStyle getPromptStyle()
          Controls the prompt style for this request only.
 Boolean getSendNoQueue()
          When set to true, this request is sent to the server immediately, bypassing any current queue.
 Boolean getServerOutputAsString()
          Setting this flag makes the body of the HTTP response available as a String in the callback as data.
 Boolean getShowPrompt()
          Overrides RPCManager.showPrompt for this request only.
 Boolean getSuppressAutoDraw()
          If evalResult is set, setting this property to true causes autoDraw to be set to false for the duration of the result evaluation - which is generally what you want if you're returning new components from the server.
 int getTimeout()
          Overrides RPCManager.defaultTimeout for this request only.
 RPCTransport getTransport()
          Selects the transport used for this RPCRequest.
 Boolean getUseHttpProxy()
          Indicates whether this request should use the HttpProxyServlet in order to enable contacting hosts other than the origin server (available only in Pro Edition or better).
 Boolean getUseSimpleHttp()
          When set to true, assume the request is not going to the Smart GWT server, and hence send a simple HTTP request that does not use Smart GWT-specific request encoding.
 Boolean getWillHandleError()
          With willHandleError:false, rpcResponses that indicate an error go through centralized handling in the RPCManager and rpcRequest.callback is never invoked.
 void setActionURL(String actionURL)
          Overrides RPCManager.actionURL for this request only.
 void setAllowIE9Leak(Boolean allowIE9Leak)
          Advanced flag to avoid a potential memory leak in Internet Explorer 9 for requests with JSON formatted responses.
 void setBypassCache(Boolean bypassCache)
          For xmlHttp transport + httpMethod: "GET" only, set to true to force a conditional GET request even if the browser thinks it has a current cached response.
 void setCallbackParam(String callbackParam)
          For use only with the scriptInclude transport, this attribute specifies the name of the URL parameter which is used to specify the callback function that the server is expected to call by writing out JavaScript code.
 void setContainsCredentials(Boolean containsCredentials)
          For use during Relogin, this property marks this request an attempt to login, therefore a response containing the loginRequiredMarker is a normal condition and should result in the status code STATUS_LOGIN_INCORRECT rather than a call to loginRequired().
 void setContentType(String contentType)
          Valid with the xmlHttpRequest transport only and only when httpMethod is set to "POST".
 void setData(JavaScriptObject data)
          This attribute specifies the payload of the RPCRequest.
 void setData(Map data)
          This attribute specifies the payload of the RPCRequest.
 void setData(Record data)
          This attribute specifies the payload of the RPCRequest.
 void setData(String data)
          This attribute specifies the payload of the RPCRequest.
 void setDownloadResult(Boolean downloadResult)
          If enabled, causes the RPCRequest to download the requested resource as a file, either showing the browser's Save dialog or displaying the file-content in a new browser window.
 void setDownloadToNewWindow(Boolean downloadToNewWindow)
          When downloadResult is true, setting this attribute to true causes the content of the downloaded file to be displayed in a new browser window.
 void setEvalResult(Boolean evalResult)
          This works similarly to serverOutputAsString except the resulting String is automatically evaluated as JavaScript.
 void setEvalVars(Map evalVars)
          If you've set setEvalResult(Boolean) : true, then the property values of this object will be available in the evaluation scope of the result under the variable names specified by the property names.
 void setHttpHeaders(Map httpHeaders)
          HTTP headers to send, as a mapping Header name -> Header value, eg { "Content-Type" : "text/xml" }
 void setHttpMethod(String httpMethod)
          Selects the HTTP method that will be used for the request.
 void setIgnoreTimeout(Boolean ignoreTimeout)
          When set to true, no reply is expected from the server.
 void setJavaScriptObject(JavaScriptObject jsObj)
           
 void setOmitNullMapValuesInResponse(Boolean omitNullMapValuesInResponse)
          If enabled, the server omits any key/value pairs in map that have null values from the response.
 void setParams(Map params)
          Values to be sent as simple HTTP params, as a JavaScript Object where each property/value pair will become an HTTP parameter name and value.
 void setPrompt(String prompt)
          Overrides RPCManager.defaultPrompt for this request only.
 void setPromptCursor(String promptCursor)
          Controls the cursor shown when promptStyle is set to "cursor" for this request only.
 void setPromptStyle(PromptStyle promptStyle)
          Controls the prompt style for this request only.
 void setSendNoQueue(Boolean sendNoQueue)
          When set to true, this request is sent to the server immediately, bypassing any current queue.
 void setServerOutputAsString(Boolean serverOutputAsString)
          Setting this flag makes the body of the HTTP response available as a String in the callback as data.
 void setShowPrompt(Boolean showPrompt)
          Overrides RPCManager.showPrompt for this request only.
 void setSuppressAutoDraw(Boolean suppressAutoDraw)
          If evalResult is set, setting this property to true causes autoDraw to be set to false for the duration of the result evaluation - which is generally what you want if you're returning new components from the server.
 void setTimeout(int timeout)
          Overrides RPCManager.defaultTimeout for this request only.
 void setTransport(RPCTransport transport)
          Selects the transport used for this RPCRequest.
 void setUseHttpProxy(Boolean useHttpProxy)
          Indicates whether this request should use the HttpProxyServlet in order to enable contacting hosts other than the origin server (available only in Pro Edition or better).
 void setUseSimpleHttp(Boolean useSimpleHttp)
          When set to true, assume the request is not going to the Smart GWT server, and hence send a simple HTTP request that does not use Smart GWT-specific request encoding.
 void setWillHandleError(Boolean willHandleError)
          With willHandleError:false, rpcResponses that indicate an error go through centralized handling in the RPCManager and rpcRequest.callback is never invoked.
 
Methods inherited from class com.smartgwt.client.core.DataClass
doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute
 
Methods inherited from class com.smartgwt.client.core.JsObject
isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RPCRequest

public RPCRequest()

RPCRequest

public RPCRequest(JavaScriptObject jsObj)
Method Detail

getOrCreateRef

public static RPCRequest getOrCreateRef(JavaScriptObject jsObj)

setJavaScriptObject

public void setJavaScriptObject(JavaScriptObject jsObj)

setActionURL

public void setActionURL(String actionURL)
Overrides RPCManager.actionURL for this request only. If you're using queuing, note that queues as per-URL - in other words all RPCRequests in a queue must go to a single URL. If you attempt to send a request with an actionURL that is different from those already in the queue, it will be sent to the server separately, ahead of the queue, and a warning will be logged to the Developer Console.

Parameters:
actionURL - . See String. Default value is RPCManager.actionURL
See Also:
com.smartgwt.client.rpc.RPCManager#actionURL

getActionURL

public String getActionURL()
Overrides RPCManager.actionURL for this request only. If you're using queuing, note that queues as per-URL - in other words all RPCRequests in a queue must go to a single URL. If you attempt to send a request with an actionURL that is different from those already in the queue, it will be sent to the server separately, ahead of the queue, and a warning will be logged to the Developer Console.

Returns:
. See String
See Also:
com.smartgwt.client.rpc.RPCManager#actionURL

setAllowIE9Leak

public void setAllowIE9Leak(Boolean allowIE9Leak)
Advanced flag to avoid a potential memory leak in Internet Explorer 9 for requests with JSON formatted responses.

This attribute may be set to false to explicitly enable the workaround described here for this request, avoiding a potential memory leak in Internet Explorer 9.

This workaround has a limitation in that if parsing the JSON response generates certain object types including JavaScript Date or function objects, attempts to interact with these objects can subsequently lead to a JavaScript error with the message "Can't execute code from a freed script".

This workaround therefore may not be suitable for all transactions or dataSources within a given application.

This property may also be set globally within an application (via allowIE9Leak)_.

Note: This memory leak and workaround is discussed further in the online Smart GWT FAQ.

Note : This is an advanced setting

Parameters:
allowIE9Leak - allowIE9Leak Default value is null

getAllowIE9Leak

public Boolean getAllowIE9Leak()
Advanced flag to avoid a potential memory leak in Internet Explorer 9 for requests with JSON formatted responses.

This attribute may be set to false to explicitly enable the workaround described here for this request, avoiding a potential memory leak in Internet Explorer 9.

This workaround has a limitation in that if parsing the JSON response generates certain object types including JavaScript Date or function objects, attempts to interact with these objects can subsequently lead to a JavaScript error with the message "Can't execute code from a freed script".

This workaround therefore may not be suitable for all transactions or dataSources within a given application.

This property may also be set globally within an application (via allowIE9Leak)_.

Note: This memory leak and workaround is discussed further in the online Smart GWT FAQ.

Returns:
Boolean

setBypassCache

public void setBypassCache(Boolean bypassCache)
For xmlHttp transport + httpMethod: "GET" only, set to true to force a conditional GET request even if the browser thinks it has a current cached response.

Note : This is an advanced setting

Parameters:
bypassCache - bypassCache Default value is false

getBypassCache

public Boolean getBypassCache()
For xmlHttp transport + httpMethod: "GET" only, set to true to force a conditional GET request even if the browser thinks it has a current cached response.

Returns:
Boolean

setCallbackParam

public void setCallbackParam(String callbackParam)
For use only with the scriptInclude transport, this attribute specifies the name of the URL parameter which is used to specify the callback function that the server is expected to call by writing out JavaScript code. The actual function to call is automatically generated and differs for every request (to allow concurrency).

For example, with callbackParam set to it's default value of "callback", the server might be contacted with a URL like:

     loadData?callback=isc_scriptIncludeCallback_5
  
.. then the server's response should look like:
     isc_scriptIncludeCallback_5({ .. data .. });
  
The name "isc_scriptIncludeCallback_5" is automatically generated and will differ each time the server is contacted.

Smart GWT makes of this server-provided callback mechanism, then calls callback normally.

rpcRequest.callbackParam is ignored by all transport other than scriptInclude.

Parameters:
callbackParam - . See String. Default value is "callback"

getCallbackParam

public String getCallbackParam()
For use only with the scriptInclude transport, this attribute specifies the name of the URL parameter which is used to specify the callback function that the server is expected to call by writing out JavaScript code. The actual function to call is automatically generated and differs for every request (to allow concurrency).

For example, with callbackParam set to it's default value of "callback", the server might be contacted with a URL like:

     loadData?callback=isc_scriptIncludeCallback_5
  
.. then the server's response should look like:
     isc_scriptIncludeCallback_5({ .. data .. });
  
The name "isc_scriptIncludeCallback_5" is automatically generated and will differ each time the server is contacted.

Smart GWT makes of this server-provided callback mechanism, then calls callback normally.

rpcRequest.callbackParam is ignored by all transport other than scriptInclude.

Returns:
. See String

setContainsCredentials

public void setContainsCredentials(Boolean containsCredentials)
For use during Relogin, this property marks this request an attempt to login, therefore a response containing the loginRequiredMarker is a normal condition and should result in the status code STATUS_LOGIN_INCORRECT rather than a call to loginRequired().

It is not required to set containsCredentials, however, it does typically simplify relogin logic by separating the handling of RPCs that are login attempts from RPCs that are not.

Note : This is an advanced setting

Parameters:
containsCredentials - containsCredentials Default value is false
See Also:
Relogin overview and related methods

getContainsCredentials

public Boolean getContainsCredentials()
For use during Relogin, this property marks this request an attempt to login, therefore a response containing the loginRequiredMarker is a normal condition and should result in the status code STATUS_LOGIN_INCORRECT rather than a call to loginRequired().

It is not required to set containsCredentials, however, it does typically simplify relogin logic by separating the handling of RPCs that are login attempts from RPCs that are not.

Returns:
Boolean
See Also:
Relogin overview and related methods

setContentType

public void setContentType(String contentType)
Valid with the xmlHttpRequest transport only and only when httpMethod is set to "POST".

Parameters:
contentType - . See String. Default value is "application/x-www-form-urlencoded"

getContentType

public String getContentType()
Valid with the xmlHttpRequest transport only and only when httpMethod is set to "POST".

Returns:
. See String

setDownloadResult

public void setDownloadResult(Boolean downloadResult)
If enabled, causes the RPCRequest to download the requested resource as a file, either showing the browser's Save dialog or displaying the file-content in a new browser window.

Setting this attribute to true means that no callback will be fired and implies that the request will silently use transport: "hiddenFrame".

Note : This is an advanced setting

Parameters:
downloadResult - downloadResult Default value is false

getDownloadResult

public Boolean getDownloadResult()
If enabled, causes the RPCRequest to download the requested resource as a file, either showing the browser's Save dialog or displaying the file-content in a new browser window.

Setting this attribute to true means that no callback will be fired and implies that the request will silently use transport: "hiddenFrame".

Returns:
Boolean

setDownloadToNewWindow

public void setDownloadToNewWindow(Boolean downloadToNewWindow)
When downloadResult is true, setting this attribute to true causes the content of the downloaded file to be displayed in a new browser window.

Note : This is an advanced setting

Parameters:
downloadToNewWindow - downloadToNewWindow Default value is false

getDownloadToNewWindow

public Boolean getDownloadToNewWindow()
When downloadResult is true, setting this attribute to true causes the content of the downloaded file to be displayed in a new browser window.

Returns:
Boolean

setEvalResult

public void setEvalResult(Boolean evalResult)
This works similarly to serverOutputAsString except the resulting String is automatically evaluated as JavaScript. The result of the evaluation is then passed to any specified callback as data.

This feature can be used to dynamically load new application modules into a running application. An RPCRequest with evalResult enabled can be used to fetch a static .js file or JavaScript dynamically generated by the server. The returned JavaScript can contain anything that a JavaScript file loaded at init time can contain, including new views and new Smart GWT class definitions.

Example usage with RPCManager.sendRequest:

  isc.RPCManager.sendRequest({
      evalResult:true,
      actionURL:"js/loadLabel.js",
      evalVars:{var1:"A Value"}
  });
  
This call would execute the code from loadLabel.js, and make the variable var1 available to that code. Therefore if the .js file contained this code:
  isc.Label.create({
      contents:var1
  })
  
A label would be created with contents set to the value of var1 - the string "A Value".

This feature relies on the XMLHttpRequest object which can be disabled by end-users in some supported browsers. See PlatformDependencies for more information.

Note : This is an advanced setting

Parameters:
evalResult - evalResult Default value is false
See Also:
ViewLoader, setEvalVars(java.util.Map)

getEvalResult

public Boolean getEvalResult()
This works similarly to serverOutputAsString except the resulting String is automatically evaluated as JavaScript. The result of the evaluation is then passed to any specified callback as data.

This feature can be used to dynamically load new application modules into a running application. An RPCRequest with evalResult enabled can be used to fetch a static .js file or JavaScript dynamically generated by the server. The returned JavaScript can contain anything that a JavaScript file loaded at init time can contain, including new views and new Smart GWT class definitions.

Example usage with RPCManager.sendRequest:

  isc.RPCManager.sendRequest({
      evalResult:true,
      actionURL:"js/loadLabel.js",
      evalVars:{var1:"A Value"}
  });
  
This call would execute the code from loadLabel.js, and make the variable var1 available to that code. Therefore if the .js file contained this code:
  isc.Label.create({
      contents:var1
  })
  
A label would be created with contents set to the value of var1 - the string "A Value".

This feature relies on the XMLHttpRequest object which can be disabled by end-users in some supported browsers. See PlatformDependencies for more information.

Returns:
Boolean
See Also:
ViewLoader, com.smartgwt.client.rpc.RPCRequest#getEvalVars

setHttpMethod

public void setHttpMethod(String httpMethod)
Selects the HTTP method that will be used for the request. Typical values are "POST" and "GET".

The more obscure "PUT", "DELETE" and "HEAD" methods are also valid, however, none of these are supported by the Safari browser previous to version 3.0.

Parameters:
httpMethod - . See String. Default value is "POST"

getHttpMethod

public String getHttpMethod()
Selects the HTTP method that will be used for the request. Typical values are "POST" and "GET".

The more obscure "PUT", "DELETE" and "HEAD" methods are also valid, however, none of these are supported by the Safari browser previous to version 3.0.

Returns:
. See String

setIgnoreTimeout

public void setIgnoreTimeout(Boolean ignoreTimeout)
When set to true, no reply is expected from the server. However, if a reply is received, it will be processed.

Note: setting this to true, forces sendNoQueue to true for this request.

Note : This is an advanced setting

Parameters:
ignoreTimeout - ignoreTimeout Default value is false

getIgnoreTimeout

public Boolean getIgnoreTimeout()
When set to true, no reply is expected from the server. However, if a reply is received, it will be processed.

Note: setting this to true, forces sendNoQueue to true for this request.

Returns:
Boolean

setOmitNullMapValuesInResponse

public void setOmitNullMapValuesInResponse(Boolean omitNullMapValuesInResponse)
If enabled, the server omits any key/value pairs in map that have null values from the response. This can reduce the size of the response when many fields have null values.

To enable this globally for all responses you can set RPCManager.omitNullMapValuesInResponse in server.properties.

Note : This is an advanced setting

Parameters:
omitNullMapValuesInResponse - omitNullMapValuesInResponse Default value is false

getOmitNullMapValuesInResponse

public Boolean getOmitNullMapValuesInResponse()
If enabled, the server omits any key/value pairs in map that have null values from the response. This can reduce the size of the response when many fields have null values.

To enable this globally for all responses you can set RPCManager.omitNullMapValuesInResponse in server.properties.

Returns:
Boolean

setPrompt

public void setPrompt(String prompt)
Overrides RPCManager.defaultPrompt for this request only. If you're using queuing, note that the prompt string from the first request in the queue is the one that is shown to the user.

Parameters:
prompt - . See String. Default value is RPCManager.defaultPrompt
See Also:
com.smartgwt.client.rpc.RPCManager#defaultPrompt, com.smartgwt.client.rpc.RPCManager#showPrompt, com.smartgwt.client.rpc.RPCManager#promptStyle, com.smartgwt.client.rpc.RPCManager#promptCursor, setShowPrompt(java.lang.Boolean), setPromptStyle(com.smartgwt.client.types.PromptStyle), setPromptCursor(java.lang.String), RpcPrompt overview and related methods

getPrompt

public String getPrompt()
Overrides RPCManager.defaultPrompt for this request only. If you're using queuing, note that the prompt string from the first request in the queue is the one that is shown to the user.

Returns:
. See String
See Also:
com.smartgwt.client.rpc.RPCManager#defaultPrompt, com.smartgwt.client.rpc.RPCManager#showPrompt, com.smartgwt.client.rpc.RPCManager#promptStyle, com.smartgwt.client.rpc.RPCManager#promptCursor, getShowPrompt(), getPromptStyle(), getPromptCursor(), RpcPrompt overview and related methods

setPromptCursor

public void setPromptCursor(String promptCursor)
Controls the cursor shown when promptStyle is set to "cursor" for this request only. Defaults to promptCursor.

In Safari, IE 5.5 and Firefox 1.0 the default value is "wait", on all other platforms it is "progress". The reason for this split is that the above-mentioned browsers do not support CSS2.1 - which is required for the "progress" cursor type.

Parameters:
promptCursor - . See String. Default value is browser-dependent
See Also:
com.smartgwt.client.rpc.RPCManager#promptCursor, RpcPrompt overview and related methods

getPromptCursor

public String getPromptCursor()
Controls the cursor shown when promptStyle is set to "cursor" for this request only. Defaults to promptCursor.

In Safari, IE 5.5 and Firefox 1.0 the default value is "wait", on all other platforms it is "progress". The reason for this split is that the above-mentioned browsers do not support CSS2.1 - which is required for the "progress" cursor type.

Returns:
. See String
See Also:
com.smartgwt.client.rpc.RPCManager#promptCursor, RpcPrompt overview and related methods

setPromptStyle

public void setPromptStyle(PromptStyle promptStyle)
Controls the prompt style for this request only. Defaults to promptStyle.

Parameters:
promptStyle - promptStyle Default value is RPCManager.promptStyle
See Also:
com.smartgwt.client.rpc.RPCManager#promptStyle, RpcPrompt overview and related methods

getPromptStyle

public PromptStyle getPromptStyle()
Controls the prompt style for this request only. Defaults to promptStyle.

Returns:
PromptStyle
See Also:
com.smartgwt.client.rpc.RPCManager#promptStyle, RpcPrompt overview and related methods

setSendNoQueue

public void setSendNoQueue(Boolean sendNoQueue)
When set to true, this request is sent to the server immediately, bypassing any current queue.

Note : This is an advanced setting

Parameters:
sendNoQueue - sendNoQueue Default value is false

getSendNoQueue

public Boolean getSendNoQueue()
When set to true, this request is sent to the server immediately, bypassing any current queue.

Returns:
Boolean

setServerOutputAsString

public void setServerOutputAsString(Boolean serverOutputAsString)
Setting this flag makes the body of the HTTP response available as a String in the callback as data. This is typically only useful if you are sending a request that will not be received by the Smart GWT Java Server, however in that case, set useSimpleHttp:true instead, which implies serverOutputAsString:true.

serverOutputAsString:true allows you to, for example, load the contents of static files off your webserver into a string for processing on the client with no server support. The actionURL must be in the same domain as the current page for this to work.

This feature relies on the XMLHttpRequest object which can be disabled by end-users in some supported browsers. See PlatformDependencies for more information.

Generally this API is used for either non-Java backends or for advanced usage such as content that requires processing before it can be used in Smart GWT components (such as client-side web scraping). Note that Smart GWT provides higher-level APIs for loading common types of data, see eg HTMLFlow for HTML content, ViewLoader for loading Smart GWT components, XMLTools.loadXML for loading XML, evalResult for loading JSON, and DataSource for loading structured data in various formats.

Note : This is an advanced setting

Parameters:
serverOutputAsString - serverOutputAsString Default value is false

getServerOutputAsString

public Boolean getServerOutputAsString()
Setting this flag makes the body of the HTTP response available as a String in the callback as data. This is typically only useful if you are sending a request that will not be received by the Smart GWT Java Server, however in that case, set useSimpleHttp:true instead, which implies serverOutputAsString:true.

serverOutputAsString:true allows you to, for example, load the contents of static files off your webserver into a string for processing on the client with no server support. The actionURL must be in the same domain as the current page for this to work.

This feature relies on the XMLHttpRequest object which can be disabled by end-users in some supported browsers. See PlatformDependencies for more information.

Generally this API is used for either non-Java backends or for advanced usage such as content that requires processing before it can be used in Smart GWT components (such as client-side web scraping). Note that Smart GWT provides higher-level APIs for loading common types of data, see eg HTMLFlow for HTML content, ViewLoader for loading Smart GWT components, XMLTools.loadXML for loading XML, evalResult for loading JSON, and DataSource for loading structured data in various formats.

Returns:
Boolean

setShowPrompt

public void setShowPrompt(Boolean showPrompt)
Overrides RPCManager.showPrompt for this request only. If you're using queuing, note that if any of the requests in the queue specify showPrompt:true, then a prompt will be shown for the entire queue with the prompt text of the first request in the queue to specify a custom prompt if promptStyle is set to "dialog". If promptStyle is set to "cursor" for the request that specified showPrompt: true, then the entire queue uses the "cursor" style for the prompt.

Parameters:
showPrompt - showPrompt Default value is RPCManager.showPrompt
See Also:
com.smartgwt.client.rpc.RPCManager#showPrompt, RpcPrompt overview and related methods

getShowPrompt

public Boolean getShowPrompt()
Overrides RPCManager.showPrompt for this request only. If you're using queuing, note that if any of the requests in the queue specify showPrompt:true, then a prompt will be shown for the entire queue with the prompt text of the first request in the queue to specify a custom prompt if promptStyle is set to "dialog". If promptStyle is set to "cursor" for the request that specified showPrompt: true, then the entire queue uses the "cursor" style for the prompt.

Returns:
Boolean
See Also:
com.smartgwt.client.rpc.RPCManager#showPrompt, RpcPrompt overview and related methods

setSuppressAutoDraw

public void setSuppressAutoDraw(Boolean suppressAutoDraw)
If evalResult is set, setting this property to true causes autoDraw to be set to false for the duration of the result evaluation - which is generally what you want if you're returning new components from the server.

This also effects components loaded via the RPCManager.loadScreen API.

Note : This is an advanced setting

Parameters:
suppressAutoDraw - suppressAutoDraw Default value is true

getSuppressAutoDraw

public Boolean getSuppressAutoDraw()
If evalResult is set, setting this property to true causes autoDraw to be set to false for the duration of the result evaluation - which is generally what you want if you're returning new components from the server.

This also effects components loaded via the RPCManager.loadScreen API.

Returns:
Boolean

setTimeout

public void setTimeout(int timeout)
Overrides RPCManager.defaultTimeout for this request only. If you're using queuing, note that the timeout setting derived from the last request in the queue is used for the entire queue. If you want to override the timeout for the queue, make sure to set your override at least on the last request in the queue.

Note : This is an advanced setting

Parameters:
timeout - timeout Default value is RPCManager.defaultTimeout
See Also:
com.smartgwt.client.rpc.RPCManager#defaultTimeout

getTimeout

public int getTimeout()
Overrides RPCManager.defaultTimeout for this request only. If you're using queuing, note that the timeout setting derived from the last request in the queue is used for the entire queue. If you want to override the timeout for the queue, make sure to set your override at least on the last request in the queue.

Returns:
int
See Also:
com.smartgwt.client.rpc.RPCManager#defaultTimeout

setTransport

public void setTransport(RPCTransport transport)
Selects the transport used for this RPCRequest. If unset, the value of defaultTransport will be used.

If you're using queueing, note that all requests in the queue must use the same transport. If you attempt to send a request via a different transport than those that are currently on the queue, it will be sent to the server separately, ahead of the queue, and a warning will be logged to the Developer Console.

If you specify an unknown transport, an error will be logged to the DeveloperConsole and defaultTransport will be used instead.

If you specify the xmlHttpRequest transport and it is not available, a warning will be logged to the Developer Console and the RPCManager will attempt to use the hiddenFrame transport instead for this request. Note that some features like serverOutputAsString require the xmlHttpRequest transport and will not work if the xmlHttpRequest transport is unavailable (this can happen if the end user is using Internet Explorer and has disabled ActiveX). You can check whether or not the xmlHttpRequest transport is currently available by calling RPCManager.xmlHttpRequestAvailable.

Note : This is an advanced setting

Parameters:
transport - transport Default value is RPCManager.defaultTransport
See Also:
com.smartgwt.client.rpc.RPCManager#defaultTransport

getTransport

public RPCTransport getTransport()
Selects the transport used for this RPCRequest. If unset, the value of defaultTransport will be used.

If you're using queueing, note that all requests in the queue must use the same transport. If you attempt to send a request via a different transport than those that are currently on the queue, it will be sent to the server separately, ahead of the queue, and a warning will be logged to the Developer Console.

If you specify an unknown transport, an error will be logged to the DeveloperConsole and defaultTransport will be used instead.

If you specify the xmlHttpRequest transport and it is not available, a warning will be logged to the Developer Console and the RPCManager will attempt to use the hiddenFrame transport instead for this request. Note that some features like serverOutputAsString require the xmlHttpRequest transport and will not work if the xmlHttpRequest transport is unavailable (this can happen if the end user is using Internet Explorer and has disabled ActiveX). You can check whether or not the xmlHttpRequest transport is currently available by calling RPCManager.xmlHttpRequestAvailable.

Returns:
RPCTransport
See Also:
com.smartgwt.client.rpc.RPCManager#defaultTransport

setUseHttpProxy

public void setUseHttpProxy(Boolean useHttpProxy)
Indicates whether this request should use the HttpProxyServlet in order to enable contacting hosts other than the origin server (available only in Pro Edition or better).

When various UI components issues requests automatically, or when a call to RPCManager.sendProxied is made, the HttpProxy will automatically be used for a URL that starts with "http" and uses a hostname other than "localhost" or window.location.hostname, or if the port number differs.

rpcRequest.useHttpProxy should only be used to force requests to go through the HttpProxy when the above rules don't work, or to avoid using the HttpProxy when contacting hosts that allow cross-site calls via the Http Access Control standard.

You can also set useHttpProxy:false to avoid ever using the HttpProxyServlet.

Parameters:
useHttpProxy - useHttpProxy Default value is null

getUseHttpProxy

public Boolean getUseHttpProxy()
Indicates whether this request should use the HttpProxyServlet in order to enable contacting hosts other than the origin server (available only in Pro Edition or better).

When various UI components issues requests automatically, or when a call to RPCManager.sendProxied is made, the HttpProxy will automatically be used for a URL that starts with "http" and uses a hostname other than "localhost" or window.location.hostname, or if the port number differs.

rpcRequest.useHttpProxy should only be used to force requests to go through the HttpProxy when the above rules don't work, or to avoid using the HttpProxy when contacting hosts that allow cross-site calls via the Http Access Control standard.

You can also set useHttpProxy:false to avoid ever using the HttpProxyServlet.

Returns:
Boolean

setUseSimpleHttp

public void setUseSimpleHttp(Boolean useSimpleHttp)
When set to true, assume the request is not going to the Smart GWT server, and hence send a simple HTTP request that does not use Smart GWT-specific request encoding.

Values specified in params are sent to to the server as HTTP request parameters. If httpMethod is "GET", parameters appear in the request URL, otherwise if httpMethod is "POST", parameters are encoded in the request body (exactly like an HTML form does). These parameters are then accessible via typical server-side APIs for retrieving HTTP parameters, eg, servletRequest.getParameter(paramName) in Java Servlets.

Note that if httpMethod method is POST and data is supplied, data is assumed to be a string to post as the HTTP request body, and params are sent as URL parameters instead. This usage is for sending custom request bodies such as the XML payloads used for SOAP. In this case, contentType is typically also set to indicate the content type of the request body.

Setting useSimpleHttp to true also automatically sets serverOutputAsString to true as well.

Note : This is an advanced setting

Parameters:
useSimpleHttp - useSimpleHttp Default value is false

getUseSimpleHttp

public Boolean getUseSimpleHttp()
When set to true, assume the request is not going to the Smart GWT server, and hence send a simple HTTP request that does not use Smart GWT-specific request encoding.

Values specified in params are sent to to the server as HTTP request parameters. If httpMethod is "GET", parameters appear in the request URL, otherwise if httpMethod is "POST", parameters are encoded in the request body (exactly like an HTML form does). These parameters are then accessible via typical server-side APIs for retrieving HTTP parameters, eg, servletRequest.getParameter(paramName) in Java Servlets.

Note that if httpMethod method is POST and data is supplied, data is assumed to be a string to post as the HTTP request body, and params are sent as URL parameters instead. This usage is for sending custom request bodies such as the XML payloads used for SOAP. In this case, contentType is typically also set to indicate the content type of the request body.

Setting useSimpleHttp to true also automatically sets serverOutputAsString to true as well.

Returns:
Boolean

setWillHandleError

public void setWillHandleError(Boolean willHandleError)
With willHandleError:false, rpcResponses that indicate an error go through centralized handling in the RPCManager and rpcRequest.callback is never invoked.

Setting willHandleError:true means that your rpcRequest.callback will receive rpcResponses that have an error status and must handle them.

See also the error handling section in the RPCManager docs.

Parameters:
willHandleError - willHandleError Default value is false
See Also:
RPCManager, ErrorHandling overview and related methods

getWillHandleError

public Boolean getWillHandleError()
With willHandleError:false, rpcResponses that indicate an error go through centralized handling in the RPCManager and rpcRequest.callback is never invoked.

Setting willHandleError:true means that your rpcRequest.callback will receive rpcResponses that have an error status and must handle them.

See also the error handling section in the RPCManager docs.

Returns:
Boolean
See Also:
RPCManager, ErrorHandling overview and related methods

create

public static void create()
RPCRequest shouldn't be created directly. Instead, pass Properties to RPCManager.sendRequest and RPCManager.send.


setData

public void setData(JavaScriptObject data)
This attribute specifies the payload of the RPCRequest. When using the Smart GWT server, objects sent to the server as request.data will be available on the server-side RPCRequest object as Java Objects. This is achieved by serializing the client side data in a JSON type format and generating Java Objects on the server from this serialized data.

If the client side request.data is set to a Java object in your SmartGWT code it will be serialized as JSON as follows:
- Numeric client side values (int, Integer, etc) will be serialized as JavaScript numbers.
- String values will be serialized as JavaScript strings.
- Date values will be serialized as JavaScript dates.
- Maps or Record objects will be serialized as JavaScript Objects.
- Arrays or Lists will become JavaScript arrays
Serialization of Maps and Arrays is recursive - each entry in an Array, or attribute on a Map will also be serialized according to the above rules.
Note that you can also set request.data directly to a JavaScriptObject, and use the JSOHelper class or SomeObject.getJSObj() to perform your own data conversions on the client. The serialized JavaScript will then be converted back to Java on the server according to the following rules.

Here are the mapping of JavaScript types to their corresponding server object types:

JS Type Java Type
Object: {} Map
Array: [] List
String String
Number Long|Double
Boolean Boolean
Date java.util.Date
String ValueEnum


Note that the order of keys/values in the Maps created on the server is not guaranteed because JavaScript Object literals do not guarantee order.

Server->client conversion follows this table as well, with some extras. See the toJS() method on JSTranslater in the server documentation for a description of additional behaviors.

When not communicating with the Smart GWT server, rpcRequest.data becomes simple HTTP parameters or an HTTP request body - see useSimpleHttp for details.

Parameters:
data - data Default value is null
See Also:
RPCResponse.getDataAsMap(), RPCResponse.getDataAsObject(), RPCResponse.getDataAsString()

setData

public void setData(String data)
This attribute specifies the payload of the RPCRequest. When using the Smart GWT server, objects sent to the server as request.data will be available on the server-side RPCRequest object as Java Objects. This is achieved by serializing the client side data in a JSON type format and generating Java Objects on the server from this serialized data.

If the client side request.data is set to a Java object in your SmartGWT code it will be serialized as JSON as follows:
- Numeric client side values (int, Integer, etc) will be serialized as JavaScript numbers.
- String values will be serialized as JavaScript strings.
- Date values will be serialized as JavaScript dates.
- Maps or Record objects will be serialized as JavaScript Objects.
- Arrays or Lists will become JavaScript arrays
Serialization of Maps and Arrays is recursive - each entry in an Array, or attribute on a Map will also be serialized according to the above rules.
Note that you can also set request.data directly to a JavaScriptObject, and use the JSOHelper class or SomeObject.getJSObj() to perform your own data conversions on the client. The serialized JavaScript will then be converted back to Java on the server according to the following rules.

Here are the mapping of JavaScript types to their corresponding server object types:

JS Type Java Type
Object: {} Map
Array: [] List
String String
Number Long|Double
Boolean Boolean
Date java.util.Date
String ValueEnum


Note that the order of keys/values in the Maps created on the server is not guaranteed because JavaScript Object literals do not guarantee order.

Server->client conversion follows this table as well, with some extras. See the toJS() method on JSTranslater in the server documentation for a description of additional behaviors.

When not communicating with the Smart GWT server, rpcRequest.data becomes simple HTTP parameters or an HTTP request body - see useSimpleHttp for details.

Parameters:
data - data Default value is null
See Also:
RPCResponse.getDataAsMap(), RPCResponse.getDataAsObject(), RPCResponse.getDataAsString()

setData

public void setData(Record data)
This attribute specifies the payload of the RPCRequest. When using the Smart GWT server, objects sent to the server as request.data will be available on the server-side RPCRequest object as Java Objects. This is achieved by serializing the client side data in a JSON type format and generating Java Objects on the server from this serialized data.

If the client side request.data is set to a Java object in your SmartGWT code it will be serialized as JSON as follows:
- Numeric client side values (int, Integer, etc) will be serialized as JavaScript numbers.
- String values will be serialized as JavaScript strings.
- Date values will be serialized as JavaScript dates.
- Maps or Record objects will be serialized as JavaScript Objects.
- Arrays or Lists will become JavaScript arrays
Serialization of Maps and Arrays is recursive - each entry in an Array, or attribute on a Map will also be serialized according to the above rules.
Note that you can also set request.data directly to a JavaScriptObject, and use the JSOHelper class or SomeObject.getJSObj() to perform your own data conversions on the client. The serialized JavaScript will then be converted back to Java on the server according to the following rules.

Here are the mapping of JavaScript types to their corresponding server object types:

JS Type Java Type
Object: {} Map
Array: [] List
String String
Number Long|Double
Boolean Boolean
Date java.util.Date
String ValueEnum


Note that the order of keys/values in the Maps created on the server is not guaranteed because JavaScript Object literals do not guarantee order.

Server->client conversion follows this table as well, with some extras. See the toJS() method on JSTranslater in the server documentation for a description of additional behaviors.

When not communicating with the Smart GWT server, rpcRequest.data becomes simple HTTP parameters or an HTTP request body - see useSimpleHttp for details.

Parameters:
data - data Default value is null
See Also:
RPCResponse.getDataAsMap(), RPCResponse.getDataAsObject(), RPCResponse.getDataAsString()

setData

public void setData(Map data)
This attribute specifies the payload of the RPCRequest. When using the Smart GWT server, objects sent to the server as request.data will be available on the server-side RPCRequest object as Java Objects. This is achieved by serializing the client side data in a JSON type format and generating Java Objects on the server from this serialized data.

If the client side request.data is set to a Java object in your SmartGWT code it will be serialized as JSON as follows:
- Numeric client side values (int, Integer, etc) will be serialized as JavaScript numbers.
- String values will be serialized as JavaScript strings.
- Date values will be serialized as JavaScript dates.
- Maps or Record objects will be serialized as JavaScript Objects.
- Arrays or Lists will become JavaScript arrays
Serialization of Maps and Arrays is recursive - each entry in an Array, or attribute on a Map will also be serialized according to the above rules.
Note that you can also set request.data directly to a JavaScriptObject, and use the JSOHelper class or SomeObject.getJSObj() to perform your own data conversions on the client. The serialized JavaScript will then be converted back to Java on the server according to the following rules.

Here are the mapping of JavaScript types to their corresponding server object types:

JS Type Java Type
Object: {} Map
Array: [] List
String String
Number Long|Double
Boolean Boolean
Date java.util.Date
String ValueEnum


Note that the order of keys/values in the Maps created on the server is not guaranteed because JavaScript Object literals do not guarantee order.

Server->client conversion follows this table as well, with some extras. See the toJS() method on JSTranslater in the server documentation for a description of additional behaviors.

When not communicating with the Smart GWT server, rpcRequest.data becomes simple HTTP parameters or an HTTP request body - see useSimpleHttp for details.

Parameters:
data - data Default value is null
See Also:
RPCResponse.getDataAsMap(), RPCResponse.getDataAsObject(), RPCResponse.getDataAsString()

getData

public JavaScriptObject getData()

getDataAsString

public String getDataAsString()

setParams

public void setParams(Map params)
Values to be sent as simple HTTP params, as a JavaScript Object where each property/value pair will become an HTTP parameter name and value. These parameters are then accessible on the server, for example, using servletRequest.getParameter(paramName) in Java Servlets.

This API is primarily used in combination with useSimpleHttp.

When contacting the Smart GWT server, setting params is an opportunity to send additional data aside from the main data payload; this is useful for adding data to DataSource requests which will be kept separate from the automatically sent DataSource data.

Note that in contrast to data object, the data in rpcRequest.params is not serialized/deserialized by the Smart GWT server, and all values arrive on the server as String type (like HTTP parameters always do).

The params value can also be a componentID or component instance that provides a method getValues() that returns an Object literal. Smart GWT components DynamicForm, ValuesManager are two such classes. Lastly, you may specify the ID of a native form element (retreivable via getElementById()) and the params will be populated from there. If there is an error resolving your params directive, it will be logged to the Developer Console.

Note: The params are submitted once per http transaction. If you are using RPCManager.startQueue() to bundle multiple RPCRequests or DSRequests into a single HTTP turnaround, the params from the various RPCRequests will be merged, with the later-queued transactions winning on parameter name collisions. A warning will be logged in the Developer Console if multiple RPCRequests specified params.

Parameters:
params - params Default value is null

setHttpHeaders

public void setHttpHeaders(Map httpHeaders)
HTTP headers to send, as a mapping Header name -> Header value, eg { "Content-Type" : "text/xml" }

Valid with the xmlHttpRequest transport only.

Parameters:
httpHeaders - the http headers

getHttpHeaders

public Map getHttpHeaders()
HTTP headers to send, as a mapping Header name -> Header value, eg { "Content-Type" : "text/xml" }

Valid with the xmlHttpRequest transport only.

Returns:
the http headers

setEvalVars

public void setEvalVars(Map evalVars)
If you've set setEvalResult(Boolean) : true, then the property values of this object will be available in the evaluation scope of the result under the variable names specified by the property names.

So e.g. if evalVars is: {foo: "bar"} then a reference to the variable foo in the result will evaluate to "bar".

Parameters:
evalVars - the eval vars. Defaults to null