You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Andrea Tomasini <an...@dsnet.it> on 2000/03/09 10:27:59 UTC

getRequestURI() ? Not JSDK2.0 Compliant??

Hi to all,
 I have noticed a strange behaviour in using getRequestURI() method, in fact
if I have an URL like this:

http://www.my.server.com/foo.jsp?param1=1&param2=2

The correct URI is "/foo.jsp" without parameters, but Tomcat give me the
complete path after server URL... "/foo.jsp?param1=1&param2=2", which is not
JSDK2.0 compliant according to "O'REILLY JAVA SERVLET PROGRAMMING"

Is that right?

Thanks
ANdreaT

Re: getRequestURI() ? Not JSDK2.0 Compliant??

Posted by Mike Engelhart <me...@earthtrip.com>.
Jason Hunter wrote:

> 
> BTW, news on the second edition is kept at
> http://www.servlets.com/book/news.html.
> 
> -jh-
> 
Sorry about that :-)
> Book's a year old but still kicking.  :-)
Totally - I still use it - I just reference the API's from the net


Re: getRequestURI() ? Not JSDK2.0 Compliant??

Posted by Jason Hunter <jh...@acm.org>.
Serge Knystautas wrote:
> 
> Mike Engelhart wrote:
> >
> > Andrea Tomasini wrote:
> >
> > > The correct URI is "/foo.jsp" without parameters, but Tomcat 
> > > give me the
> > > complete path after server URL... "/foo.jsp?param1=1&param2=2",
> > > which is not
> > > JSDK2.0 compliant according to "O'REILLY JAVA SERVLET PROGRAMMING"
> > >
> > > Is that right?
> > Tomcat is JSDK2.2 compliant.  The o'reilly book is over a year old.
> >
> > Use this API documentation if you're using Tomcat:
> > http://java.sun.com/products/servlet/2.2/javadoc/index.html
> 
> According to that site, Andrea is expecting the correct behavior (JSDK
> 2.0 or 2.2).  To quote the 2.2 API:

Book's a year old but still kicking.  :-)

BTW, news on the second edition is kept at
http://www.servlets.com/book/news.html.

-jh-

-- 
Jason Hunter
jhunter@acm.org
Book:    http://www.servlets.com/book
2.0 to 2.1: http://www.javaworld.com/jw-12-1998/jw-12-servletapi.html
2.1 to 2.2: http://www.javaworld.com/jw-10-1999/jw-10-servletapi.html

Re: getRequestURI() ? Not JSDK2.0 Compliant??

Posted by Jerome Moliere <jm...@perform.fr>.
Hi all,
using Apache 1.3.11 + mod_jserv 1.1b3 (not the final release because 
of a Post problem) + Tomcat 3.1M1
I've been obliged to make a work around in a servlet palying a proxy 
role.In fact my servlet wrote twice the query parameters wich is a 
new behaviour (our old servlet engine 1.02 Servlet API compliant 
didn't make such things).
For me, parameters are not part from an URI & in a logic point of 
view should not be returned by such method.

cf Servlet API 2.2 Reference from Sun site :
Returns the part of this request's URL from the protocol name up to 
the query string in the first line of the HTTP request. For example: 
                {PRIVATE}First line of HTTP request 
                                  
                          Returned Value 
                                  
POST /some/path.html HTTP/1.1 

/some/path.html 

GET http://foo.bar/a.html HTTP/1.0 

http://foo.bar/a.html 

HEAD /xyz?a=b HTTP/1.1 

/xyz 


It seems very clear for me , it 's a bug from Tomcat or mod_jserv or 
both.


jerome

J.Molière jmoliere@perform.fr
ingénieur recherche & développement
I don't fear computers - I fear lack of them
Isaac Asimov

Re: getRequestURI() ? Not JSDK2.0 Compliant??

Posted by Serge Knystautas <se...@lokitech.com>.
Mike Engelhart wrote:
> 
> Andrea Tomasini wrote:
> 
> > The correct URI is "/foo.jsp" without parameters, but Tomcat give me the
> > complete path after server URL... "/foo.jsp?param1=1&param2=2", which is not
> > JSDK2.0 compliant according to "O'REILLY JAVA SERVLET PROGRAMMING"
> >
> > Is that right?
> Tomcat is JSDK2.2 compliant.  The o'reilly book is over a year old.
> 
> Use this API documentation if you're using Tomcat:
> http://java.sun.com/products/servlet/2.2/javadoc/index.html


According to that site, Andrea is expecting the correct behavior (JSDK
2.0 or 2.2).  To quote the 2.2 API:

------------
public java.lang.String getRequestURI()

Returns the part of this request's URL from the protocol name up to the
query string in the first line of the HTTP request. For example: 

First line of HTTP request		Returned Value 
POST /some/path.html HTTP/1.1		/some/path.html 
GET http://foo.bar/a.html HTTP/1.0	http://foo.bar/a.html 
HEAD /xyz?a=b HTTP/1.1			/xyz 
------------
Assuming the behavior Andrea describes is correct, this would be a bug
in Tomcat.

Serge Knystautas
Loki Technologies
http://www.lokitech.com/

Re: getRequestURI() ? Not JSDK2.0 Compliant??

Posted by Mike Engelhart <me...@earthtrip.com>.
Andrea Tomasini wrote:

> The correct URI is "/foo.jsp" without parameters, but Tomcat give me the
> complete path after server URL... "/foo.jsp?param1=1&param2=2", which is not
> JSDK2.0 compliant according to "O'REILLY JAVA SERVLET PROGRAMMING"
> 
> Is that right?
Tomcat is JSDK2.2 compliant.  The o'reilly book is over a year old.

Use this API documentation if you're using Tomcat:
http://java.sun.com/products/servlet/2.2/javadoc/index.html