62
BlackBerry Device Applications Integration Guide
RedirectEvent e = (RedirectEvent) event;
String referrer = e.getSourceURL();
switch (e.getType()) {
case RedirectEvent.TYPE_SINGLE_FRAME_REDIRECT :
// show redirect message
Application.getApplication().invokeAndWait(new Runnable() {
public void run() {
Status.show(“You are being redirected to a different
page...”);
}
});
break;
case RedirectEvent.TYPE_JAVASCRIPT :
break;
case RedirectEvent.TYPE_META :
// MSIE and Mozilla don’t send a Referer for META Refresh.
referrer = null;
break;
case RedirectEvent.TYPE_300_REDIRECT :
// MSIE, Mozilla, and Opera all send the original
// request’s Referer as the Referer for the new
// request.
Object eventSource = e.getSource();
if (eventSource instanceof HttpConnection) {
referrer =
((HttpConnection)eventSource).getRequestProperty(REFERER);
}
break;
}
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setProperty(REFERER, referrer);
PrimaryResourceFetchThread thread = new
PrimaryResourceFetchThread(e.getLocation(), requestHeaders,null, event, this);
thread.start();
break;
} case Event.EVENT_CLOSE :
// TODO: close the appication
break;
case Event.EVENT_SET_HEADER : // no cache support
case Event.EVENT_SET_HTTP_COOKIE : // no cookie support
case Event.EVENT_HISTORY : // no history support
case Event.EVENT_EXECUTING_SCRIPT : // no progress bar is supported
case Event.EVENT_FULL_WINDOW : // no full window support
case Event.EVENT_STOP : // no stop loading support
default :
}
return null;
}
/**
* @see
net.rim.device.api.browser.RenderingApplication#getAvailableHeight(net.rim.device.api.brow
ser.BrowserContent)
*/
public int getAvailableHeight(BrowserContent browserField) {
// field has full screen
return Graphics.getScreenHeight();
Summary of Contents for JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE
Page 4: ......
Page 7: ......
Page 10: ...10 BlackBerry Device Applications Integration Guide...
Page 12: ...12 BlackBerry Device Applications Integration Guide...
Page 50: ...50 BlackBerry Device Applications Integration Guide...
Page 56: ...56 BlackBerry Device Applications Integration Guide...
Page 65: ......
Page 66: ...2008 Research In Motion Limited Published in Canada...