goog.net.ChannelRequest
Provided By |
---|
Creates a ChannelRequest object which encapsulates a request to the server. A new ChannelRequest is created for each request to the server.
new ChannelRequest( channel, channelDebug, opt_sessionId, opt_requestId, opt_retryId )
Parameters |
|
---|
Instance Methods
this.cancel() → void
void
Cancels the request no matter what the underlying transport is.
this.getLastError() → (goog.net.ChannelRequest.Error|null)
(goog.net.ChannelRequest.Error|null)
If the request was not successful, returns the reason.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getLastStatusCode() → number
number
Returns the status code of the last request.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getPostData() → (string|null)
(string|null)
Returns the data for a post, if this request is a post.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getRequestStartTime() → (number|null)
(number|null)
Returns the time that the request started, if it has started.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getSessionId() → (string|undefined)
(string|undefined)
Returns the session id for this channel.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getSuccess() → boolean
boolean
Indicates whether the request was successful. Only valid after the handler is called to indicate completion of the request.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.sendUsingImgTag( uri ) → void
void
Uses an IMG tag to send an HTTP get to the server. This is only currently used to terminate the connection, as an IMG tag is the most reliable way to send something to the server while the page is getting torn down.
Parameters |
|
---|
this.setExtraHeaders( extraHeaders ) → void
void
Sets extra HTTP headers to add to all the requests sent to the server.
Parameters |
|
---|
this.setReadyStateChangeThrottle( throttle ) → void
void
Sets the throttle for handling onreadystatechange events for the request.
Parameters |
|
---|
this.setTimeout( timeout ) → void
void
Sets the timeout for a request
Parameters |
|
---|
this.tridentGet( uri, usingSecondaryDomain ) → void
void
Uses the Trident htmlfile ActiveX control to send a GET request in IE. This is the innovation discovered that lets us get intermediate results in Internet Explorer. Thanks to http://go/kev
Parameters |
|
---|
this.xmlHttpGet( uri, decodeChunks, hostPrefix, opt_noClose ) → void
void
Uses XMLHTTP to send an HTTP GET to the server.
Parameters |
|
---|
this.xmlHttpPost( uri, postData, decodeChunks ) → void
void
Static Functions
ChannelRequest.createChannelRequest( channel, channelDebug, opt_sessionId, opt_requestId, opt_retryId ) → goog.net.ChannelRequest
goog.net.ChannelRequest
Instantiates a ChannelRequest with the given parameters. Overidden in tests.
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
ChannelRequest.errorStringFromCode( errorCode, statusCode ) → string
string
Returns a useful error string for debugging based on the specified error code.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
ChannelRequest.supportsXhrStreaming() → boolean
boolean
Returns whether XHR streaming is supported on this browser.
If XHR streaming is not supported, we will try to use an ActiveXObject to create a Forever IFrame.
Parameters | None. | ||
---|---|---|---|
Returns |
| ||
See Also | http://code.google.com/p/closure-library/issues/detail?id=346 |
Static Properties
ChannelRequest.POLLING_INTERVAL_MS → number
number
How often to poll (in MS) for changes to responseText in browsers that don't fire onreadystatechange during incremental loading of responseText.
ChannelRequest.TIMEOUT_MS → number
number
Default timeout in MS for a request. The server must return data within this time limit for the request to not timeout.