com.webrenderer.se.event
Class ProtocolEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.webrenderer.se.event.ProtocolEvent
All Implemented Interfaces:
java.io.Serializable

public class ProtocolEvent
extends java.util.EventObject

An event which indicates that the browser needs to load data through a registered protocol. Currently, a ProtocolEvent will be invoked in an IMozillaBrowserCanvas .

This event object contains callback methods to pass data back to the underlying browser about a protocol load. For an example of using ProtocolEvent see Protocol Listener.

See Also:
ProtocolListener, IMozillaBrowserCanvas.registerProtocol(java.lang.String, com.webrenderer.se.event.ProtocolListener), Serialized Form

Field Summary
static int REQUEST_FAILED
          The load has finished but something has failed.
static int REQUEST_OK
          The load has finished and everything has been successful.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ProtocolEvent(java.lang.Object source, int listener, java.lang.String theURL, int chan, int ctxt)
          Constructor for ProtocolEvent with a source.
 
Method Summary
 java.lang.String getURL()
          Returns the URL.
 void onDataAvailable(byte[] data)
          Passes some data to the underlying browser.
 void onStartRequest(java.lang.String contentType)
          Tell the underlying browser that the load is about to begin.
 void onStopRequest(int result)
          Tell the underlying browser that all the data has been sent.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REQUEST_OK

public static int REQUEST_OK
The load has finished and everything has been successful.


REQUEST_FAILED

public static int REQUEST_FAILED
The load has finished but something has failed.

Constructor Detail

ProtocolEvent

public ProtocolEvent(java.lang.Object source,
                     int listener,
                     java.lang.String theURL,
                     int chan,
                     int ctxt)
Constructor for ProtocolEvent with a source.

Parameters:
source -
See Also:
EventObject.EventObject(Object)
Method Detail

onStartRequest

public void onStartRequest(java.lang.String contentType)
Tell the underlying browser that the load is about to begin.

Parameters:
contentType - the content type of the data that is about to be sent. e.g. "text/html", or "image/gif" etc.

onStopRequest

public void onStopRequest(int result)
Tell the underlying browser that all the data has been sent.

Parameters:
result - result of load. Can either be REQUEST_OK or REQUEST_FAILED
See Also:
REQUEST_OK, REQUEST_FAILED

onDataAvailable

public void onDataAvailable(byte[] data)
Passes some data to the underlying browser. This can be called multiple times as data becomes availbable. onDataAvailable should only be called after onStartRequest and before onStopRequest.

Parameters:
data - byte array contianing data.

getURL

public java.lang.String getURL()
Returns the URL.

Returns:
String