spring-3

MVC Java Config - HandlerInterceptor not excluding paths

感情迁移 提交于 2019-12-03 11:53:25
问题 I have a MVC Java configuration but the HandlerInterceptor is not excluding some patterns. At the line marked with xxx , if 1) I add both addPatterns("/**") and excludePathPatterns("*.ecxld") to the HandlerInterceptor 's InterceptorRegistration , the HandlerInterceptor.preHanlde() is NOT invoked at all. e.g .addPathPatterns("/**").excludePathPatterns("*.ecxld") 2) I add only excludePathPatterns("*.ecxld") to the HandlerInterceptor 's InterceptorRegistration , the HandlerInterceptor.preHanlde(

Spring 3.0.6 MVC @PathVariable and @RequestParam blank/empty in JSP view

戏子无情 提交于 2019-12-03 11:19:30
I have been trying to get an incredibly simple controller/view set up, and just can't make it work. In my web.xml , I've defined a <servlet> called servlet-context.xml , which is running ok. In servlet-context.xml , I've set: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" <...other stuff in here... /> <mvc:annotation-driven /> among other things. My understanding is this is all that's needed to use @ annotations. In my controller, I have: @RequestMapping(value="/student/{username}/", method

Assertive programming with JavaScript

对着背影说爱祢 提交于 2019-12-03 11:09:53
I know why assertive programming is good, so I want to use it with JavaScript. However, I don't want to show users error boxes, and it's unusual thing. Just ignore it and make them retry could be better. For example this code will make an error box and interrupt users. function getDomainFromURL(url) { assertTrue(url, 'URL should not be null'); ...parsing } So, I'd make like this. function getDomainFromURL(url) { if (!url) return; ...parsing } Second one is good for usability, I think, and first one is good for developing. Therefore, IMO it would be the best to combine these and make the assert

A component named 'XXX' is already defined in this module in JBoss 7.1.1

淺唱寂寞╮ 提交于 2019-12-03 10:50:00
问题 I did not create the spring bean name with TimerServiceDispatcher in my application. But, the JBoss throw exception because of TimerServiceDispatcher is already defined in this module. I don't know what is the problem. What I am missing? What I need to do? My application use Seam 2.3, Spring 3.0 and JPA 2.0. I don't use EJB . 11:29:01,531 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "MRBS.war" 11:29:04,217 ERROR [org.jboss.msc.service.fail]

Spring MVC 3 : Ambiguous mapping found

自闭症网瘾萝莉.ら 提交于 2019-12-03 10:30:51
I am playing with spring MVC 3.1 and testing different features. I wanted to verify following statement taken from @RequestMapping#value doc If you have a single default method (without explicit path mapping), then all requests without a more specific mapped method found will be dispatched to it. If you have multiple such default methods, then the method name will be taken into account for choosing between them So I created following controller with multiple default handler methods. @Controller @RequestMapping("/book") public class BookController { @RequestMapping public @ResponseBody String

Spring 3 Security: AccessDeniedHandler is not being invoked

两盒软妹~` 提交于 2019-12-03 10:16:23
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an Access is Denied exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that doesn't get invoked. Based on the type of the requested resource, I would like to show custom error messages or pages. Here is my spring configuration. How do I get Spring to invoke my access-denied-handler . Here is my spring configuration <security:http auto-config='true'>

Creating unitary tests in Spring 3

泪湿孤枕 提交于 2019-12-03 09:53:23
问题 I'm starting on testing applications in general and I want to create several tests to learn Mockito in Spring. I've been reading several information but I have some general doubts I'd like to ask. I have seen come Mockito tests and they annotate the test of the class with: @RunWith(MockitoJUnitRunner.class) while in the Spring documentation it is used @RunWith(SpringJUnit4ClassRunner.class) . I don't know what's the difference between them and which one should I use for a Spring application

How to test POST spring mvc

扶醉桌前 提交于 2019-12-03 08:48:49
My problem is to how to call this. I could do MyObject o = new MyObject(); myController.save(o, "value"); but this is not what I would like to do. I would like the MyObject to be in the request post body? How can this be done? @Requestmapping(value="/save/{value}", method=RequestMethod.POST) public void post(@Valid MyObject o, @PathVariable String value{ objectService.save(o); } Just to be clear I am talking about unit testing. Edit: @RequestMapping(value = "/", method = RequestMethod.POST) public View postUser(ModelMap data, @Valid Profile profile, BindingResult bindingResult) { if

Downloading Spring Jars without using Maven

Deadly 提交于 2019-12-03 08:43:17
问题 How do you download Spring Framework jars if you can't stand Maven or any of the other build management tools. From what I can tell it seems you have to spend many frustrating hours on Google to find out how to do this. I thought Spring was supposed to be easy. All I'm trying to do is to write a simple Hello World application using Eclipse and Tomcat. Why is it so difficult with Spring 3? 回答1: go there http://repo.spring.io/release/org/springframework/spring/ you can see all versions, like

spring-security - where can I find the list of ALL security filters registered when I use the <http> element?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 06:51:30
问题 There are a default set of filters registered when we use the <http> element in our xml file. This mentions the ordering of filters (whichever we choose to apply), and just above that, it mentions : <bean id="filterChainProxy" class="org.springframework.security.web.FilterChainProxy"> <constructor-arg> <list> <sec:filter-chain pattern="/restful/**" filters=" securityContextPersistenceFilterWithASCFalse, basicAuthenticationFilter, exceptionTranslationFilter, filterSecurityInterceptor" /> <sec