abiieez
abiieez

Reputation: 3189

Spring MVC custom URL

I'd like to customize the URL of a current web application. For example the current default landing page is

https://somedomain/index

Now I need to customize the URL based on the user company. For example if the company is ABC then the URL would be

https://abc.somedomain/index

OR

https://somedomain/abc/index

And for this company I want to apply a custom CSS`

How can I achieve this ?

Upvotes: 1

Views: 472

Answers (1)

Aakash
Aakash

Reputation: 1791

Well what I'm writing here is not the best solution. But, I think it will satisfy what you are trying to do.

My strong suggestion is to find a better way of doing this.

<c:set var="serverName" value="${ pageContext.request.serverName }"></c:set>
<c:set var="split" value="${ fn:split(serverName, '.') }"></c:set>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="resources/css/${split[0]}.index.css">

this should get compile to

if http://abc.domain.com/

<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="resources/css/abc.index.css">

if http://xyz.domain.com/

<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="resources/css/xyz.index.css">

Upvotes: 3

Related Questions