com.caucho.jsmp
Class JsmpWebSocketWriter

java.lang.Object
  extended by com.caucho.bam.stream.AbstractMessageStream
      extended by com.caucho.bam.actor.AbstractActor
          extended by com.caucho.jsmp.JsmpWebSocketWriter
All Implemented Interfaces:
Actor, MessageStream

public class JsmpWebSocketWriter
extends AbstractActor

JsmpWriteStream writes JSMP packets to an OutputStream.


Constructor Summary
JsmpWebSocketWriter(WebSocketContext context)
           
JsmpWebSocketWriter(WriteStream out)
           
 
Method Summary
 void close()
           
 void flush()
           
 java.lang.String getAddress()
          The address of the stream
 boolean isClosed()
          Tests if the stream is closed.
 void message(java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Sends a message to a given address
 void messageError(java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
          Sends a message error to a given address
 void query(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Sends a queryGet to a given address
 void queryError(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
          Sends a query error to a given address
 void queryResult(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Sends a queryResult to a given address
 void setAddress(java.lang.String address)
          The address of the stream
 
Methods inherited from class com.caucho.bam.stream.AbstractMessageStream
getBroker, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.caucho.bam.stream.MessageStream
getBroker
 

Constructor Detail

JsmpWebSocketWriter

public JsmpWebSocketWriter(WriteStream out)
                    throws java.io.IOException
Throws:
java.io.IOException

JsmpWebSocketWriter

public JsmpWebSocketWriter(WebSocketContext context)
                    throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getAddress

public java.lang.String getAddress()
The address of the stream

Specified by:
getAddress in interface MessageStream
Overrides:
getAddress in class AbstractMessageStream

setAddress

public void setAddress(java.lang.String address)
The address of the stream


message

public void message(java.lang.String to,
                    java.lang.String from,
                    java.io.Serializable payload)
Sends a message to a given address

Specified by:
message in interface MessageStream
Overrides:
message in class AbstractMessageStream
Parameters:
to - the address of the target actor
from - the address of the source actor
payload - the message payload

messageError

public void messageError(java.lang.String to,
                         java.lang.String from,
                         java.io.Serializable payload,
                         BamError error)
Sends a message error to a given address

Specified by:
messageError in interface MessageStream
Overrides:
messageError in class AbstractMessageStream
Parameters:
to - the address of the target actor
from - the address of the source actor
payload - the message payload
error - the message error

query

public void query(long id,
                  java.lang.String to,
                  java.lang.String from,
                  java.io.Serializable payload)
Sends a queryGet to a given address

Specified by:
query in interface MessageStream
Overrides:
query in class AbstractMessageStream
Parameters:
id - the query id
to - the address of the target actor
from - the address of the source actor
payload - the message payload

queryResult

public void queryResult(long id,
                        java.lang.String to,
                        java.lang.String from,
                        java.io.Serializable payload)
Sends a queryResult to a given address

Specified by:
queryResult in interface MessageStream
Overrides:
queryResult in class AbstractMessageStream
Parameters:
id - the query id
to - the address of the target actor
from - the address of the source actor
payload - the message payload

queryError

public void queryError(long id,
                       java.lang.String to,
                       java.lang.String from,
                       java.io.Serializable payload,
                       BamError error)
Sends a query error to a given address

Specified by:
queryError in interface MessageStream
Overrides:
queryError in class AbstractMessageStream
Parameters:
id - the query identifier
to - the address of the target actor
from - the address of the source actor
payload - the message payload
error - the message error

isClosed

public boolean isClosed()
Description copied from class: AbstractMessageStream
Tests if the stream is closed.

Specified by:
isClosed in interface MessageStream
Overrides:
isClosed in class AbstractMessageStream

flush

public void flush()

close

public void close()