laxman kumar
laxman kumar

Reputation: 67

How tomcat handles welcome-file-list mentioned in web.xml

I am having an application where i have mentioned welcome file list like this

<welcome-file-list>
    <welcome-file>flows/login.htm</welcome-file></welcome-file-list>

So when i hit the URL of my application i.e. http://localhost:8080/demoApplication

Then it loads the welcome page i.e login page. But in URL it shows only http://localhost:8080/demoApplication not like http://localhost:8080/demoApplication/flows/login.htm

I want to show like this http://localhost:8080/demoApplication/flows/login.htm .Basically by this URL "http://localhost:8080/demoApplication" its by passing one of my filter.

So how does tomcat handles the welcome-file-list, means how does it redirects user to it. Or how do i get the URL like this http://localhost:8080/demoApplication/flows/login.htm

Upvotes: 0

Views: 407

Answers (1)

Christopher Schultz
Christopher Schultz

Reputation: 20862

If you want the URL to change then you need to send a redirect to the client. Otherwise, the client thinks that the server answered a request for http://localhost:8080/demoApplication rather than performing an internal-forward to flows/login.htm.

In version 8 and above, Tomcat has support for configurable rewriting. If you have an earlier version of Tomcat, or don't like the built-in rewrite capabilities, Tuckey's urlrewrite is very popular.

Upvotes: 1

Related Questions