|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

public interface ISessionManager
Session Manager. The API required to manage sessions. By implementing and assigning the SessionManager
the HttpSession can be managed by a custom implementation. It can also be used to
intercept the (default) SessionManager data flow. See example:
class MySessionManagerInterceptor implements ISessionManager {
private ISessionManager delegate = null;
void MySessionManagerInterceptor(ISessionManager delegate) {
this.delegate = delegate;
}
public boolean isEmtpy() {
return delegate.isEmtpy();
}
public Map getSessionMap() {
return delegate.getSessionMap();
}
public String newSession(String idPrefix) throws IOException {
String id = delegate.newSession(idPrefix);
System.out.println("session " + id + " created");
return id;
}
public void saveSession(String sessionId) throws IOException {
delegate.saveSession(sessionId);
}
public void registerSession(HttpSession session) throws IOException {
delegate.registerSession(session);
}
public HttpSession getSession(String sessionId) throws IOException {
return delegate.getSession(sessionId);
}
public void removeSession(String sessionId) throws IOException {
delegate.removeSession(sessionId);
}
public void close() throws IOException {
delegate.close();
}
}
...
HttpServer httpServer = new HttpServer(8030, myHandler);
httpServer.setSessionManager(new MySessionManagerInterceptor(httpServer.getSessionManager()));
httpServer.start();
| Method Summary | |
|---|---|
HttpSession |
getSession(String sessionId)
returns the session for a session id |
Map<String,HttpSession> |
getSessionMap()
return the session map |
boolean |
isEmtpy()
returns true, if no session exists |
String |
newSession(String idPrefix)
creates a new session |
void |
registerSession(HttpSession session)
registers a session |
void |
removeSession(String sessionId)
removes a session |
void |
saveSession(String sessionId)
save the session |
| Methods inherited from interface java.io.Closeable |
|---|
close |
| Method Detail |
|---|
boolean isEmtpy()
HttpSession getSession(String sessionId)
throws IOException
sessionId - the session id
null
IOException - if an exception occursMap<String,HttpSession> getSessionMap()
String newSession(String idPrefix)
throws IOException
idPrefix - the id prefix
IOException - if an exception occurs
void saveSession(String sessionId)
throws IOException
session - id the session id
IOException - if an exception occurs
void registerSession(HttpSession session)
throws IOException
session - the session
IOException - if an exception occurs
void removeSession(String sessionId)
throws IOException
session - the session id
IOException - if an exception occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||