Interface CodecContext
public interface CodecContext
Allows a
ChannelCodec to communicate with its container.-
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(String realm, String username, String password) Authenticates the supplied credentials in the given realm.computeUserAuthDigest(String realm, String username) Computes the string HEX(MD5(username + ':' + realm + ':' + password)).Creates and returns a newMessage.voidGenerates a fine log message using supplied arguments.intReturns the minimum size that a message must have before it is compressed.Returns the local address of the codec channel.getName()Returns the name of the codec channel.Returns the remote address of the codec channel.getServerParam(String name) Returns the string value of the parameter/configuration indexed by name.getSharedParam(String name) Returns the object value of the shared parameter indexed by name.getType()Returns the type of the codec channel.voidGenerates an information log message using supplied arguments.booleanisLoggable(Level level) Returnstrueif the given message level is being logged.booleanisUserDefined(String realm, String username) Returnstrueif a user is defined in specified realm.voidsetMissingDecoderBytes(int missingBytes) Defines the number of missing bytes of the next decoded message.setSharedParam(String name, Object value) Changes the object value of the shared parameter indexed by name.voidGenerates a severe log message using supplied arguments.voidGenerates a severe log message using supplied throwable and arguments.voidGenerates a warning log message using supplied arguments.
-
Method Details
-
createMessage
-
setMissingDecoderBytes
void setMissingDecoderBytes(int missingBytes) Defines the number of missing bytes of the next decoded message.- Parameters:
missingBytes- number of missing bytes of next decoded message.- Throws:
IllegalArgumentException- ifmissingBytesis negative.
-
isUserDefined
Returnstrueif a user is defined in specified realm.- Parameters:
realm- the name of the authentication realm.username- the name of the user being authenticated.- Returns:
trueif the user is defined in specified realm.- Throws:
NullPointerException- if an argument isnull.
-
authenticate
Authenticates the supplied credentials in the given realm.- Parameters:
realm- the name of the authentication realm.username- the name of the user being authenticated.password- the password of the specified user.- Returns:
trueif supplied credentials are valid.- Throws:
NullPointerException- if an argument isnull.
-
computeUserAuthDigest
Computes the string HEX(MD5(username + ':' + realm + ':' + password)).- Parameters:
realm- the name of the authentication realm.username- the name of the user being authenticated.- Returns:
- the string or
nullif the user is undefined. - Throws:
NullPointerException- if an argument isnull.IllegalStateException- if digest calculator is not available.
-
getServerParam
Returns the string value of the parameter/configuration indexed by name.- Parameters:
name- the name of the required parameter/configuration.- Returns:
- the value or
nullif parameter/configuration is undefined. - Throws:
NullPointerException- ifnameisnullor empty.
-
getName
-
getType
-
getLocalAddress
InetSocketAddress getLocalAddress()Returns the local address of the codec channel.- Returns:
- the local address of the codec channel.
-
getRemoteAddress
InetSocketAddress getRemoteAddress()Returns the remote address of the codec channel.- Returns:
- the remote address of the codec channel.
-
getCompressionThreshold
int getCompressionThreshold()Returns the minimum size that a message must have before it is compressed.- Returns:
- the minimum size that a message must have before it is compressed.
-
isLoggable
Returnstrueif the given message level is being logged.- Parameters:
level- a message logging level.- Returns:
trueif the given message level is being logged.- Throws:
NullPointerException- iflevelisnull.
-
fine
-
info
-
warning
-
severe
-
severe
-