Class Binding

java.lang.Object
org.apache.mina.integration.spring.Binding
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

public class Binding extends Object implements org.springframework.beans.factory.InitializingBean
Defines an address to IoHandler binding. This is used when specifying the addresses to accept new connections on when creating IoAcceptor objects using IoAcceptorFactoryBean.

Note that the address property is of SocketAddress type. Use InetSocketAddressEditor or VmPipeAddressEditor in your Spring configuration file to simply the creation of SocketAddress instances using Spring.

This class also allows for an optional service configuration using setServiceConfig(IoServiceConfig) to be specified. If the binding specifies an IoServiceConfig IoAcceptorFactoryBean will use IoAcceptor.bind(SocketAddress, IoHandler, IoServiceConfig) instead of IoAcceptor.bind(SocketAddress, IoHandler) when binding. The IoServiceConfig object lets you specify transport specific confiuration options and define port specific filters. This makes it possible to specify different filters depending on the port the client is connecting on (e.g. using an

invalid reference
org.apache.mina.filter.SSLFilter
when connecting on port 443 but not on port 80).

  • Constructor Details

    • Binding

      public Binding()
      Creates a new empty instance.
    • Binding

      public Binding(SocketAddress address, org.apache.mina.common.IoHandler handler)
      Creates a new instance using the specified values.
      Parameters:
      address - the address.
      handler - the handler.
      Throws:
      IllegalArgumentException - if the any of the specified values are null.
    • Binding

      public Binding(SocketAddress address, org.apache.mina.common.IoHandler handler, org.apache.mina.common.IoServiceConfig serviceConfig)
      Creates a new instance using the specified values.
      Parameters:
      address - the address.
      handler - the handler.
      serviceConfig - the service configuration.
      Throws:
      IllegalArgumentException - if the any of the specified values are null.
  • Method Details

    • getAddress

      public SocketAddress getAddress()
      Returns the address the handler of this object will be bound to.
      Returns:
      the address.
    • setAddress

      public void setAddress(SocketAddress address)
      Sets the address the handler of this object will be bound to.
      Parameters:
      address - the address.
      Throws:
      IllegalArgumentException - if the specified value is null.
    • getHandler

      public org.apache.mina.common.IoHandler getHandler()
      Returns the handler of this binding object.
      Returns:
      the handler.
    • setHandler

      public void setHandler(org.apache.mina.common.IoHandler handler)
      Sets the handler of this binding object.
      Parameters:
      handler - the handler.
      Throws:
      IllegalArgumentException - if the specified value is null.
    • getServiceConfig

      public org.apache.mina.common.IoServiceConfig getServiceConfig()
    • setServiceConfig

      public void setServiceConfig(org.apache.mina.common.IoServiceConfig serviceConfig)
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception