Source Code Cross Referenced for FlowServlet.java in  » Web-Framework » jucas » org » jucas » addon » pageflow » 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 » Web Framework » jucas » org.jucas.addon.pageflow 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.jucas.addon.pageflow;
002:
003:        import java.io.IOException;
004:        import java.net.URI;
005:
006:        import javax.servlet.ServletConfig;
007:        import javax.servlet.ServletException;
008:        import javax.servlet.http.HttpServlet;
009:        import javax.servlet.http.HttpServletRequest;
010:        import javax.servlet.http.HttpServletResponse;
011:
012:        import org.jaul.DocumentScript;
013:        import org.jaul.IScriptCache;
014:        import org.jaul.IURIResolver;
015:        import org.jaul.JaulUtil;
016:        import org.jaul.ScriptStore;
017:        import org.jaul.utils.ServletURIResolver;
018:        import org.jaul.utils.SimpleScriptCache;
019:
020:        /*
021:         * License
022:         *
023:         *
024:         * Copyright (c) 2003 Essl Christian.  All rights 
025:         * reserved.
026:         * 
027:         * This Licence is based on the Apache Software Licence Version 1.1.
028:         *
029:         *
030:         * Redistribution and use in source and binary forms, with or without
031:         * modification, are permitted provided that the following conditions
032:         * are met:
033:         *
034:         * 1. Redistributions of source code must retain the above copyright
035:         *    notice, this list of conditions and the following disclaimer. 
036:         *
037:         * 2. Redistributions in binary form must reproduce the above copyright
038:         *    notice, this list of conditions and the following disclaimer in
039:         *    the documentation and/or other materials provided with the
040:         *    distribution.
041:         *
042:         * 3. The end-user documentation included with the redistribution,
043:         *    if any, must include the following acknowledgment:  
044:         *       "This product includes software developed by Christian Essl 
045:         *        and others for project Jucas (http://www.jucas.org/)."
046:         *    Alternately, this acknowledgment may appear in the software itself,
047:         *    if and wherever such third-party acknowledgments normally appear.
048:         *
049:         * 4. The names "Jucas" and "Christian Essl" must    not be used to endorse or
050:         * promote products derived from this    software without prior written
051:         * permission. For written    permission, please contact essl_christian@jucas.
052:         * org.
053:         *
054:         * 5. Products derived from this software may not be called "Jucas"
055:         *    or "Christian Essl", nor may "Jucas" or "Christian Essl"
056:         *    appear in their name, without prior written permission
057:         *    of Christian Essl (essl_christian@jucas.org).
058:         *
059:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
060:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
061:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
062:         * DISCLAIMED.  IN NO EVENT SHALL CHRISTIAN ESSL OR
063:         * OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
064:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
065:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
066:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
067:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
068:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
069:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
070:         * SUCH DAMAGE.
071:         * ====================================================================
072:         *
073:         * 
074:         */
075:
076:        /**
077:         * 
078:         * 
079:         * @author chris
080:         */
081:        public class FlowServlet extends HttpServlet {
082:            /** the logger for this class */
083:            public static transient final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
084:                    .getLog(FlowServlet.class);
085:
086:            private ScriptStore scriptStore;
087:
088:            /**
089:             * Constructor for FlowServlet.
090:             */
091:            public FlowServlet() {
092:                super ();
093:            }
094:
095:            /**
096:             * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
097:             */
098:            protected void doGet(HttpServletRequest req, HttpServletResponse res)
099:                    throws ServletException, IOException {
100:                this .doAction(req, res);
101:            }
102:
103:            /**
104:             * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
105:             */
106:            protected void doPost(HttpServletRequest req,
107:                    HttpServletResponse res) throws ServletException,
108:                    IOException {
109:                this .doAction(req, res);
110:            }
111:
112:            /**
113:             * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
114:             */
115:            public void init(ServletConfig config) throws ServletException {
116:                super .init(config);
117:
118:                String cSize = config.getInitParameter("cache-size");
119:                int cSizeInt = 10;
120:                if (cSize != null) {
121:                    try {
122:                        cSizeInt = Integer.parseInt(cSize);
123:                    } catch (Exception e) {
124:                        cSizeInt = 10;
125:                    }
126:                }
127:
128:                URI baseURI = ServletURIResolver.SERVLET_ROOT_URI;
129:                IScriptCache cache = new SimpleScriptCache(cSizeInt);
130:                IURIResolver[] resolvers = { new ServletURIResolver(config
131:                        .getServletContext(), "xml", null) };
132:
133:                ClassLoader classLoader = this .getClass().getClassLoader();
134:
135:                this .scriptStore = new ScriptStore(baseURI, resolvers, cache,
136:                        classLoader, null);
137:            }
138:
139:            /**
140:             * Method doAction.
141:             * @param req
142:             * @param res
143:             */
144:            private void doAction(HttpServletRequest req,
145:                    HttpServletResponse res) {
146:                String path = req.getPathInfo();
147:                String target;
148:                String source;
149:                int cut = path.lastIndexOf('/');
150:                if (cut == 0) {
151:                    source = "/WEB-INF/main.jucasflow.xml";
152:                    target = path.substring(1);
153:                } else {
154:                    target = path.substring(cut + 1);
155:                    source = path.substring(0, cut) + ".jucasflow.xml";
156:                }
157:
158:                URI uri = URI.create(source);
159:                //laod the source
160:                DocumentScript script;
161:                try {
162:                    script = this .scriptStore.getDocumentScript(uri);
163:                    JaulFlowContext ctxt = new JaulFlowContext(script, req,
164:                            res, this .getServletContext(), target);
165:                    script.execute(ctxt, JaulUtil.NULL_WRITER);
166:                } catch (Exception e) {
167:                    log.debug("Error in executing target: " + target
168:                            + " in script script: " + source, e);
169:                }
170:
171:            }
172:
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.