net.rim.device.api.browser.field2
Class ProtocolController

java.lang.Object
  extended by net.rim.device.api.browser.field2.ProtocolController
All Implemented Interfaces:
BrowserFieldController

public class ProtocolController
extends Object
implements BrowserFieldController

The ProtocolController uses several BrowserFieldResourceHandlers to handle navigation and resource requests associated with specific protocols. For instance, a TransportResourceHandler is used to handle "http" and "https" requests while "local" requests are handled by a ModuleResourceHandler instance. New handlers can be added to the controller to either handle new protocols or to replace existing handlers for specific protocols.

Since:
BlackBerry API 5.0.0

Constructor Summary
ProtocolController(BrowserField browserField)
          Creates a new ProtocolController instance
 
Method Summary
 void handleNavigationRequest(BrowserFieldRequest request)
          This method handles navigation requests from a BrowserField (e.g., what to do when a link is clicked on the page).
 InputConnection handleResourceRequest(BrowserFieldRequest request)
          This method handles resource requests from a BrowserField (e.g., what to do when an image is requested within a page).
 void setNavigationRequestHandler(String protocol, BrowserFieldNavigationRequestHandler handler)
          Sets the BrowserFieldRequestHandler that should handle navigation requests for a given protocol.
 void setResourceRequestHandler(String protocol, BrowserFieldResourceRequestHandler handler)
          Sets the BrowserFieldResourceRequestHandler that should handle resource requests for a given protocol.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

ProtocolController

public ProtocolController(BrowserField browserField)
Creates a new ProtocolController instance

Parameters:
browserField - The BrowserField component for which this controller belongs
Since:
BlackBerry API 5.0.0


Method Detail

handleNavigationRequest

public void handleNavigationRequest(BrowserFieldRequest request)
                             throws Exception
This method handles navigation requests from a BrowserField (e.g., what to do when a link is clicked on the page).

Specified by:
handleNavigationRequest in interface BrowserFieldController
Parameters:
request - Contains details about the content being requested (e.g., URL, HTTP headers).
Throws:
Exception
See Also:
BrowserFieldController.handleNavigationRequest(BrowserFieldRequest)
Since:
BlackBerry API 5.0.0

setNavigationRequestHandler

public void setNavigationRequestHandler(String protocol,
                                        BrowserFieldNavigationRequestHandler handler)
Sets the BrowserFieldRequestHandler that should handle navigation requests for a given protocol.

Parameters:
protocol - The protocol (e.g., http, https, file, data) to associate with the handler.
handler - The BrowserFieldRequestHandler that handles navigation requests for the specified protocol.
See Also:
BrowserFieldController.handleNavigationRequest(BrowserFieldRequest)
Since:
BlackBerry API 5.0.0

handleResourceRequest

public InputConnection handleResourceRequest(BrowserFieldRequest request)
                                      throws Exception
This method handles resource requests from a BrowserField (e.g., what to do when an image is requested within a page).

Specified by:
handleResourceRequest in interface BrowserFieldController
Parameters:
request - Contains details about the resource being requested (e.g., URL, HTTP headers).
Returns:
The InputConnection for the requested resource
Throws:
Exception
See Also:
BrowserFieldController.handleNavigationRequest(BrowserFieldRequest)
Since:
BlackBerry API 5.0.0

setResourceRequestHandler

public void setResourceRequestHandler(String protocol,
                                      BrowserFieldResourceRequestHandler handler)
Sets the BrowserFieldResourceRequestHandler that should handle resource requests for a given protocol.

Parameters:
protocol - The protocol (e.g., http, https, file, data) to associate with the handler.
handler - The BrowserFieldResourceRequestHandler that handles resource requests for the specified protocol.
See Also:
BrowserFieldController.handleNavigationRequest(BrowserFieldRequest)
Since:
BlackBerry API 5.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal