What headerfields will a webserver receive if someone makes a urlconnection (GPRS) with for example a nokia telephone. Can a webwerver detect that the connection was from a mobilephone?
What headerfields will a webserver receive if someone makes a urlconnection (GPRS) with for example a nokia telephone. Can a webwerver detect that the connection was from a mobilephone?
Hi!
That's a good question... it's hard to know without looking, as it's not dependant upon the phone alone, but also the WAP gateway, which may change the headers in unexpected ways. I find that the content-type field gets changed when I make POST requests, for example. But for the most part, headers depend on you - on what you place in the header using the setRequestProperty of the HttpConnection object. You could add your own header item (such as a "user-agent" string) - this is described in the documentation of HttpConnection. If you want to know what you're running on, try using the system property "microedition.platform" - this gives me the string "Nokia6100/04.01".
If you need to know exactly what you get, you need to write something on your server to catch the header and store it for you (or send it back as response content). But beware that it may be different for different phones and different networks.
Any help?
Cheers,
Graham.
Graham is right. You're best bet if you want the server to recognize that it's talking to a phone is sending a user agent header. I find that this header is usually "left alone" by the WAP gateways.
Code:HttpConnection c = null; // .... c.setRequestProperty("User-Agent", someStringYouCanUseToIdentifyTheMIDlet);