Source Code Cross Referenced for JspRaw.java in  » J2EE » Sofia » com » salmonllc » jsp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Sofia » com.salmonllc.jsp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //** Copyright Statement ***************************************************
002:        //The Salmon Open Framework for Internet Applications (SOFIA)
003:        // Copyright (C) 1999 - 2002, Salmon LLC
004:        //
005:        // This program is free software; you can redistribute it and/or
006:        // modify it under the terms of the GNU General Public License version 2
007:        // as published by the Free Software Foundation;
008:        // 
009:        // This program is distributed in the hope that it will be useful,
010:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
011:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:        // GNU General Public License for more details.
013:        // 
014:        // You should have received a copy of the GNU General Public License
015:        // along with this program; if not, write to the Free Software
016:        // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
017:        // 
018:        // For more information please visit http://www.salmonllc.com
019:        //** End Copyright Statement ***************************************************
020:        package com.salmonllc.jsp;
021:
022:        /////////////////////////
023:        //$Archive: /JADE/SourceCode/com/salmonllc/jsp/JspRaw.java $
024:        //$Author: Dan $
025:        //$Revision: 8 $
026:        //$Modtime: 10/30/02 2:38p $
027:        /////////////////////////
028:
029:        import com.salmonllc.sql.DataStoreBuffer;
030:        import com.salmonllc.sql.DataStoreEvaluator;
031:        import com.salmonllc.sql.DataStoreExpression;
032:
033:        import java.io.BufferedReader;
034:        import java.io.InputStream;
035:        import java.io.InputStreamReader;
036:
037:        /**
038:         * This type can be used to add raw html to your page.
039:         */
040:        public class JspRaw extends JspContainer {
041:            private String _html;
042:            private DataStoreEvaluator _dsEval = null;
043:            private InputStream _in = null;
044:            private String _fileName;
045:
046:            /**
047:             * Constructs a raw html object for the page
048:             * @param html - HTML to place in the page.
049:             * @param p - page to place the HTML in.
050:             */
051:            public JspRaw(String html, com.salmonllc.html.HtmlPage p) {
052:                super ("", p);
053:                _html = html;
054:            }
055:
056:            /**
057:             * Constructs a raw html object for the page
058:             * @param name - The name of the component in the page
059:             * @param html - HTML to place in the page.
060:             * @param p - page to place the HTML in.
061:             */
062:
063:            public JspRaw(String name, String html,
064:                    com.salmonllc.html.HtmlPage p) {
065:                super (name, p);
066:                _html = html;
067:            }
068:
069:            public void generateHTML(java.io.PrintWriter p, int rowNo)
070:                    throws java.io.IOException {
071:                try {
072:                    if (_dsEval != null) {
073:                        Object res;
074:
075:                        if (rowNo > -1)
076:                            res = _dsEval.evaluateRow(rowNo);
077:                        else
078:                            res = _dsEval.evaluateRow();
079:
080:                        if (res == null)
081:                            _html = null;
082:                        else
083:                            _html = res.toString();
084:                    }
085:                } catch (Exception e) {
086:                }
087:                if (!getVisible())
088:                    return;
089:
090:                if (_in != null) {
091:                    BufferedReader buf = new BufferedReader(
092:                            new InputStreamReader(_in, "ISO8859_1"));
093:                    char[] c = new char[1024];
094:                    int bytesRead = 0;
095:                    while (true) {
096:                        bytesRead = buf.read(c, 0, 1024);
097:                        if (bytesRead <= 0)
098:                            break;
099:                        p.write(c, 0, bytesRead);
100:                    }
101:                    buf.close();
102:                    return;
103:                }
104:
105:                if (_html == null)
106:                    return;
107:
108:                p.print(_html);
109:            }
110:
111:            /**
112:             * Use this method get the name file on the server file system to be streamed back to the browser.
113:             */
114:            public String getFileName() {
115:                return _fileName;
116:
117:            }
118:
119:            /**
120:             * This method returns the html in the component.
121:             */
122:            public String getHtml() {
123:                return _html;
124:            }
125:
126:            /**
127:             * This method sets the input stream that the component will draw it's html from.
128:             */
129:            public InputStream getInputStream() {
130:                return _in;
131:            }
132:
133:            /**
134:             * Use this method to bind this component to an expression in a DataStore
135:             * @param ds The DataStore to bind to.
136:             * @param expression The expression to bind to.
137:             * @see DataStoreEvaluator
138:             */
139:            public void setExpression(DataStoreBuffer ds,
140:                    DataStoreExpression expression) throws Exception {
141:                _dsEval = new DataStoreEvaluator(ds, expression);
142:            }
143:
144:            /**
145:             * Use this method to bind this component to an expression in a DataStore
146:             * @param ds The DataStore to bind to.
147:             * @param expression The expression to bind to.
148:             * @see DataStoreEvaluator
149:             */
150:            public void setExpression(DataStoreBuffer ds, String expression)
151:                    throws Exception {
152:                _dsEval = new DataStoreEvaluator(ds, expression);
153:            }
154:
155:            /**
156:             * Use this method to specify the name file on the server file system to be streamed back to the browser.
157:             */
158:            public void setFileName(String fileName) {
159:                try {
160:                    setInputStream(new java.io.FileInputStream(fileName));
161:                    _fileName = fileName;
162:                } catch (Exception e) {
163:                }
164:
165:            }
166:
167:            /**
168:             * This method sets the html that the componnt will generate.
169:             */
170:            public void setHtml(String html) {
171:                _html = html;
172:            }
173:
174:            /**
175:             * This method sets the input stream that the component will draw it's html from.
176:             */
177:            public void setInputStream(InputStream in) {
178:                _in = in;
179:            }
180:
181:            /**
182:             * This method gets the DataStoreEvaluator being used for expressions.
183:             * @return DataStoreEvaluator
184:             * @see DataStoreEvaluator
185:             */
186:            public DataStoreEvaluator getExpression() {
187:                return _dsEval;
188:            }
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.