This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Method to recognise the device from where request is coming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Method to recognise the device from where request is coming" Watch "Method to recognise the device from where request is coming" New topic
Author

Method to recognise the device from where request is coming

Simon Johnn
Greenhorn

Joined: Mar 23, 2003
Posts: 15
A want to design a web application which can receive request from multiple devices such as from a pc through browser,from a mobile phone etc,how can i know that from which device request is coming so that i can generate the specific response for that device means for browser generate html ,for mobile phone generate wml etc.
I check the methods of class ServletRequest as well as HttpServletRequest to know but unable to find a method.Anybody can plz let me know whats the method i should use and that method belongs to which class.
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

What about HttpServletRequest.getHeader() and look for User-Agent -- I'm pretty sure it will tell you what kind of device the user is accessing your site with (whether it be IE, a Nokia or Sony Clie).


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Method to recognise the device from where request is coming
 
Similar Threads
Parent constructor calls method of Child
InstantiationException
doubt in servlets
Method to recognise the device from where request is coming
Method to recognise the device from where request is coming