org.objectweb.dsrg.sofa.util
Class URLUtil

java.lang.Object
  extended by org.objectweb.dsrg.sofa.util.URLUtil

public final class URLUtil
extends java.lang.Object

Utility class for parsing URLs. Intended to easier working with URL string constants in sources. Uses the parsing functionality of URL, the calls do not throw any exceptions for convenience. Rather do not use this class on any user input.


Constructor Summary
URLUtil()
           
 
Method Summary
static java.lang.String getHost(java.lang.String url)
          Extracts the host part of given URL.
static java.lang.String getPath(java.lang.String url)
          Extracts the path part of given URL.
static int getPort(java.lang.String url)
          Extracts the port part of given URL.
static java.lang.String getPortString(java.lang.String url)
          Extracts the port part of given URL.
static java.lang.String getProtocol(java.lang.String url)
          Extracts the protocol from given URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLUtil

public URLUtil()
Method Detail

getPort

public static int getPort(java.lang.String url)
Extracts the port part of given URL. Exceptions are packed as errors. Do not use on user input.

Parameters:
url - URL requested to parse.
Returns:
The port part of the URL as integer.

getPortString

public static java.lang.String getPortString(java.lang.String url)
Extracts the port part of given URL. Exceptions are packed as errors. Do not use on user input.

Parameters:
url - URL requested to parse.
Returns:
The port part of the URL as String.

getHost

public static java.lang.String getHost(java.lang.String url)
Extracts the host part of given URL. Exceptions are packed as errors. Do not use on user input.

Parameters:
url - URL requested to parse.
Returns:
The host part of the URL.

getPath

public static java.lang.String getPath(java.lang.String url)
Extracts the path part of given URL. Exceptions are packed as errors. Do not use on user input.

Parameters:
url - URL requested to parse.
Returns:
The path part of the URL.

getProtocol

public static java.lang.String getProtocol(java.lang.String url)
Extracts the protocol from given URL. Exceptions are packed as errors. Do not use on user input.

Parameters:
url - URL requested to parse.
Returns:
The protocol part of the URL.