tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Wilson <mike...@hotmail.com>
Subject RE: servlet spec violation?
Date Tue, 25 Jan 2011 12:56:29 GMT
Konstantin Kolinko wrote:
> 2011/1/25 mikewse <mikewse@hotmail.com>:
> >
> > Trying out a simple servlet on Tomcat 6 and 7:
> (..)
> > and sending a request:
> >        GET /app
> 
> AFAIK, usually Tomcat will respond with 302 redirect to /app/ and the
> second request will be GET /app/.  So, one question is why it is not
> happening in your case. 

This redirect happens if I instead map my servlet as a default 
servlet (servlet-mapping to /), but in this case I am using 
path mapping (/*) and no redirect is issued.

Getting the /app request through without having the container
insert a redirect to /app/ is preferrable (so I would rather
remove redirecting from the default servlet case as well).

> I suspect that it might be if there is no
> welcome file at the root of the webapp.

There are no files in the webapp apart from web.xml and the Java
files. Here's the full web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5">
	<display-name>servlet25tries</display-name>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
	<servlet>
		<servlet-name>pathservlet</servlet-name>
		<servlet-class>LoggingServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>pathservlet</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>
</web-app>

Best regards
Mike

> > yields the following values on the request:
> >        requestUri = "/app"
> >        contextPath = "/app"
> >        servletPath = ""
> >        pathInfo = "/"
> > This seems to violate the rule:
> >        requestUri = contextPath + servletpath + pathInfo
> > on page 28 of the Servlet 2.5 spec (pathInfo should be null).
> 
> Looks like it. Though I have never seen such requests - as said above.
> 
> 
> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message