Source Code Cross Referenced for ServletDspContext.java in  » Ajax » zk » org » zkoss » web » servlet » dsp » 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 » Ajax » zk » org.zkoss.web.servlet.dsp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ServletDspContext.java
002:
003:        {{IS_NOTE
004:        	Purpose:
005:        		
006:        	Description:
007:        		
008:        	History:
009:        		Sat Sep 17 19:27:35     2005, Created by tomyeh
010:        }}IS_NOTE
011:
012:        Copyright (C) 2004 Potix Corporation. All Rights Reserved.
013:
014:        {{IS_RIGHT
015:        	This program is distributed under GPL Version 2.0 in the hope that
016:        	it will be useful, but WITHOUT ANY WARRANTY.
017:        }}IS_RIGHT
018:         */
019:        package org.zkoss.web.servlet.dsp;
020:
021:        import java.io.Writer;
022:        import java.io.IOException;
023:
024:        import javax.servlet.ServletContext;
025:        import javax.servlet.ServletRequest;
026:        import javax.servlet.ServletResponse;
027:        import javax.servlet.http.HttpServletRequest;
028:        import javax.servlet.http.HttpServletResponse;
029:
030:        import org.zkoss.util.resource.Locator;
031:        import org.zkoss.xel.VariableResolver;
032:        import org.zkoss.xel.FunctionMapper;
033:        import org.zkoss.xel.ExpressionFactory;
034:        import org.zkoss.xel.Expressions;
035:
036:        import org.zkoss.web.util.resource.ServletContextLocator;
037:        import org.zkoss.web.servlet.xel.RequestXelResolver;
038:
039:        /**
040:         * A DSP context based on HTTP servlet request and response.
041:         *
042:         * @author tomyeh
043:         */
044:        public class ServletDspContext implements  DspContext {
045:            private final Locator _locator;
046:            private final ServletContext _ctx;
047:            private final HttpServletRequest _request;
048:            private final HttpServletResponse _response;
049:            private Writer _out;
050:            private VariableResolver _resolver;
051:            private ExpressionFactory _expf;
052:
053:            /**
054:             * Constructor.
055:             *
056:             * @param locator used to locate resources, such as taglib.
057:             * If null is specified, the locator for the specified servlet context
058:             * is used. (In other words, we use ServletContextLocator(ctx), if locator is null).
059:             */
060:            public ServletDspContext(ServletContext ctx,
061:                    HttpServletRequest request, HttpServletResponse response,
062:                    Locator locator) {
063:                this (ctx, request, response, null, locator);
064:            }
065:
066:            /**
067:             * Constructor with the specified writer.
068:             *
069:             * @param locator used to locate resources, such as taglib.
070:             * If null is specified, the locator for the specified servlet context
071:             * is used. (In other words, we use ServletContextLocator(ctx), if locator is null).
072:             * @param out the output to generate the result.
073:             * If null, it is the same as {@link #ServletDspContext(ServletContext,HttpServletRequest,HttpServletResponse,Locator)}
074:             * In other words, response.getWriter() is used.
075:             * @since 2.4.1
076:             */
077:            public ServletDspContext(ServletContext ctx,
078:                    HttpServletRequest request, HttpServletResponse response,
079:                    Writer out, Locator locator) {
080:                _locator = locator != null ? locator
081:                        : new ServletContextLocator(ctx);
082:                _ctx = ctx;
083:                _request = request;
084:                _response = response;
085:                _out = out;
086:            }
087:
088:            //-- DspContext --//
089:            public Locator getLocator() {
090:                return _locator;
091:            }
092:
093:            public void setContentType(String ctype) {
094:                _response.setContentType(ctype);
095:            }
096:
097:            public void setOut(Writer out) {
098:                _out = out;
099:            }
100:
101:            //-- XelContext --//
102:            public Writer getOut() throws IOException {
103:                return _out != null ? _out : _response.getWriter();
104:            }
105:
106:            public ServletRequest getRequest() {
107:                return _request;
108:            }
109:
110:            public ServletResponse getResponse() {
111:                return _response;
112:            }
113:
114:            public ServletContext getServletContext() {
115:                return _ctx;
116:            }
117:
118:            public VariableResolver getVariableResolver() {
119:                if (_resolver == null)
120:                    _resolver = new RequestXelResolver(_ctx, _request,
121:                            _response) {
122:                        public ExpressionFactory getExpressionFactory() {
123:                            return ServletDspContext.this 
124:                                    .getExpressionFactory();
125:                        }
126:                    };
127:                return _resolver;
128:            }
129:
130:            private ExpressionFactory getExpressionFactory() {
131:                if (_expf == null)
132:                    _expf = Expressions.newExpressionFactory(); //TODO: expfcls
133:                return _expf;
134:            }
135:
136:            public FunctionMapper getFunctionMapper() {
137:                return null;
138:            }
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.