Interface CodecContext


public interface CodecContext
Allows a ChannelCodec to communicate with its container.
  • Method Details

    • createMessage

      Message createMessage()
      Creates and returns a new Message.
      Returns:
      the new message.
    • 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 - if missingBytes is negative.
    • isUserDefined

      boolean isUserDefined(String realm, String username)
      Returns true if a user is defined in specified realm.
      Parameters:
      realm - the name of the authentication realm.
      username - the name of the user being authenticated.
      Returns:
      true if the user is defined in specified realm.
      Throws:
      NullPointerException - if an argument is null.
    • authenticate

      boolean authenticate(String realm, String username, String password)
      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:
      true if supplied credentials are valid.
      Throws:
      NullPointerException - if an argument is null.
    • computeUserAuthDigest

      String computeUserAuthDigest(String realm, String username)
      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 null if the user is undefined.
      Throws:
      NullPointerException - if an argument is null.
      IllegalStateException - if digest calculator is not available.
    • getServerParam

      String getServerParam(String name)
      Returns the string value of the parameter/configuration indexed by name.
      Parameters:
      name - the name of the required parameter/configuration.
      Returns:
      the value or null if parameter/configuration is undefined.
      Throws:
      NullPointerException - if name is null or empty.
    • getSharedParam

      Object getSharedParam(String name)
      Returns the object value of the shared parameter indexed by name.
      Parameters:
      name - the name of the required shared parameter.
      Returns:
      the object value or null if the parameter is undefined.
      Throws:
      NullPointerException - if name is null or empty.
    • setSharedParam

      Object setSharedParam(String name, Object value)
      Changes the object value of the shared parameter indexed by name. If the supplied value is null, the shared parameter is removed from the table of shared parameters.
      Parameters:
      name - the name of the required shared parameter.
      value - the object value of the shared parameter (can be null).
      Returns:
      the previous value indexed by name or null.
      Throws:
      NullPointerException - if name is null or empty.
    • getName

      String getName()
      Returns the name of the codec channel.
      Returns:
      the name of the codec channel.
    • getType

      String getType()
      Returns the type of the codec channel.
      Returns:
      the type of the codec channel.
    • 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

      boolean isLoggable(Level level)
      Returns true if the given message level is being logged.
      Parameters:
      level - a message logging level.
      Returns:
      true if the given message level is being logged.
      Throws:
      NullPointerException - if level is null.
    • fine

      void fine(String message, Object... args)
      Generates a fine log message using supplied arguments.
      Parameters:
      message - the message or format.
      args - array of format arguments.
    • info

      void info(String message, Object... args)
      Generates an information log message using supplied arguments.
      Parameters:
      message - the message or format.
      args - array of format arguments.
    • warning

      void warning(String message, Object... args)
      Generates a warning log message using supplied arguments.
      Parameters:
      message - the message or format.
      args - array of format arguments.
    • severe

      void severe(String message, Object... args)
      Generates a severe log message using supplied arguments.
      Parameters:
      message - the message or format.
      args - array of format arguments.
    • severe

      void severe(Throwable thrown, String message, Object... args)
      Generates a severe log message using supplied throwable and arguments.
      Parameters:
      thrown - the throwable to be logged.
      message - the message or format.
      args - array of format arguments.