KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > rmi > server > transport > http > HeaderHandler


1 package org.sapia.ubik.rmi.server.transport.http;
2
3 import simple.http.ProtocolHandler;
4 import simple.http.Request;
5 import simple.http.Response;
6
7
8 /**
9  * Adds mandatory HTTP headers to every response - before it is returned.
10  *
11  * @author Yanick Duchesne
12  * <dl>
13  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2004 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
14  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
15  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
16  * </dl>
17  */

18 class HeaderHandler implements ProtocolHandler {
19   private ProtocolHandler _handler;
20
21   HeaderHandler(ProtocolHandler toWrap) {
22     _handler = toWrap;
23   }
24
25   /**
26    * @see simple.http.ProtocolHandler#handle(simple.http.Request, simple.http.Response)
27    */

28   public void handle(Request req, Response res) {
29     res.set("Server", "DemoServer/1.0 (Simple)");
30     res.setDate("Date", System.currentTimeMillis());
31     res.setDate("Last-Modified", System.currentTimeMillis());
32     _handler.handle(req, res);
33   }
34 }
35
Popular Tags