KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > webapp > region > Content


1 /*
2  * $Id: Content.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2001-2003 Sun Microsystems Inc., published in "Advanced Java Server Pages" by Prentice Hall PTR
5  * Copyright (c) 2002 The Open For Business Project - www.ofbiz.org
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a
8  * copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation
10  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11  * and/or sell copies of the Software, and to permit persons to whom the
12  * Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
22  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
23  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  *
25  */

26 package org.ofbiz.webapp.region;
27
28 import javax.servlet.ServletException JavaDoc;
29 import javax.servlet.http.HttpServletRequest JavaDoc;
30 import javax.servlet.http.HttpServletResponse JavaDoc;
31 import javax.servlet.jsp.JspException JavaDoc;
32 import javax.servlet.jsp.PageContext JavaDoc;
33
34 /**
35  * Abstract base class for Section and Region
36  * <br/>Subclasses of Content must implement render(PageContext)
37  *
38  *@author David M. Geary in the book "Advanced Java Server Pages"
39  *@author <a HREF="mailto:jonesde@ofbiz.org">David E. Jones</a>
40  *@created February 26, 2002
41  *@version 1.0
42  */

43 public abstract class Content implements java.io.Serializable JavaDoc {
44     protected final String JavaDoc content;
45
46     /** type can be:
47      * <br/>- direct (for direct inline content)
48      * <br/>- region (for a nested region)
49      * <br/>- default (for region if matches region name OR JSP/Servlet resource otherwise)
50      * <br/>- resource (for JSP/Servlet resource)
51      * <br/>- or any ViewHandler defined in the corresponding controller.xml file
52      */

53     protected final String JavaDoc type;
54
55     // Render this content in a JSP page
56
abstract void render(PageContext JavaDoc pc) throws JspException JavaDoc;
57
58     abstract void render(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws java.io.IOException JavaDoc, ServletException JavaDoc;
59
60     public Content(String JavaDoc content, String JavaDoc type) {
61         this.content = content;
62         this.type = type;
63     }
64
65     public String JavaDoc getContent() {
66         return content;
67     }
68
69     public String JavaDoc getType() {
70         return type;
71     }
72
73     public String JavaDoc toString() {
74         return "Content: " + content + ", type: " + type;
75     }
76 }
77
Popular Tags