goog.net.ChannelRequest
Classgoog.net.ChannelRequest(channel, channelDebug, opt_sessionId, opt_requestId, opt_retryId)
Creates a ChannelRequest object which encapsulates a request to the server. A new ChannelRequest is created for each request to the server.
channel
{goog.net.BrowserChannel
|goog.net.BrowserTestChannel
}
channelDebug
{goog.net.ChannelDebug
}
opt_sessionId
{string
=}
opt_requestId
{string
|number
=}
opt_retryId
{number
=}
goog.net.ChannelRequest.Error
EnumEnum type for identifying a ChannelRequest error. … more
.POLLING_INTERVAL_MS
{number
}How often to poll (in MS) for changes to responseText in browsers that don't fire onreadystatechange during incremental loading of responseText.
.TIMEOUT_MS
{number
}Default timeout in MS for a request. The server must return data within this time limit for the request to not timeout.
.cancel()
Cancels the request no matter what the underlying transport is.
.errorStringFromCode(errorCode, statusCode)
Returns a useful error string for debugging based on the specified error code.
errorCode
{goog.net.ChannelRequest.Error
}
statusCode
{number
}
string
}
.getLastError()
If the request was not successful, returns the reason.
goog.net.ChannelRequest.Error
}
.getLastStatusCode()
Returns the status code of the last request.
number
}
.getPostData()
Returns the data for a post, if this request is a post.
string
}
.getRequestId()
Returns the request id for this request. Each request has a unique request id and the request IDs are a sequential increasing count.
string
|number
|undefined
}
.getRequestStartTime()
Returns the time that the request started, if it has started.
number
}
.getSessionId()
Returns the session id for this channel.
string
|undefined
}
.getSuccess()
Indicates whether the request was successful. Only valid after the handler is called to indicate completion of the request.
boolean
}
.sendUsingImgTag(uri)
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.
uri
{goog.Uri
}
.setExtraHeaders(extraHeaders)
Sets extra HTTP headers to add to all the requests sent to the server.
extraHeaders
{Object
}
.setTimeout(timeout)
Sets the timeout for a request
timeout
{number
}
.supportsXhrStreaming()
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.
boolean
}
.tridentGet(uri, usingSecondaryDomain)
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
uri
{goog.Uri
}
usingSecondaryDomain
{boolean
}
.xmlHttpGet(uri, decodeChunks, hostPrefix, opt_noClose)
Uses XMLHTTP to send an HTTP GET to the server.
uri
{goog.Uri
}
decodeChunks
{boolean
}
hostPrefix
{?string
}
opt_noClose
{boolean
=}
.xmlHttpPost(uri, postData, decodeChunks)
Uses XMLHTTP to send an HTTP POST to the server.
uri
{goog.Uri
}
postData
{string
}
decodeChunks
{boolean
}