0

I would like to know if is possible to identify (with JAVA) the kind of computer used to make a request, for example: Server, desktop, PDA (tablet,cellphone,etc)?

Thank you!

  • I don't think that particular piece of information is explicitly sent in the request, though you might be able to get close by checking the User Agent string. It's not completely reliable of course, as it entirely depends on what the client sends for that value. – David Jun 29 '13 at 17:59

2 Answers2

1

Depends on what are you using to accept requests. For http requests, informations are in User agent section of request header.

Majky
  • 1,943
  • 1
  • 18
  • 30
0

Yes it is to a degree. You have to get the User-Agent string from the HTTP request. How to do that will depend on your Java and framework implementation but that's the direction you should take. You will have to examin the string for browser versions, mobile, etc...

Here is the request from my Mac:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1

And here from my Windows server:

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)

And here from my iPhone:

Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25
bitfiddler
  • 2,095
  • 1
  • 12
  • 11