File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Create friendly URL in Apache tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Create friendly URL in Apache tomcat" Watch "Create friendly URL in Apache tomcat" New topic
Author

Create friendly URL in Apache tomcat

Foni kumar
Ranch Hand

Joined: Sep 19, 2007
Posts: 66
Hi All,

I want to modify my application URL http://localhost:8080/monitor/index.html to just monitor , so that on putting monitor on browser, my application should open. Is there a way to achieve this, can someone suggest the configuration changes which will be required for this.

Thanks and regards
Deb
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42632
    
  65
That's what the <welcome-file-list> tag in your web.xml is for.


Ping & DNS - my free Android networking tools app
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

index.html is already on the welcome list, so you don;t need to do anything to make that happen.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Foni kumar
Ranch Hand

Joined: Sep 19, 2007
Posts: 66
Ulf Dittmer wrote:That's what the <welcome-file-list> tag in your web.xml is for.


Thanks for the reply but how can I shorten this URL link http://localhost:8080/monitor/index.html to a friednly url . Can you provide me some steps so that I will be clear about this approach?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42632
    
  65
I assumed that by "friendly URL" you meant being able to use "http://localhost:8080/monitor/" instead of "http://localhost:8080/monitor/index.html". That's what <welcome-file-list> allows you to do, and a web search will quickly find more information about how to do that if you aren't familiar with it. If you meant something else, tell us what that is.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Given:

http://localhost:8080/monitor/index.html

Setting the monitor webapp's web.xml "welcome-page" to index.html will reduce to:

http://localhost:8080/monitor

Setting the monitor webapp to run under the root context would reduce to:

http://localhost:8080

Setting Tomcat to listen to port 80 would reduce to

http://localhost

Although it would typically require running Tomcat as a privileged user.

Depending on your browser, you might get it to respond at when you type in "localhost".

You could put an entry in your system's "hosts" file to map www.monitor.com to 127.0.0.1 and thereby use "monitor" as a shortcut URL, providing that your system supports a "hosts" file and that the browser you use is one of the ones that takes a simplified domain name and expands it to add the "www" and ".com" parts.






Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create friendly URL in Apache tomcat