public abstract class Service
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
CREATE
When the session is created, read the incoming cookie key and/or set
the key you wish to be stored, the domain and the expire date.
|
static int |
DISCONNECT
The client actively disconnected it's last TCP socket.
|
static int |
TIMEOUT
Normal timeout, the client simply was inactive for too long.
|
Constructor and Description |
---|
Service() |
Modifier and Type | Method and Description |
---|---|
void |
create(Daemon daemon)
Initiate service dependencies.
|
void |
destroy()
Free service dependencies.
|
abstract void |
filter(Event event)
The service method, equivalent of HttpServlet.service().
|
int |
index()
Where in the filter chain is this service? Default position is first
(index 0).
|
abstract java.lang.String |
path()
The identifier that should trigger this service.
|
void |
session(Session session,
int type)
If sessions are used and a session invokes a service, that service will
then be notified before the session is added, so that you may assign your
own session cookie id; or removed, so that you may act upon both session
timeout and physical TCP disconnects.
|
public static final int CREATE
public static final int TIMEOUT
public static final int DISCONNECT
public int index()
public abstract java.lang.String path()
event.daemon().chain(event, "/login").filter(event); throw event; // stop the chainor
event.reply().header("Location", "/login"); event.reply().code("302 Found"); throw event; // stop the chain
public void create(Daemon daemon) throws java.lang.Exception
daemon
- so you can setup yourself as a listener.java.lang.Exception
public void destroy() throws java.lang.Exception
java.lang.Exception
public void session(Session session, int type) throws java.lang.Exception
session
- type
- java.lang.Exception