01: /**
02: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
03: *
04: * Permission is hereby granted, free of charge, to any person obtaining a copy
05: * of this software and associated documentation files (the "Software"), to deal
06: * in the Software without restriction, including without limitation the rights
07: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
08: * copies of the Software, and to permit persons to whom the Software is
09: * furnished to do so, subject to the following conditions:
10: *
11: * The above copyright notice and this permission notice shall be included in
12: * all copies or substantial portions of the Software.
13: *
14: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20: * SOFTWARE.
21: */package com.liferay.portal.kernel.dao.search;
22:
23: import com.liferay.portal.kernel.servlet.StringServletResponse;
24:
25: import javax.servlet.RequestDispatcher;
26: import javax.servlet.ServletContext;
27: import javax.servlet.http.HttpServletRequest;
28: import javax.servlet.http.HttpServletResponse;
29: import javax.servlet.jsp.PageContext;
30:
31: /**
32: * <a href="JSPSearchEntry.java.html"><b><i>View Source</i></b></a>
33: *
34: * @author Brian Wing Shun Chan
35: *
36: */
37: public class JSPSearchEntry extends SearchEntry {
38:
39: public JSPSearchEntry(String align, String valign, String path) {
40: this (align, valign, DEFAULT_COLSPAN, path, null, null, null);
41: }
42:
43: public JSPSearchEntry(String align, String valign, int colspan,
44: String path) {
45:
46: this (align, valign, colspan, path, null, null, null);
47: }
48:
49: public JSPSearchEntry(String align, String valign, int colspan,
50: String path, ServletContext ctx, HttpServletRequest req,
51: HttpServletResponse res) {
52:
53: super (align, valign, colspan);
54:
55: _path = path;
56: _ctx = ctx;
57: _req = req;
58: _res = res;
59: }
60:
61: public String getPath() {
62: return _path;
63: }
64:
65: public void setPath(String path) {
66: _path = path;
67: }
68:
69: public void print(PageContext pageContext) throws Exception {
70: if (_ctx != null) {
71: RequestDispatcher rd = _ctx.getRequestDispatcher(_path);
72:
73: StringServletResponse stringServletRes = new StringServletResponse(
74: _res);
75:
76: rd.include(_req, stringServletRes);
77:
78: pageContext.getOut().print(stringServletRes.getString());
79: } else {
80: pageContext.include(_path);
81: }
82: }
83:
84: public Object clone() {
85: return new JSPSearchEntry(getAlign(), getValign(),
86: getColspan(), getPath());
87: }
88:
89: private String _path;
90: private ServletContext _ctx;
91: private HttpServletRequest _req;
92: private HttpServletResponse _res;
93:
94: }
|