window.runtime propertywindow.runtime.air.net.URLMonitor
InheritanceURLMonitor Inheritance ServiceMonitor Inheritance EventDispatcher Inheritance Object

Monitors availablity of a HTTP or HTTPS-based service.

To use this class in JavaScript code, load the ServiceMonitor.swf file, as in the following:

<script src="ServiceMonitor.swf" type="application/x-shockwave-flash">



Properties
 PropertyDefined By
  acceptableStatusCodes : Array
The numeric status codes representing a successful result.
URLMonitor
 Inheritedavailable : Boolean
Whether the service is currently considered "available." The initial value is false until either a status check sets the property to true or the the property is initialized to true explicitly. Typically, this property is set by the checkStatus() implementation in a subclass or specializer, but if the application has independent information about a service's availability (for example, a request just succeeded or failed), the property can be set explicitly.
ServiceMonitor
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedlastStatusUpdate : Date
[read-only] The time of the last status update.
ServiceMonitor
 InheritedpollInterval : Number
The interval, in milliseconds, for polling the server.
ServiceMonitor
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 Inheritedrunning : Boolean
[read-only] Whether the monitor has been started.
ServiceMonitor
  urlRequest : URLRequest
[read-only] The URLRequest object representing the probe request.
URLMonitor
Public Methods
 MethodDefined By
  
URLMonitor(urlRequest:URLRequest, acceptableStatusCodes:Array = null)
Creates a URLMonitor Object for a specified HTTP or HTTPS-based service.
URLMonitor
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
EventDispatcher
 Inherited
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
hasOwnProperty(name:String):Boolean
Indicates whether an object has a specified property defined.
Object
 Inherited
isPrototypeOf(theClass:Object):Boolean
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
makeJavascriptSubclass(constructorFunction:Object):void
[static] Adds public ServiceMonitor methods to a JavaScript constructor function's prototype.
ServiceMonitor
 Inherited
propertyIsEnumerable(name:String):Boolean
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
start():void
Start the service monitor.
ServiceMonitor
 Inherited
stop():void
Stop monitoring the service.
ServiceMonitor
  
toString():String
Returns the string representation of the specified object.
URLMonitor
 Inherited
valueOf():Object
Returns the primitive value of the specified object.
Object
 Inherited
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Protected Methods
 MethodDefined By
  
checkStatus():void
Calling the checkStatus() method of a URLMonitor object causes the application to try loading the URL in the background, to check for a returned HTTP status code.
URLMonitor
Events
 Event Summary Defined By
 Inherited Dispatched when Flash Player or an AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited Dispatched when Flash Player or an AIR application loses operating system focus and is becoming inactive.EventDispatcher
 Inherited Indicates that the service status has changed.ServiceMonitor
Property Detail
acceptableStatusCodesproperty
acceptableStatusCodes:Array  [read-write]

The numeric status codes representing a successful result.


urlRequestproperty 
urlRequest:URLRequest  [read-only]

The URLRequest object representing the probe request.


Constructor Detail
URLMonitor()Constructor
function URLMonitor(urlRequest:URLRequest, acceptableStatusCodes:Array = null)

Creates a URLMonitor Object for a specified HTTP or HTTPS-based service.

After creating a URLMonitor, the caller should call start to begin monitoring the status of the service.

As with the Timer object, the caller should maintain a reference to the URLMonitor object. Otherwise, the runtime deletes the object and monitoring ends.

A URLRequest parameter specifies the probe request for polling the server. Typically, the request method will be either "GET" or "HEAD".

Parameters
urlRequest:URLRequest — The URLRequest object representing a probe request for polling the server.
 
acceptableStatusCodes:Array (default = null) — An array of numeric status codes representing a successful result.

If you do not specify a value for acceptableStatusCodes, the following status codes are recognized as a successful response:

  • 200 (OK)
  • 202 (Accepted)
  • 204 (No content
  • 205 (Reset content)
  • 206 (Partial content, in response to request with a Range header)
Method Detail
checkStatus()method
function checkStatus():void

Calling the checkStatus() method of a URLMonitor object causes the application to try loading the URL in the background, to check for a returned HTTP status code.

toString()method 
function toString():String

Returns the string representation of the specified object.

Returns
String — A string representation of the object.




 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/labs/air/1/jslr/air/net/URLMonitor.html