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,082,665
  • 372
  • 3,610
  • 3,555
coder247
  • 2,913
  • 19
  • 50
  • 70
  • 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
  • 398,947
  • 96
  • 818
  • 769