Rectangle 27 0

As the spring filter is applied to all requests, this is also the case for png images. For the first question you can filter png's with a line like this

<intercept-url pattern="/**/*.png" access="ROLE_ANONYMOUS" />

or if you decide to use access expressions with

<intercept-url pattern="/**/*.png" access="true" />

But from your config files, this should be the case anyway.

Another way of doing this is:

<http pattern="/**/*.png" security="none"/>

java - Spring MVC + Spring Security + JPA returns Null ModelAndView an...

java spring spring-mvc spring-security
Rectangle 27 0

The answer of Adrian is good. With Spring 4 and Spring Security 4 we do filtering for images and others resources like that now:

<http auto-config="true" use-expressions="true">
    <intercept-url pattern="/" access="permitAll" />
    <intercept-url pattern="/assets**" access="permitAll" />
    <intercept-url pattern="/images**" access="permitAll" />
...
</http>

That ant-style pattern notation allows you to do not care about folders hierarchies for your resources.

Of course you must use appropriate access rights with tags like that:

<intercept-url pattern="/private.do" access="hasAnyRole('ROLE_USER','ROLE_ADMIN')" />
<intercept-url pattern="/admin.do" access="hasRole('ROLE_ADMIN')" />

And do not forget to activate CSRF protection with:

<csrf/>

I found it very handy to configure. Five years ago it was not so easy :)

java - Spring MVC + Spring Security + JPA returns Null ModelAndView an...

java spring spring-mvc spring-security
Rectangle 27 0

If you meant to return the string ReproduceError, then mark the return value with @ResponseBody.

On the other hand, if you've got a View called ReproduceError then perhaps your view resolver isn't configured properly?

EDIT: ok, looks like a rendering of the ReproduceError view is intended, but from the logfile it seems that the controller method isn't being hit.

Sorry, I'm not the type who runs random code I found on the internet! However, I can tell you that your edited post has already told me something - I don't think your method is being hit! I'm willing to look at the rest of your log file though, can you post that somewhere?

I added the answer to the end of my OP. I am also marking yours as the answer and +1 to thank you for looking into this. Separately, a zipped eclipse project is just a collection of folders and classes with some configs. In this case, the contents were so minimalistic that it would only have taken a few minutes to simply cut and paste files into a new project and to read each file rather than just blindly importing. But the problem is solved now anyway.

java - Spring returning null ModelAndView to DispatcherServlet - Stack...

java eclipse spring spring-mvc
Rectangle 27 0

For posterity: I was able to finally get this working by redirecting errors to a page that Spring MVC had a controller for. The controller just returned a null ModelAndView. Because it was a RESTful service, I really didn't need to have any HTML emitted anyway.

java - Custom Error Pages in JBoss - Stack Overflow

java web-services jboss
Rectangle 27 0

As the spring filter is applied to all requests, this is also the case for png images. For the first question you can filter png's with a line like this

<intercept-url pattern="/**/*.png" access="ROLE_ANONYMOUS" />

or if you decide to use access expressions with

<intercept-url pattern="/**/*.png" access="true" />

But from your config files, this should be the case anyway.

Another way of doing this is:

<http pattern="/**/*.png" security="none"/>

java - Spring MVC + Spring Security + JPA returns Null ModelAndView an...

java spring spring-mvc spring-security
Rectangle 27 0

viewResolver
tilesConfigurer
tx:annotation-driven
mvc:annotation-driven

Moving it to the servlet context solved the problem.

Could you elaborate ? I've also served time in there.

spring - Null ModelAndView returned to DispatcherServlet - Stack Overf...

spring hibernate tiles