public class ProtocolSessionImpl extends Object implements ProtocolSession
ProtocolSession
ProtocolSession.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()
ProtocolSession
InetSocketAddress
of the local bound addressgetLocalAddress
in interface ProtocolSession
public InetSocketAddress getRemoteAddress()
ProtocolSession
InetSocketAddress
of the remote peergetRemoteAddress
in interface ProtocolSession
public String getUser()
ProtocolSession
getUser
in interface ProtocolSession
ProtocolSession.getUser()
public void setUser(String user)
ProtocolSession
setUser
in interface ProtocolSession
user
- the user nameProtocolSession.setUser(java.lang.String)
public ProtocolTransport getProtocolTransport()
ProtocolTransport
which is used for this ProtocolSession
public boolean isStartTLSSupported()
ProtocolSession
isStartTLSSupported
in interface ProtocolSession
ProtocolSession.isStartTLSSupported()
public boolean isTLSStarted()
ProtocolSession
isTLSStarted
in interface ProtocolSession
ProtocolSession.isTLSStarted()
public Logger getLogger()
ProtocolSession
getLogger
in interface ProtocolSession
ProtocolSession.getLogger()
public String getSessionID()
ProtocolSession
getSessionID
in interface ProtocolSession
ProtocolSession.getSessionID()
public Map<String,Object> getConnectionState()
ProtocolSession
ProtocolSession
per connectiongetConnectionState
in interface ProtocolSession
ProtocolSession
state per connectionProtocolSession.getConnectionState()
public Map<String,Object> getState()
ProtocolSession
getState
in interface ProtocolSession
ProtocolSession.getState()
public Response newLineTooLongResponse()
null
. Sub-classes should
overwrite this if needednewLineTooLongResponse
in interface ProtocolSession
public Response newFatalErrorResponse()
null
. Sub-classes should
overwrite this if needednewFatalErrorResponse
in interface ProtocolSession
public void resetState()
resetState
in interface ProtocolSession
public ProtocolConfiguration getConfiguration()
ProtocolSession
ProtocolConfiguration
getConfiguration
in interface ProtocolSession
ProtocolSession.getConfiguration()
public Object setAttachment(String key, Object value, ProtocolSession.State state)
ProtocolSession
ProtocolSession.State
. If you want to remove a value you need to use null
as valuesetAttachment
in interface ProtocolSession
key
- 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)
ProtocolSession
ProtocolSession.State
or null
if non was stored before.getAttachment
in interface ProtocolSession
key
- 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 ProtocolSession
public String getLineDelimiter()
getLineDelimiter
in interface ProtocolSession
public void popLineHandler()
ProtocolSession
popLineHandler
in interface ProtocolSession
public int getPushedLineHandlerCount()
ProtocolSession
LineHandler
getPushedLineHandlerCount
in interface ProtocolSession
public <T extends ProtocolSession> void pushLineHandler(LineHandler<T> overrideCommandHandler)
ProtocolSession
pushLineHandler
in interface ProtocolSession
Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.