Q:

How spring use https for request automatically?

I'm implementing a web application using spring 3.2.8.RELEASE and tomcat 7.0.55. 
I need spring to use https for some requests for example '/login' but not for all requests.
The application runs on http and https perfectly, but I want to filter some request to run on https automatically.
How can I config spring to do this?

A:

You can configure that https is required by adding requires-channel- attribute on each intercept-url. 
For example:
<security:intercept-url pattern="/your_url" access="your_role" requires-channel="https"/>

EDIT:
Required spring security mappings in web.xml:
<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

I hope this will work.

