You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by mikewse <mi...@hotmail.com> on 2011/01/25 01:05:36 UTC
servlet spec violation?
Trying out a simple servlet on Tomcat 6 and 7:
<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>
mounting the application on the context path:
/app
and sending a request:
GET /app
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).
Or am I missing something?
Best regards
Mike Wilson
--
View this message in context: http://old.nabble.com/servlet-spec-violation--tp30748094p30748094.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: servlet spec violation?
Posted by Mark Thomas <ma...@apache.org>.
On 05/02/2011 19:50, Mike Wilson wrote:
> Ok, so how do we get this fixed? Should I submit a bug report
> somewhere, post the full code that reproduces the problem, or
> something else?
Create a bugzilla entry. If you add some sample code for the simplest
possible servlet that demonstrates the issue that would be appreciated.
Mark
>
> Thanks
> Mike
>
> Mike Wilson wrote:
>> Konstantin Kolinko wrote:
>>> 2011/1/25 mikewse <mi...@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.
>
>
> ---------------------------------------------------------------------
> 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
RE: servlet spec violation?
Posted by Mike Wilson <mi...@hotmail.com>.
Ok, so how do we get this fixed? Should I submit a bug report
somewhere, post the full code that reproduces the problem, or
something else?
Thanks
Mike
Mike Wilson wrote:
> Konstantin Kolinko wrote:
> > 2011/1/25 mikewse <mi...@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.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: servlet spec violation?
Posted by Mike Wilson <mi...@hotmail.com>.
Konstantin Kolinko wrote:
> 2011/1/25 mikewse <mi...@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
Re: servlet spec violation?
Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/1/25 mikewse <mi...@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. I suspect that it might be if there is no
welcome file at the root of the webapp.
> 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