opt_xmlHttpFactory
: goog.net.XmlHttpFactory=
Factory to use when
creating XMLHttpRequest objects.
|
![]()
Abort the current XMLHttpRequest
Arguments:
|
code » | |||
![]()
Make sure the timeout timer isn't running.
|
code » | |||
![]()
Remove the listener to protect against leaks, and nullify the XMLHttpRequest
object.
Arguments:
|
code » | |||
![]()
Disposes of the specified goog.net.XhrIo created by
goog.net.XhrIo.send and removes it from
goog.net.XhrIo.pendingStaticSendInstances_ .
|
code » | |||
![]()
Creates a new XHR object.
Returns: !goog.net.XhrLike.OrNative
The newly created XHR object.
|
code » | |||
![]()
Dispatches COMPLETE and ERROR in case of an error. This ensures that we do
not dispatch multiple error events.
|
code » | |||
![]()
Nullifies all callbacks to reduce risks of leaks.
|
code » | |||
![]()
Something errorred, so inactivate, fire error callback and clean up
Arguments:
|
code » | |||
Adds the last method, status and URI to the message. This is used to add
this information to the logging calls.
|
code » | |||
Gets the text of all the headers in the response.
Will only return correct result when called from the context of a callback
and the request has completed.
Returns: string
The value of the response headers or empty string.
|
code » | |||
Get the last error message
Returns: string
Last error message.
|
code » | |||
![]()
Get the last error message
Returns: goog.net.ErrorCode
Last error code.
|
code » | |||
Get the last Uri that was requested
Returns: string
Last Uri.
|
code » | |||
![]()
Get the readystate from the Xhr object
Will only return correct result when called from the context of a callback
Returns: goog.net.XmlHttp.ReadyState
goog.net.XmlHttp.ReadyState.*.
|
code » | |||
![]()
Get the response as the type specificed by
#setResponseType . At time
of writing, this is only directly supported in very recent versions of WebKit
(10.0.612.1 dev and later). If the field is not supported directly, we will
try to emulate it.
Emulating the response means following the rules laid out at
http://www.w3.org/TR/XMLHttpRequest/#the-response-attribute
On browsers with no support for this (Chrome < 10, Firefox < 4, etc), only
response types of DEFAULT or TEXT may be used, and the response returned will
be the text response.
On browsers with Mozilla's draft support for array buffers (Firefox 4, 5),
only response types of DEFAULT, TEXT, and ARRAY_BUFFER may be used, and the
response returned will be either the text response or the Mozilla
implementation of the array buffer response.
On browsers will full support, any valid response type supported by the
browser may be used, and the response provided by the browser will be
returned.
Returns: *
The response.
|
code » | |||
Get the response body from the Xhr object. This property is only available
in IE since version 7 according to MSDN:
http://msdn.microsoft.com/en-us/library/ie/ms534368(v=vs.85).aspx
Will only return correct result when called from the context of a callback.
One option is to construct a VBArray from the returned object and convert
it to a JavaScript array using the toArray method:
(new window['VBArray'](xhrIo.getResponseBody())).toArray()
This will result in an array of numbers in the range of [0..255]
Another option is to use the VBScript CStr method to convert it into a
string as outlined in http://stackoverflow.com/questions/1919972
Returns: Object
Binary result from the server or null if not available.
|
code » | |||
Get the value of the response-header with the given name from the Xhr object
Will only return correct result when called from the context of a callback
and the request has completed
|
code » | |||
Returns all response headers as a key-value map.
Multiple values for the same header key can be combined into one,
separated by a comma and a space.
Note that the native getResponseHeader method for retrieving a single header
does a case insensitive match on the header name. This method does not
include any case normalization logic, it will just return a key-value
representation of the headers.
See: http://www.w3.org/TR/XMLHttpRequest/#the-getresponseheader()-method
|
code » | |||
Get the response and evaluates it as JSON from the Xhr object
Will only return correct result when called from the context of a callback
Arguments:
|
code » | |||
Get the response text from the Xhr object
Will only return correct result when called from the context of a callback.
Returns: string
Result from the server, or '' if no result available.
|
code » | |||
![]()
Gets the desired type for the response.
Returns: goog.net.XhrIo.ResponseType
The desired type for the response.
|
code » | |||
Get the response XML from the Xhr object
Will only return correct result when called from the context of a callback.
Returns: Document
The DOM Document representing the XML file, or null
if no result available.
|
code » | |||
Get the status from the Xhr object
Will only return correct result when called from the context of a callback
Returns: number
Http status.
|
code » | |||
Get the status text from the Xhr object
Will only return correct result when called from the context of a callback
Returns: string
Status text.
|
code » | |||
Returns the number of milliseconds after which an incomplete request will be
aborted, or 0 if no timeout is set.
Returns: number
Timeout interval in milliseconds.
|
code » | |||
Gets whether a "credentialed" request is to be sent.
Returns: boolean
The desired type for the response.
|
code » | |||
No description.
Returns: boolean
Whether there is an active request.
|
code » | |||
No description.
Returns: boolean
Whether the request has completed.
|
code » | |||
No description.
Returns: boolean
whether the effective scheme of the last URI that was
fetched was 'http' or 'https'.
|
code » | |||
No description.
Returns: boolean
Whether the request completed with a success.
|
code » | |||
![]()
Used to protect the onreadystatechange handler entry point. Necessary
as {#onReadyStateChange_} maybe called from within send or abort, this
method is only called when {#onReadyStateChange_} is called as an
entry point.
|
code » | |||
![]()
Helper for
#onReadyStateChange_ . This is used so that
entry point calls to #onReadyStateChange_ can be routed through
#onReadyStateChangeEntryPoint_ .
|
code » | |||
![]()
Internal handler for the XHR object's readystatechange event. This method
checks the status and the readystate and fires the correct callbacks.
If the request has ended, the handlers are cleaned up and the XHR object is
nullified.
|
code » | |||
![]()
Instance send that actually uses XMLHttpRequest to make a server call.
|
code » | |||
![]()
Sets the desired type for the response. At time of writing, this is only
supported in very recent versions of WebKit (10.0.612.1 dev and later).
If this is used, the response may only be accessed via
#getResponse .
Arguments:
|
code » | |||
![]()
Sets the number of milliseconds after which an incomplete request will be
aborted and a
goog.net.EventType.TIMEOUT event raised; 0 means no
timeout is set.
Arguments:
|
code » | |||
![]()
Sets whether a "credentialed" request that is aware of cookie and
authentication information should be made. This option is only supported by
browsers that support HTTP Access Control. As of this writing, this option
is not supported in IE.
Arguments:
|
code » | |||
![]()
The request didn't complete after
goog.net.XhrIo#timeoutInterval_
milliseconds; raises a goog.net.EventType.TIMEOUT event and aborts
the request.
|
code » |
![]()
Use
#listen instead, when possible. Otherwise, use
goog.events.listen if you are passing Object
(instead of Function) as handler.
Adds an event listener to the event target. The same handler can only be
added once per the type. Even if you add the same handler multiple times
using the same type then it will only be called once when the event is
dispatched.
Arguments:
|
code » | |||||
![]()
Asserts that the event target instance is initialized properly.
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
Removes listeners from this object. Classes that extend EventTarget may
need to override this method in order to remove references to DOM Elements
and additional listeners.
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
No description.
|
code » | |||||
Returns the parent of this event target to use for bubbling.
Returns: goog.events.EventTarget
The parent EventTarget or null if
there is no parent.
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
Use
#unlisten instead, when possible. Otherwise, use
goog.events.unlisten if you are passing Object
(instead of Function) as handler.
Removes an event listener from the event target. The handler must be the
same object as the one added. If the handler has not been added then
nothing is done.
Arguments:
|
code » | |||||
![]()
Sets the parent of this event target to use for capture/bubble
mechanism.
Arguments:
|
code » | |||||
![]()
Sets the target to be used for
event.target when firing
event. Mainly used for testing. For example, see
goog.testing.events.mixinListenable .
Arguments:
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
No description.
|
code » |
![]()
Invokes a callback function when this object is disposed. Callbacks are
invoked in the order in which they were added.
Arguments:
|
code » | |||
![]()
Disposes of the object. If the object hasn't already been disposed of, calls
#disposeInternal . Classes that extend goog.Disposable should
override #disposeInternal in order to delete references to COM
objects, DOM nodes, and other disposable objects. Reentrant.
Returns: void
Nothing.
|
code » | |||
![]()
Deletes or nulls out any references to COM objects, DOM nodes, or other
disposable objects. Classes that extend
goog.Disposable should
override this method.
Not reentrant. To avoid calling it twice, it must only be called from the
subclass' disposeInternal method. Everywhere else the public
dispose method must be used.
For example:
mypackage.MyClass = function() { mypackage.MyClass.base(this, 'constructor'); // Constructor logic specific to MyClass. ... }; goog.inherits(mypackage.MyClass, goog.Disposable); mypackage.MyClass.prototype.disposeInternal = function() { // Dispose logic specific to MyClass. ... // Call superclass's disposeInternal at the end of the subclass's, like // in C++, to avoid hard-to-catch issues. mypackage.MyClass.base(this, 'disposeInternal'); }; |
code » | |||
Use
#isDisposed instead.
No description.
Returns: boolean
Whether the object has been disposed of.
|
code » | |||
No description.
Returns: boolean
Whether the object has been disposed of.
|
code » | |||
![]()
Associates a disposable object with this object so that they will be disposed
together.
Arguments:
|
code » |
![]()
Whether XMLHttpRequest is active. A request is active from the time send()
is called until onReadyStateChange() is complete, or error() or abort()
is called.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
Used to ensure that we don't dispatch an multiple ERROR events. This can
happen in IE when it does a synchronous load and one error is handled in
the ready statte change and one is handled due to send() throwing an
exception.
|
Code » | |
Map of default headers to add to every request, use:
XhrIo.headers.set(name, value)
|
Code » | |
![]()
Used in determining if a call to
#onReadyStateChange_ is from
within a call to this.xhr_.abort.
|
Code » | |
![]()
Used in determining if a call to
#onReadyStateChange_ is from
within a call to this.xhr_.open.
|
Code » | |
![]()
Used to make sure we don't fire the complete event from inside a send call.
|
Code » | |
![]()
Last error code.
|
Code » | |
![]()
Last error message.
|
Code » | |
![]()
Method for the last request.
|
Code » | |
![]()
Last URL that was requested.
|
Code » | |
A reference to the XhrIo logger
|
Code » | |
![]()
The requested type for the response. The empty string means use the default
XHR behavior.
|
Code » | |
![]()
Timer to track request timeout.
|
Code » | |
![]()
Number of milliseconds after which an incomplete request will be aborted
and a
goog.net.EventType.TIMEOUT event raised; 0 means no timeout
is set.
|
Code » | |
![]()
True if we can use XMLHttpRequest's timeout directly.
|
Code » | |
![]()
Whether a "credentialed" request is to be sent (one that is aware of
cookies and authentication). This is applicable only for cross-domain
requests and more recent browsers that support this part of the HTTP Access
Control standard.
|
Code » | |
![]()
The options to use with the current XMLHttpRequest object.
|
Code » | |
The XMLHttpRequest object that is being used for the transfer.
|
Code » | |
Optional XmlHttpFactory
|
Code » |
The object to use for event.target. Useful when mixing in an
EventTarget to another object.
|
Code » | |
![]()
No description.
|
Code » | |
Maps of event type to an array of listeners.
|
Code » | |
Parent event target, used during event bubbling.
TODO(user): Change this to goog.events.Listenable. This
currently breaks people who expect getParentEventTarget to return
goog.events.EventTarget.
|
Code » |
![]()
Disposes all non-disposed instances of goog.net.XhrIo created by
goog.net.XhrIo.send .
goog.net.XhrIo.send cleans up the goog.net.XhrIo instance
it creates when the request completes or fails. However, if
the request never completes, then the goog.net.XhrIo is not disposed.
This can occur if the window is unloaded before the request completes.
We could have goog.net.XhrIo.send return the goog.net.XhrIo
it creates and make the client of goog.net.XhrIo.send be
responsible for disposing it in this case. However, this makes things
significantly more complicated for the client, and the whole point
of goog.net.XhrIo.send is that it's simple and easy to use.
Clients of goog.net.XhrIo.send should call
goog.net.XhrIo.cleanup when doing final
cleanup on window unload.
|
code » | ||||||||
No description.
|
code » | ||||||||
![]()
Installs exception protection for all entry point introduced by
goog.net.XhrIo instances which are not protected by
goog.debug.ErrorHandler#protectWindowSetTimeout ,
goog.debug.ErrorHandler#protectWindowSetInterval , or
goog.events.protectBrowserEventEntryPoint .
Arguments:
|
code » | ||||||||
![]()
Static send that creates a short lived instance of XhrIo to send the
request.
Arguments:
|
code » | ||||||||
Determines if the argument is an XMLHttpRequest that supports the level 2
timeout value and event.
Currently, FF 21.0 OS X has the fields but won't actually call the timeout
handler. Perhaps the confusion in the bug referenced below hasn't
entirely been resolved.
Arguments:
Returns: boolean
True if the request supports level 2 timeout.
|
code » |
![]()
The Content-Type HTTP header name
|
Code » | |
![]()
The Content-Type HTTP header value for a url-encoded form
|
Code » | |
![]()
The pattern matching the 'http' and 'https' URI schemes
|
Code » | |
![]()
The methods that typically come along with form data. We set different
headers depending on whether the HTTP action is one of these.
|
Code » | |
![]()
The XMLHttpRequest Level two ontimeout handler property name.
|
Code » | |
![]()
The XMLHttpRequest Level two timeout delay ms property name.
|
Code » | |
![]()
All non-disposed instances of goog.net.XhrIo created
by
goog.net.XhrIo.send are in this Array.
|
Code » | |
![]()
No description.
|
Code » |
![]()
Response types that may be requested for XMLHttpRequests.
Constants:
|
Code » |