*/
private String [] getClientClassification (MauiApplication aMauiApplication)
{
String [] retVal = new String [3];
HTTPSession theSession = aMauiApplication.getSession ();
retVal [0] = (aMauiApplication.getCompositor () instanceof WMLCompositor ? "wml" : "html");
if (retVal [0].equals ("wml"))
{
theSession.setKeepAlive (false);
}
Map theHeaderValues = aMauiApplication.getRequestHeaderValues ();
String theUserAgent = (String) theHeaderValues.get ("user-agent");
if (theUserAgent != null)
{
theUserAgent = theUserAgent.toLowerCase ();
int theIndex;
// Internet Explorer
// e.g. "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)"
if ((theIndex = theUserAgent.indexOf ("msie")) != -1)
{
retVal [1] = "explorer";
theUserAgent = theUserAgent.substring (theIndex + 5);
theIndex = theUserAgent.indexOf (";");
retVal [2] = theUserAgent.substring (0, theIndex);
}
else if ((theIndex = theUserAgent.indexOf ("opera")) != -1)
{
retVal [1] = "opera";
theIndex = theUserAgent.indexOf ("/");
theUserAgent = theUserAgent.substring (theIndex);
retVal [2] = theUserAgent.substring (0, theUserAgent.indexOf (" "));
//
// Can't use keep alive
//
theSession.setKeepAlive (false);
}
// Palm Web Clipping Application (a.k.a. PQA)
// e.g. "Mozilla/2.0 (compatible; Elaine/2.0)"
else if (theUserAgent.indexOf ("elaine") != -1)
{
retVal [1] = "wca";
theIndex = theUserAgent.indexOf ("/");
theUserAgent = theUserAgent.substring (theIndex + 1);
theIndex = theUserAgent.indexOf (")");
retVal [2] = theUserAgent.substring (0, theIndex);
// If we are dealing with a RIM device, set the dimension to 132x64
if ((theUserAgent.indexOf("rim") != -1) && (theUserAgent.indexOf("957") == -1))
{
theSession.setClientDimension(new Dimension(132, 64));
}
// All Palms have 160x160 screens.
else
{
theSession.setClientDimension(new Dimension(160, 160));
}
}
// Netscape
// e.g. "Mozilla/4.76 (Macintosh; U; PPC)"
else if (theUserAgent.indexOf ("mozilla") != -1)
{
retVal [1] = "netscape";
theIndex = theUserAgent.indexOf ("/");
theUserAgent = theUserAgent.substring (theIndex + 1);
theIndex = theUserAgent.indexOf (" ");
retVal [2] = theUserAgent.substring (0, theIndex);
}
// Lynx
// e.g. "Lynx/2.8.3rel.1 libwww-FM/2.14"
else if (theUserAgent.indexOf ("lynx") == 0)
{
retVal [1] = "lynx";
theIndex = theUserAgent.indexOf ("/");
theUserAgent = theUserAgent.substring (theIndex + 1);
theIndex = theUserAgent.indexOf (" ");
retVal [2] = theUserAgent.substring (0, theIndex);
}
// UP.Browser
else if ((theIndex = theUserAgent.indexOf ("up.browser")) != -1)
{
retVal [1] = "up";
theIndex = theUserAgent.indexOf ("/");
theUserAgent = theUserAgent.substring (theIndex + 1);
theIndex = theUserAgent.indexOf (" ");
int theOther = theUserAgent.indexOf ("-");
if (theOther != -1 && theOther < theIndex)
{
theIndex = theOther;
}
retVal [2] = theUserAgent.substring (0, theIndex);
String theDimension = (String) theHeaderValues.get ("x-up-devcap-screenpixels");
if (theDimension != null)
{
int theComma = theDimension.indexOf (',');
theSession.setClientDimension (new Dimension (Integer.parseInt (theDimension.substring (0, theComma)),
Integer.parseInt (theDimension.substring (theComma + 1))));
}
}
// Klondike
else if (theUserAgent.indexOf ("klondike") != -1)
{
retVal [1] = "klondike";
retVal [2] = null;
}
// Wapsody
else if (theUserAgent.indexOf ("wapsody") != -1)
{
retVal [1] = "wapsody";
retVal [2] = null;
}
// Nokia
else if (theUserAgent.indexOf ("nokia") != -1)
{
retVal [1] = "nokia";
//
// 7110 is (96 x 65)
//
if ((theIndex = theUserAgent.indexOf ("7110")) != -1)
{
theSession.setClientDimension (new Dimension (96, 65));
theUserAgent = theUserAgent.substring (theIndex + 5);
}
theIndex = theUserAgent.indexOf ("/");
if (theIndex != -1)