KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > server > jetty > RequestAdapter


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.server.jetty;
21
22 import java.io.InputStream JavaDoc;
23 import java.util.Enumeration JavaDoc;
24 import java.util.Map JavaDoc;
25
26 import javax.servlet.http.Cookie JavaDoc;
27
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30 import org.mortbay.http.HttpRequest;
31
32 import com.sslexplorer.boot.RequestHandlerRequest;
33 import com.sslexplorer.boot.RequestHandlerTunnel;
34
35 public class RequestAdapter implements RequestHandlerRequest {
36
37     final static Log log = LogFactory.getLog(RequestAdapter.class);
38
39     private HttpRequest request;
40
41     public RequestAdapter(HttpRequest request) {
42         this.request = request;
43     }
44     
45     public HttpRequest getHttpRequest() {
46         return request;
47     }
48
49     public String JavaDoc getURIEncoded() {
50         return request.getURI().toString();
51     }
52
53     public boolean isSecure() {
54         return request.isConfidential();
55     }
56
57     public Cookie JavaDoc[] getCookies() {
58         return request.getCookies();
59     }
60
61     public String JavaDoc getRemoteAddr() {
62         return request.getRemoteAddr();
63     }
64
65     public String JavaDoc getRemoteHost() {
66         return request.getRemoteHost();
67     }
68
69     public String JavaDoc getField(String JavaDoc name) {
70         return request.getField(name);
71     }
72
73     public Enumeration JavaDoc getFieldValues(String JavaDoc name) {
74         return request.getFieldValues(name);
75     }
76
77     public String JavaDoc getMethod() {
78         return request.getMethod();
79     }
80
81     public Enumeration JavaDoc getFieldNames() {
82         return request.getFieldNames();
83     }
84
85     public String JavaDoc getPath() {
86         return request.getPath();
87     }
88
89     public Map JavaDoc getParameters() {
90         return request.getParameters();
91     }
92
93     public String JavaDoc getHost() {
94         return request.getHost();
95     }
96
97     public InputStream JavaDoc getInputStream() {
98         return request.getInputStream();
99     }
100
101     public int getPort() {
102         return request.getPort();
103     }
104
105     public void setTunnel(RequestHandlerTunnel tunnel) {
106         request.getHttpConnection().setHttpTunnel(new TunnelAdapter(tunnel));
107     }
108     
109     public void setTunnel(RequestHandlerTunnel tunnel, int timeoutMs) {
110         request.getHttpConnection().setHttpTunnel(new TunnelAdapter(tunnel, timeoutMs));
111     }
112     
113     public void setAttribute(String JavaDoc name, Object JavaDoc value) {
114         request.setAttribute(name, value);
115     }
116
117     public Object JavaDoc getAttribute(String JavaDoc name) {
118         return request.getAttribute(name);
119     }
120     
121     public void setCharacterEncoding(String JavaDoc charset) {
122         request.setCharacterEncoding(charset, false);
123     }
124
125
126     public int getContentLength() {
127         return request.getContentLength();
128     }
129
130     public String JavaDoc getContentType() {
131         return request.getContentType();
132     }
133
134 }
135
Popular Tags