Class Binding
- java.lang.Object
-
- org.apache.mina.integration.spring.Binding
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
public class Binding extends java.lang.Object implements org.springframework.beans.factory.InitializingBean
Defines an address toIoHandler
binding. This is used when specifying the addresses to accept new connections on when creatingIoAcceptor
objects usingIoAcceptorFactoryBean
.Note that the
address
property is ofSocketAddress
type. UseInetSocketAddressEditor
orVmPipeAddressEditor
in your Spring configuration file to simply the creation ofSocketAddress
instances using Spring.This class also allows for an optional service configuration using
setServiceConfig(IoServiceConfig)
to be specified. If the binding specifies anIoServiceConfig
IoAcceptorFactoryBean
will useIoAcceptor.bind(SocketAddress, IoHandler, IoServiceConfig)
instead ofIoAcceptor.bind(SocketAddress, IoHandler)
when binding. TheIoServiceConfig
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 anorg.apache.mina.filter.SSLFilter
when connecting on port 443 but not on port 80).
-
-
Constructor Summary
Constructors Constructor Description Binding()
Creates a new empty instance.Binding(java.net.SocketAddress address, org.apache.mina.common.IoHandler handler)
Creates a new instance using the specified values.Binding(java.net.SocketAddress address, org.apache.mina.common.IoHandler handler, org.apache.mina.common.IoServiceConfig serviceConfig)
Creates a new instance using the specified values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
java.net.SocketAddress
getAddress()
Returns the address the handler of this object will be bound to.org.apache.mina.common.IoHandler
getHandler()
Returns the handler of this binding object.org.apache.mina.common.IoServiceConfig
getServiceConfig()
void
setAddress(java.net.SocketAddress address)
Sets the address the handler of this object will be bound to.void
setHandler(org.apache.mina.common.IoHandler handler)
Sets the handler of this binding object.void
setServiceConfig(org.apache.mina.common.IoServiceConfig serviceConfig)
-
-
-
Constructor Detail
-
Binding
public Binding()
Creates a new empty instance.
-
Binding
public Binding(java.net.SocketAddress address, org.apache.mina.common.IoHandler handler)
Creates a new instance using the specified values.- Parameters:
address
- the address.handler
- the handler.- Throws:
java.lang.IllegalArgumentException
- if the any of the specified values arenull
.
-
Binding
public Binding(java.net.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:
java.lang.IllegalArgumentException
- if the any of the specified values arenull
.
-
-
Method Detail
-
getAddress
public java.net.SocketAddress getAddress()
Returns the address the handler of this object will be bound to.- Returns:
- the address.
-
setAddress
public void setAddress(java.net.SocketAddress address)
Sets the address the handler of this object will be bound to.- Parameters:
address
- the address.- Throws:
java.lang.IllegalArgumentException
- if the specified value isnull
.
-
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:
java.lang.IllegalArgumentException
- if the specified value isnull
.
-
getServiceConfig
public org.apache.mina.common.IoServiceConfig getServiceConfig()
-
setServiceConfig
public void setServiceConfig(org.apache.mina.common.IoServiceConfig serviceConfig)
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception
-
-