KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > httpconnector > RequestWrapper


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.httpconnector;
17
18 import org.mortbay.http.HttpRequest;
19
20 import javax.servlet.http.HttpServletRequest JavaDoc;
21 import javax.servlet.http.Cookie JavaDoc;
22 import javax.servlet.http.HttpSession JavaDoc;
23 import javax.servlet.RequestDispatcher JavaDoc;
24 import javax.servlet.ServletInputStream JavaDoc;
25 import java.io.BufferedReader JavaDoc;
26 import java.io.IOException JavaDoc;
27 import java.io.UnsupportedEncodingException JavaDoc;
28 import java.io.InputStream JavaDoc;
29 import java.util.Enumeration JavaDoc;
30 import java.util.Map JavaDoc;
31 import java.util.Locale JavaDoc;
32 import java.security.Principal JavaDoc;
33
34 /**
35  * A wrapper around a Jetty HttpRequest object to turn it into a
36  * HttpServletRequest. Only implements the methods strictly required
37  * for our purposes.
38  */

39 public class RequestWrapper implements HttpServletRequest JavaDoc {
40     private HttpRequest jettyRequest;
41
42     public RequestWrapper(HttpRequest jettyRequest) {
43         this.jettyRequest = jettyRequest;
44     }
45
46     public BufferedReader JavaDoc getReader() throws IOException JavaDoc {
47         throw new RuntimeException JavaDoc("Method not implemented");
48     }
49
50     public String JavaDoc[] getParameterValues(String JavaDoc string) {
51         throw new RuntimeException JavaDoc("Method not implemented");
52     }
53
54     public void setCharacterEncoding(String JavaDoc string) throws UnsupportedEncodingException JavaDoc {
55         throw new RuntimeException JavaDoc("Method not implemented");
56     }
57
58     public String JavaDoc getCharacterEncoding() {
59         throw new RuntimeException JavaDoc("Method not implemented");
60     }
61
62     public boolean isSecure() {
63         throw new RuntimeException JavaDoc("Method not implemented");
64     }
65
66     public void setAttribute(String JavaDoc string, Object JavaDoc object) {
67         throw new RuntimeException JavaDoc("Method not implemented");
68     }
69
70     public void removeAttribute(String JavaDoc string) {
71         throw new RuntimeException JavaDoc("Method not implemented");
72     }
73
74     public Enumeration JavaDoc getAttributeNames() {
75         throw new RuntimeException JavaDoc("Method not implemented");
76     }
77
78     public String JavaDoc getContentType() {
79         throw new RuntimeException JavaDoc("Method not implemented");
80     }
81
82     public String JavaDoc getParameter(String JavaDoc string) {
83         throw new RuntimeException JavaDoc("Method not implemented");
84     }
85
86     public RequestDispatcher JavaDoc getRequestDispatcher(String JavaDoc string) {
87         throw new RuntimeException JavaDoc("Method not implemented");
88     }
89
90     public String JavaDoc getRemoteAddr() {
91         throw new RuntimeException JavaDoc("Method not implemented");
92     }
93
94     public String JavaDoc getRemoteHost() {
95         throw new RuntimeException JavaDoc("Method not implemented");
96     }
97
98     public String JavaDoc getRealPath(String JavaDoc string) {
99         throw new RuntimeException JavaDoc("Method not implemented");
100     }
101
102     public int getContentLength() {
103         return jettyRequest.getContentLength();
104     }
105
106     public String JavaDoc getProtocol() {
107         throw new RuntimeException JavaDoc("Method not implemented");
108     }
109
110     public int getServerPort() {
111         throw new RuntimeException JavaDoc("Method not implemented");
112     }
113
114     public Object JavaDoc getAttribute(String JavaDoc string) {
115         throw new RuntimeException JavaDoc("Method not implemented");
116     }
117
118     public Map JavaDoc getParameterMap() {
119         throw new RuntimeException JavaDoc("Method not implemented");
120     }
121
122     public Enumeration JavaDoc getLocales() {
123         throw new RuntimeException JavaDoc("Method not implemented");
124     }
125
126     public String JavaDoc getServerName() {
127         throw new RuntimeException JavaDoc("Method not implemented");
128     }
129
130     public ServletInputStream JavaDoc getInputStream() throws IOException JavaDoc {
131         return new ServletInputStreamWrapper(jettyRequest.getInputStream());
132     }
133
134     public Locale JavaDoc getLocale() {
135         throw new RuntimeException JavaDoc("Method not implemented");
136     }
137
138     public Enumeration JavaDoc getParameterNames() {
139         throw new RuntimeException JavaDoc("Method not implemented");
140     }
141
142     public String JavaDoc getScheme() {
143         throw new RuntimeException JavaDoc("Method not implemented");
144     }
145
146     public long getDateHeader(String JavaDoc string) {
147         throw new RuntimeException JavaDoc("Method not implemented");
148     }
149
150     public String JavaDoc getRemoteUser() {
151         throw new RuntimeException JavaDoc("Method not implemented");
152     }
153
154     public String JavaDoc getQueryString() {
155         throw new RuntimeException JavaDoc("Method not implemented");
156     }
157
158     public boolean isUserInRole(String JavaDoc string) {
159         throw new RuntimeException JavaDoc("Method not implemented");
160     }
161
162     public String JavaDoc getRequestedSessionId() {
163         throw new RuntimeException JavaDoc("Method not implemented");
164     }
165
166     public boolean isRequestedSessionIdValid() {
167         throw new RuntimeException JavaDoc("Method not implemented");
168     }
169
170     public String JavaDoc getHeader(String JavaDoc name) {
171         return jettyRequest.getField(name);
172     }
173
174     public Cookie JavaDoc[] getCookies() {
175         throw new RuntimeException JavaDoc("Method not implemented");
176     }
177
178     public boolean isRequestedSessionIdFromURL() {
179         throw new RuntimeException JavaDoc("Method not implemented");
180     }
181
182     public boolean isRequestedSessionIdFromCookie() {
183         throw new RuntimeException JavaDoc("Method not implemented");
184     }
185
186     public String JavaDoc getServletPath() {
187         throw new RuntimeException JavaDoc("Method not implemented");
188     }
189
190     public String JavaDoc getMethod() {
191         throw new RuntimeException JavaDoc("Method not implemented");
192     }
193
194     public Enumeration JavaDoc getHeaders(String JavaDoc string) {
195         throw new RuntimeException JavaDoc("Method not implemented");
196     }
197
198     public String JavaDoc getPathInfo() {
199         throw new RuntimeException JavaDoc("Method not implemented");
200     }
201
202     public Enumeration JavaDoc getHeaderNames() {
203         throw new RuntimeException JavaDoc("Method not implemented");
204     }
205
206     public String JavaDoc getContextPath() {
207         throw new RuntimeException JavaDoc("Method not implemented");
208     }
209
210     public int getIntHeader(String JavaDoc string) {
211         throw new RuntimeException JavaDoc("Method not implemented");
212     }
213
214     public String JavaDoc getRequestURI() {
215         throw new RuntimeException JavaDoc("Method not implemented");
216     }
217
218     public HttpSession JavaDoc getSession(boolean b) {
219         throw new RuntimeException JavaDoc("Method not implemented");
220     }
221
222     public HttpSession JavaDoc getSession() {
223         throw new RuntimeException JavaDoc("Method not implemented");
224     }
225
226     public boolean isRequestedSessionIdFromUrl() {
227         throw new RuntimeException JavaDoc("Method not implemented");
228     }
229
230     public String JavaDoc getAuthType() {
231         throw new RuntimeException JavaDoc("Method not implemented");
232     }
233
234     public Principal JavaDoc getUserPrincipal() {
235         throw new RuntimeException JavaDoc("Method not implemented");
236     }
237
238     public StringBuffer JavaDoc getRequestURL() {
239         throw new RuntimeException JavaDoc("Method not implemented");
240     }
241
242     public String JavaDoc getPathTranslated() {
243         throw new RuntimeException JavaDoc("Method not implemented");
244     }
245
246     static class ServletInputStreamWrapper extends ServletInputStream JavaDoc {
247         private InputStream JavaDoc inputStream;
248
249         public ServletInputStreamWrapper(InputStream JavaDoc inputStream) {
250             this.inputStream = inputStream;
251         }
252
253         public synchronized void mark(int readlimit) {
254             inputStream.mark(readlimit);
255         }
256
257         public void close() throws IOException JavaDoc {
258             inputStream.close();
259         }
260
261         public synchronized void reset() throws IOException JavaDoc {
262             inputStream.reset();
263         }
264
265         public int available() throws IOException JavaDoc {
266             return inputStream.available();
267         }
268
269         public boolean markSupported() {
270             return inputStream.markSupported();
271         }
272
273         public long skip(long n) throws IOException JavaDoc {
274             return inputStream.skip(n);
275         }
276
277         public int read(byte b[]) throws IOException JavaDoc {
278             return inputStream.read(b);
279         }
280
281         public int read(byte b[], int off, int len) throws IOException JavaDoc {
282             return inputStream.read(b, off, len);
283         }
284
285         public int read() throws IOException JavaDoc {
286             return inputStream.read();
287         }
288     }
289 }
290
Popular Tags