de.enough.polish.browser.protocols
Class ExternalProtocolHandler

java.lang.Object
  extended by de.enough.polish.browser.ProtocolHandler
      extended by de.enough.polish.browser.protocols.ExternalProtocolHandler

public class ExternalProtocolHandler
extends ProtocolHandler

Protocol handler to handle the external: protocol. This class calls the given URLs in an external browser on MIDP 2.0 phones. Example: <a href="external:http://www.j2mepolish.org">J2ME Polish</a> Note that this handler requires MIDP 2.0 or higher.


Field Summary
 
Fields inherited from class de.enough.polish.browser.ProtocolHandler
bytebuf, protocolName
 
Constructor Summary
ExternalProtocolHandler(MIDlet midlet)
          Creates an ExternalProtocolHandler object using the default "external" protocol name.
ExternalProtocolHandler(String protocolName, MIDlet midlet)
          Creates an ExternalProtocolHandler object using the specified protocol name.
 
Method Summary
 StreamConnection getConnection(String url)
          Creates a StreamConnection for the given url.
protected  String stripProtocol(String url)
          Strips the protol part off an url.
 
Methods inherited from class de.enough.polish.browser.ProtocolHandler
getProtocolName, readByteArrayFromStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalProtocolHandler

public ExternalProtocolHandler(MIDlet midlet)
Creates an ExternalProtocolHandler object using the default "external" protocol name.

Parameters:
midlet - the midlet object of the application

ExternalProtocolHandler

public ExternalProtocolHandler(String protocolName,
                               MIDlet midlet)
Creates an ExternalProtocolHandler object using the specified protocol name.

Parameters:
protocolName - the name of the protocol to handle
midlet - the midlet object of the application
Method Detail

getConnection

public StreamConnection getConnection(String url)
                               throws IOException
Description copied from class: ProtocolHandler
Creates a StreamConnection for the given url.

Specified by:
getConnection in class ProtocolHandler
Parameters:
url - the url
Returns:
the stream conenction for the given url
Throws:
IOException - if an error occurs

stripProtocol

protected String stripProtocol(String url)
Strips the protol part off an url. In contrast to other protocol handlers, the external protocol handler only uses a single colon to separate the external protocol from the folllowing protocol, e.g. external:http://www.j2mepolish.org

Overrides:
stripProtocol in class ProtocolHandler
Parameters:
url - the url to remove the protocol from
Returns:
the host and part part of the given url