@ManagedObject public class WebSocketSession extends ContainerLifeCycle implements javax.net.websocket.Session<Object>, WebSocketConnection, IncomingFrames
AbstractLifeCycle.AbstractLifeCycleListener
Container.InheritedListener, Container.Listener
LifeCycle.Listener
Constructor and Description |
---|
WebSocketSession(URI requestURI,
EventDriver websocket,
LogicalConnection connection) |
addBean, addBean, addBean, contains, destroy, doStart, doStop, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, setBeans, setStopTimeout, start, unmanage, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public WebSocketSession(URI requestURI, EventDriver websocket, LogicalConnection connection)
public void addMessageHandler(javax.net.websocket.MessageHandler listener)
addMessageHandler
in interface javax.net.websocket.Session<Object>
public void close() throws IOException
WebSocketConnection
Basic usage: results in an non-blocking async write, then connection close.
close
in interface javax.net.websocket.Session<Object>
close
in interface WebSocketConnection
IOException
StatusCode
,
WebSocketConnection.close(int, String)
public void close(javax.net.websocket.CloseReason closeStatus) throws IOException
close
in interface javax.net.websocket.Session<Object>
IOException
public void close(int statusCode, String reason)
WebSocketConnection
Advanced usage: results in an non-blocking async write, then connection close.
close
in interface WebSocketConnection
statusCode
- the status codereason
- the (optional) reason. (can be null for no reason)StatusCode
public void dump(Appendable out, String indent) throws IOException
dump
in interface Dumpable
dump
in class ContainerLifeCycle
IOException
public LogicalConnection getConnection()
public javax.net.websocket.ClientContainer getContainer()
getContainer
in interface javax.net.websocket.Session<Object>
public ExtensionFactory getExtensionFactory()
public long getInactiveTime()
getInactiveTime
in interface javax.net.websocket.Session<Object>
@ManagedAttribute(readonly=true) public IncomingFrames getIncomingHandler()
public InetSocketAddress getLocalAddress()
WebSocketConnection
getLocalAddress
in interface WebSocketConnection
public long getMaximumMessageSize()
getMaximumMessageSize
in interface javax.net.websocket.Session<Object>
public Set<javax.net.websocket.MessageHandler> getMessageHandlers()
getMessageHandlers
in interface javax.net.websocket.Session<Object>
public List<String> getNegotiatedExtensions()
getNegotiatedExtensions
in interface javax.net.websocket.Session<Object>
public String getNegotiatedSubprotocol()
getNegotiatedSubprotocol
in interface javax.net.websocket.Session<Object>
@ManagedAttribute(readonly=true) public OutgoingFrames getOutgoingHandler()
public Map<String,String[]> getParameterMap()
getParameterMap
in interface javax.net.websocket.Session<Object>
public WebSocketPolicy getPolicy()
WebSocketConnection
WebSocketPolicy
in use for this connection.getPolicy
in interface WebSocketConnection
public String getProtocolVersion()
getProtocolVersion
in interface javax.net.websocket.Session<Object>
public String getQueryString()
getQueryString
in interface javax.net.websocket.Session<Object>
public javax.net.websocket.RemoteEndpoint<Object> getRemote()
getRemote
in interface javax.net.websocket.Session<Object>
public javax.net.websocket.RemoteEndpoint<Object> getRemote(Class<Object> c)
getRemote
in interface javax.net.websocket.Session<Object>
public InetSocketAddress getRemoteAddress()
WebSocketConnection
getRemoteAddress
in interface WebSocketConnection
public URI getRequestURI()
WebSocketConnection
getRequestURI
in interface javax.net.websocket.Session<Object>
getRequestURI
in interface WebSocketConnection
public String getSubProtocol()
WebSocketConnection
getSubProtocol
in interface WebSocketConnection
public long getTimeout()
getTimeout
in interface javax.net.websocket.Session<Object>
public void incomingError(WebSocketException e)
incomingError
in interface IncomingFrames
public void incomingFrame(Frame frame)
incomingFrame
in interface IncomingFrames
public boolean isActive()
isActive
in interface javax.net.websocket.Session<Object>
public boolean isOpen()
WebSocketConnection
isOpen
in interface WebSocketConnection
public boolean isSecure()
isSecure
in interface javax.net.websocket.Session<Object>
public void open()
IOException
public void ping(ByteBuffer buf) throws IOException
WebSocketConnection
NIO style with callbacks, allows for knowledge of successful ping send.
Use @OnWebSocketFrame and monitor Pong frames
ping
in interface WebSocketConnection
IOException
public void removeMessageHandler(javax.net.websocket.MessageHandler listener)
removeMessageHandler
in interface javax.net.websocket.Session<Object>
public void setActive(boolean active)
public void setEncoders(List<javax.net.websocket.Encoder> encoders)
setEncoders
in interface javax.net.websocket.Session<Object>
public void setExtensionFactory(ExtensionFactory extensionFactory)
public void setMaximumMessageSize(long length)
setMaximumMessageSize
in interface javax.net.websocket.Session<Object>
public void setNegotiatedSubprotocol(String negotiatedSubprotocol)
public void setOutgoingHandler(OutgoingFrames outgoing)
public void setPolicy(WebSocketPolicy policy)
public void setTimeout(long seconds)
setTimeout
in interface javax.net.websocket.Session<Object>
public SuspendToken suspend()
WebSocketConnection
suspend
in interface WebSocketConnection
public Future<javax.net.websocket.SendResult> write(byte[] buf, int offset, int len) throws IOException
WebSocketConnection
NIO style with callbacks, allows for concurrent results of the write operation.
write
in interface WebSocketConnection
IOException
public Future<javax.net.websocket.SendResult> write(ByteBuffer buffer) throws IOException
WebSocketConnection
NIO style with callbacks, allows for concurrent results of the write operation.
write
in interface WebSocketConnection
IOException
public Future<javax.net.websocket.SendResult> write(String message) throws IOException
WebSocketConnection
NIO style with callbacks, allows for concurrent results of the entire write operation. (Callback is only called once at the end of processing all of the messages)
write
in interface WebSocketConnection
IOException
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.