WML or HTML detection

2002-07-25 Thread David Oxley

From a servlet how can you detect what should be output from the type of
client that sent the request. i.e. If a WAP phone accesses a servlet then it
outputs WML or if a Web Browser accesses the same servlet then HTML is
output

 

Thanks.

Dave




RE: WML or HTML detection

2002-07-25 Thread Turner, John


Assuming HttpServletRequest request:

String clientBrowser = request.getHeader(User-Agent);
String clientReferer = request.getHeader(Referer);
String clientIP = request.getRemoteAddr();

John Turner
[EMAIL PROTECTED]


-Original Message-
From: David Oxley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 25, 2002 8:37 AM
To: 'Tomcat Users List'
Subject: WML or HTML detection


From a servlet how can you detect what should be output from the type of
client that sent the request. i.e. If a WAP phone accesses a servlet then it
outputs WML or if a Web Browser accesses the same servlet then HTML is
output

 

Thanks.

Dave


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: WML or HTML detection

2002-07-25 Thread Donie Kelly

Try looking at the Accept header. That should tell you if the browser
accepts HTML or WML, maybe. That with a combination of User-Agent checks
should be able to help you...

Donie


 -Original Message-
From:   Turner, John [mailto:[EMAIL PROTECTED]] 
Sent:   July 25, 2002 14:14
To: 'Tomcat Users List'
Subject:RE: WML or HTML detection


Assuming HttpServletRequest request:

String clientBrowser = request.getHeader(User-Agent);
String clientReferer = request.getHeader(Referer);
String clientIP = request.getRemoteAddr();

John Turner
[EMAIL PROTECTED]


-Original Message-
From: David Oxley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 25, 2002 8:37 AM
To: 'Tomcat Users List'
Subject: WML or HTML detection


From a servlet how can you detect what should be output from the type of
client that sent the request. i.e. If a WAP phone accesses a servlet then it
outputs WML or if a Web Browser accesses the same servlet then HTML is
output

 

Thanks.

Dave


--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: WML or HTML detection

2002-07-25 Thread Arthur Veinstein

You should check the headers his browser sent you, you will be able to
understand which file he support, if he supports HTML then give it to him,
else is WML is supported the send the WML

if (request.getHeader(Accept).lastIndexOf (wml) != -1)

send WML
else
send HTML

Arthur
- Original Message -
From: David Oxley [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Thursday, July 25, 2002 2:37 PM
Subject: WML or HTML detection


 From a servlet how can you detect what should be output from the type of
 client that sent the request. i.e. If a WAP phone accesses a servlet
 then it
 outputs WML or if a Web Browser accesses the same servlet then HTML is
 output



 Thanks.

 Dave




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: WML or HTML detection

2002-07-25 Thread Craig R. McClanahan



On Thu, 25 Jul 2002, David Oxley wrote:

 Date: Thu, 25 Jul 2002 13:37:01 +0100
 From: David Oxley [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: 'Tomcat Users List' [EMAIL PROTECTED]
 Subject: WML or HTML detection

 From a servlet how can you detect what should be output from the type of
 client that sent the request. i.e. If a WAP phone accesses a servlet then it
 outputs WML or if a Web Browser accesses the same servlet then HTML is
 output


String userAgent = request.getHeader(user-agent);

You can use this value to determine what the client device (or browser)
is, including the version number.



 Thanks.

 Dave



Craig



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]