KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > connector > SessionRequest55


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package org.apache.catalina.connector;
6
7 import org.apache.catalina.Context;
8 import org.apache.catalina.Host;
9 import org.apache.catalina.Realm;
10 import org.apache.catalina.Session;
11 import org.apache.catalina.Wrapper;
12 import org.apache.tomcat.util.buf.B2CConverter;
13 import org.apache.tomcat.util.buf.MessageBytes;
14 import org.apache.tomcat.util.http.mapper.MappingData;
15
16 import com.tc.tomcat.session.SessionInternal;
17 import com.terracotta.session.TerracottaRequest;
18
19 import java.io.BufferedReader JavaDoc;
20 import java.io.IOException JavaDoc;
21 import java.io.InputStream JavaDoc;
22 import java.io.UnsupportedEncodingException JavaDoc;
23 import java.security.Principal JavaDoc;
24 import java.util.Enumeration JavaDoc;
25 import java.util.Locale JavaDoc;
26 import java.util.Map JavaDoc;
27
28 import javax.servlet.FilterChain JavaDoc;
29 import javax.servlet.RequestDispatcher JavaDoc;
30 import javax.servlet.ServletInputStream JavaDoc;
31 import javax.servlet.http.Cookie JavaDoc;
32 import javax.servlet.http.HttpServletRequest JavaDoc;
33 import javax.servlet.http.HttpSession JavaDoc;
34
35 public class SessionRequest55 extends Request {
36   private final Request valveReq;
37   private final TerracottaRequest sessionReq;
38   private final Realm realm;
39   private SessionResponse55 sessionRes;
40   private Session sessionInternal = null;
41
42   /**
43    * @param sessionReq SessionRequest must be a HttpServletRequest slice of Request
44    * @param valveReq
45    */

46   public SessionRequest55(TerracottaRequest sessionReq, Request valveReq, Realm realm) {
47     this.valveReq = valveReq;
48     this.sessionReq = sessionReq;
49     this.realm = realm;
50   }
51
52   public void setSessionResponse(SessionResponse55 sessionRes) {
53     this.sessionRes = sessionRes;
54   }
55
56   // ////////////////////////////////////////////////////////
57
// ------------ Interesting methods START ------------
58
// ////////////////////////////////////////////////////////
59
public HttpSession JavaDoc getSession() {
60     return sessionReq.getSession();
61   }
62
63   public HttpSession JavaDoc getSession(boolean arg0) {
64     return sessionReq.getSession(arg0);
65   }
66
67   public String JavaDoc getRequestedSessionId() {
68     return sessionReq.getRequestedSessionId();
69   }
70
71   public boolean isRequestedSessionIdFromCookie() {
72     return sessionReq.isRequestedSessionIdFromCookie();
73   }
74
75   public boolean isRequestedSessionIdFromUrl() {
76     return sessionReq.isRequestedSessionIdFromUrl();
77   }
78
79   public boolean isRequestedSessionIdFromURL() {
80     return sessionReq.isRequestedSessionIdFromURL();
81   }
82
83   public boolean isRequestedSessionIdValid() {
84     return sessionReq.isRequestedSessionIdValid();
85   }
86
87   public HttpServletRequest JavaDoc getRequest() {
88     return sessionReq;
89   }
90
91   public Response getResponse() {
92     return sessionRes;
93   }
94
95   public Session getSessionInternal() {
96     return getSessionInternal(true);
97   }
98
99   public Session getSessionInternal(boolean create) {
100     synchronized (this) {
101       if (sessionInternal != null) { return sessionInternal; }
102
103       com.terracotta.session.Session tcSession = (com.terracotta.session.Session) getSession(create);
104       if (tcSession == null) { return null; }
105
106       return sessionInternal = new SessionInternal(tcSession, realm);
107     }
108
109     // unreachable
110
}
111
112   // ////////////////////////////////////////////////////////
113
// ------------ Interesting methods END ------------
114
// ////////////////////////////////////////////////////////
115

116   // /////////////////////////////////////////////////////////
117
// the rest should be just delegating methods...
118
public boolean equals(Object JavaDoc obj) {
119     return valveReq.equals(obj);
120   }
121
122   public Object JavaDoc getAttribute(String JavaDoc arg0) {
123     return valveReq.getAttribute(arg0);
124   }
125
126   public Enumeration JavaDoc getAttributeNames() {
127     return valveReq.getAttributeNames();
128   }
129
130   public String JavaDoc getAuthType() {
131     return valveReq.getAuthType();
132   }
133
134   public String JavaDoc getCharacterEncoding() {
135     return valveReq.getCharacterEncoding();
136   }
137
138   public int getContentLength() {
139     return valveReq.getContentLength();
140   }
141
142   public String JavaDoc getContentType() {
143     return valveReq.getContentType();
144   }
145
146   public String JavaDoc getContextPath() {
147     return valveReq.getContextPath();
148   }
149
150   public Cookie JavaDoc[] getCookies() {
151     return valveReq.getCookies();
152   }
153
154   public long getDateHeader(String JavaDoc arg0) {
155     return valveReq.getDateHeader(arg0);
156   }
157
158   public String JavaDoc getHeader(String JavaDoc arg0) {
159     return valveReq.getHeader(arg0);
160   }
161
162   public Enumeration JavaDoc getHeaderNames() {
163     return valveReq.getHeaderNames();
164   }
165
166   public Enumeration JavaDoc getHeaders(String JavaDoc arg0) {
167     return valveReq.getHeaders(arg0);
168   }
169
170   public ServletInputStream JavaDoc getInputStream() throws IOException JavaDoc {
171     return valveReq.getInputStream();
172   }
173
174   public int getIntHeader(String JavaDoc arg0) {
175     return valveReq.getIntHeader(arg0);
176   }
177
178   public String JavaDoc getLocalAddr() {
179     return valveReq.getLocalAddr();
180   }
181
182   public Locale JavaDoc getLocale() {
183     return valveReq.getLocale();
184   }
185
186   public Enumeration JavaDoc getLocales() {
187     return valveReq.getLocales();
188   }
189
190   public String JavaDoc getLocalName() {
191     return valveReq.getLocalName();
192   }
193
194   public int getLocalPort() {
195     return valveReq.getLocalPort();
196   }
197
198   public String JavaDoc getMethod() {
199     return valveReq.getMethod();
200   }
201
202   public String JavaDoc getParameter(String JavaDoc arg0) {
203     return valveReq.getParameter(arg0);
204   }
205
206   public Map JavaDoc getParameterMap() {
207     return valveReq.getParameterMap();
208   }
209
210   public Enumeration JavaDoc getParameterNames() {
211     return valveReq.getParameterNames();
212   }
213
214   public String JavaDoc[] getParameterValues(String JavaDoc arg0) {
215     return valveReq.getParameterValues(arg0);
216   }
217
218   public String JavaDoc getPathInfo() {
219     return valveReq.getPathInfo();
220   }
221
222   public String JavaDoc getPathTranslated() {
223     return valveReq.getPathTranslated();
224   }
225
226   public String JavaDoc getProtocol() {
227     return valveReq.getProtocol();
228   }
229
230   public String JavaDoc getQueryString() {
231     return valveReq.getQueryString();
232   }
233
234   public BufferedReader JavaDoc getReader() throws IOException JavaDoc {
235     return valveReq.getReader();
236   }
237
238   public String JavaDoc getRealPath(String JavaDoc arg0) {
239     return valveReq.getRealPath(arg0);
240   }
241
242   public String JavaDoc getRemoteAddr() {
243     return valveReq.getRemoteAddr();
244   }
245
246   public String JavaDoc getRemoteHost() {
247     return valveReq.getRemoteHost();
248   }
249
250   public int getRemotePort() {
251     return valveReq.getRemotePort();
252   }
253
254   public String JavaDoc getRemoteUser() {
255     return valveReq.getRemoteUser();
256   }
257
258   public RequestDispatcher JavaDoc getRequestDispatcher(String JavaDoc arg0) {
259     return valveReq.getRequestDispatcher(arg0);
260   }
261
262   public String JavaDoc getRequestURI() {
263     return valveReq.getRequestURI();
264   }
265
266   public StringBuffer JavaDoc getRequestURL() {
267     return valveReq.getRequestURL();
268   }
269
270   public String JavaDoc getScheme() {
271     return valveReq.getScheme();
272   }
273
274   public String JavaDoc getServerName() {
275     return valveReq.getServerName();
276   }
277
278   public int getServerPort() {
279     return valveReq.getServerPort();
280   }
281
282   public String JavaDoc getServletPath() {
283     return valveReq.getServletPath();
284   }
285
286   public Principal JavaDoc getUserPrincipal() {
287     return valveReq.getUserPrincipal();
288   }
289
290   public int hashCode() {
291     return valveReq.hashCode();
292   }
293
294   public boolean isSecure() {
295     return valveReq.isSecure();
296   }
297
298   public boolean isUserInRole(String JavaDoc arg0) {
299     return valveReq.isUserInRole(arg0);
300   }
301
302   public void removeAttribute(String JavaDoc arg0) {
303     valveReq.removeAttribute(arg0);
304   }
305
306   public void setAttribute(String JavaDoc arg0, Object JavaDoc arg1) {
307     valveReq.setAttribute(arg0, arg1);
308   }
309
310   public void setCharacterEncoding(String JavaDoc arg0) throws UnsupportedEncodingException JavaDoc {
311     valveReq.setCharacterEncoding(arg0);
312   }
313
314   public void addCookie(Cookie JavaDoc cookie) {
315     valveReq.addCookie(cookie);
316   }
317
318   public void addHeader(String JavaDoc s, String JavaDoc s1) {
319     valveReq.addHeader(s, s1);
320   }
321
322   public void addLocale(Locale JavaDoc locale) {
323     valveReq.addLocale(locale);
324   }
325
326   public void addParameter(String JavaDoc name, String JavaDoc[] values) {
327     valveReq.addParameter(name, values);
328   }
329
330   public void clearCookies() {
331     valveReq.clearCookies();
332   }
333
334   public void clearHeaders() {
335     valveReq.clearHeaders();
336   }
337
338   public void clearLocales() {
339     valveReq.clearLocales();
340   }
341
342   public void clearParameters() {
343     valveReq.clearParameters();
344   }
345
346   protected void configureSessionCookie(Cookie JavaDoc cookie) {
347     valveReq.configureSessionCookie(cookie);
348   }
349
350   public void finishRequest() throws IOException JavaDoc {
351     valveReq.finishRequest();
352   }
353
354   public ServletInputStream JavaDoc createInputStream() throws IOException JavaDoc {
355     return valveReq.createInputStream();
356   }
357
358   public Connector getConnector() {
359     return valveReq.getConnector();
360   }
361
362   public Context getContext() {
363     return valveReq.getContext();
364   }
365
366   public String JavaDoc getDecodedRequestURI() {
367     return valveReq.getDecodedRequestURI();
368   }
369
370   public FilterChain JavaDoc getFilterChain() {
371     return valveReq.getFilterChain();
372   }
373
374   public Host getHost() {
375     return valveReq.getHost();
376   }
377
378   public String JavaDoc getInfo() {
379     return valveReq.getInfo();
380   }
381
382   public Object JavaDoc getNote(String JavaDoc name) {
383     return valveReq.getNote(name);
384   }
385
386   public java.util.Iterator JavaDoc getNoteNames() {
387     return valveReq.getNoteNames();
388   }
389
390   public Principal JavaDoc getPrincipal() {
391     return valveReq.getPrincipal();
392   }
393
394   public java.io.InputStream JavaDoc getStream() {
395     return valveReq.getStream();
396   }
397
398   public Wrapper getWrapper() {
399     return valveReq.getWrapper();
400   }
401
402   public void recycle() {
403     valveReq.recycle();
404   }
405
406   public void removeNote(String JavaDoc name) {
407     valveReq.removeNote(name);
408   }
409
410   public void setAuthType(String JavaDoc type) {
411     valveReq.setAuthType(type);
412   }
413
414   public void setConnector(Connector connector) {
415     valveReq.setConnector(connector);
416   }
417
418   public void setContentLength(int i) {
419     valveReq.setContentLength(i);
420   }
421
422   public String JavaDoc toString() {
423     return valveReq.toString();
424   }
425
426   public void setContentType(String JavaDoc s) {
427     valveReq.setContentType(s);
428   }
429
430   public void setContext(Context context) {
431     valveReq.setContext(context);
432   }
433
434   public void setContextPath(String JavaDoc path) {
435     valveReq.setContextPath(path);
436   }
437
438   public void setCookies(Cookie JavaDoc[] cookies) {
439     valveReq.setCookies(cookies);
440   }
441
442   public void setDecodedRequestURI(String JavaDoc s) {
443     valveReq.setDecodedRequestURI(s);
444   }
445
446   public void setFilterChain(FilterChain JavaDoc filterChain) {
447     valveReq.setFilterChain(filterChain);
448   }
449
450   public void setHost(Host host) {
451     valveReq.setHost(host);
452   }
453
454   public void setMethod(String JavaDoc s) {
455     valveReq.setMethod(s);
456   }
457
458   public void setNote(String JavaDoc name, Object JavaDoc value) {
459     valveReq.setNote(name, value);
460   }
461
462   public void setPathInfo(String JavaDoc path) {
463     valveReq.setPathInfo(path);
464   }
465
466   public void setProtocol(String JavaDoc s) {
467     valveReq.setProtocol(s);
468   }
469
470   public void setQueryString(String JavaDoc s) {
471     valveReq.setQueryString(s);
472   }
473
474   public void setRemoteAddr(String JavaDoc s) {
475     valveReq.setRemoteAddr(s);
476   }
477
478   public void setRemoteHost(String JavaDoc s) {
479     valveReq.setRemoteHost(s);
480   }
481
482   public void setRequestedSessionCookie(boolean flag) {
483     valveReq.setRequestedSessionCookie(flag);
484   }
485
486   public void setRequestedSessionId(String JavaDoc id) {
487     valveReq.setRequestedSessionId(id);
488   }
489
490   public void setRequestedSessionURL(boolean flag) {
491     valveReq.setRequestedSessionURL(flag);
492   }
493
494   public void setRequestURI(String JavaDoc s) {
495     valveReq.setRequestURI(s);
496   }
497
498   public void setResponse(Response response) {
499     valveReq.setResponse(response);
500   }
501
502   public void setScheme(String JavaDoc s) {
503     valveReq.setScheme(s);
504   }
505
506   public void setSecure(boolean secure) {
507     valveReq.setSecure(secure);
508   }
509
510   public void setServerName(String JavaDoc name) {
511     valveReq.setServerName(name);
512   }
513
514   public void setServerPort(int port) {
515     valveReq.setServerPort(port);
516   }
517
518   public void setServletPath(String JavaDoc path) {
519     valveReq.setServletPath(path);
520   }
521
522   public void setStream(InputStream JavaDoc inputstream) {
523     valveReq.setStream(inputstream);
524   }
525
526   public void setUserPrincipal(Principal JavaDoc principal) {
527     valveReq.setUserPrincipal(principal);
528   }
529
530   public void setWrapper(Wrapper wrapper) {
531     valveReq.setWrapper(wrapper);
532   }
533
534   protected Session doGetSession(boolean create) {
535     return valveReq.doGetSession(create);
536   }
537
538   protected void parseCookies() {
539     valveReq.parseCookies();
540   }
541
542   protected void parseLocales() {
543     valveReq.parseLocales();
544   }
545
546   protected void parseLocalesHeader(String JavaDoc value) {
547     valveReq.parseLocalesHeader(value);
548   }
549
550   protected void parseParameters() {
551     valveReq.parseParameters();
552   }
553
554   protected int readPostBody(byte[] body, int len) throws IOException JavaDoc {
555     return valveReq.readPostBody(body, len);
556   }
557
558   public MessageBytes getContextPathMB() {
559     return valveReq.getContextPathMB();
560   }
561
562   public org.apache.coyote.Request getCoyoteRequest() {
563     return valveReq.getCoyoteRequest();
564   }
565
566   public MessageBytes getDecodedRequestURIMB() {
567     return valveReq.getDecodedRequestURIMB();
568   }
569
570   public MappingData getMappingData() {
571     return valveReq.getMappingData();
572   }
573
574   public MessageBytes getPathInfoMB() {
575     return valveReq.getPathInfoMB();
576   }
577
578   public MessageBytes getRequestPathMB() {
579     return valveReq.getRequestPathMB();
580   }
581
582   public MessageBytes getServletPathMB() {
583     return valveReq.getServletPathMB();
584   }
585
586   protected B2CConverter getURIConverter() {
587     return valveReq.getURIConverter();
588   }
589
590   public void setCoyoteRequest(org.apache.coyote.Request coyoteRequest) {
591     valveReq.setCoyoteRequest(coyoteRequest);
592   }
593
594   protected void setURIConverter(B2CConverter URIConverter) {
595     valveReq.setURIConverter(URIConverter);
596   }
597
598 }
599
Popular Tags