com.webrenderer.event
Class ProtocolEvent

java.lang.Object
  extended byjava.util.EventObject
      extended bycom.webrenderer.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, IBrowserCanvas.registerProtocol(java.lang.String, com.webrenderer.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.
 
Constructor Summary
ProtocolEvent(java.lang.Object source, int listener, java.lang.String theURL, int chan, int ctxt)
          Constructor for ProtocolEvent with a source.
ProtocolEvent(java.lang.Object source, int listener, java.lang.String theURL, int chan, int ctxt, java.lang.String postData)
           
 
Method Summary
 java.lang.String getPOSTData()
          Returns any POST data sent with this request.
 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
equals, 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)

ProtocolEvent

public ProtocolEvent(java.lang.Object source,
                     int listener,
                     java.lang.String theURL,
                     int chan,
                     int ctxt,
                     java.lang.String postData)
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

getPOSTData

public java.lang.String getPOSTData()
Returns any POST data sent with this request.

Returns:
The POST data.