This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes welcome file for virtual/logical path Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "welcome file for virtual/logical path" Watch "welcome file for virtual/logical path" New topic
Author

welcome file for virtual/logical path

rouven gorsky
Greenhorn

Joined: Feb 10, 2009
Posts: 14
I have got the following servlet and -mapping in my DD:

<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>com.example.web.MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/path/to/myservlet</url-pattern>
</servlet-mapping>

/path/to/myservlet is a virtual/logical path. It's not part of the file structure of my web app.

When calling http://localhost:8080/MyWebApp/path/to
I would like the server to respond with a welcome file instead of getting back a 404 error. How would you accomplish this? Please note, that /path/to/myservlet is not a physical path of my Web-Application.






Frits Walraven
Rancher

Joined: Apr 07, 2010
Posts: 1066

Hi Rouven,

Have you tried the following welcome-file mapping:

I think you have to create a fysical path "/path/to" and put your index.html in there in order for the server to find your welcome-file.
Regards,
Frits
Rafael Leandro Santos
Greenhorn

Joined: Apr 30, 2010
Posts: 4
Hi gorsky,
<welcome-file> cannot "/" character... every entry to <welcome-file> is applied to all application, (if you have directories under / YourApplication)
/path/to/myservlet is a virtual/logical path, if you configure a

will be applied to any application and not just /path/to/

You can not call direct http://localhost:8080/MyWebApp/path/to/myservlet or you can not have more than one 'path/xxx' to myservlet map, 'path/yyy' otherservlet
graciously
Rafa

Rafael L Santos
Sun Certified Java Programmer
Sun Certified Web Component Developer
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: welcome file for virtual/logical path
 
Similar Threads
How to give a path name in web.xml
URLRewriteFilter for ROOT?
getting MyFaces Tomahawk up and running in Eclipse Indigo
compile?????
The requested resource is not available