KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > requesthandler > test > TestRequestHandler


1 package com.sslexplorer.requesthandler.test;
2
3 import java.io.IOException JavaDoc;
4
5 import org.apache.commons.logging.Log;
6 import org.apache.commons.logging.LogFactory;
7
8 import com.sslexplorer.boot.HttpConstants;
9 import com.sslexplorer.boot.RequestHandler;
10 import com.sslexplorer.boot.RequestHandlerException;
11 import com.sslexplorer.boot.RequestHandlerRequest;
12 import com.sslexplorer.boot.RequestHandlerResponse;
13
14 public class TestRequestHandler implements RequestHandler {
15
16     public static Log log = LogFactory.getLog(TestRequestHandler.class);
17     
18     public TestRequestHandler() {
19         super();
20     }
21
22     public boolean handle(String JavaDoc pathInContext, String JavaDoc pathParams, RequestHandlerRequest request, RequestHandlerResponse response)
23                     throws IOException JavaDoc, RequestHandlerException {
24         
25         
26             if(request.getMethod().equals("TEST")) {
27                 
28                 if(log.isDebugEnabled())
29                     log.debug("Starting TEST request");
30                 
31                 
32             request.setTunnel(new TestFullDuplexTunnel());
33             
34             // Set the response status
35
response.setStatus(HttpConstants.RESP_200_OK);
36
37             return true;
38         } else
39             return false;
40         
41     }
42
43 }
44
Popular Tags