Duane,

This is a pretty crazy set of requirements you're working with here -- I'll trust there's a good reason for it and just stick to the question. ;)

At 11:34 AM 2/16/2004, you wrote:
Assuming I have a URL of
http://www.mysite.com/myservlet.jsp?myvar=1&yourvar=2

Your URL is: "http://www.mysite.com/myservlet.jsp"; Your Query String is: "myvar=1&yourvar=2"

When the browser sends this request to tomcat (which is also acting as a
webserver - no apache is running), does it put everything after the ? into
the QUERY_STRING HTTP variable, or does it include it in the URL request?

It parses the GET request into the two components listed above.


I have a filter in place that will replace /variable/ with &variable= to
allow for proper processing of variables.  Here is what I observe :

If I have a URL of :
mysite.com/myservlet.jsp/myvar/1/yourvar/2

then it will properly translate this into :
mysite.com/myservlet.jsp?myvar=1&yourvar=2

and everything works.

Looks good.


However, we have a new requirement that we want to keep ?myvar=1 as part
of the original URL, so the incoming request would look like this :
mysite.com/myservlet.jsp?myvar=1/yourvar/2

Your URL is: "http://www.mysite.com/myservlet.jsp"; Your Query String is: "myvar=1/yourvar/2"

AND

request.getParameter("myvar") == "1/yourvar/2"

and, naturally, we want it translated into
mysite.com/myservlet.jsp?myvar=1&yourvar=2

but this does NOT happen.  Instead, it seems like the filter is doing
nothing.
The only explanation I can think of is that, now that the ? is in the
original request URL, the browser is taking everthing after it, stripping
it out of the request URL, and putting it into the QUERY_STRING variable -
so that the filter doesn't see it.  The filter would only see
mysite.com/myservlet.jsp
and would not perform any translation.

This is exactly what's happening. If you want to inspect the entire GET request, you need to reconstruct the entire GET request by doing something like this (pseudo code):


StringBuffer sb = request.getRequestURL();
sb.append("/");
parse request.getQueryString() into name=value pairs and name/value pairs
for each pair
if pair is name=value, convert each name=value pair into a name/value pair
sb.append(name/value pair)


Or whatever, depending on what you need.

Hope that clears up any confusion. Again, I hope -- for your own sake -- you have a *really* good reason for complicating this relatively simple process. ;)

justin


______________________________________________ Justin Ruthenbeck Software Engineer, NextEngine Inc. justinr - AT - nextengine DOT com Confidential. See: http://www.nextengine.com/confidentiality.php ______________________________________________


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



Reply via email to