Source Code Cross Referenced for ThrowawayControllerHandlerAdapter.java in  » J2EE » spring-framework-2.0.6 » org » springframework » web » servlet » mvc » throwaway » 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 » spring framework 2.0.6 » org.springframework.web.servlet.mvc.throwaway 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2005 the original author or authors.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.springframework.web.servlet.mvc.throwaway;
018:
019:        import javax.servlet.http.HttpServletRequest;
020:        import javax.servlet.http.HttpServletResponse;
021:
022:        import org.springframework.web.bind.ServletRequestDataBinder;
023:        import org.springframework.web.servlet.HandlerAdapter;
024:        import org.springframework.web.servlet.ModelAndView;
025:
026:        /**
027:         * Adapter to use the ThrowawayController workflow interface with the
028:         * generic DispatcherServlet. Does not support last-modified checks.
029:         *
030:         * <p>This is an SPI class, not used directly by application code.
031:         * It can be explicitly configured in a DispatcherServlet context, to use a
032:         * customized version instead of the default ThrowawayControllerHandlerAdapter.
033:         *
034:         * @author Juergen Hoeller
035:         * @since 08.12.2003
036:         */
037:        public class ThrowawayControllerHandlerAdapter implements 
038:                HandlerAdapter {
039:
040:            public static final String DEFAULT_COMMAND_NAME = "throwawayController";
041:
042:            private String commandName = DEFAULT_COMMAND_NAME;
043:
044:            /**
045:             * Set the name of the command in the model.
046:             * The command object will be included in the model under this name.
047:             */
048:            public final void setCommandName(String commandName) {
049:                this .commandName = commandName;
050:            }
051:
052:            /**
053:             * Return the name of the command in the model.
054:             */
055:            public final String getCommandName() {
056:                return this .commandName;
057:            }
058:
059:            public boolean supports(Object handler) {
060:                return (handler instanceof  ThrowawayController);
061:            }
062:
063:            /**
064:             * This implementation binds request parameters to the ThrowawayController
065:             * instance and then calls <code>execute</code> on it.
066:             * @see #createBinder
067:             * @see ThrowawayController#execute
068:             */
069:            public ModelAndView handle(HttpServletRequest request,
070:                    HttpServletResponse response, Object handler)
071:                    throws Exception {
072:
073:                ThrowawayController throwaway = (ThrowawayController) handler;
074:
075:                ServletRequestDataBinder binder = createBinder(request,
076:                        throwaway);
077:                binder.bind(request);
078:                binder.closeNoCatch();
079:
080:                return throwaway.execute();
081:            }
082:
083:            /**
084:             * Create a new binder instance for the given command and request.
085:             * <p>Called by <code>bindAndValidate</code>. Can be overridden to plug in
086:             * custom ServletRequestDataBinder subclasses.
087:             * <p>Default implementation creates a standard ServletRequestDataBinder,
088:             * sets the specified MessageCodesResolver (if any), and invokes initBinder.
089:             * Note that <code>initBinder</code> will not be invoked if you override this method!
090:             * @param request current HTTP request
091:             * @param command the command to bind onto
092:             * @return the new binder instance
093:             * @throws Exception in case of invalid state or arguments
094:             * @see #initBinder
095:             * @see #getCommandName
096:             */
097:            protected ServletRequestDataBinder createBinder(
098:                    HttpServletRequest request, ThrowawayController command)
099:                    throws Exception {
100:
101:                ServletRequestDataBinder binder = new ServletRequestDataBinder(
102:                        command, getCommandName());
103:                initBinder(request, binder);
104:                return binder;
105:            }
106:
107:            /**
108:             * Initialize the given binder instance, for example with custom editors.
109:             * Called by <code>createBinder</code>.
110:             * <p>This method allows you to register custom editors for certain fields of your
111:             * command class. For instance, you will be able to transform Date objects into a
112:             * String pattern and back, in order to allow your JavaBeans to have Date properties
113:             * and still be able to set and display them in an HTML interface.
114:             * <p>Default implementation is empty.
115:             * @param request current HTTP request
116:             * @param binder new binder instance
117:             * @throws Exception in case of invalid state or arguments
118:             * @see #createBinder
119:             * @see org.springframework.validation.DataBinder#registerCustomEditor
120:             * @see org.springframework.beans.propertyeditors.CustomDateEditor
121:             */
122:            protected void initBinder(HttpServletRequest request,
123:                    ServletRequestDataBinder binder) throws Exception {
124:            }
125:
126:            /**
127:             * This implementation always returns -1, as last-modified checks are not supported.
128:             */
129:            public long getLastModified(HttpServletRequest request,
130:                    Object handler) {
131:                return -1;
132:            }
133:
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.