public class ProtocolSessionImpl extends Object implements ProtocolSession
ProtocolSessionProtocolSession.State| Modifier and Type | Field and Description |
|---|---|
protected ProtocolConfiguration |
config |
| Constructor and Description |
|---|
ProtocolSessionImpl(Logger logger,
ProtocolTransport transport,
ProtocolConfiguration config) |
| Modifier and Type | Method and Description |
|---|---|
Object |
getAttachment(String key,
ProtocolSession.State state)
Return the value which is stored for the given key in the specified
ProtocolSession.State or null if non was stored before. |
Charset |
getCharset()
Returns a Charset for US-ASCII
|
ProtocolConfiguration |
getConfiguration()
Return the
ProtocolConfiguration |
Map<String,Object> |
getConnectionState()
Returns Map that consists of the state of the
ProtocolSession per connection |
String |
getLineDelimiter()
Returns "\r\n";
|
InetSocketAddress |
getLocalAddress()
Return the
InetSocketAddress of the local bound address |
Logger |
getLogger()
Gets the context sensitive log for this session.
|
ProtocolTransport |
getProtocolTransport()
Return the wrapped
ProtocolTransport which is used for this ProtocolSession |
int |
getPushedLineHandlerCount()
Return the size of the pushed
LineHandler |
InetSocketAddress |
getRemoteAddress()
Return the
InetSocketAddress of the remote peer |
String |
getSessionID()
Return the ID for the session
|
Map<String,Object> |
getState()
Return Map which can be used to store objects within a session
|
String |
getUser()
Returns the user name associated with this interaction.
|
boolean |
isStartTLSSupported()
Return true if StartTLS is supported by the configuration
|
boolean |
isTLSStarted()
Return true if the starttls was started
|
Response |
newFatalErrorResponse()
This implementation just returns
null. |
Response |
newLineTooLongResponse()
This implementation just returns
null. |
void |
popLineHandler()
Pop the last command handler
|
<T extends ProtocolSession> |
pushLineHandler(LineHandler<T> overrideCommandHandler)
Put a new line handler in the chain
|
void |
resetState()
This implementation just clears the sessions state.
|
Object |
setAttachment(String key,
Object value,
ProtocolSession.State state)
Store the given value with the given key in the specified
ProtocolSession.State. |
void |
setUser(String user)
Sets the user name associated with this interaction.
|
protected final ProtocolConfiguration config
public ProtocolSessionImpl(Logger logger, ProtocolTransport transport, ProtocolConfiguration config)
public InetSocketAddress getLocalAddress()
ProtocolSessionInetSocketAddress of the local bound addressgetLocalAddress in interface ProtocolSessionpublic InetSocketAddress getRemoteAddress()
ProtocolSessionInetSocketAddress of the remote peergetRemoteAddress in interface ProtocolSessionpublic String getUser()
ProtocolSessiongetUser in interface ProtocolSessionProtocolSession.getUser()public void setUser(String user)
ProtocolSessionsetUser in interface ProtocolSessionuser - the user nameProtocolSession.setUser(java.lang.String)public ProtocolTransport getProtocolTransport()
ProtocolTransport which is used for this ProtocolSessionpublic boolean isStartTLSSupported()
ProtocolSessionisStartTLSSupported in interface ProtocolSessionProtocolSession.isStartTLSSupported()public boolean isTLSStarted()
ProtocolSessionisTLSStarted in interface ProtocolSessionProtocolSession.isTLSStarted()public Logger getLogger()
ProtocolSessiongetLogger in interface ProtocolSessionProtocolSession.getLogger()public String getSessionID()
ProtocolSessiongetSessionID in interface ProtocolSessionProtocolSession.getSessionID()public Map<String,Object> getConnectionState()
ProtocolSessionProtocolSession per connectiongetConnectionState in interface ProtocolSessionProtocolSession state per connectionProtocolSession.getConnectionState()public Map<String,Object> getState()
ProtocolSessiongetState in interface ProtocolSessionProtocolSession.getState()public Response newLineTooLongResponse()
null. Sub-classes should
overwrite this if needednewLineTooLongResponse in interface ProtocolSessionpublic Response newFatalErrorResponse()
null. Sub-classes should
overwrite this if needednewFatalErrorResponse in interface ProtocolSessionpublic void resetState()
resetState in interface ProtocolSessionpublic ProtocolConfiguration getConfiguration()
ProtocolSessionProtocolConfigurationgetConfiguration in interface ProtocolSessionProtocolSession.getConfiguration()public Object setAttachment(String key, Object value, ProtocolSession.State state)
ProtocolSessionProtocolSession.State. If you want to remove a value you need to use null as valuesetAttachment in interface ProtocolSessionkey - the key under which the value should get storedvalue - the value which will get stored under the given key or null if you want to remove any value which is stored under the keystate - the ProtocolSession.State to which the mapping belongsnull if non was stored before.public Object getAttachment(String key, ProtocolSession.State state)
ProtocolSessionProtocolSession.State or null if non was stored before.getAttachment in interface ProtocolSessionkey - the key under which the value should be searchedstate - the ProtocolSession.State in which the value was stored for the keypublic Charset getCharset()
getCharset in interface ProtocolSessionpublic String getLineDelimiter()
getLineDelimiter in interface ProtocolSessionpublic void popLineHandler()
ProtocolSessionpopLineHandler in interface ProtocolSessionpublic int getPushedLineHandlerCount()
ProtocolSessionLineHandlergetPushedLineHandlerCount in interface ProtocolSessionpublic <T extends ProtocolSession> void pushLineHandler(LineHandler<T> overrideCommandHandler)
ProtocolSessionpushLineHandler in interface ProtocolSessionCopyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.