1

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?

BalusC
  • 1,040,783
  • 362
  • 3,548
  • 3,513
coder247
  • 2,833
  • 18
  • 48
  • 69
  • This post will helpful to you [Get location and browser inforrmation][1] [1]: http://stackoverflow.com/questions/1326928/how-can-i-get-client-infomation-such-as-os-and-browser/18030465#18030465 – lambodar Aug 07 '13 at 15:19

1 Answers1

2

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
  • 390,936
  • 96
  • 800
  • 764