Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8880041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:05:11+00:00 2026-06-14T20:05:11+00:00

I have an application which uses spring (also spring security) where few services were

  • 0

I have an application which uses spring (also spring security) where few services were kept outside the secured resource set by specifying like below in the applicationContext.xml:

<http pattern="/services/rest/nohisb/Msgs" security="none"/>

Now these services needs to be accessed only via https. Container is configured to have https. Requirement is when user access the above service on http, he should be redirected to https (port number too changes, as it in not the default 443).

Is it possible to achieve this via spring ?

thanks

Nohsib

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:05:12+00:00Added an answer on June 14, 2026 at 8:05 pm

    Yes, it is possible to achieve using Spring Channel Processing and PortMapper

    Spring Channel Processing used to define http/https access URL Patterns. For Example-

    Https Access URL-

    https://localhost/myapp/user/myaccount
    

    Http: Access URL-

    http://localhost/myapp/home
    

    Then if user access the secure URL in http mode “http://localhost/myapp/user/myaccount” spring channel security redirect the user to secure URL “https://localhost/myapp/user/myaccount” and vice verse.

    PortMapper Bean is used map non-standard port numbers for HTTP and HTTPS mapping

    Sample Configuration:

    Channel Processing Bean Definition And Port Mapper-

    <bean id="channelProcessingFilter" class="org.springframework.security.web.access.channel.ChannelProcessingFilter">
      <property name="channelDecisionManager" ref="channelDecisionManager"/>
      <property name="securityMetadataSource">
            <security:filter-security-metadata-source path-type="ant">
                <security:intercept-url pattern="/services/rest/nohisb/Msgs**" access="REQUIRES_SECURE_CHANNEL" />
                <security:intercept-url pattern="/**/*.html**" access="REQUIRES_SECURE_CHANNEL" />
    
                <!-- more pattern definition -->
    
            </security:filter-security-metadata-source>
      </property>
    </bean>
    
    <bean id="channelDecisionManager" class="org.springframework.security.web.access.channel.ChannelDecisionManagerImpl">
      <property name="channelProcessors">
        <list>
            <ref bean="secureChannelProcessor"/>
            <ref bean="insecureChannelProcessor"/>
        </list>
      </property>
    </bean>
    
    <bean id="secureChannelProcessor" class="org.springframework.security.web.access.channel.SecureChannelProcessor">
        <property name="entryPoint" ref="secureEntryPoint"/>
    </bean>
    
    <bean id="insecureChannelProcessor" class="org.springframework.security.web.access.channel.InsecureChannelProcessor">
        <property name="entryPoint" ref="insecureEntryPoint"/>
    </bean>
    
    <bean id="secureEntryPoint" class="org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint">
        <property name="portMapper" ref="portMapper"/>
    </bean>
    
    <bean id="insecureEntryPoint" class="org.springframework.security.web.access.channel.RetryWithHttpEntryPoint">
        <property name="portMapper" ref="portMapper"/>
    </bean>
    
    <bean id="portMapper" class="org.springframework.security.web.PortMapperImpl">
        <property name="portMappings">
            <map>
                <entry key="80" value="443"/>
                <entry key="8081" value="8443"/>
                <entry key="8443" value="8081"/>
                <!-- so on... -->
            </map>
        </property>
    </bean>
    

    Filter Mapping-

    <security:http auto-config="false" 
                entry-point-ref="authenticationProcessingFilterEntryPoint" 
                access-decision-manager-ref="accessDecisionManager" >
    
        <security:custom-filter position="CHANNEL_FILTER" ref="channelProcessingFilter"/>
    
        <security:intercept-url pattern="/*.html*" access="ROLE_ANONYMOUS,admin,user"  />
        <security:intercept-url pattern="/*.jsp" access="ROLE_ANONYMOUS,admin,user" />
    
        <!-- more pattern definition -->
    
    </security:http>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have application, which uses Spring, Hibernate and Spring Security. My goal is to
I have a Spring MVC application which uses FreeMarker as View technology (But maybe
I have an IOS application which uses environment variables and am able to set
I have a java web application which uses spring webflow as framework. I have
I have a web application that uses spring security. It uses <intercept-url ../> elements
We have a JSF web application that uses Acegi security. We also have a
We have implemented JUnit4 in our application which uses Spring core & JPA with
I have application which uses Sherlock ActionBar package. The application uses platform-specific behavior for
I have an application which uses the microsoft kinect device. The thing is that
I have an application which uses code that produces various types of objects and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.