Source Code Cross Referenced for ServletDispatcher.java in  » J2EE » webwork-2.2.6 » com » opensymphony » webwork » dispatcher » 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 » webwork 2.2.6 » com.opensymphony.webwork.dispatcher 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2002-2003 by OpenSymphony
003:         * All rights reserved.
004:         */
005:        package com.opensymphony.webwork.dispatcher;
006:
007:        import com.opensymphony.webwork.WebWorkStatics;
008:        import com.opensymphony.webwork.dispatcher.mapper.ActionMapperFactory;
009:        import com.opensymphony.webwork.dispatcher.mapper.ActionMapping;
010:        import org.apache.commons.logging.Log;
011:        import org.apache.commons.logging.LogFactory;
012:
013:        import javax.servlet.ServletConfig;
014:        import javax.servlet.ServletException;
015:        import javax.servlet.http.HttpServlet;
016:        import javax.servlet.http.HttpServletRequest;
017:        import javax.servlet.http.HttpServletResponse;
018:        import java.io.IOException;
019:
020:        /**
021:         * Main dispatcher servlet in WebWork2 which acts as the controller in the MVC paradigm. <p>
022:         * <p/>
023:         * When a request enters the servlet the following things will happen: <ol>
024:         * <p/>
025:         * <li>The action name is parsed from the servlet path (i.e., /foo/bar/MyAction.action -> MyAction).</li>
026:         * <li>A context consisting of the request, response, parameters, session and application
027:         * properties is created.</li>
028:         * <li>An XWork <tt>ActionProxy</tt> object is instantiated (wraps an <tt>Action</tt>) using the action name, path,
029:         * and context then executed.</li>
030:         * <li>Action output will channel back through the response to the user.</li></ol>
031:         * <p/>
032:         * Any errors occurring during the action execution will result in a
033:         * {@link javax.servlet.http.HttpServletResponse#SC_INTERNAL_SERVER_ERROR} error and any resource errors
034:         * (i.e., invalid action name or missing JSP page) will result in a
035:         * {@link javax.servlet.http.HttpServletResponse#SC_NOT_FOUND} error. <p>
036:         * <p/>
037:         * Instead of traditional servlet init params this servlet will initialize itself using WebWork2 properties.
038:         * The following properties are used upon initialization: <ul>
039:         * <p/>
040:         * <li><tt>webwork.configuration.xml.reload</tt>: if and only if set to <tt>true</tt> then the xml configuration
041:         * files (action definitions, interceptor definitions, etc) will be reloaded for each request. This is
042:         * useful for development but should be disabled for production deployment.</li>
043:         * <li><tt>webwork.multipart.saveDir</tt>: The path used for temporarily uploaded files. Defaults to the
044:         * temp path specified by the app server.</li>
045:         * <li><tt>webwork.multipart.maxSize</tt>: sets the maximum allowable multipart request size
046:         * in bytes. If the size was not specified then {@link java.lang.Integer#MAX_VALUE} will be used
047:         * (essentially unlimited so be careful).</li></ul>
048:         * <p/>
049:         *
050:         * @author <a href="mailto:rickard@middleware-company.com">Rickard �berg</a>
051:         * @author <a href="mailto:matt@smallleap.com">Matt Baldree</a>
052:         * @author Jason Carreira
053:         * @author <a href="mailto:cameron@datacodex.net">Cameron Braid</a>
054:         * @author Bill Lynch
055:         * @see ServletDispatcherResult
056:         * @deprecated use {@link FilterDispatcher} instead
057:         */
058:        public class ServletDispatcher extends HttpServlet implements 
059:                WebWorkStatics {
060:
061:            /**
062:             * Logger for this class.
063:             */
064:            protected static final Log LOG = LogFactory
065:                    .getLog(ServletDispatcher.class);
066:
067:            /**
068:             * Initalizes the servlet. Please read the {@link ServletDispatcher class documentation} for more
069:             * detail. <p>
070:             *
071:             * @param servletConfig the ServletConfig object.
072:             * @throws ServletException if an error occurs during initialization.
073:             */
074:            public void init(ServletConfig servletConfig)
075:                    throws ServletException {
076:                super .init(servletConfig);
077:                DispatcherUtils.initialize(getServletContext());
078:            }
079:
080:            /**
081:             * Services the request by determining the desired action to load, building the action context and
082:             * then executing the action. This handles all servlet requests including GETs and POSTs. <p>
083:             * <p/>
084:             * This method also transparently handles multipart requests.
085:             *
086:             * @param request  the HttpServletRequest object.
087:             * @param response the HttpServletResponse object.
088:             * @throws ServletException if an error occurs while loading or executing the action.
089:             */
090:            public void service(HttpServletRequest request,
091:                    HttpServletResponse response) throws ServletException {
092:                // prepare the request no matter what - this ensures that the proper character encoding
093:                // is used before invoking the mapper (see WW-9127)
094:                DispatcherUtils du = DispatcherUtils.getInstance();
095:                du.prepare(request, response);
096:
097:                try {
098:                    request = du.wrapRequest(request, getServletContext());
099:                } catch (IOException e) {
100:                    String message = "Could not wrap servlet request with MultipartRequestWrapper!";
101:                    LOG.error(message, e);
102:                    throw new ServletException(message, e);
103:                }
104:
105:                ActionMapping mapping = ActionMapperFactory.getMapper()
106:                        .getMapping(request);
107:                if (mapping == null) {
108:                    try {
109:                        response.sendError(404);
110:                    } catch (IOException e) {
111:                        LOG
112:                                .error(
113:                                        "Could not send 404 after not finding any ActionMapping",
114:                                        e);
115:                    }
116:                    return;
117:                }
118:
119:                du.serviceAction(request, response, getServletContext(),
120:                        mapping);
121:            }
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.