com.ibm.xsp.designer.context
Class XSPUrl

java.lang.Object
  extended by com.ibm.designer.runtime.UrlObject
      extended by com.ibm.xsp.designer.context.XSPUrl
All Implemented Interfaces:
java.lang.Cloneable

public class XSPUrl
extends com.ibm.designer.runtime.UrlObject
implements java.lang.Cloneable


Nested Class Summary
 
Nested classes/interfaces inherited from class com.ibm.designer.runtime.UrlObject
com.ibm.designer.runtime.UrlObject.Parameter
 
Field Summary
 
Fields inherited from class com.ibm.designer.runtime.UrlObject
fragment, host, parameters, password, path, port, scheme, username
 
Constructor Summary
XSPUrl()
          Default constructor for RuntimeUrl
XSPUrl(java.lang.String urlStr)
          Creates an RuntimeUrl object
 
Method Summary
static java.lang.String _decodeString(java.lang.String str)
          Not public.
static java.lang.String _encodeString(java.lang.String str)
          Not public.
 java.lang.Object clone()
           
 XSPUrl cloneUrl()
          Return a clone of this RuntimeUrl or null if cloning is not supported
static java.lang.String decodeParameter(java.lang.String param)
          Decode the string parameter witch is encoded into application/w-www-form-urlencoded format.
static java.lang.String decodeParameter(java.lang.String param, java.lang.String enc)
          Decode the string parameter witch is encoded into application/w-www-form-urlencoded format using the specify encoding scheme.
static java.lang.String encodeParameter(java.lang.String param)
          Encode the string parameter by translating it into application/w-www-form-urlencoded format.
static java.lang.String encodeParameter(java.lang.String param, java.lang.String enc)
          Encode the string parameter by translating it into application/w-www-form-urlencoded format.
 java.lang.String getAddress()
          Gets the full address of the URL Builds a string of the form 'scheme://host:port/path' The scheme, host, port and fragment will appear in the string only if they have a non-empty value.
protected  java.lang.String getContextPath(XSPContext context)
           
 java.lang.String getFragment()
          Gets the fragment (reference) included in the URL
 java.lang.String getHost()
          Get the host name or address
 java.lang.String getParameter(java.lang.String name)
          Gets the value of a query string parameter, by name
 java.lang.String getParameterName(int index)
          Gets the name of a query string parameter, by index
 int getParametersCount()
          Gets the number of parameters in the query string
 java.lang.String getPath()
          Gets the path included in the URL
 int getPort()
          Gets the port number
 java.lang.String getQueryString()
          Gets the whole query string, including the first '?'
 java.lang.String getScheme()
          Gets the scheme (protocol) of the URL
 java.lang.String getSiteRelativeAddress(XSPContext context)
          Gets the address of the URL, starting with the root directory Builds a string of the form '/path' The scheme, host, port and fragment are ignored
 boolean hasParameter(java.lang.String name)
          Tests the existence of a query string parameter
 void removeAllParameters()
          Removes all the query string parameters
 void removeParameter(java.lang.String name)
          Removes a query string parameter by name
 void setAddress(java.lang.String address)
          Sets the full address of the URL.
 void setFragment(java.lang.String fragment)
          Sets the fragment (reference) in the URL
 void setHost(java.lang.String host)
          Sets the host name or address
 void setParameter(java.lang.String name, java.lang.String value)
          Sets the value of a query string parameter The parameter may be an existing one, and in that case its value is replaced by the new value, or a new parameter.
 void setPath(java.lang.String path)
          Sets the path in the URL
 void setPort(int port)
          Sets the port number of the URL
 void setScheme(java.lang.String scheme)
          Sets the scheme (protocol) of the URL
 java.lang.String toSiteRelativeString(XSPContext context)
          Writes the URL as a string, in a site-relative form
 java.lang.String toString()
          Writes the URL as a string
 
Methods inherited from class com.ibm.designer.runtime.UrlObject
doDecodeParameter, doDecodeParameter, doEncodeParameter, doEncodeParameter, getFragmenStringUtil, getParameterEntry, getParameterEntry, getPassword, getUsername, setPassword, setQueryString, setUsername
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XSPUrl

public XSPUrl()
Default constructor for RuntimeUrl


XSPUrl

public XSPUrl(java.lang.String urlStr)
Creates an RuntimeUrl object

Parameters:
url - url String
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class com.ibm.designer.runtime.UrlObject
Throws:
java.lang.CloneNotSupportedException

cloneUrl

public XSPUrl cloneUrl()
Return a clone of this RuntimeUrl or null if cloning is not supported

Returns:

getQueryString

public java.lang.String getQueryString()
Gets the whole query string, including the first '?'

Overrides:
getQueryString in class com.ibm.designer.runtime.UrlObject
Returns:
the query string, if any, starting with '?'

toString

public java.lang.String toString()
Writes the URL as a string

Overrides:
toString in class com.ibm.designer.runtime.UrlObject
Returns:
a string representation of the URL

toSiteRelativeString

public java.lang.String toSiteRelativeString(XSPContext context)
Writes the URL as a string, in a site-relative form

Returns:
a string representation of the URL, in a site-relative form

getScheme

public java.lang.String getScheme()
Gets the scheme (protocol) of the URL

Overrides:
getScheme in class com.ibm.designer.runtime.UrlObject
Returns:
the scheme of the URL

setScheme

public void setScheme(java.lang.String scheme)
Sets the scheme (protocol) of the URL

Overrides:
setScheme in class com.ibm.designer.runtime.UrlObject
Parameters:
scheme - the new scheme

getHost

public java.lang.String getHost()
Get the host name or address

Overrides:
getHost in class com.ibm.designer.runtime.UrlObject
Returns:
the host set in the URL (name or address)

setHost

public void setHost(java.lang.String host)
Sets the host name or address

Overrides:
setHost in class com.ibm.designer.runtime.UrlObject
Parameters:
host - the new host name or address

getPort

public int getPort()
Gets the port number

Overrides:
getPort in class com.ibm.designer.runtime.UrlObject
Returns:
the port number, of -1 if no port specified

setPort

public void setPort(int port)
Sets the port number of the URL

Overrides:
setPort in class com.ibm.designer.runtime.UrlObject
Parameters:
port - the new port number, or -1 to remove any port number

getPath

public java.lang.String getPath()
Gets the path included in the URL

Overrides:
getPath in class com.ibm.designer.runtime.UrlObject
Returns:
the path included in the URL

setPath

public void setPath(java.lang.String path)
Sets the path in the URL

Overrides:
setPath in class com.ibm.designer.runtime.UrlObject
Parameters:
path - the new path

getFragment

public java.lang.String getFragment()
Gets the fragment (reference) included in the URL

Overrides:
getFragment in class com.ibm.designer.runtime.UrlObject
Returns:
the fragment if there is one, without the first '#', otherwise an empty string

setFragment

public void setFragment(java.lang.String fragment)
Sets the fragment (reference) in the URL

Overrides:
setFragment in class com.ibm.designer.runtime.UrlObject
Parameters:
fragment - the fragment value

getAddress

public java.lang.String getAddress()
Gets the full address of the URL Builds a string of the form 'scheme://host:port/path' The scheme, host, port and fragment will appear in the string only if they have a non-empty value.

Overrides:
getAddress in class com.ibm.designer.runtime.UrlObject
Returns:
the full address in the URL (without the query string)

getSiteRelativeAddress

public java.lang.String getSiteRelativeAddress(XSPContext context)
Gets the address of the URL, starting with the root directory Builds a string of the form '/path' The scheme, host, port and fragment are ignored

Returns:
the site-relative address in the URL (without the query string)

getContextPath

protected java.lang.String getContextPath(XSPContext context)

setAddress

public void setAddress(java.lang.String address)
Sets the full address of the URL. Parses the new address and replaces the old values for scheme, host, port, path, query string and fragment. Some of the new values may be empty.

Overrides:
setAddress in class com.ibm.designer.runtime.UrlObject
Parameters:
address - the string to be parsed as the new URL address

getParametersCount

public int getParametersCount()
Gets the number of parameters in the query string

Overrides:
getParametersCount in class com.ibm.designer.runtime.UrlObject
Returns:
the number of parameters in the query string

getParameterName

public java.lang.String getParameterName(int index)
Gets the name of a query string parameter, by index

Overrides:
getParameterName in class com.ibm.designer.runtime.UrlObject
Parameters:
index - index value in the query string parameters ; first is 0
Returns:
the name of the query string parameter specified by its index

hasParameter

public boolean hasParameter(java.lang.String name)
Tests the existence of a query string parameter

Overrides:
hasParameter in class com.ibm.designer.runtime.UrlObject
Parameters:
name - the name of the parameter to look for
Returns:
true if there is a query string parameter with the specified name

removeParameter

public void removeParameter(java.lang.String name)
Removes a query string parameter by name

Overrides:
removeParameter in class com.ibm.designer.runtime.UrlObject
Parameters:
name - the name of the parameter to remove

removeAllParameters

public void removeAllParameters()
Removes all the query string parameters

Overrides:
removeAllParameters in class com.ibm.designer.runtime.UrlObject

getParameter

public java.lang.String getParameter(java.lang.String name)
Gets the value of a query string parameter, by name

Overrides:
getParameter in class com.ibm.designer.runtime.UrlObject
Parameters:
name - the name of the query string parameter
Returns:
the value of the corresponding query string parameter

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Sets the value of a query string parameter The parameter may be an existing one, and in that case its value is replaced by the new value, or a new parameter.

Overrides:
setParameter in class com.ibm.designer.runtime.UrlObject
Parameters:
name - the name of the query string param
value - the new value of the parameter

encodeParameter

public static java.lang.String encodeParameter(java.lang.String param)
Encode the string parameter by translating it into application/w-www-form-urlencoded format. The parameter is encoded with default server character encoding property. Prefer the method using an explicit encoding.

Parameters:
param - the string parameter to encode
Returns:
the translated string

encodeParameter

public static java.lang.String encodeParameter(java.lang.String param,
                                               java.lang.String enc)
Encode the string parameter by translating it into application/w-www-form-urlencoded format. The supplied encoding is used to determine what character are to be represented by consecutive sequences of the form "%xy". This method requires at least jdk1.4 to use the encoding parameter. With previous versions, it just ignores it and uses the default server character encoding property.

Parameters:
param - the string parameter to encode
enc - the name of the character encoding
Returns:
the translated string

decodeParameter

public static java.lang.String decodeParameter(java.lang.String param)
Decode the string parameter witch is encoded into application/w-www-form-urlencoded format. The parameter is decoded with default server character encoding property. Prefer the method using an explicit encoding.

Parameters:
param - the string parameter to decode
Returns:
the decoded string

decodeParameter

public static java.lang.String decodeParameter(java.lang.String param,
                                               java.lang.String enc)
Decode the string parameter witch is encoded into application/w-www-form-urlencoded format using the specify encoding scheme. The supplied encoding is used to determine what character are represented by any consecutive sequences of the form "%xy". This method requires at least jdk1.4 to use the encoding parameter. With previous versions, it just ignores it and uses the default server character encoding property.

Parameters:
param - the string parameter to decode
enc - the name of the character encoding
Returns:
the decoded string

_encodeString

public static java.lang.String _encodeString(java.lang.String str)
Not public. Do not use.

Parameters:
str -
Returns:

_decodeString

public static java.lang.String _decodeString(java.lang.String str)
Not public. Do not use.

Parameters:
str -
Returns: