views:

24

answers:

1

Hi,

I've created a servlet for sending the exception or error details to the webmaster. I get the details like this:

 Throwable throwable=null;
 Object codeObj, messageObj, typeObj;
 codeObj = request.getAttribute("javax.servlet.error.status_code");
 typeObj = request.getAttribute("javax.servlet.error.exception_type");
 throwable = (Throwable) request.getAttribute("javax.servlet.error.exception");
 uri = (String) request.getAttribute("javax.servlet.error.request_uri");

Is there any way to get details like browser name and version also from my error servlet?

+2  A: 

You can get the browser user agent using this:

request.getHeader("User-Agent");

The version information should be in there, but reliably extracting it programmatically is difficult, since every browser user agent looks different.

skaffman
thanks skaffman...
coder247