01: /*
02: * JFolder, Copyright 2001-2006 Gary Steinmetz
03: *
04: * Distributable under LGPL license.
05: * See terms of license at gnu.org.
06: */
07:
08: package org.jfolder.common.utils.web;
09:
10: //base classes
11: import java.util.ArrayList;
12: import java.util.HashMap;
13: import java.util.Iterator;
14: import javax.servlet.ServletContext;
15: import javax.servlet.http.HttpServletRequest;
16: import javax.servlet.http.HttpServletResponse;
17: import javax.servlet.http.HttpSession;
18: import javax.servlet.jsp.PageContext;
19:
20: //project specific classes
21: import org.jfolder.common.ImmutableByteArray;
22:
23: //other classes
24:
25: public class WebComponentHolder {
26:
27: //
28: private ServletContext sc = null;
29: private HttpServletRequest req = null;
30: private HttpServletResponse res = null;
31: private HttpSession session = null;
32:
33: //
34: private WebComponentHolder(ServletContext inSc,
35: HttpServletRequest inReq, HttpServletResponse inRes,
36: HttpSession inSession) {
37: //
38: this .sc = inSc;
39: this .req = inReq;
40: this .res = inRes;
41: this .session = inSession;
42: }
43:
44: //
45: public final static WebComponentHolder newInstance(PageContext inPc) {
46: //
47: WebComponentHolder outValue = new WebComponentHolder(inPc
48: .getServletContext(), ((HttpServletRequest) inPc
49: .getRequest()), ((HttpServletResponse) inPc
50: .getResponse()), inPc.getSession());
51:
52: return outValue;
53: }
54:
55: //
56: public final static WebComponentHolder newInstance(
57: ServletContext inSc, HttpServletRequest inReq,
58: HttpServletResponse inRes, HttpSession inSession) {
59: //
60: WebComponentHolder outValue = new WebComponentHolder(inSc,
61: inReq, inRes, inSession);
62:
63: return outValue;
64: }
65:
66: //
67: public ServletContext getServletContext() {
68: return this .sc;
69: }
70:
71: public HttpServletRequest getHttpServletRequest() {
72: return this .req;
73: }
74:
75: public HttpServletResponse getHttpServletResponse() {
76: return this .res;
77: }
78:
79: public HttpSession getHttpSession() {
80: return this.session;
81: }
82: }
|