Java Doc for ControllerClassNameHandlerMapping.java in  » J2EE » spring-framework-2.0.6 » org » springframework » web » servlet » mvc » 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.0.6 » org.springframework.web.servlet.mvc.support 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
   org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping

ControllerClassNameHandlerMapping
public class ControllerClassNameHandlerMapping extends AbstractUrlHandlerMapping implements HandlerMapping(Code)
Implementation of HandlerMapping that follows a simple convention for generating URL path mappings from the class names of registered org.springframework.web.servlet.mvc.Controller and org.springframework.web.servlet.mvc.throwaway.ThrowawayController beans.

For simple org.springframework.web.servlet.mvc.Controller implementations (those that handle a single request type), the convention is to take the ClassUtils.getShortName short name of the Class, remove the 'Controller' suffix if it exists and return the remaining text, lowercased, as the mapping, with a leading /. For example:

  • WelcomeController -> /welcome*
  • HomeController -> /home*

For MultiActionController MultiActionControllers then a similar mapping is registered, except that all sub-paths are registed using the trailing wildcard pattern /*. For example:

  • WelcomeController -> /welcome/*
  • CatalogController -> /catalog/*

For MultiActionController it is often useful to use this mapping strategy in conjunction with the org.springframework.web.servlet.mvc.multiaction.InternalPathMethodNameResolver .
author:
   Rob Harrop
author:
   Juergen Hoeller
since:
   2.0
See Also:   org.springframework.web.servlet.mvc.Controller
See Also:   org.springframework.web.servlet.mvc.throwaway.ThrowawayController
See Also:   org.springframework.web.servlet.mvc.multiaction.MultiActionController





Method Summary
protected  voiddetectControllers()
     Detect all the org.springframework.web.servlet.mvc.Controller and org.springframework.web.servlet.mvc.throwaway.ThrowawayController beans registered in the org.springframework.context.ApplicationContext and register a URL path mapping for each one based on rules defined here.
protected  StringgeneratePathMapping(Class beanClass)
     Generate the actual URL path for the given controller class.
protected  voidinitApplicationContext()
     Calls the ControllerClassNameHandlerMapping.detectControllers() method in addition to the superclass's initialization.
protected  booleanisEligibleForMapping(String beanName, Class beanClass)
     Determine whether the specified controller is excluded from this mapping.
protected  voidregisterController(String beanName, Class beanClass)
     Register the controller with the given name, as defined in the current application context.
protected  voidregisterControllers(Class controllerType)
     Register all controllers of the given type, searching the current DispatcherServlet's ApplicationContext for matching beans.
public  voidsetExcludedClasses(Class[] excludedClasses)
     Specify controller classes that should be excluded from this mapping.
public  voidsetExcludedPackages(String[] excludedPackages)
     Specify Java packages that should be excluded from this mapping. Any classes in such a package (or any of its subpackages) will be ignored by this HandlerMapping.

Default is to exclude the entire "org.springframework.web.servlet.mvc" package, including its subpackages, since none of Spring's out-of-the-box Controller implementations is a reasonable candidate for this mapping strategy. Such controllers are typically handled by a separate HandlerMapping, e.g.




Method Detail
detectControllers
protected void detectControllers() throws BeansException(Code)
Detect all the org.springframework.web.servlet.mvc.Controller and org.springframework.web.servlet.mvc.throwaway.ThrowawayController beans registered in the org.springframework.context.ApplicationContext and register a URL path mapping for each one based on rules defined here.
throws:
  BeansException - if the controllers couldn't be obtained or registered
See Also:   ControllerClassNameHandlerMapping.generatePathMapping(Class)



generatePathMapping
protected String generatePathMapping(Class beanClass)(Code)
Generate the actual URL path for the given controller class.

Subclasses may choose to customize the paths that are generated by overriding this method.
Parameters:
  beanClass - the controller bean class to generate a mapping for the URL path mapping for the given controller




initApplicationContext
protected void initApplicationContext()(Code)
Calls the ControllerClassNameHandlerMapping.detectControllers() method in addition to the superclass's initialization.



isEligibleForMapping
protected boolean isEligibleForMapping(String beanName, Class beanClass)(Code)
Determine whether the specified controller is excluded from this mapping.
Parameters:
  beanName - the name of the controller bean
Parameters:
  beanClass - the concrete class of the controller bean whether the specified class is excluded
See Also:   ControllerClassNameHandlerMapping.setExcludedPackages
See Also:   ControllerClassNameHandlerMapping.setExcludedClasses



registerController
protected void registerController(String beanName, Class beanClass) throws BeansException, IllegalStateException(Code)
Register the controller with the given name, as defined in the current application context.
Parameters:
  beanName - the name of the controller bean
Parameters:
  beanClass - the concrete class of the controller bean
throws:
  BeansException - if the controller couldn't be registered
throws:
  IllegalStateException - if there is a conflicting handler registered
See Also:   ControllerClassNameHandlerMapping.getApplicationContext()



registerControllers
protected void registerControllers(Class controllerType) throws BeansException(Code)
Register all controllers of the given type, searching the current DispatcherServlet's ApplicationContext for matching beans.
Parameters:
  controllerType - the type of controller to search for
throws:
  BeansException - if the controllers couldn't be obtained or registered



setExcludedClasses
public void setExcludedClasses(Class[] excludedClasses)(Code)
Specify controller classes that should be excluded from this mapping. Any such classes will simply be ignored by this HandlerMapping.



setExcludedPackages
public void setExcludedPackages(String[] excludedPackages)(Code)
Specify Java packages that should be excluded from this mapping. Any classes in such a package (or any of its subpackages) will be ignored by this HandlerMapping.

Default is to exclude the entire "org.springframework.web.servlet.mvc" package, including its subpackages, since none of Spring's out-of-the-box Controller implementations is a reasonable candidate for this mapping strategy. Such controllers are typically handled by a separate HandlerMapping, e.g. a org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping , alongside this ControllerClassNameHandlerMapping for application controllers.




Methods inherited from org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
protected void exposePathWithinMapping(String pathWithinMapping, HttpServletRequest request)(Code)(Java Doc)
protected Object getHandlerInternal(HttpServletRequest request) throws Exception(Code)(Java Doc)
final public Map getHandlerMap()(Code)(Java Doc)
public Object getRootHandler()(Code)(Java Doc)
protected Object lookupHandler(String urlPath, HttpServletRequest request)(Code)(Java Doc)
protected void registerHandler(String[] urlPaths, String beanName) throws BeansException, IllegalStateException(Code)(Java Doc)
protected void registerHandler(String urlPath, Object handler) throws BeansException, IllegalStateException(Code)(Java Doc)
public void setAlwaysUseFullPath(boolean alwaysUseFullPath)(Code)(Java Doc)
public void setLazyInitHandlers(boolean lazyInitHandlers)(Code)(Java Doc)
public void setPathMatcher(PathMatcher pathMatcher)(Code)(Java Doc)
public void setRootHandler(Object rootHandler)(Code)(Java Doc)
public void setUrlDecode(boolean urlDecode)(Code)(Java Doc)
public void setUrlPathHelper(UrlPathHelper urlPathHelper)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.