You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Terence Jacyno <tj...@galasoft.net> on 2001/11/08 02:54:20 UTC

Default (/) mapping

Hi.

I too have been having some problems with the way Tomcat handles the
default mapping.  The servlet spec (version 2.2) seems to suggest that
such a path should map to a default servlet.  However, when calling
request.getPathInfo(), null is returned, which causes problems with
frameworks such as Struts.  A solution to this would be to change the
following line in the Tomcat 3.3 org.apache.tomcat.request.SimpleMapper1
class (org.apache.tomcat.request.SimpleMapper1 in Tomcat 3.2.3)
    pathI = null;
to
    pathI= (path.length() <= ctxPLen + 1) ? "" : path.substring( ctxPLen
+ 1, pathLen);

(line 444 in Tomcat 3.3, 414 in Tomcat 3.2.3).  This would make Tomcat
behave like WebLogic 6.0's interpretation.  If there are any developers
out there, please let me know what you think.  Thanks.

--
---------------------
Terence JACYNO
Galasoft Inc.



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


web-inf WLS60 vs Tomcat4.0

Posted by Carl Boudreau <ca...@notiva.com>.
OK I got it working,  the problems was that WLS6.0 allowed the
<servlet></servlet> to be mixed with <servlet-mapping></servlet-mapping>.

But this was causing Tomcat 4.0 to crash...

Tomcat is expecting the tags to be grouped together.

<servlet></servlet>
<servlet></servlet>
<servlet></servlet>

<servlet-mapping></servlet-mapping>
<servlet-mapping></servlet-mapping>
<servlet-mapping></servlet-mapping>

Thanks for the help, Carl


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: web.xml problems

Posted by "Craig R. McClanahan" <cr...@apache.org>.
The first thing you should do is download the Servlet Specification
<http://java.sun.com/products/servlet/download.html> and read the chapter
on mapping requests to servlets.  You will find that a <url-pattern> of
"ValidateUser" is illegal.  You probably want "/ValidateUser" instead.

Craig


On Wed, 7 Nov 2001, Carl Boudreau wrote:

> Date: Wed, 7 Nov 2001 20:55:53 -0600
> From: Carl Boudreau <ca...@notiva.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
>      carl.boudreau@notiva.com
> To: 'Tomcat Users List' <to...@jakarta.apache.org>
> Subject: web.xml problems
>
> Here are my files,
>
> The working copy is loading  great, but I need to add a few more Classes, so
> I am trying to use the original.
> But when I did Tomcat4.0 wouldn't load the index.html page for the web apps
> context directory.
>
> So I took a shot in the dark and only added one <servlet></servlet> tag,
> when I added the second tag is
> stops working.  This same war file is running under WLS6.0 now.
>
> I have tried placing / in the <servlet-class>  without progress, then I
> tried it in the <url-pattern></url-pattern> tag
> with out success.  I bet it is one char, throwing the whole thing off.  But
> I'll be darn if I can find it.
>
>
> The working copy.
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>     "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
>
>
> <web-app>
>
> 	<servlet>
> 		<servlet-name>ValidateUser</servlet-name>
> 		<description>Validate the incoming user servlet.</description>
> 		<servlet-class>ValidateUser</servlet-class>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>ValidateUser</servlet-name>
> 		<url-pattern>ValidateUser</url-pattern>
> 	</servlet-mapping>
>
>
> </web-app>
>
> And here is the original
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>     "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
>
>
> <web-app>
>
> 	<servlet>
> 		<servlet-name>ValidateUser</servlet-name>
> 		<description>Validate the incoming user servlet.</description>
> 		<servlet-class>ValidateUser</servlet-class>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>ValidateUser</servlet-name>
> 		<url-pattern>ValidateUser</url-pattern>
> 	</servlet-mapping>
>
>
> 	<servlet>
> 		<servlet-name>ValidUser</servlet-name>
> 		<description>If user is valid then the servlet redirects to the main
> page.</description>
> 		<servlet-class>ValidUser</servlet-class>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>ValidUser</servlet-name>
> 		<url-pattern>ValidUser</url-pattern>
> 	</servlet-mapping>
>
>
> 	<servlet>
> 		<servlet-name>Chat</servlet-name>
> 		<description>A Chat servlet.</description>
> 		<servlet-class>Chat</servlet-class>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>Chat</servlet-name>
> 		<url-pattern>Chat</url-pattern>
> 	</servlet-mapping>
>
>
> 	<servlet>
> 		servlet-name>RegisterNewUser</servlet-name>
> 		<description>This servlet adds a new user the the database.</description>
> 		<servlet-class>RegisterNewUser</servlet-class>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>RegisterNewUser</servlet-name>
> 		<url-pattern>RegisterNewUser</url-pattern>
> 	</servlet-mapping>
>
>
> 	<servlet>
> 		servlet-name>DisplayCapture</servlet-name>
> 		<description>This servlet Display Capture table from
> database.</description>
> 		<servlet-class>DisplayCapture</servlet-class>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>DisplayCapture</servlet-name>
> 		<url-pattern>DisplayCapture</url-pattern>
> 	</servlet-mapping>
>
> </web-app>
>
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


web.xml problems

Posted by Carl Boudreau <ca...@notiva.com>.
Here are my files,

The working copy is loading  great, but I need to add a few more Classes, so
I am trying to use the original.
But when I did Tomcat4.0 wouldn't load the index.html page for the web apps
context directory.

So I took a shot in the dark and only added one <servlet></servlet> tag,
when I added the second tag is
stops working.  This same war file is running under WLS6.0 now.

I have tried placing / in the <servlet-class>  without progress, then I
tried it in the <url-pattern></url-pattern> tag
with out success.  I bet it is one char, throwing the whole thing off.  But
I'll be darn if I can find it.


The working copy.
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">


<web-app>

	<servlet>
		<servlet-name>ValidateUser</servlet-name>
		<description>Validate the incoming user servlet.</description>
		<servlet-class>ValidateUser</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>ValidateUser</servlet-name>
		<url-pattern>ValidateUser</url-pattern>
	</servlet-mapping>


</web-app>

And here is the original
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">


<web-app>

	<servlet>
		<servlet-name>ValidateUser</servlet-name>
		<description>Validate the incoming user servlet.</description>
		<servlet-class>ValidateUser</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>ValidateUser</servlet-name>
		<url-pattern>ValidateUser</url-pattern>
	</servlet-mapping>


	<servlet>
		<servlet-name>ValidUser</servlet-name>
		<description>If user is valid then the servlet redirects to the main
page.</description>
		<servlet-class>ValidUser</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>ValidUser</servlet-name>
		<url-pattern>ValidUser</url-pattern>
	</servlet-mapping>


	<servlet>
		<servlet-name>Chat</servlet-name>
		<description>A Chat servlet.</description>
		<servlet-class>Chat</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>Chat</servlet-name>
		<url-pattern>Chat</url-pattern>
	</servlet-mapping>


	<servlet>
		servlet-name>RegisterNewUser</servlet-name>
		<description>This servlet adds a new user the the database.</description>
		<servlet-class>RegisterNewUser</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>RegisterNewUser</servlet-name>
		<url-pattern>RegisterNewUser</url-pattern>
	</servlet-mapping>


	<servlet>
		servlet-name>DisplayCapture</servlet-name>
		<description>This servlet Display Capture table from
database.</description>
		<servlet-class>DisplayCapture</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>DisplayCapture</servlet-name>
		<url-pattern>DisplayCapture</url-pattern>
	</servlet-mapping>

</web-app>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>