- 浏览: 615773 次
- 性别:
- 来自: 杭州
文章分类
- 全部博客 (228)
- io (15)
- cluster (16)
- linux (7)
- js (23)
- bizarrerie (46)
- groovy (1)
- thread (1)
- jsp (8)
- static (4)
- cache (3)
- protocol (2)
- ruby (11)
- hibernate (6)
- svn (1)
- python (8)
- spring (19)
- gma (1)
- architecture (4)
- search (15)
- db (3)
- ibatis (1)
- html5 (1)
- iptables (1)
- server (5)
- nginx (4)
- scala (1)
- DNS (1)
- jPlayer (1)
- Subversion 版本控制 (1)
- velocity (1)
- html (1)
- ppt poi (1)
- java (1)
- bizarrerie spring security (1)
最新评论
-
koreajapan03:
楼主啊,好人啊,帮我解决了问题,谢谢
自定义过滤器时,不能再使用<sec:authorize url="">问题 -
snailprince:
请问有同一页面,多个上传实例的例子吗
webuploader用java实现上传 -
wutao8818:
姚小呵 写道如何接收server返回的参数呢?例如你返回的是“ ...
webuploader用java实现上传 -
姚小呵:
如何接收server返回的参数呢?例如你返回的是“1”,上传的 ...
webuploader用java实现上传 -
zycjf2009:
你好,我想用jplayer做一个简单的播放器,但是因为对js不 ...
jplayer 实战
这里也提到这个问题
http://forum.springsource.org/showthread.php?p=151750
Allow ControllerClassNameHandlerMapping and @Controller to work together
似乎在Spring mvc 2.5.4里面有一个 bug
就是当你实现一个controller 时候,使用 COC原则自动映射。无法映射到对应的默认方法 handleRequestInternal
这个问题在 spring 官方论坛的mvc版块里面也提到了这个问题。还是 appfuse Matt Raible 提交的。
具体的一个解决方式是 Keith Donald 提出的。看看他的配置文件就知道了。
Matt Raible 看了以后说
Thanks Keith - your webmvc-config.xml seems to contain the magic sauce that makes this work as expected.
Keith Donald added a comment - 14/Apr/08 12:27 PM
In Matt's example the index method on HomeController would be mapped to the URL /home/index by the 2.5.3 convention, which I imagine isn't what he wants.
Just to provide more usage examples of this feature, here is an example in the Spring MVC + Web Flow reference application "booking-mvc". You can see the code on-line here: https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc
Specifically see:
@Controller code: https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/HotelsController.java
Config:
https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webmvc-config.xml
The URls mapped by convention are then:
/hotels/index
/hotels/search
/hotels/show
/hotels/deleteBooking
But no, /hotels doesn't mapped to to the index method by default... not in 2.5.3 anyway. Is this the convention you want? Perhaps we could employ a convention to map the root controller URL e.g. /home to a "home" method on the HomeController...
提交到JIRA链接在这里
http://jira.springframework.org/browse/SPR-4129
下面2个spring mvc 相关的链接可以看看
http://blog.springsource.com/2007/11/14/annotated-web-mvc-controllers-in-spring-25/
http://code.google.com/p/nestorurquiza/wiki/SpringMVCTutorial
http://forum.springsource.org/showthread.php?p=151750
Allow ControllerClassNameHandlerMapping and @Controller to work together
似乎在Spring mvc 2.5.4里面有一个 bug
就是当你实现一个controller 时候,使用 COC原则自动映射。无法映射到对应的默认方法 handleRequestInternal
这个问题在 spring 官方论坛的mvc版块里面也提到了这个问题。还是 appfuse Matt Raible 提交的。
具体的一个解决方式是 Keith Donald 提出的。看看他的配置文件就知道了。
Matt Raible 看了以后说
Thanks Keith - your webmvc-config.xml seems to contain the magic sauce that makes this work as expected.
引用
Keith Donald added a comment - 14/Apr/08 12:27 PM
In Matt's example the index method on HomeController would be mapped to the URL /home/index by the 2.5.3 convention, which I imagine isn't what he wants.
Just to provide more usage examples of this feature, here is an example in the Spring MVC + Web Flow reference application "booking-mvc". You can see the code on-line here: https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc
Specifically see:
@Controller code: https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/HotelsController.java
Config:
https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webmvc-config.xml
The URls mapped by convention are then:
/hotels/index
/hotels/search
/hotels/show
/hotels/deleteBooking
But no, /hotels doesn't mapped to to the index method by default... not in 2.5.3 anyway. Is this the convention you want? Perhaps we could employ a convention to map the root controller URL e.g. /home to a "home" method on the HomeController...
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <!-- Maps request paths to flows in the flowRegistry; e.g. a path of /hotels/booking looks for a flow with id "hotels/booking" --> <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> <property name="order" value="0" /> <property name="flowRegistry" ref="flowRegistry" /> </bean> <!-- Maps request paths to @Controller classes; e.g. a path of /hotels looks for a controller named HotelsController --> <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"> <property name="order" value="1" /> <property name="defaultHandler"> <!-- If no @Controller match, map path to a view to render; e.g. the "/intro" path would map to the view named "intro" --> <bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" /> </property> </bean> <!-- Resolves logical view names returned by Controllers to Tiles; a view name to resolve is treated as the name of a tiles definition --> <bean id="tilesViewResolver" class="org.springframework.js.ajax.AjaxUrlBasedViewResolver"> <property name="viewClass" value="org.springframework.webflow.mvc.view.FlowAjaxTilesView"/> </bean> <!-- Configures the Tiles layout system --> <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"> <property name="definitions"> <list> <value>/WEB-INF/layouts/layouts.xml</value> <value>/WEB-INF/views.xml</value> <value>/WEB-INF/hotels/views.xml</value> <value>/WEB-INF/hotels/booking/views.xml</value> </list> </property> </bean> <!-- Dispatches requests mapped to POJO @Controllers implementations --> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> <!-- Dispatches requests mapped to org.springframework.web.servlet.mvc.Controller implementations --> <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" /> <!-- Dispatches requests mapped to flows to FlowHandler implementations --> <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter"> <property name="flowExecutor" ref="flowExecutor"/> </bean> <!-- Custom FlowHandler for the hotel booking flow --> <bean name="hotels/booking" class="org.springframework.webflow.samples.booking.BookingFlowHandler" /> </beans>
提交到JIRA链接在这里
http://jira.springframework.org/browse/SPR-4129
下面2个spring mvc 相关的链接可以看看
http://blog.springsource.com/2007/11/14/annotated-web-mvc-controllers-in-spring-25/
http://code.google.com/p/nestorurquiza/wiki/SpringMVCTutorial
发表评论
-
webuploader用java实现上传
2014-10-17 23:55 40773<div id="uploader&q ... -
springmvc,Servlet3异步,websocket
2014-10-17 22:58 1441spring4.0以后加入了对websocket技术的支持 ... -
SpringMVC中的文件上传【转发】
2014-09-19 21:54 1035http://blog.csdn.net/jadyer/art ... -
{转}spring security 3 自定义认证授权示例
2011-11-10 16:46 2313转:http://www.4ucode.com/Study/T ... -
用spring resource 接口获取 web应用的ROOT目录
2010-12-09 19:44 3160Resource r = new ClassPathResou ... -
springmvc 表单 @RequestMapping 上传文件
2010-06-04 18:08 6538@RequestMapping(method = Req ... -
spring MessageSource
2009-06-12 13:06 1300http://www.blogjava.net/xzclog/ ... -
PagedListHolder
2009-03-26 23:32 1689org.springframework.beans.suppo ... -
HOWTO: Use Freemarker, SiteMesh, and Spring MVC(2)
2009-03-19 23:52 2033Here's an example of the Freema ... -
HOWTO: Use Freemarker, SiteMesh, and Spring MVC(1)
2009-03-19 23:50 4798<object classid="c ... -
spring mvc & freemarker 版ROR
2008-06-19 01:27 3568实现COC原则无配置自动映射 引用http://localho ... -
spring mvc 也能实现 ror 类似的URL路由
2008-06-18 18:54 3581看过ror的朋友一定知道它所体现的一个核心思想就是惯例优先原则 ... -
重头开始学 Spring JPetStore 5
2008-06-18 18:25 2045重头开始学 Spring JPetStore 4 里面的Con ... -
重头开始学 Spring JPetStore 4
2008-06-18 15:42 2463跟踪一个 .do 请求吧 就它了。 Enter the S ... -
重头开始学 Spring JPetStore 3
2008-06-18 14:21 2313按 重头开始学 Spring JPetStore 2 中的提示 ... -
重头开始学 Spring JPetStore 2
2008-06-17 11:50 17722. BUILD AND DEPLOYMENT 编译和发布 ... -
重头开始学 Spring JPetStore 1
2008-06-17 11:35 1655先看看它的readme.txt 引用@author Juer ... -
一个关于Spring的好消息及Spring Batch概述
2008-05-26 00:45 56853年前,即将大学毕业,遇到了spring,还以SSH框架为题做 ...
相关推荐
Spring 3.x Restfull示例 控制器类别名称매핑방법1번 ControllerClassNameHandlerMapping와Bean용해이용해이같 < bean class = " one.contro
* ControllerClassNameHandlerMapping:通过使用控制器的类名作为URL基础将控制器映射到URL。 * DefaultAnnotationHandlerMapping:将请求映射给使用@RequestMapping注解的控制器和控制器方法。 * ...
- **ControllerClassNameHandlerMapping**:通过URL映射到类名。 ##### 4. HandlerAdapter **HandlerAdapter**用于执行具体的Handler。SpringMVC提供了多种类型的Adapter,比如: - **...
控制器类名-处理器映射ControllerClassNameHandlerMapping允许通过类名直接映射请求到处理器。 在控制器中设置Cache-Control、ETag和Last-Modified响应头可指导客户端如何缓存响应内容,以及如何在后续请求中使用...
Spring MVC提供了“约定优于配置”的Web安全支持,可以通过配置`ControllerClassNameHandlerMapping`来实现基于控制器类名的映射。此外,还可以自定义异常解析器处理各种异常,包括业务异常和HTTP状态码的映射。 ...
WebApplicationContext 中特殊的 Bean 类型包括 HandlerMapping、HandlerAdapter、Controller 等,它们是框架用来处理请求的重要组件。 默认的 DispatcherServlet 配置涉及了 Spring 配置文件的设置,说明了如何...
2. ControllerClassNameHandlerMapping,根据controller名称进行对应,注意命名规则,地址栏上写最后的类名要全部小写,如果最后是controller,可以省略,也可以首字母不区分大小写。 3. SimpleUrlHandlerMappering...
3 URL Mapping: ControllerClassNameHandlerMapping 映射控制器 4 使用MultiActionController 5 所有service利用spring注入到controller中,利用注解 6 数据库连接串单独在properties文件配置 7 在spring中配置数据...
- **使用@Controller 注解定义一个控制器**:通过这个注解可以将类标记为一个控制器,Spring 会自动检测并将其纳入管理。 - **使用@RequestMapping 注解映射请求路径**:此注解用于指定控制器处理的具体 URL 路径...
- `ControllerClassNameHandlerMapping`:根据请求URL自动推断处理器的类名。 - `RequestMappingHandlerMapping`:使用@RequestMapping注解自动映射。 ##### 3. HandlerAdapter(处理器适配器) - **定义**:...
13.11.1. 对控制器的支持:ControllerClassNameHandlerMapping 13.11.2. 对模型的支持:ModelMap(ModelAndView) 13.11.3. 对视图的支持:RequestToViewNameTranslator 13.12. 基于注解的控制器配置 13.12.1. ...
13.11.1. 对控制器的支持:ControllerClassNameHandlerMapping 13.11.2. 对模型的支持:ModelMap(ModelAndView) 13.11.3. 对视图的支持:RequestToViewNameTranslator 13.12. 基于注解的控制器配置 13.12.1. ...
13.11.1. 对控制器的支持: ControllerClassNameHandlerMapping 13.11.2. 对模型的支持:ModelMap (ModelAndView) 13.11.3. 对视图的支持: RequestToViewNameTranslator 13.12. 其它资源 14. 集成视图技术 14.1. ...
ControllerClassNameHandlerMapping Conventions CookieGenerator CookieLocaleResolver CookieThemeResolver CosMailSenderImpl CosMultipartHttpServletRequest CosMultipartResolver CronTriggerBean ...