* @return true if the URL points to a MIDlet suite
*/
private boolean isMidletSuiteUrl(String url) {
Connection conn = null;
HttpConnection httpConnection = null;
String profile;
int space;
String configuration;
String locale;
int responseCode;
String mediaType;
try {
conn = Connector.open(url, Connector.READ);
} catch (IllegalArgumentException e) {
return false;
} catch (IOException e) {
return false;
}
try {
if (!(conn instanceof HttpConnection)) {
// only HTTP or HTTPS are supported
return false;
}
httpConnection = (HttpConnection)conn;
httpConnection.setRequestMethod(HttpConnection.HEAD);
httpConnection.setRequestProperty("Accept", "*/*");
profile = System.getProperty("microedition.profiles");
space = profile.indexOf(' ');
if (space != -1) {
profile = profile.substring(0, space);
}
configuration = System.getProperty("microedition.configuration");
httpConnection.setRequestProperty("User-Agent",
"Profile/" + profile + " Configuration/" + configuration);
httpConnection.setRequestProperty("Accept-Charset",
"UTF-8, ISO-8859-1");
/* locale can be null */
locale = System.getProperty("microedition.locale");
if (locale != null) {
httpConnection.setRequestProperty("Accept-Language", locale);
}
responseCode = httpConnection.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK) {
return false;
}
mediaType = Util.getHttpMediaType(httpConnection.getType());
if (mediaType == null) {
return false;
}
if (mediaType.equals(JAD_MT) || mediaType.equals(JAR_MT_1) ||