-
1. Re: Images only display with certain context
just_a_w Sep 16, 2003 12:56 AM (in response to just_a_w)If I change the servlet-mapping to specify a url-pattern other than "/", I can go to that page and the image will display.
So if I have the following, I can go to http://:8080/something and I will see the image.
<servlet-mapping>
<servlet-name>Controller</servlet-name>
<url-pattern>/something</url-pattern>
</servlet-mapping>
But if someone navigates to the root context at http://:8080/ they see a listing of the contents of my war file.
Any suggestions? -
2. Re: Images only display with certain context
jonlee Sep 16, 2003 6:52 AM (in response to just_a_w)The URL pattern is to map whatever matches the pattern you specify to the servlet named Controller. Placing just a '/' for the mapping is probably not the outcome you want. Please read a servlet tutorial or get a servlet development book to work through the web.xml deployment definitions.
The default application context for your WAR is Chat, assuming that your application.xml does not have an override for this mapping. This means that the overall URL for accessing your image locally would be:
http://localhost:8080/Chat/images/pic.jpg. Note that this is within your default application context /Chat.
From your description, you appear to be overriding the default application context, moving your application to the root context. So I am assuming this is what your are doing.
With the pattern match '/something', it means that your Controller servlet is run when you access http://localhost:8080/something.
Normally a web application expects an index.html, index.htm or index.jsp to be found when you enter just the http://localhost:8080/. Otherwise, with the default settings, you will get a directory listing. The configuration for welcome files <welcome-file-list> will be explained in a good servlet tutorial. This is probably a better method for achieving what you want. -
3. Re: Images only display with certain context
raja05 Sep 16, 2003 8:44 AM (in response to just_a_w)If u make ur application.xml map ur WAR To /, you should be able to achieve what you are trying to do.
Also, if u dont want the listings to be shown(on Tomcat), turn the "listings" tag to false in the <JBoss_Dist>/catalina/conf/web.xml
-Raj -
4. Re: Images only display with certain context
just_a_w Sep 16, 2003 9:53 AM (in response to just_a_w)Thanks for the responses!
One thing I forgot to mention is that I've set the context root in jboss-web.xml as follows:
<context-root>/</context-root>
Right now I'm only planning to deploy a single app on my server. So when people to navigate to my server, I want my app to be displayed at http://, without a uri on the end (without /Chat or anything).