com.sapportals.portal.prt.util
Class AbstractURI

java.lang.Object
  |
  +--com.sapportals.portal.prt.util.AbstractURI

public class AbstractURI
extends java.lang.Object

AbstractURL is a convenience class for manipulation of URLs based on the W3C RFC 2396 (see the World Wide Web Consortium pages). In general a URI consists of the parts

concatenated as <scheme>://<user info>@<host>:<port><path>?<query>#<fragment> Many combinations are admissable. Examples
  1. <scheme>:/<path>#<fragment>
  2. <scheme>://<user info>@<host>/<path>
  3. <scheme>://<user info>@<host>:<port>?<query>

Version:
$Revision: #3 $

Constructor Summary
AbstractURI()
          Constructor.
AbstractURI(java.lang.String uri)
          Constructor with initial URL.
 
Method Summary
 void addParameter(java.lang.String name, java.lang.String value)
          Adds a parameter with value to the query part.
 java.lang.String getFragment()
          Gets the scheme of the current URI.
 java.lang.String getHost()
          Gets the Host of the current URI.
 java.lang.String[] getParameters()
          Gets all parameters of the query part.
 java.util.Enumeration getParametersEnumeration()
          Gets all parameters of the query part in an Enumeration
 java.lang.String getParameterValue(java.lang.String name)
          Gets the lone value assigned to a parameter from the query part.
 java.lang.String[] getParameterValues(java.lang.String name)
          Gets all values assigned to a parameter from the query part.
 java.util.Iterator getParameterValuesIterator(java.lang.String name)
          Gets all values assigned to a parameter from the query part as an Iteration.
 java.lang.String getPath()
          Gets the path of the current URI.
 java.lang.String getPort()
          Gets the port of the current URI.
 java.lang.String getQuery()
          Gets the query String.
 java.lang.String getScheme()
          Gets the scheme of the current URI.
 java.lang.String getUserInfo()
          Gets the UserInfo of the current URI.
 boolean isAbsolute()
          Gets wether this URI is absolute.
protected  void parse(java.lang.String uri)
          parse a given URI
 void removeParameter(java.lang.String name)
          Removes the specified parameter from the query part.
 void removeParameter(java.lang.String name, java.lang.String value)
          Removes the specified name-value pair from the query part.
 void removeParameters()
          Removes all parameters from the query part.
 void setFragment(java.lang.String fragment)
          Sets the fragment of the URI
 void setHost(java.lang.String host)
          Sets the Host of the URI
 void setPath(java.lang.String path)
          Sets the path of the URI
 void setPort(java.lang.String port)
          Sets the port of the URI
 void setScheme(java.lang.String scheme)
          Sets the scheme of the URI, e.g. http, https, file, ftp, ...etc.
 void setURI(java.lang.String uri)
          Sets the URI handled by this instance.
 void setUserInfo(java.lang.String userInfo)
          Sets the User-info of the URI
 java.lang.String toString()
          Gets a string representation of the URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractURI

public AbstractURI()
Constructor.

AbstractURI

public AbstractURI(java.lang.String uri)
Constructor with initial URL.
Parameters:
uri - The URI to hanlde.
Method Detail

setURI

public void setURI(java.lang.String uri)
Sets the URI handled by this instance.
Parameters:
uri -  

parse

protected void parse(java.lang.String uri)
parse a given URI
Parameters:
uri -  

setScheme

public void setScheme(java.lang.String scheme)
Sets the scheme of the URI, e.g. http, https, file, ftp, ...etc.
Parameters:
scheme -  

getScheme

public java.lang.String getScheme()
Gets the scheme of the current URI.

isAbsolute

public boolean isAbsolute()
Gets wether this URI is absolute.

setFragment

public void setFragment(java.lang.String fragment)
Sets the fragment of the URI
Parameters:
fragment -  

getFragment

public java.lang.String getFragment()
Gets the scheme of the current URI.

setUserInfo

public void setUserInfo(java.lang.String userInfo)
Sets the User-info of the URI
Parameters:
userInfo -  

getUserInfo

public java.lang.String getUserInfo()
Gets the UserInfo of the current URI.

setHost

public void setHost(java.lang.String host)
Sets the Host of the URI
Parameters:
host -  

getHost

public java.lang.String getHost()
Gets the Host of the current URI.

setPort

public void setPort(java.lang.String port)
Sets the port of the URI
Parameters:
port -  

getPort

public java.lang.String getPort()
Gets the port of the current URI.

setPath

public void setPath(java.lang.String path)
Sets the path of the URI
Parameters:
path -  

getPath

public java.lang.String getPath()
Gets the path of the current URI.

removeParameters

public void removeParameters()
Removes all parameters from the query part.

removeParameter

public void removeParameter(java.lang.String name)
Removes the specified parameter from the query part.
Parameters:
name - the name of the parameter to be removed

removeParameter

public void removeParameter(java.lang.String name,
                            java.lang.String value)
Removes the specified name-value pair from the query part.
Parameters:
name - the name of the parameter to be removed
value -  

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String value)
Adds a parameter with value to the query part.
Parameters:
name - the name of the parameter to add.
value - the value of the parameter to add.

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Gets all values assigned to a parameter from the query part.
Parameters:
name - the name of the parameter to get the values of.
Returns:
a String Array containing all the values of the specified parameter.

getParameterValue

public java.lang.String getParameterValue(java.lang.String name)
Gets the lone value assigned to a parameter from the query part. If the parameter is multi-valued, the result can be any of the values.
Parameters:
name - the name of the parameter to get the values of.
Returns:
a String containing one value of the specified parameter.

getParameterValuesIterator

public java.util.Iterator getParameterValuesIterator(java.lang.String name)
Gets all values assigned to a parameter from the query part as an Iteration.
Parameters:
name - the name of the parameter to get the values of.
Returns:
an Iterator of all values assigned to the specified parameter.

getParametersEnumeration

public java.util.Enumeration getParametersEnumeration()
Gets all parameters of the query part in an Enumeration
Returns:
An Enumeration of all parameters.

getParameters

public java.lang.String[] getParameters()
Gets all parameters of the query part.

getQuery

public java.lang.String getQuery()
Gets the query String.
Returns:
String representation of the query part of the URI

toString

public java.lang.String toString()
Gets a string representation of the URI.
Overrides:
toString in class java.lang.Object
Returns:
the URI as a String.