Source Code Cross Referenced for ConfigurableWebBindingInitializer.java in  » J2EE » spring-framework-2.5 » org » springframework » web » bind » support » 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.5 » org.springframework.web.bind.support 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2007 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.bind.support;
018:
019:        import org.springframework.beans.PropertyEditorRegistrar;
020:        import org.springframework.validation.BindingErrorProcessor;
021:        import org.springframework.validation.MessageCodesResolver;
022:        import org.springframework.web.bind.WebDataBinder;
023:        import org.springframework.web.context.request.WebRequest;
024:
025:        /**
026:         * Convenient {@link WebBindingInitializer} for declarative configuration
027:         * in a Spring application context. Allows for reusing pre-configured
028:         * initializers with multiple controller/handlers.
029:         *
030:         * @author Juergen Hoeller
031:         * @since 2.5
032:         * @see #setDirectFieldAccess
033:         * @see #setMessageCodesResolver
034:         * @see #setBindingErrorProcessor
035:         * @see #setPropertyEditorRegistrar
036:         */
037:        public class ConfigurableWebBindingInitializer implements 
038:                WebBindingInitializer {
039:
040:            private boolean directFieldAccess = false;
041:
042:            private MessageCodesResolver messageCodesResolver;
043:
044:            private BindingErrorProcessor bindingErrorProcessor;
045:
046:            private PropertyEditorRegistrar[] propertyEditorRegistrars;
047:
048:            /**
049:             * Set whether to use direct field access instead of bean property access.
050:             * <p>Default is <code>false</code>, using bean property access.
051:             * Switch this to <code>true</code> for enforcing direct field access.
052:             */
053:            public final void setDirectFieldAccess(boolean directFieldAccess) {
054:                this .directFieldAccess = directFieldAccess;
055:            }
056:
057:            /**
058:             * Set the strategy to use for resolving errors into message codes.
059:             * Applies the given strategy to all data binders used by this controller.
060:             * <p>Default is <code>null</code>, i.e. using the default strategy of
061:             * the data binder.
062:             * @see org.springframework.validation.DataBinder#setMessageCodesResolver
063:             */
064:            public final void setMessageCodesResolver(
065:                    MessageCodesResolver messageCodesResolver) {
066:                this .messageCodesResolver = messageCodesResolver;
067:            }
068:
069:            /**
070:             * Return the strategy to use for resolving errors into message codes.
071:             */
072:            public final MessageCodesResolver getMessageCodesResolver() {
073:                return this .messageCodesResolver;
074:            }
075:
076:            /**
077:             * Set the strategy to use for processing binding errors, that is,
078:             * required field errors and <code>PropertyAccessException</code>s.
079:             * <p>Default is <code>null</code>, that is, using the default strategy
080:             * of the data binder.
081:             * @see org.springframework.validation.DataBinder#setBindingErrorProcessor
082:             */
083:            public final void setBindingErrorProcessor(
084:                    BindingErrorProcessor bindingErrorProcessor) {
085:                this .bindingErrorProcessor = bindingErrorProcessor;
086:            }
087:
088:            /**
089:             * Return the strategy to use for processing binding errors.
090:             */
091:            public final BindingErrorProcessor getBindingErrorProcessor() {
092:                return this .bindingErrorProcessor;
093:            }
094:
095:            /**
096:             * Specify a single PropertyEditorRegistrar to be applied
097:             * to every DataBinder that this controller uses.
098:             */
099:            public final void setPropertyEditorRegistrar(
100:                    PropertyEditorRegistrar propertyEditorRegistrar) {
101:                this .propertyEditorRegistrars = new PropertyEditorRegistrar[] { propertyEditorRegistrar };
102:            }
103:
104:            /**
105:             * Specify multiple PropertyEditorRegistrars to be applied
106:             * to every DataBinder that this controller uses.
107:             */
108:            public final void setPropertyEditorRegistrars(
109:                    PropertyEditorRegistrar[] propertyEditorRegistrars) {
110:                this .propertyEditorRegistrars = propertyEditorRegistrars;
111:            }
112:
113:            /**
114:             * Return the PropertyEditorRegistrars to be applied
115:             * to every DataBinder that this controller uses.
116:             */
117:            public final PropertyEditorRegistrar[] getPropertyEditorRegistrars() {
118:                return this .propertyEditorRegistrars;
119:            }
120:
121:            public void initBinder(WebDataBinder binder, WebRequest request) {
122:                if (this .directFieldAccess) {
123:                    binder.initDirectFieldAccess();
124:                }
125:                if (this .messageCodesResolver != null) {
126:                    binder.setMessageCodesResolver(this .messageCodesResolver);
127:                }
128:                if (this .bindingErrorProcessor != null) {
129:                    binder.setBindingErrorProcessor(this .bindingErrorProcessor);
130:                }
131:                if (this .propertyEditorRegistrars != null) {
132:                    for (int i = 0; i < this.propertyEditorRegistrars.length; i++) {
133:                        this.propertyEditorRegistrars[i]
134:                                .registerCustomEditors(binder);
135:                    }
136:                }
137:            }
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.