Tomcat 5.5.x returns wrong value for request.getRequestURI()

2005-04-15 Thread Yaakov Chaikin
Hi,

Using Tomcat 5.5.7 (tried Tomcat 5.5.9 with the same results) on Windows XP.

When forwarding to a JSP page that is located in
/WEB-INF/jsp/success.jsp and calling:
%= request.getRequestURI() % inside the success.jsp page, the result I get is:
/WEB-INF/jsp/success.jsp

I am pretty sure that according to the API, this is the wrong result.
It should have returned the URI of the **request**, not the path to
the resource.

Is this a known bug or there is some weird Tomcat setting that I need
to change. I ran this on Tomcat without changing any of the original
settings.

BTW, the same is true of request.getRequestURL(). It returns (peculiar enough):
http://localhost:8080/WEB-INF/jsp/success.jsp

Thanks,
Yaakov.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5.x returns wrong value for request.getRequestURI()

2005-04-15 Thread Remy Maucherat
On 4/15/05, Yaakov Chaikin [EMAIL PROTECTED] wrote:
 Hi,
 
 Using Tomcat 5.5.7 (tried Tomcat 5.5.9 with the same results) on Windows XP.
 
 When forwarding to a JSP page that is located in
 /WEB-INF/jsp/success.jsp and calling:
 %= request.getRequestURI() % inside the success.jsp page, the result I get 
 is:
 /WEB-INF/jsp/success.jsp
 
 I am pretty sure that according to the API, this is the wrong result.
 It should have returned the URI of the **request**, not the path to
 the resource.
 
 Is this a known bug or there is some weird Tomcat setting that I need
 to change. I ran this on Tomcat without changing any of the original
 settings.
 
 BTW, the same is true of request.getRequestURL(). It returns (peculiar 
 enough):
 http://localhost:8080/WEB-INF/jsp/success.jsp

This is not a bug, as it's intentional, and hasn't been shown to
contrdict the spec. The spec seems to hint that this should use the
path elements (but is very vague). I didn't quite agree with the
change, but didn't actually care about the issue, so you can try
asking for clarifications to Sun or on tomcat-dev.

If you want to change that, hack the request wrapper code a little,
it's very easy.

-- 
x
Rémy Maucherat
Developer  Consultant
JBoss Group (Europe) SàRL
x

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5.x returns wrong value for request.getRequestURI()

2005-04-15 Thread Trond G. Ziarkowski
Hi,
pretty sure isn't always good enough ;) To get the uri that forwarded 
to the jsp you need to use 
%=request.getAttribute(javax.servlet.forward.request_uri)%. Check 
out the servlet 2.4 spec section 8.4 for more info.

Trond
Yaakov Chaikin wrote:
Hi,
Using Tomcat 5.5.7 (tried Tomcat 5.5.9 with the same results) on Windows XP.
When forwarding to a JSP page that is located in
/WEB-INF/jsp/success.jsp and calling:
%= request.getRequestURI() % inside the success.jsp page, the result I get is:
/WEB-INF/jsp/success.jsp
I am pretty sure that according to the API, this is the wrong result.
It should have returned the URI of the **request**, not the path to
the resource.
Is this a known bug or there is some weird Tomcat setting that I need
to change. I ran this on Tomcat without changing any of the original
settings.
BTW, the same is true of request.getRequestURL(). It returns (peculiar enough):
http://localhost:8080/WEB-INF/jsp/success.jsp
Thanks,
Yaakov.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Tomcat 5.5.x returns wrong value for request.getRequestURI()

2005-04-15 Thread Yaakov Chaikin
Hmm...

How many ways are there to read this part of the spec:
**
public java.lang.StringBuffer getRequestURL()
Reconstructs the **URL the client used to make the request.**
The returned URL
contains a protocol, server name, port number, and server path, but it does not
include query string parameters.
Because this method returns a StringBuffer, not a string, you can modify
the URL easily, for example, to append query parameters.
This method is useful for creating redirect messages and for reporting errors.
***

On 4/15/05, Remy Maucherat [EMAIL PROTECTED] wrote:
 On 4/15/05, Yaakov Chaikin [EMAIL PROTECTED] wrote:
  Hi,
 
  Using Tomcat 5.5.7 (tried Tomcat 5.5.9 with the same results) on Windows XP.
 
  When forwarding to a JSP page that is located in
  /WEB-INF/jsp/success.jsp and calling:
  %= request.getRequestURI() % inside the success.jsp page, the result I 
  get is:
  /WEB-INF/jsp/success.jsp
 
  I am pretty sure that according to the API, this is the wrong result.
  It should have returned the URI of the **request**, not the path to
  the resource.
 
  Is this a known bug or there is some weird Tomcat setting that I need
  to change. I ran this on Tomcat without changing any of the original
  settings.
 
  BTW, the same is true of request.getRequestURL(). It returns (peculiar 
  enough):
  http://localhost:8080/WEB-INF/jsp/success.jsp
 
 This is not a bug, as it's intentional, and hasn't been shown to
 contrdict the spec. The spec seems to hint that this should use the
 path elements (but is very vague). I didn't quite agree with the
 change, but didn't actually care about the issue, so you can try
 asking for clarifications to Sun or on tomcat-dev.
 
 If you want to change that, hack the request wrapper code a little,
 it's very easy.
 
 --
 x
 Rémy Maucherat
 Developer  Consultant
 JBoss Group (Europe) SàRL
 x
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5.x returns wrong value for request.getRequestURI()

2005-04-15 Thread Yaakov Chaikin
I checked out the spec section 8.4.2 Forwarded Request Parameters.

It does seem to me that it implies that the parameters is where one
would get the original URI from.

However, there are still 2 problems that I can see:
1) The API says: URL the client used to make the request
2) 8.4.2 says that these parameters are NOT to be set if you obtain
the RequestDispatcher object using getNamedDispatcher() method. How
would you get at the original URI/URL then (without custom coding)?

Yaakov.

On 4/15/05, Trond G. Ziarkowski [EMAIL PROTECTED] wrote:
 Hi,
 
 pretty sure isn't always good enough ;) To get the uri that forwarded
 to the jsp you need to use
 %=request.getAttribute(javax.servlet.forward.request_uri)%. Check
 out the servlet 2.4 spec section 8.4 for more info.
 
 
 Trond
 
 Yaakov Chaikin wrote:
 
 Hi,
 
 Using Tomcat 5.5.7 (tried Tomcat 5.5.9 with the same results) on Windows XP.
 
 When forwarding to a JSP page that is located in
 /WEB-INF/jsp/success.jsp and calling:
 %= request.getRequestURI() % inside the success.jsp page, the result I get 
 is:
 /WEB-INF/jsp/success.jsp
 
 I am pretty sure that according to the API, this is the wrong result.
 It should have returned the URI of the **request**, not the path to
 the resource.
 
 Is this a known bug or there is some weird Tomcat setting that I need
 to change. I ran this on Tomcat without changing any of the original
 settings.
 
 BTW, the same is true of request.getRequestURL(). It returns (peculiar 
 enough):
 http://localhost:8080/WEB-INF/jsp/success.jsp
 
 Thanks,
 Yaakov.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5.x returns wrong value for request.getRequestURI()

2005-04-15 Thread Remy Maucherat
On 4/15/05, Yaakov Chaikin [EMAIL PROTECTED] wrote:
 I checked out the spec section 8.4.2 Forwarded Request Parameters.
 
 It does seem to me that it implies that the parameters is where one
 would get the original URI from.
 
 However, there are still 2 problems that I can see:
 1) The API says: URL the client used to make the request
 2) 8.4.2 says that these parameters are NOT to be set if you obtain
 the RequestDispatcher object using getNamedDispatcher() method. How
 would you get at the original URI/URL then (without custom coding)?

This is not constructive argumentation.

1) Applies to the core request class behavior. Cool, it works. The RD
has to wrap it using a request wrapper, so it does not apply.

2) How about trying things instead of making what-if theories ? (hint:
it works fine) ;)

-- 
x
Rémy Maucherat
Developer  Consultant
JBoss Group (Europe) SàRL
x

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5.x returns wrong value for request.getRequestURI()

2005-04-15 Thread Yaakov Chaikin
On 4/15/05, Remy Maucherat [EMAIL PROTECTED] wrote:
 On 4/15/05, Yaakov Chaikin [EMAIL PROTECTED] wrote:
  I checked out the spec section 8.4.2 Forwarded Request Parameters.
 
  It does seem to me that it implies that the parameters is where one
  would get the original URI from.
 
  However, there are still 2 problems that I can see:
  1) The API says: URL the client used to make the request
  2) 8.4.2 says that these parameters are NOT to be set if you obtain
  the RequestDispatcher object using getNamedDispatcher() method. How
  would you get at the original URI/URL then (without custom coding)?
 
 This is not constructive argumentation.

I am not arguing with you. Tried it on WebLogic and it works exactly
as Tomcat does. So, obviously, you are right. I am just trying to
understand why you are right.

 1) Applies to the core request class behavior. Cool, it works. The RD
 has to wrap it using a request wrapper, so it does not apply.

So, what you are really saying is that the API should have pointed out
that getRequestURL() does not work the same way every time. Then, I am
not sure how anyone could have arrived at the conclusion that the
words ... URL the **client** used to make the request... really
means unless something else happens behind the scene and the
returned value is no longer what the **client** used. That doesn't
seem strange to you, taking only into account what has been said?

Seems pretty clear to me. Unless, I am overlooking some other part of
the spec that says something else. (Still bad since API didn't mention
it, but at least understandable.)

 2) How about trying things instead of making what-if theories ? (hint:
 it works fine) ;)

I haven't tried this particular part. True. I HAVE tried everything
else I mentioned however. Are you saying that how things really work
ONCE AGAIN is not the way the servlet spec describes they should?
Quote 8.4.2:
If the forwarded servlet was obtained by using the getNamedDispatcher
method, these attributes **must not be set.**

Thanks,
Yaakov.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5.x returns wrong value for request.getRequestURI()

2005-04-15 Thread Remy Maucherat
On 4/15/05, Yaakov Chaikin [EMAIL PROTECTED] wrote:
  1) Applies to the core request class behavior. Cool, it works. The RD
  has to wrap it using a request wrapper, so it does not apply.
 
 So, what you are really saying is that the API should have pointed out
 that getRequestURL() does not work the same way every time. Then, I am
 not sure how anyone could have arrived at the conclusion that the
 words ... URL the **client** used to make the request... really
 means unless something else happens behind the scene and the
 returned value is no longer what the **client** used. That doesn't
 seem strange to you, taking only into account what has been said?

I'm just pointing out you're not actually using the same class. The
javadoc for the base class mentions the behavior of the non-wrapped
base request class. After going in the request dispatcher and
wrapping, this behavior is not the same.

  2) How about trying things instead of making what-if theories ? (hint:
  it works fine) ;)
 
 I haven't tried this particular part. True. I HAVE tried everything
 else I mentioned however. Are you saying that how things really work
 ONCE AGAIN is not the way the servlet spec describes they should?
 Quote 8.4.2:
 If the forwarded servlet was obtained by using the getNamedDispatcher
 method, these attributes **must not be set.**

Well, the path values are simply set to the original ones, and,
indeed, there are no attributes.

-- 
x
Rémy Maucherat
Developer  Consultant
JBoss Group (Europe) SàRL
x

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5.x returns wrong value for request.getRequestURI()

2005-04-15 Thread Yaakov Chaikin
Oh, now I see what you are saying (in both cases.)

That clears it up for me. Thanks.

Yaakov.

On 4/15/05, Remy Maucherat [EMAIL PROTECTED] wrote:
 On 4/15/05, Yaakov Chaikin [EMAIL PROTECTED] wrote:
   1) Applies to the core request class behavior. Cool, it works. The RD
   has to wrap it using a request wrapper, so it does not apply.
 
  So, what you are really saying is that the API should have pointed out
  that getRequestURL() does not work the same way every time. Then, I am
  not sure how anyone could have arrived at the conclusion that the
  words ... URL the **client** used to make the request... really
  means unless something else happens behind the scene and the
  returned value is no longer what the **client** used. That doesn't
  seem strange to you, taking only into account what has been said?
 
 I'm just pointing out you're not actually using the same class. The
 javadoc for the base class mentions the behavior of the non-wrapped
 base request class. After going in the request dispatcher and
 wrapping, this behavior is not the same.
 
   2) How about trying things instead of making what-if theories ? (hint:
   it works fine) ;)
 
  I haven't tried this particular part. True. I HAVE tried everything
  else I mentioned however. Are you saying that how things really work
  ONCE AGAIN is not the way the servlet spec describes they should?
  Quote 8.4.2:
  If the forwarded servlet was obtained by using the getNamedDispatcher
  method, these attributes **must not be set.**
 
 Well, the path values are simply set to the original ones, and,
 indeed, there are no attributes.
 
 --
 x
 Rémy Maucherat
 Developer  Consultant
 JBoss Group (Europe) SàRL
 x
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5.x returns wrong value for request.getRequestURI()

2005-04-15 Thread Yaakov Chaikin
Remy,

BTW, since which version of the spec has this change been instituted?

Thanks,
Yaakov.

On 4/15/05, Yaakov Chaikin [EMAIL PROTECTED] wrote:
 Oh, now I see what you are saying (in both cases.)
 
 That clears it up for me. Thanks.
 
 Yaakov.
 
 On 4/15/05, Remy Maucherat [EMAIL PROTECTED] wrote:
  On 4/15/05, Yaakov Chaikin [EMAIL PROTECTED] wrote:
1) Applies to the core request class behavior. Cool, it works. The RD
has to wrap it using a request wrapper, so it does not apply.
  
   So, what you are really saying is that the API should have pointed out
   that getRequestURL() does not work the same way every time. Then, I am
   not sure how anyone could have arrived at the conclusion that the
   words ... URL the **client** used to make the request... really
   means unless something else happens behind the scene and the
   returned value is no longer what the **client** used. That doesn't
   seem strange to you, taking only into account what has been said?
 
  I'm just pointing out you're not actually using the same class. The
  javadoc for the base class mentions the behavior of the non-wrapped
  base request class. After going in the request dispatcher and
  wrapping, this behavior is not the same.
 
2) How about trying things instead of making what-if theories ? (hint:
it works fine) ;)
  
   I haven't tried this particular part. True. I HAVE tried everything
   else I mentioned however. Are you saying that how things really work
   ONCE AGAIN is not the way the servlet spec describes they should?
   Quote 8.4.2:
   If the forwarded servlet was obtained by using the getNamedDispatcher
   method, these attributes **must not be set.**
 
  Well, the path values are simply set to the original ones, and,
  indeed, there are no attributes.
 
  --
  x
  Rémy Maucherat
  Developer  Consultant
  JBoss Group (Europe) SàRL
  x
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]