break;
}
case Event.EVENT_REDIRECT: {
final 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.
final Object eventSource = e.getSource();
if (eventSource instanceof HttpConnection) {
referrer =
((HttpConnection) eventSource)
.getRequestProperty(REFERER);
}
break;
}
final HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setProperty(REFERER, referrer);
final PrimaryResourceFetchThread thread =
new PrimaryResourceFetchThread(e.getLocation(),
requestHeaders, null, event, this);
thread.start();
break;
}