|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.GenericService SK.gnome.dwarf.thread.ThreadService SK.gnome.dwarf.tcpip.Listener
Abstract service for receiving client requests.
This service just defines a set of common methods for a network listener. Subclasses must further add the required network listening functionality.
The setAddress(InetAddress)
and setPort(int)
methods can be used
to setup an internet address and port on which the listener will receive the client
requests. The setAllowedHosts(InetHostSet)
and setDeniedHosts(InetHostSet)
may be used to specify which clients will be accepted or rejected by the listener.
The protected method acceptHost(InetAddress)
tests the given address against
the internal sets of allowed and denied hosts, and returns true if a request
from the given address may be accepted by the listener and forwarded to the server for
further processing. This method may be overriden to implement a custom behaviour.
Field Summary | |
protected java.net.InetAddress |
address
The internet address to listen on. |
protected InetHostSet |
allowedHosts
The set of allowed host ranges. |
protected InetHostSet |
deniedHosts
The set of denied host ranges. |
protected int |
port
The network port to listen on. |
Fields inherited from class SK.gnome.dwarf.thread.ThreadService |
daemon, thread |
Fields inherited from class SK.gnome.dwarf.GenericService |
initParameters, parent |
Fields inherited from interface SK.gnome.dwarf.Service |
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED |
Constructor Summary | |
Listener(java.lang.String name)
Creates a new Listener. |
Method Summary | |
protected boolean |
acceptHost(java.net.InetAddress address)
Decides whether to accept a request from the given address. |
void |
setAddress(java.net.InetAddress address)
Sets the internet address to listen on. |
void |
setAllowedHosts(InetHostSet hosts)
Sets the allowed host ranges. |
void |
setDeniedHosts(InetHostSet hosts)
Sets the denied host ranges. |
void |
setPort(int port)
Sets the port to listen on. |
Methods inherited from class SK.gnome.dwarf.thread.ThreadService |
enableThread, finish, loop, run, setDaemon, shutdown, start, stop |
Methods inherited from class SK.gnome.dwarf.GenericService |
getAuthenticator, getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getLogger, getName, getParameters, getPrincipal, getShutdownTimeout, getState, init, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.net.InetAddress address
protected int port
protected InetHostSet allowedHosts
setAllowedHosts(InetHostSet)
protected InetHostSet deniedHosts
setDeniedHosts(InetHostSet)
Constructor Detail |
public Listener(java.lang.String name)
Method Detail |
public void setAddress(java.net.InetAddress address)
address
- the internet addressaddress
public void setPort(int port)
port
- the portport
public void setAllowedHosts(InetHostSet hosts)
hosts
- the host range listacceptHost(InetAddress)
,
InetHostSet
public void setDeniedHosts(InetHostSet hosts)
hosts
- the host range listacceptHost(InetAddress)
,
InetHostSet
protected boolean acceptHost(java.net.InetAddress address)
The decision is based on the sets of allowed/denied host ranges. The current
alghoritm works as follows: if the allowedHosts
is not null and does not
imply the given address, the method return false, otherwise the deniedHosts
is consulted. If it is not null and implies the given address, false is returned,
otherwise true is returned.
This method can be overriden to customize the listener's way of accepting client request.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |