Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with accessing a web application  RSS feed

 
Matt Cable
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I have a question about a web application I'm developing. Where do I specify what will happen when someone goes to the follwing URL - http://m-cable.com/thecontextroot

thecontextroot is my context root. It seems that if I go to http://m-cable.com/theapplicationname/ (with the trailing slash), that it will go to the correct welcome-file, but if I omit the slash, I get a 404 error.

Any ideas?

Thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66198
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some information on what container you are using and how you have set up the web app might be helpful.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you setting the welcome files?
Can you paste as how are you writing this tag in the web.xml , remember the welcome-file tag should only have filename with extension with any starting slashes.
 
Deepan Devadasan
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul,

a small correction...

welcome-file-list 's welcome-file tag should only have entries without slashes..

here is an example..


<welcome-file-list>
<welcome-file>default.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>


what happens with the above xml entry is, if a directly path accessed,
the container first looks for default.html and then index.jsp(as specified above), and will return the one that was found first...

I am also interested as how to set the container, so that when we type somedomain.com it will take to our web app directly rather than typing, somedomain.com/somewebapp

please clarify the above..as this is a crucial thing in production environments..
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh ! that was a typo , I also meant without shashle.




I am also interested as how to set the container, so that when we type somedomain.com it will take to our web app directly rather than typing, somedomain.com/somewebapp


Put the default file (as mentioned in welcome-file tag) in the context directly.You can configure your container for virtual hosts and client will send a additional Host header with the request, that would help the container to direct the request to the correct virtual host.So if you make an request to www.rahul.net , an additional request hearder will go to server as
" target="_blank">www.rahul.net[/CODE]
and the request will be enroute to virtual host www.rahul.net and the the default file would be called as according to welcome-file tag.
Check with your container documentation as how to configure a server for virtual hosts.
 
Matt Cable
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JBoss. I don't think it's an issue with the welcome-file list. If I use this URL:
http://m-cable.com/thecontextroot/

it will bring up the index.jsp found in the welcome-file list. The problem is when I use this URL:
http://m-cable.com/thecontextroot

which is the same URL minus the trailing slash.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!