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 8515501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:09:50+00:00 2026-06-11T05:09:50+00:00

I created a small and simple webapp using Spring Security and SpringMVC and I’m

  • 0

I created a small and simple webapp using Spring Security and SpringMVC and I’m trying to convert it to be a multi-tenant application.
The concept I want is to re-use actual JSPs I have and alter their contents based on configuration which I determine based on the path of the URL.

Example:
Customer #1 (abc) – URL: http://mydomain.com/abc/login.html
Customer #2 (xyz) – URL: http://mydomain.com/xyz/login.html

So the name of the “tenant” is a prefix to the page’s path.

I modified my controller to be like this:

@Controller
@RequestMapping("/{customer:[a-zA-Z0-9]+}/login.htm")
public class LoginController 
{
    private static final Logger logger = Logger.getLogger(LoginController.class);

    @RequestMapping
    @ReadOnlyRequest
    public String login(@PathVariable("customer") String customer, HttpServletRequest request) 
    {
        // Do some 'customer' related actions here

        return "login"; // Map to the 'login.jsp' view
    }
}

My view resolver configuration is:

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
   <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
   <property name="prefix" value="/WEB-INF/jsp/" />
   <property name="suffix" value=".jsp" />
</bean>

Until now, I had the following form-login configuration:

<form-login 
   login-page="/login.htm"
   authentication-failure-url="/login.htm?error=true"
   login-processing-url="/login_process"
   default-target-url="/index.jsp"
   always-use-default-target="true"
/>

But I do not know how to convert it to support my changes.

Is there a way to convert it to something like:

<form-login 
  login-page="/${customer}/login.htm"
  authentication-failure-url="/${customer}/login.htm?error=true"
  login-processing-url="/${customer}/login_process"
  default-target-url="/index.jsp"
  always-use-default-target="true"
/>
  • 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-11T05:09:51+00:00Added an answer on June 11, 2026 at 5:09 am

    One possible idea is to use URL rewriting instead of manual handling of tenant identifiers. This way you can completely decouple tenant handling logic from your code, for example, as follows:

    • You define an inbound rewriting rule that converts /abc/login.html to /login.html and saves tenant identifier as a request attribute.

    • You define an outbound rule that appends the current tenant identifier to URLs being written into response. I think Spring Security should respect such a rule when sending redirects (if it doesn’t, you can define a custom RedirectStrategy).

    Though I have not tested this idea and cannot be sure that it would work.

    See also:

    • OCPSoft Rewrite
    • UrlRewriteFilter
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had created a small multi threaded application and I am trying to convert
I am using Eclipse with WindowsBuilder. I have created a small simple project to
I'm having a small problem with my insert statements in Spring-data/jpa/hibernate/mysql/junit application. I created
I have created a small and simple android app. I tried installing it on
I created a small WPF desktop application. I am thinking about how to make
I've created a small helpers framework and I want it to be multi-languages. So
I have created a small chatting application in C#, and started as a Console
I have created a small parser in c using flex and bison. The parser
Based on this question I've created a small application which is catching all debug
I have created a use case of a small application and now I have

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.