de.uplanet.lucy.server.util
Class URL

java.lang.Object
  extended by de.uplanet.lucy.server.util.URL

@Scriptable
public final class URL
extends java.lang.Object

Version:
$Revision: 72675 $

Constructor Summary
URL(java.lang.String p_strUrl)
           
 
Method Summary
 java.lang.String asEntityEncodedString()
           
 java.lang.String asString()
           
 void clearParams()
          Remove all querystring parameters.
 java.lang.String getFragment()
          Get the URL's fragment.
 java.lang.Object getParam(java.lang.String p_strParam)
          Get a querystring parameter.
 boolean hasFragment()
          Determine if this URL has a fragment.
 boolean hasParam(java.lang.String p_strParam)
          Test if the URL has the specified querystring parameter.
 void putParam(java.lang.String p_strParam, java.lang.Object p_value)
          Set a querystring parameter.
 void putParamUnencoded(java.lang.String p_strParam, java.lang.Object p_value)
          Deprecated. The method putParamUnencoded is error-prone and thus not supported anymore. User putParam instead.
 void removeFragment()
          Remove the URL's fragment.
 boolean removeParam(java.lang.String p_strParam)
          Remove the specified querystring parameter.
 void setFragment(java.lang.String p_strFragment)
          Set the URL#s fragment.
 void setParams(java.util.Map<java.lang.String,java.lang.String> p_params)
          Set the querystring parameters that are contained in the given map.
 void writeEntityEncodedTo(java.io.Writer p_out)
          Write the URL to the specified java.io.Writer, e.g.
 void writeTo(java.io.Writer p_out)
          Write the URL to the specified java.io.Writer, e.g.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URL

public URL(java.lang.String p_strUrl)
    throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException
Method Detail

putParam

public void putParam(java.lang.String p_strParam,
                     java.lang.Object p_value)
Set a querystring parameter.

Parameters that start with rq_ will be hex-encoded unless they are in the list of unencoded querystring parameters. All other parameters are not hex-encoded.

Parameters:
p_strParam - The name of the querystring parameter.
p_value - The value of the querystring parameter.

putParamUnencoded

@Deprecated
public void putParamUnencoded(java.lang.String p_strParam,
                                         java.lang.Object p_value)
Deprecated. The method putParamUnencoded is error-prone and thus not supported anymore. User putParam instead.

Throws:
java.lang.UnsupportedOperationException - Always.

getParam

public java.lang.Object getParam(java.lang.String p_strParam)
Get a querystring parameter.

Parameters:
p_strParam - The name of the querystring parameter.
Returns:
The value of the given querystring parameter, or null if it does not exist.

hasParam

public boolean hasParam(java.lang.String p_strParam)
Test if the URL has the specified querystring parameter.

Parameters:
p_strParam - The querystring parameter.
Returns:
true if the URL has the specified, querystring parameter, or false otherwise.

removeParam

public boolean removeParam(java.lang.String p_strParam)
Remove the specified querystring parameter.

Parameters:
p_strParam - The The querystring parameter.
Returns:
true if the specified querystring parameter was was removed, or false if the URL did not contain the specified querystring parameter.

setParams

public void setParams(java.util.Map<java.lang.String,java.lang.String> p_params)
Set the querystring parameters that are contained in the given map.

Parameters:
p_params - The querystring parameters to set.

clearParams

public void clearParams()
Remove all querystring parameters.


hasFragment

public boolean hasFragment()
Determine if this URL has a fragment.

Returns:
true if the URL has a fragment, or false otherwise.

getFragment

public java.lang.String getFragment()
Get the URL's fragment.

Returns:
The URL's fragment, not including the leading sharp sign, or null if the URL has no fragment.

setFragment

public void setFragment(java.lang.String p_strFragment)
Set the URL#s fragment.

Parameters:
p_strFragment - The URL#s fragment.

removeFragment

public void removeFragment()
Remove the URL's fragment.


writeTo

public void writeTo(java.io.Writer p_out)
             throws java.io.IOException
Write the URL to the specified java.io.Writer, e.g. $Response.

Parameters:
p_out - The output stream.
Throws:
java.io.IOException - If an I/O error occurred or the character encoding could not be determined.

writeEntityEncodedTo

public void writeEntityEncodedTo(java.io.Writer p_out)
                          throws java.io.IOException
Write the URL to the specified java.io.Writer, e.g. $Response.

Parameters:
p_out - The output stream.
Throws:
java.io.IOException - If an I/O error occurred or the character encoding could not be determined.

asString

public java.lang.String asString()

asEntityEncodedString

public java.lang.String asEntityEncodedString()


Last updated: 2011-01-27
Copyright 2000-2010 United Planet. All Rights Reserved.