com.sun.grizzly.container
Class AsyncConnectionImpl

java.lang.Object
  extended by com.sun.grizzly.container.AsyncConnectionImpl
All Implemented Interfaces:
AsyncConnection

public class AsyncConnectionImpl
extends Object
implements AsyncConnection

This class represent a possible asynchronous connection. An asynchronous connection can always be suspended or resumed, its associated request and response objects be used to construct a response, etc. This class hook the Grizzlet with the underlying CometHandler.

Author:
Jeanfrancois Arcand

Field Summary
 String message
           
 
Constructor Summary
AsyncConnectionImpl()
           
 
Method Summary
 String getPushEvent()
          Return the message that can be pushed back.
 GrizzletRequest getRequest()
          Return the GrizzletRequest associated with this AsynchConnection.
 GrizzletResponse getResponse()
          Return the GrizzletResponse associated with this AsynchConnection.
 boolean hasPushEvent()
          Is this AsyncConnection has push events ready to push back data to its associated client.
 boolean isGet()
          Is the current asynchronous connection defined as an HTTP Get.
 boolean isPost()
          Is the current asynchronous connection defined as an HTTP Get.
 boolean isResuming()
          Is this AsyncConnection being in the process of being resumed?
 boolean isSuspended()
          Return true is the current connection associated with this event has been suspended.
 void push(String message)
          Advises the Grizzlet Container to start intiating a push operation, using the argument message.
 void recycle()
           
 void resume()
          Resume a suspended connection.
 void setCometContext(CometContext cometContext)
           
 void setGrizzlet(Grizzlet grizzlet)
           
 void sethasPushEvent(boolean hasPushEvent)
           
 void setIsResuming(boolean isResuming)
           
protected  void setRequest(GrizzletRequest cometRequest)
           
protected  void setResponse(GrizzletResponse cometResponse)
           
 void suspend()
          Suspend the current connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

message

public String message
Constructor Detail

AsyncConnectionImpl

public AsyncConnectionImpl()
Method Detail

setCometContext

public void setCometContext(CometContext cometContext)

getRequest

public GrizzletRequest getRequest()
Description copied from interface: AsyncConnection
Return the GrizzletRequest associated with this AsynchConnection.

Specified by:
getRequest in interface AsyncConnection

setRequest

protected void setRequest(GrizzletRequest cometRequest)

getResponse

public GrizzletResponse getResponse()
Description copied from interface: AsyncConnection
Return the GrizzletResponse associated with this AsynchConnection.

Specified by:
getResponse in interface AsyncConnection

setResponse

protected void setResponse(GrizzletResponse cometResponse)

isSuspended

public boolean isSuspended()
Description copied from interface: AsyncConnection
Return true is the current connection associated with this event has been suspended.

Specified by:
isSuspended in interface AsyncConnection

suspend

public void suspend()
             throws AlreadyPausedException
Description copied from interface: AsyncConnection
Suspend the current connection. Suspended connection are parked and eventually used when the Grizzlet Container initiates pushes.

Specified by:
suspend in interface AsyncConnection
Throws:
AlreadyPausedException

resume

public void resume()
            throws NotYetPausedException
Description copied from interface: AsyncConnection
Resume a suspended connection. The response will be completed and the connection become synchronous (e.g. a normal http connection).

Specified by:
resume in interface AsyncConnection
Throws:
NotYetPausedException

isResuming

public boolean isResuming()
Description copied from interface: AsyncConnection
Is this AsyncConnection being in the process of being resumed?

Specified by:
isResuming in interface AsyncConnection

setIsResuming

public void setIsResuming(boolean isResuming)

push

public void push(String message)
          throws IOException
Description copied from interface: AsyncConnection
Advises the Grizzlet Container to start intiating a push operation, using the argument message. All asynchronous connection that has been suspended will have a chance to push the data back to their associated clients.

Specified by:
push in interface AsyncConnection
Parameters:
message - The data that will be pushed.
Throws:
IOException

sethasPushEvent

public void sethasPushEvent(boolean hasPushEvent)

hasPushEvent

public boolean hasPushEvent()
Description copied from interface: AsyncConnection
Is this AsyncConnection has push events ready to push back data to its associated client.

Specified by:
hasPushEvent in interface AsyncConnection

getPushEvent

public String getPushEvent()
Description copied from interface: AsyncConnection
Return the message that can be pushed back.

Specified by:
getPushEvent in interface AsyncConnection

isGet

public boolean isGet()
Description copied from interface: AsyncConnection
Is the current asynchronous connection defined as an HTTP Get.

Specified by:
isGet in interface AsyncConnection

isPost

public boolean isPost()
Description copied from interface: AsyncConnection
Is the current asynchronous connection defined as an HTTP Get.

Specified by:
isPost in interface AsyncConnection

setGrizzlet

public void setGrizzlet(Grizzlet grizzlet)

recycle

public void recycle()


Copyright © 2011 SUN Microsystems. All Rights Reserved.