01: package com.icesoft.faces.webapp.http.core;
02:
03: import com.icesoft.faces.webapp.command.Command;
04: import com.icesoft.faces.webapp.command.SessionExpired;
05: import com.icesoft.faces.webapp.http.common.Request;
06: import com.icesoft.faces.webapp.http.common.Server;
07: import com.icesoft.faces.webapp.http.common.standard.FixedXMLContentHandler;
08:
09: import java.io.IOException;
10: import java.io.Writer;
11:
12: public class IDVerifier extends FixedXMLContentHandler implements
13: Server {
14: private final static Command SessionExpired = new SessionExpired();
15: private String sessionID;
16: private Server server;
17:
18: public IDVerifier(String sessionID, Server server) {
19: this .sessionID = sessionID;
20: this .server = server;
21: }
22:
23: public void service(Request request) throws Exception {
24: String id = request.getParameter("ice.session");
25: if (id != null && sessionID.equals(id)) {
26: server.service(request);
27: } else {
28: request.respondWith(this );
29: }
30: }
31:
32: public void shutdown() {
33: server.shutdown();
34: }
35:
36: public void writeTo(Writer writer) throws IOException {
37: SessionExpired.serializeTo(writer);
38: }
39: }
|