com.gwtext.client.core
Class Connection

java.lang.Object
  extended by com.gwtext.client.core.JsObject
      extended by com.gwtext.client.core.Connection
Direct Known Subclasses:
Ajax

public class Connection
extends JsObject

The class encapsulates a connection to the page's originating domain, allowing requests to be made either to a configured URL, or to a URL specified at request time. Requests made by this class are asynchronous, and will return immediately. No data from the server will be available to the statement immediately following the request call. To process returned data, use a callback in the request options object, or an event listener. Note: If you are doing a file upload, you will not get a normal response object sent back to your callback or event handler. Since the upload is handled via in IFRAME, there is no XMLHttpRequest. The response object is created using the innerHTML of the IFRAME's document as the responseText property and, if present, the IFRAME's XML document as the responseXML property. This means that a valid XML or HTML document must be returned. If JSON data is required, it is suggested that it be placed either inside a <textarea> in an HTML document and retrieved from the responseText using a regex, or inside a CDATA section in an XML document and retrieved from the responseXML using standard DOM methods.


Nested Class Summary
static class Connection.Method
          HTTP request method constants.
 
Field Summary
static Connection.Method GET
          Specifies that the HTTP GET method should be used.
static Connection.Method POST
          Specifies that the HTTP POST method should be used.
 
Fields inherited from class com.gwtext.client.core.JsObject
jsObj
 
Constructor Summary
protected Connection()
           
  Connection(ConnectionConfig config)
          Constructs a Connection using the configuration parameters passed.
  Connection(com.google.gwt.core.client.JavaScriptObject jsObj)
          Constructs a Connection using a native connection object.
 
Method Summary
 void abort()
          Aborts the last outstanding request.
 void abort(double transactionId)
          Aborts any outstanding request.
 void addListener(ConnectionListener listener)
          Adds a connection listener to this connection object.
 boolean isLoading()
          Determine whether this object has a request outstanding.
 boolean isLoading(double transactionId)
          Determine whether the specified transaction has a request outstanding.
 double request()
          Sends an HTTP request to a remote server.
 double request(RequestParam param)
          Sends an HTTP request to a remote server.
 
Methods inherited from class com.gwtext.client.core.JsObject
getJsObj, getProperties, isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GET

public static final Connection.Method GET
Specifies that the HTTP GET method should be used.


POST

public static final Connection.Method POST
Specifies that the HTTP POST method should be used.

Constructor Detail

Connection

protected Connection()

Connection

public Connection(com.google.gwt.core.client.JavaScriptObject jsObj)
Constructs a Connection using a native connection object.

Parameters:
jsObj - native connection object

Connection

public Connection(ConnectionConfig config)
Constructs a Connection using the configuration parameters passed.

Parameters:
config - the connection config
Method Detail

abort

public void abort()
Aborts the last outstanding request.


abort

public void abort(double transactionId)
Aborts any outstanding request.

Parameters:
transactionId - the transaction to abort

isLoading

public boolean isLoading()
Determine whether this object has a request outstanding.

Returns:
true if loading

isLoading

public boolean isLoading(double transactionId)
Determine whether the specified transaction has a request outstanding.

Parameters:
transactionId - the transaction id
Returns:
true if loading

request

public double request()
Sends an HTTP request to a remote server.

Returns:
the transaction id

request

public double request(RequestParam param)
Sends an HTTP request to a remote server.

Parameters:
param - the request params
Returns:
the transaction id

addListener

public void addListener(ConnectionListener listener)
Adds a connection listener to this connection object.

Parameters:
listener - the connection listener