aspose file tools*
The moose likes Tomcat and the fly likes Tomcat 5.0 FORM authentication + servlet mapping problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 5.0 FORM authentication + servlet mapping problem" Watch "Tomcat 5.0 FORM authentication + servlet mapping problem" New topic
Author

Tomcat 5.0 FORM authentication + servlet mapping problem

Will Ross
Greenhorn

Joined: Apr 10, 2003
Posts: 4
Hi All,

Sorry if this is a little long. Just trying to explain my problem in detail..

I'm upgrading an application from [JBoss 2.4.3 + Tomcat 3.2.3 + JDK 1.3.1_12] to [JBoss 3.2.6 + Tomcat 5.0.28 + JDK 1.4.2_05]. I've come to one problem that I'm stuck on; I'm hoping someone can point me to a fix.

The application uses form-based authentication. The relevant section of the web descriptor is:



There are two main servlets ("user" and "admin"), declared and mapped as follows:



There is also an index.jsp file in the root of the web app that just redirects to /user.

This all works in Tomcat 3. When a user directs their browser to "/App", "/App/user", or "/App/user/" they go to the login page, and after logging in they go to "/App/user" and see the output of the "user" servlet. When a user directs their browser to "/App/admin" or "/App/admin/" they go to the login page, and after logging in they go to "/App/admin" and see the output of the "admin" servlet.

On Tomcat 5, the following URLs go to the locations listed. I removed index.jsp from the root, so that there is no extra redirection to confuse things.

/App --> /App/ (directory listing)

/App/ --> /App/ (directory listing)

/App/user --> redirects to /App/index.jsp, and displays 404 error saying /index.jsp is missing

/App/user/ --> redirects to /App/user/index.jsp, and displays login page. After logging in, redirects to /App/user/index.jsp and displays a 404 error saying /user/index.jsp is missing

/App/admin --> redirects to /App/index.jsp, and displays 404 error saying /index.jsp is missing

/App/admin/ --> redirects to /App/admin/index.jsp, and displays login page. After logging in, redirects to /App/admin/index.jsp and displays a 404 error saying /admin/index.jsp is missing


If I change login to BASIC instead of FORM, I get the following behavior:

/App --> /App/ (directory listing)

/App/ --> /App/ (directory listing)

/App/user --> pops up login box, then goes to /App/user, showing output of user servlet.

/App/user/ --> pops up login box, then goes to /App/user, showing output of user servlet.

/App/admin --> pops up login box, then goes to /App/admin, showing output of admin servlet.

/App/admin/ --> pops up login box, then goes to /App/admin, showing output of admin servlet.

This has me very confused. The behavior with BASIC authentication is exactly what I want, but if I turn on FORM authentication all of my servlet mappings seem to break. Did something change in the Servlet 2.3 spec related to servlet mappings? Or is there something else wrong?

Thanks in advance!
-will
[ January 04, 2005: Message edited by: Will Ross ]
 
 
subject: Tomcat 5.0 FORM authentication + servlet mapping problem