org.mobicents.servlet.sip.address
Class RFC2396UrlDecoder

java.lang.Object
  extended by org.mobicents.servlet.sip.address.RFC2396UrlDecoder

public class RFC2396UrlDecoder
extends java.lang.Object

Copied from Apache Excalibur project. Source code available at http://www.google.com/codesearch?hl=en&q=+excalibur+decodePath+show:sK_gDY0W5Rw:OTjCHAiSuF0:th3BdHtpX20&sa=N&cd=1&ct=rc&cs_p=http://apache.edgescape.com/excalibur/excalibur-sourceresolve/source/excalibur-sourceresolve-1.1-src.zip&cs_f=excalibur-sourceresolve-1.1/src/java/org/apache/excalibur/source/SourceUtil.java

Author:
Jean Deruelle

Constructor Summary
RFC2396UrlDecoder()
           
 
Method Summary
static java.lang.String decode(java.lang.String uri)
          Decode a path.
static java.lang.String encode(java.lang.String s)
          Translates a string into x-www-form-urlencoded format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RFC2396UrlDecoder

public RFC2396UrlDecoder()
Method Detail

encode

public static java.lang.String encode(java.lang.String s)
Translates a string into x-www-form-urlencoded format.

Parameters:
s - String to be translated.
Returns:
the translated String.

decode

public static java.lang.String decode(java.lang.String uri)
Decode a path.

Interprets %XX (where XX is hexadecimal number) as UTF-8 encoded bytes.

The validity of the input path is not checked (i.e. characters that were not encoded will not be reported as errors).

This method differs from URLDecoder.decode in that it always uses UTF-8 (while URLDecoder uses the platform default encoding, often ISO-8859-1), and doesn't translate + characters to spaces.

Parameters:
uri - the path to decode
Returns:
the decoded path


Copyright © 2009. All Rights Reserved.