tags:

views:

98

answers:

1

I have an odd exception in our application and I'd like to log when it occurs and include the complete request string including the parameters.

When I try

log.warn("Weird request " + request.getRequestURL());

I get the request string but not the parameters which were included with ? and &.

example:

/testRequest.do?param1=1&param2=2

I only see

/testRequest.do

Can I get this whole string somewhere?

+8  A: 

See HttpServletRequest#getQueryString()

If you want the whole string, you'll have to append the request url and the query string together as there is no method to get the whole thing.

System.out.println(request.getRequestURL().append('?').append(request.getQueryString()));
Kevin
Thanks! I love this site :)
Dan Howard
If you do love this site, click on the check mark to accept this answer! :)
Nikki Erwin Ramirez