com.openexchange.mail.utils
Class ProviderUtility

java.lang.Object
  extended by com.openexchange.mail.utils.ProviderUtility

public final class ProviderUtility
extends java.lang.Object

ProviderUtility

Author:
Thorben Betten

Method Summary
static java.lang.String extractProtocol(java.lang.String serverUrl, java.lang.String fallback)
          Extracts the protocol from specified server URL:
(<protocol>://)?
static java.net.InetSocketAddress toSocketAddr(java.lang.String serverUrl, int defaultPort)
          Turns given server URL to an instance of InetSocketAddress.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toSocketAddr

public static java.net.InetSocketAddress toSocketAddr(java.lang.String serverUrl,
                                                      int defaultPort)
                                               throws com.openexchange.mailaccount.MailAccountException
Turns given server URL to an instance of InetSocketAddress.

Parameters:
serverUrl - The server URL
defaultPort - The default port to use if server URL does not specify a port
Returns:
An instance of InetSocketAddress denoting given server URL
Throws:
com.openexchange.mailaccount.MailAccountException - if the server URL can not be parsed.

extractProtocol

public static java.lang.String extractProtocol(java.lang.String serverUrl,
                                               java.lang.String fallback)
Extracts the protocol from specified server URL:
(<protocol>://)?(<host>)(:<port>)?

Parameters:
serverUrl - The server URL
fallback - The fallback protocol if URL does not contain a protocol
Returns:
Extracted protocol or fallback parameter