Java Doc for URI.java in  » Net » Apache-common-HttpClient » org » apache » commons » httpclient » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Apache common HttpClient » org.apache.commons.httpclient 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.httpclient.URI

All known Subclasses:   org.apache.commons.httpclient.HttpURL,
URI
public class URI implements Cloneable,Comparable,Serializable(Code)
The interface for the URI(Uniform Resource Identifiers) version of RFC 2396. This class has the purpose of supportting of parsing a URI reference to extend any specific protocols, the character encoding of the protocol to be transported and the charset of the document.

A URI is always in an "escaped" form, since escaping or unescaping a completed URI might change its semantics.

Implementers should be careful not to escape or unescape the same string more than once, since unescaping an already unescaped string might lead to misinterpreting a percent data character as another escaped character, or vice versa in the case of escaping an already escaped string.

In order to avoid these problems, data types used as follows:

 URI character sequence: char
 octet sequence: byte
 original character sequence: String
 

So, a URI is a sequence of characters as an array of a char type, which is not always represented as a sequence of octets as an array of byte.

URI Syntactic Components

 - In general, written as follows:
 Absolute URI = <scheme>:<scheme-specific-part>
 Generic URI = <scheme>://<authority><path>?<query>
 - Syntax
 absoluteURI   = scheme ":" ( hier_part | opaque_part )
 hier_part     = ( net_path | abs_path ) [ "?" query ]
 net_path      = "//" authority [ abs_path ]
 abs_path      = "/"  path_segments
 

The following examples illustrate URI that are in common use.

 ftp://ftp.is.co.za/rfc/rfc1808.txt
 -- ftp scheme for File Transfer Protocol services
 gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles
 -- gopher scheme for Gopher and Gopher+ Protocol services
 http://www.math.uio.no/faq/compression-faq/part1.html
 -- http scheme for Hypertext Transfer Protocol services
 mailto:mduerst@ifi.unizh.ch
 -- mailto scheme for electronic mail addresses
 news:comp.infosystems.www.servers.unix
 -- news scheme for USENET news groups and articles
 telnet://melvyl.ucop.edu/
 -- telnet scheme for interactive services via the TELNET Protocol
 
Please, notice that there are many modifications from URL(RFC 1738) and relative URL(RFC 1808).

The expressions for a URI

 For escaped URI forms
 - URI(char[]) // constructor
 - char[] getRawXxx() // method
 - String getEscapedXxx() // method
 - String toString() // method
 

For unescaped URI forms - URI(String) // constructor - String getXXX() // method


author:
   Sung-Gu
author:
   Mike Bowler
version:
   $Revision: 564973 $ $Date: 2002/03/14 15:14:01


Inner Class :public static class DefaultCharsetChanged extends RuntimeException
Inner Class :public static class LocaleToCharsetMap

Field Summary
final protected static  BitSetIPv4address
     Bitset that combines digit and dot fo IPv$address.
final protected static  BitSetIPv6address
     RFC 2373.
final protected static  BitSetIPv6reference
     RFC 2732, 2373.
final protected static  BitSetURI_reference
     BitSet for URI-reference.
protected  char[]_authority
     The authority.
protected  char[]_fragment
     The fragment.
protected  char[]_host
     The host.
protected  boolean_is_IPv4address
    
protected  boolean_is_IPv6reference
    
protected  boolean_is_abs_path
    
protected  boolean_is_hier_part
    
protected  boolean_is_hostname
    
protected  boolean_is_net_path
    
protected  boolean_is_opaque_part
    
protected  boolean_is_reg_name
    
protected  boolean_is_rel_path
    
protected  boolean_is_server
    
protected  char[]_opaque
     The opaque.
protected  char[]_path
     The path.
protected  int_port
     The port.
protected  char[]_query
     The query.
protected  char[]_scheme
     The scheme.
protected  char[]_uri
     This Uniform Resource Identifier (URI). The URI is always in an "escaped" form, since escaping or unescaping a completed URI might change its semantics.
protected  char[]_userinfo
     The userinfo.
final protected static  BitSetabs_path
     URI absolute path.
final protected static  BitSetabsoluteURI
     BitSet for absoluteURI.
final public static  BitSetallowed_IPv6reference
     Those characters that are allowed for the IPv6reference component.
final public static  BitSetallowed_abs_path
     Those characters that are allowed for the abs_path.
final public static  BitSetallowed_authority
     Those characters that are allowed for the authority component.
final public static  BitSetallowed_fragment
     Those characters that are allowed for the fragment component.
final public static  BitSetallowed_host
     Those characters that are allowed for the host component.
final public static  BitSetallowed_opaque_part
     Those characters that are allowed for the opaque_part.
final public static  BitSetallowed_query
     Those characters that are allowed for the query component.
final public static  BitSetallowed_reg_name
     Those characters that are allowed for the reg_name.
final public static  BitSetallowed_rel_path
     Those characters that are allowed for the rel_path.
final public static  BitSetallowed_userinfo
     Those characters that are allowed for the userinfo component.
final public static  BitSetallowed_within_authority
     Those characters that are allowed for the authority component.
final public static  BitSetallowed_within_path
     Those characters that are allowed within the path.
final public static  BitSetallowed_within_query
     Those characters that are allowed within the query component.
final public static  BitSetallowed_within_userinfo
     Those characters that are allowed for within the userinfo component.
final protected static  BitSetalpha
     BitSet for alpha.
final protected static  BitSetalphanum
     BitSet for alphanum (join of alpha & digit).
final protected static  BitSetauthority
     BitSet for authority.
final public static  BitSetcontrol
     BitSet for control.
protected static  StringdefaultDocumentCharset
     The default charset of the document.
protected static  StringdefaultDocumentCharsetByLocale
    
protected static  StringdefaultDocumentCharsetByPlatform
    
protected static  StringdefaultProtocolCharset
     The default charset of the protocol.
final public static  BitSetdelims
     BitSet for delims.
final protected static  BitSetdigit
     BitSet for digit.
final public static  BitSetdisallowed_opaque_part
     Disallowed opaque_part before escaping.
final public static  BitSetdisallowed_rel_path
     Disallowed rel_path before escaping.
final protected static  BitSetdomainlabel
     BitSet for domainlabel.
final protected static  BitSetescaped
     BitSet for escaped.
final protected static  BitSetfragment
     BitSet for fragment (alias for uric).
protected  inthash
     Cache the hash code for this URI.
final protected static  BitSethex
     BitSet for hex.
final protected static  BitSethier_part
     BitSet for hier_part.
final protected static  BitSethost
     BitSet for host.
final protected static  BitSethostname
     BitSet for hostname.
final protected static  BitSethostport
     BitSet for hostport.
final protected static  BitSetmark
     BitSet for mark.
final protected static  BitSetnet_path
     BitSet for net_path.
final protected static  BitSetopaque_part
     URI bitset that combines uric_no_slash and uric.
final protected static  BitSetparam
     BitSet for param (alias for pchar).
final protected static  BitSetpath
     URI bitset that combines absolute path and opaque part.
final protected static  BitSetpath_segments
     BitSet for path segments.
final protected static  BitSetpchar
     BitSet for pchar.
final protected static  BitSetpercent
     The percent "%" character always has the reserved purpose of being the escape indicator, it must be escaped as "%25" in order to be used as data within a URI.
final protected static  BitSetport
     Port, a logical alias for digit.
protected  StringprotocolCharset
     The charset of the protocol used by this URI instance.
final protected static  BitSetquery
     BitSet for query (alias for uric).
final protected static  BitSetreg_name
     BitSet for reg_name.
final protected static  BitSetrel_path
     BitSet for rel_path.
final protected static  BitSetrel_segment
     BitSet for rel_segment.
final protected static  BitSetrelativeURI
     BitSet for relativeURI.
final protected static  BitSetreserved
     BitSet for reserved.
final protected static  char[]rootPath
     The root path.
final protected static  BitSetscheme
     BitSet for scheme.
final protected static  BitSetsegment
     BitSet for segment.
final static  longserialVersionUID
    
final protected static  BitSetserver
     Bitset for server.
final public static  BitSetspace
     BitSet for space.
final protected static  BitSettoplabel
     BitSet for toplabel.
final protected static  BitSetunreserved
     Data characters that are allowed in a URI but do not have a reserved purpose are called unreserved.
final public static  BitSetunwise
     BitSet for unwise.
final protected static  BitSeturic
     BitSet for uric.
final protected static  BitSeturic_no_slash
     URI bitset for encoding typical non-slash characters.
final protected static  BitSetuserinfo
     Bitset for userinfo.
final public static  BitSetwithin_userinfo
     BitSet for within the userinfo component like user and password.

Constructor Summary
protected  URI()
    
public  URI(String s, boolean escaped, String charset)
     Construct a URI from a string with the given charset.
public  URI(String s, boolean escaped)
     Construct a URI from a string with the given charset.
public  URI(char[] escaped, String charset)
     Construct a URI as an escaped form of a character array with the given charset.
public  URI(char[] escaped)
     Construct a URI as an escaped form of a character array.
public  URI(String original, String charset)
     Construct a URI from the given string with the given charset.
public  URI(String original)
     Construct a URI from the given string.
public  URI(String scheme, String schemeSpecificPart, String fragment)
     Construct a general URI from the given components.
public  URI(String scheme, String authority, String path, String query, String fragment)
     Construct a general URI from the given components.
public  URI(String scheme, String userinfo, String host, int port)
     Construct a general URI from the given components.
public  URI(String scheme, String userinfo, String host, int port, String path)
     Construct a general URI from the given components.
public  URI(String scheme, String userinfo, String host, int port, String path, String query)
     Construct a general URI from the given components.
public  URI(String scheme, String userinfo, String host, int port, String path, String query, String fragment)
     Construct a general URI from the given components.
public  URI(String scheme, String host, String path, String fragment)
     Construct a general URI from the given components.
public  URI(URI base, String relative)
     Construct a general URI with the given relative URI string.
public  URI(URI base, String relative, boolean escaped)
     Construct a general URI with the given relative URI string.
Parameters:
  base - the base URI
Parameters:
  relative - the relative URI string
Parameters:
  escaped - true if URI character sequence is in escaped form.
public  URI(URI base, URI relative)
     Construct a general URI with the given relative URI.

 URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
 relativeURI   = ( net_path | abs_path | rel_path ) [ "?" query ]
 

Resolving Relative References to Absolute Form. Examples of Resolving Relative URI References Within an object with a well-defined base URI of

 http://a/b/c/d;p?q
 

the relative URI would be resolved as follows: Normal Examples

 g:h           =  g:h
 g             =  http://a/b/c/g
 ./g           =  http://a/b/c/g
 g/            =  http://a/b/c/g/
 /g            =  http://a/g
 //g           =  http://g
 ?y            =  http://a/b/c/?y
 g?y           =  http://a/b/c/g?y
 #s            =  (current document)#s
 g#s           =  http://a/b/c/g#s
 g?y#s         =  http://a/b/c/g?y#s
 ;x            =  http://a/b/c/;x
 g;x           =  http://a/b/c/g;x
 g;x?y#s       =  http://a/b/c/g;x?y#s
 .

Method Summary
public synchronized  Objectclone()
     Create and return a copy of this object, the URI-reference containing the userinfo component.
public  intcompareTo(Object obj)
     Compare this URI to another object.
protected static  Stringdecode(char[] component, String charset)
     Decodes URI encoded string. This is a two mapping, one from URI characters to octets, and subsequently a second from octets to original characters:

 URI character sequence->octet sequence->original character sequence
 

A URI must be separated into its components before the escaped characters within those components can be allowedly decoded.

Notice that there is a chance that URI characters that are non UTF-8 may be parsed as valid UTF-8.

protected static  Stringdecode(String component, String charset)
     Decodes URI encoded string. This is a two mapping, one from URI characters to octets, and subsequently a second from octets to original characters:

 URI character sequence->octet sequence->original character sequence
 

A URI must be separated into its components before the escaped characters within those components can be allowedly decoded.

Notice that there is a chance that URI characters that are non UTF-8 may be parsed as valid UTF-8.

protected static  char[]encode(String original, BitSet allowed, String charset)
     Encodes URI string. This is a two mapping, one from original characters to octets, and subsequently a second from octets to URI characters:

 original character sequence->octet sequence->URI character sequence
 

An escaped octet is encoded as a character triplet, consisting of the percent character "%" followed by the two hexadecimal digits representing the octet code.

protected  booleanequals(char[] first, char[] second)
     Test if the first array is equal to the second array.
public  booleanequals(Object obj)
     Test an object if this URI is equal to another.
public  StringgetAboveHierPath()
     Get the level above the this hierarchy level.
public  StringgetAuthority()
     Get the authority.
public  StringgetCurrentHierPath()
     Get the current hierarchy level.
public static  StringgetDefaultDocumentCharset()
     Get the recommended default charset of the document.
public static  StringgetDefaultDocumentCharsetByLocale()
     Get the default charset of the document by locale.
public static  StringgetDefaultDocumentCharsetByPlatform()
     Get the default charset of the document by platform.
public static  StringgetDefaultProtocolCharset()
     Get the default charset of the protocol.
public  StringgetEscapedAboveHierPath()
     Get the level above the this hierarchy level.
public  StringgetEscapedAuthority()
     Get the escaped authority.
public  StringgetEscapedCurrentHierPath()
     Get the escaped current hierarchy level.
public  StringgetEscapedFragment()
     Get the escaped fragment.
public  StringgetEscapedName()
     Get the escaped basename of the path.
public  StringgetEscapedPath()
     Get the escaped path.
public  StringgetEscapedPathQuery()
     Get the escaped query.
public  StringgetEscapedQuery()
     Get the escaped query.
public  StringgetEscapedURI()
     It can be gotten the URI character sequence.
public  StringgetEscapedURIReference()
     Get the escaped URI reference string.
public  StringgetEscapedUserinfo()
     Get the escaped userinfo.
public  StringgetFragment()
     Get the fragment.
public  StringgetHost()
     Get the host.
public  StringgetName()
     Get the basename of the path.
public  StringgetPath()
     Get the path.
public  StringgetPathQuery()
     Get the path and query.
public  intgetPort()
     Get the port.
public  StringgetProtocolCharset()
     Get the protocol charset used by this current URI instance. It was set by the constructor for this instance.
public  StringgetQuery()
     Get the query.
public  char[]getRawAboveHierPath()
     Get the level above the this hierarchy level.
public  char[]getRawAuthority()
     Get the raw-escaped authority.
protected  char[]getRawCurrentHierPath(char[] path)
     Get the raw-escaped current hierarchy level in the given path.
public  char[]getRawCurrentHierPath()
     Get the raw-escaped current hierarchy level.
public  char[]getRawFragment()
     Get the raw-escaped fragment.
public  char[]getRawHost()
     Get the host.
public  char[]getRawName()
     Get the raw-escaped basename of the path.
public  char[]getRawPath()
     Get the raw-escaped path.
public  char[]getRawPathQuery()
     Get the raw-escaped path and query.
public  char[]getRawQuery()
     Get the raw-escaped query.
public  char[]getRawScheme()
     Get the scheme.
public  char[]getRawURI()
     It can be gotten the URI character sequence.
public  char[]getRawURIReference()
     Get the URI reference character sequence.
public  char[]getRawUserinfo()
     Get the raw-escaped userinfo.
public  StringgetScheme()
     Get the scheme.
public  StringgetURI()
     It can be gotten the URI character sequence.
public  StringgetURIReference()
     Get the original URI reference string.
public  StringgetUserinfo()
     Get the userinfo.
public  booleanhasAuthority()
     Tell whether or not this URI has authority.
public  booleanhasFragment()
     Tell whether or not this URI has fragment.
public  booleanhasQuery()
     Tell whether or not this URI has query.
public  booleanhasUserinfo()
     Tell whether or not this URI has userinfo.
public  inthashCode()
     Return a hash code for this URI.
protected  intindexFirstOf(String s, String delims)
     Get the earlier index that to be searched for the first occurrance in one of any of the given string.
protected  intindexFirstOf(String s, String delims, int offset)
     Get the earlier index that to be searched for the first occurrance in one of any of the given string.
protected  intindexFirstOf(char[] s, char delim)
     Get the earlier index that to be searched for the first occurrance in one of any of the given array.
protected  intindexFirstOf(char[] s, char delim, int offset)
     Get the earlier index that to be searched for the first occurrance in one of any of the given array.
Parameters:
  s - the character array to be indexed
Parameters:
  delim - the delimiter used to index
Parameters:
  offset - The offset.
public  booleanisAbsPath()
     Tell whether or not the relativeURI or hier_part of this URI is abs_path.
public  booleanisAbsoluteURI()
     Tell whether or not this URI is absolute.
public  booleanisHierPart()
     Tell whether or not the absoluteURI of this URI is hier_part.
public  booleanisHostname()
     Tell whether or not the host part of this URI is hostname.
public  booleanisIPv4address()
     Tell whether or not the host part of this URI is IPv4address.
public  booleanisIPv6reference()
     Tell whether or not the host part of this URI is IPv6reference.
public  booleanisNetPath()
     Tell whether or not the relativeURI or heir_part of this URI is net_path.
public  booleanisOpaquePart()
     Tell whether or not the absoluteURI of this URI is opaque_part.
public  booleanisRegName()
     Tell whether or not the authority component of this URI is reg_name.
public  booleanisRelPath()
     Tell whether or not the relativeURI of this URI is rel_path.
public  booleanisRelativeURI()
     Tell whether or not this URI is relative.
public  booleanisServer()
     Tell whether or not the authority component of this URI is server.
protected  char[]normalize(char[] path)
     Normalize the given hier path part.
public  voidnormalize()
     Normalizes the path part of this URI.
protected  voidparseAuthority(String original, boolean escaped)
     Parse the authority component.
protected  voidparseUriReference(String original, boolean escaped)
     In order to avoid any possilbity of conflict with non-ASCII characters, Parse a URI reference as a String with the character encoding of the local system or the document.
protected  booleanprevalidate(String component, BitSet disallowed)
     Pre-validate the unescaped URI string within a specific component.
protected  char[]removeFragmentIdentifier(char[] component)
     Remove the fragment identifier of the given component.
protected  char[]resolvePath(char[] basePath, char[] relPath)
     Resolve the base and relative path.
public static  voidsetDefaultDocumentCharset(String charset)
     Set the default charset of the document.

Notice that it will be possible to contain mixed characters (e.g. ftp://host/KoreanNamespace/ChineseResource).

public static  voidsetDefaultProtocolCharset(String charset)
     Set the default charset of the protocol.

The character set used to store files SHALL remain a local decision and MAY depend on the capability of local operating systems.

public  voidsetEscapedAuthority(String escapedAuthority)
     Set the authority.
public  voidsetEscapedFragment(String escapedFragment)
     Set the escaped fragment string.
public  voidsetEscapedPath(String escapedPath)
     Set the escaped path.
public  voidsetEscapedQuery(String escapedQuery)
     Set the escaped query string.
public  voidsetFragment(String fragment)
     Set the fragment.
public  voidsetPath(String path)
     Set the path.
public  voidsetQuery(String query)
     Set the query.

When a query string is not misunderstood the reserved special characters ("&", "=", "+", ",", and "$") within a query component, it is recommended to use in encoding the whole query with this method.

The additional APIs for the special purpose using by the reserved special characters used in each protocol are implemented in each protocol classes inherited from URI.

public  voidsetRawAuthority(char[] escapedAuthority)
     Set the authority.
public  voidsetRawFragment(char[] escapedFragment)
     Set the raw-escaped fragment.
public  voidsetRawPath(char[] escapedPath)
     Set the raw-escaped path.
public  voidsetRawQuery(char[] escapedQuery)
     Set the raw-escaped query.
protected  voidsetURI()
     Once it's parsed successfully, set this URI.
public  StringtoString()
     Get the escaped URI string.

On the document, the URI-reference form is only used without the userinfo component like http://jakarta.apache.org/ by the security reason. But the URI-reference form with the userinfo component could be parsed.

In other words, this URI and any its subclasses must not expose the URI-reference expression with the userinfo component like http://user:password@hostport/restricted_zone.
It means that the API client programmer should extract each user and password to access manually.

protected  booleanvalidate(char[] component, BitSet generous)
     Validate the URI characters within a specific component. The component must be performed after escape encoding.
protected  booleanvalidate(char[] component, int soffset, int eoffset, BitSet generous)
     Validate the URI characters within a specific component. The component must be performed after escape encoding.

Field Detail
IPv4address
final protected static BitSet IPv4address(Code)
Bitset that combines digit and dot fo IPv$address.

 IPv4address   = 1*digit "." 1*digit "." 1*digit "." 1*digit
 




IPv6address
final protected static BitSet IPv6address(Code)
RFC 2373.

 IPv6address = hexpart [ ":" IPv4address ]
 




IPv6reference
final protected static BitSet IPv6reference(Code)
RFC 2732, 2373.

 IPv6reference   = "[" IPv6address "]"
 




URI_reference
final protected static BitSet URI_reference(Code)
BitSet for URI-reference.

 URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
 




_authority
protected char[] _authority(Code)
The authority.



_fragment
protected char[] _fragment(Code)
The fragment.



_host
protected char[] _host(Code)
The host.



_is_IPv4address
protected boolean _is_IPv4address(Code)



_is_IPv6reference
protected boolean _is_IPv6reference(Code)



_is_abs_path
protected boolean _is_abs_path(Code)



_is_hier_part
protected boolean _is_hier_part(Code)



_is_hostname
protected boolean _is_hostname(Code)



_is_net_path
protected boolean _is_net_path(Code)



_is_opaque_part
protected boolean _is_opaque_part(Code)



_is_reg_name
protected boolean _is_reg_name(Code)



_is_rel_path
protected boolean _is_rel_path(Code)



_is_server
protected boolean _is_server(Code)



_opaque
protected char[] _opaque(Code)
The opaque.



_path
protected char[] _path(Code)
The path.



_port
protected int _port(Code)
The port.



_query
protected char[] _query(Code)
The query.



_scheme
protected char[] _scheme(Code)
The scheme.



_uri
protected char[] _uri(Code)
This Uniform Resource Identifier (URI). The URI is always in an "escaped" form, since escaping or unescaping a completed URI might change its semantics.



_userinfo
protected char[] _userinfo(Code)
The userinfo.



abs_path
final protected static BitSet abs_path(Code)
URI absolute path.

 abs_path      = "/"  path_segments
 




absoluteURI
final protected static BitSet absoluteURI(Code)
BitSet for absoluteURI.

 absoluteURI   = scheme ":" ( hier_part | opaque_part )
 




allowed_IPv6reference
final public static BitSet allowed_IPv6reference(Code)
Those characters that are allowed for the IPv6reference component. The characters '[', ']' in IPv6reference should be excluded.



allowed_abs_path
final public static BitSet allowed_abs_path(Code)
Those characters that are allowed for the abs_path.



allowed_authority
final public static BitSet allowed_authority(Code)
Those characters that are allowed for the authority component.



allowed_fragment
final public static BitSet allowed_fragment(Code)
Those characters that are allowed for the fragment component.



allowed_host
final public static BitSet allowed_host(Code)
Those characters that are allowed for the host component. The characters '[', ']' in IPv6reference should be excluded.



allowed_opaque_part
final public static BitSet allowed_opaque_part(Code)
Those characters that are allowed for the opaque_part.



allowed_query
final public static BitSet allowed_query(Code)
Those characters that are allowed for the query component.



allowed_reg_name
final public static BitSet allowed_reg_name(Code)
Those characters that are allowed for the reg_name.



allowed_rel_path
final public static BitSet allowed_rel_path(Code)
Those characters that are allowed for the rel_path.



allowed_userinfo
final public static BitSet allowed_userinfo(Code)
Those characters that are allowed for the userinfo component.



allowed_within_authority
final public static BitSet allowed_within_authority(Code)
Those characters that are allowed for the authority component.



allowed_within_path
final public static BitSet allowed_within_path(Code)
Those characters that are allowed within the path.



allowed_within_query
final public static BitSet allowed_within_query(Code)
Those characters that are allowed within the query component.



allowed_within_userinfo
final public static BitSet allowed_within_userinfo(Code)
Those characters that are allowed for within the userinfo component.



alpha
final protected static BitSet alpha(Code)
BitSet for alpha.

 alpha         = lowalpha | upalpha
 




alphanum
final protected static BitSet alphanum(Code)
BitSet for alphanum (join of alpha & digit).

 alphanum      = alpha | digit
 




authority
final protected static BitSet authority(Code)
BitSet for authority.

 authority     = server | reg_name
 




control
final public static BitSet control(Code)
BitSet for control.



defaultDocumentCharset
protected static String defaultDocumentCharset(Code)
The default charset of the document. RFC 2277, 2396 The platform's charset is used for the document by default.



defaultDocumentCharsetByLocale
protected static String defaultDocumentCharsetByLocale(Code)



defaultDocumentCharsetByPlatform
protected static String defaultDocumentCharsetByPlatform(Code)



defaultProtocolCharset
protected static String defaultProtocolCharset(Code)
The default charset of the protocol. RFC 2277, 2396



delims
final public static BitSet delims(Code)
BitSet for delims.



digit
final protected static BitSet digit(Code)
BitSet for digit.

 digit    = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" |
 "8" | "9"
 




disallowed_opaque_part
final public static BitSet disallowed_opaque_part(Code)
Disallowed opaque_part before escaping.



disallowed_rel_path
final public static BitSet disallowed_rel_path(Code)
Disallowed rel_path before escaping.



domainlabel
final protected static BitSet domainlabel(Code)
BitSet for domainlabel.

 domainlabel   = alphanum | alphanum *( alphanum | "-" ) alphanum
 




escaped
final protected static BitSet escaped(Code)
BitSet for escaped.

 escaped       = "%" hex hex
 




fragment
final protected static BitSet fragment(Code)
BitSet for fragment (alias for uric).

 fragment      = *uric
 




hash
protected int hash(Code)
Cache the hash code for this URI.



hex
final protected static BitSet hex(Code)
BitSet for hex.

 hex           = digit | "A" | "B" | "C" | "D" | "E" | "F" |
 "a" | "b" | "c" | "d" | "e" | "f"
 




hier_part
final protected static BitSet hier_part(Code)
BitSet for hier_part.

 hier_part     = ( net_path | abs_path ) [ "?" query ]
 




host
final protected static BitSet host(Code)
BitSet for host.

 host          = hostname | IPv4address | IPv6reference
 




hostname
final protected static BitSet hostname(Code)
BitSet for hostname.

 hostname      = *( domainlabel "." ) toplabel [ "." ]
 




hostport
final protected static BitSet hostport(Code)
BitSet for hostport.

 hostport      = host [ ":" port ]
 




mark
final protected static BitSet mark(Code)
BitSet for mark.

 mark          = "-" | "_" | "." | "!" | "~" | "*" | "'" |
 "(" | ")"
 




net_path
final protected static BitSet net_path(Code)
BitSet for net_path.

 net_path      = "//" authority [ abs_path ]
 




opaque_part
final protected static BitSet opaque_part(Code)
URI bitset that combines uric_no_slash and uric.

 opaque_part   = uric_no_slash *uric
 




param
final protected static BitSet param(Code)
BitSet for param (alias for pchar).

 param         = *pchar
 




path
final protected static BitSet path(Code)
URI bitset that combines absolute path and opaque part.

 path          = [ abs_path | opaque_part ]
 




path_segments
final protected static BitSet path_segments(Code)
BitSet for path segments.

 path_segments = segment *( "/" segment )
 




pchar
final protected static BitSet pchar(Code)
BitSet for pchar.

 pchar         = unreserved | escaped |
 ":" | "@" | "&" | "=" | "+" | "$" | ","
 




percent
final protected static BitSet percent(Code)
The percent "%" character always has the reserved purpose of being the escape indicator, it must be escaped as "%25" in order to be used as data within a URI.



port
final protected static BitSet port(Code)
Port, a logical alias for digit.



protocolCharset
protected String protocolCharset(Code)
The charset of the protocol used by this URI instance.



query
final protected static BitSet query(Code)
BitSet for query (alias for uric).

 query         = *uric
 




reg_name
final protected static BitSet reg_name(Code)
BitSet for reg_name.

 reg_name      = 1*( unreserved | escaped | "$" | "," |
 ";" | ":" | "@" | "&" | "=" | "+" )
 




rel_path
final protected static BitSet rel_path(Code)
BitSet for rel_path.

 rel_path      = rel_segment [ abs_path ]
 




rel_segment
final protected static BitSet rel_segment(Code)
BitSet for rel_segment.

 rel_segment   = 1*( unreserved | escaped |
 ";" | "@" | "&" | "=" | "+" | "$" | "," )
 




relativeURI
final protected static BitSet relativeURI(Code)
BitSet for relativeURI.

 relativeURI   = ( net_path | abs_path | rel_path ) [ "?" query ]
 




reserved
final protected static BitSet reserved(Code)
BitSet for reserved.

 reserved      = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
 "$" | ","
 




rootPath
final protected static char[] rootPath(Code)
The root path.



scheme
final protected static BitSet scheme(Code)
BitSet for scheme.

 scheme        = alpha *( alpha | digit | "+" | "-" | "." )
 




segment
final protected static BitSet segment(Code)
BitSet for segment.

 segment       = *pchar *( ";" param )
 




serialVersionUID
final static long serialVersionUID(Code)
Version ID for serialization



server
final protected static BitSet server(Code)
Bitset for server.

 server        = [ [ userinfo "@" ] hostport ]
 




space
final public static BitSet space(Code)
BitSet for space.



toplabel
final protected static BitSet toplabel(Code)
BitSet for toplabel.

 toplabel      = alpha | alpha *( alphanum | "-" ) alphanum
 




unreserved
final protected static BitSet unreserved(Code)
Data characters that are allowed in a URI but do not have a reserved purpose are called unreserved.

 unreserved    = alphanum | mark
 




unwise
final public static BitSet unwise(Code)
BitSet for unwise.



uric
final protected static BitSet uric(Code)
BitSet for uric.

 uric          = reserved | unreserved | escaped
 




uric_no_slash
final protected static BitSet uric_no_slash(Code)
URI bitset for encoding typical non-slash characters.

 uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" |
 "&" | "=" | "+" | "$" | ","
 




userinfo
final protected static BitSet userinfo(Code)
Bitset for userinfo.

 userinfo      = *( unreserved | escaped |
 ";" | ":" | "&" | "=" | "+" | "$" | "," )
 




within_userinfo
final public static BitSet within_userinfo(Code)
BitSet for within the userinfo component like user and password.




Constructor Detail
URI
protected URI()(Code)
Create an instance as an internal use



URI
public URI(String s, boolean escaped, String charset) throws URIException, NullPointerException(Code)
Construct a URI from a string with the given charset. The input string can be either in escaped or unescaped form.
Parameters:
  s - URI character sequence
Parameters:
  escaped - true if URI character sequence is in escaped form. false otherwise.
Parameters:
  charset - the charset string to do escape encoding, if required
throws:
  URIException - If the URI cannot be created.
throws:
  NullPointerException - if input string is null
See Also:   URI.getProtocolCharset
since:
   3.0



URI
public URI(String s, boolean escaped) throws URIException, NullPointerException(Code)
Construct a URI from a string with the given charset. The input string can be either in escaped or unescaped form.
Parameters:
  s - URI character sequence
Parameters:
  escaped - true if URI character sequence is in escaped form. false otherwise.
throws:
  URIException - If the URI cannot be created.
throws:
  NullPointerException - if input string is null
See Also:   URI.getProtocolCharset
since:
   3.0



URI
public URI(char[] escaped, String charset) throws URIException, NullPointerException(Code)
Construct a URI as an escaped form of a character array with the given charset.
Parameters:
  escaped - the URI character sequence
Parameters:
  charset - the charset string to do escape encoding
throws:
  URIException - If the URI cannot be created.
throws:
  NullPointerException - if escaped is null
See Also:   URI.getProtocolCharset



URI
public URI(char[] escaped) throws URIException, NullPointerException(Code)
Construct a URI as an escaped form of a character array. An URI can be placed within double-quotes or angle brackets like "http://test.com/" and <http://test.com/>
Parameters:
  escaped - the URI character sequence
throws:
  URIException - If the URI cannot be created.
throws:
  NullPointerException - if escaped is null
See Also:   URI.getDefaultProtocolCharset



URI
public URI(String original, String charset) throws URIException(Code)
Construct a URI from the given string with the given charset.
Parameters:
  original - the string to be represented to URI character sequenceIt is one of absoluteURI and relativeURI.
Parameters:
  charset - the charset string to do escape encoding
throws:
  URIException - If the URI cannot be created.
See Also:   URI.getProtocolCharset



URI
public URI(String original) throws URIException(Code)
Construct a URI from the given string.

 URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
 

An URI can be placed within double-quotes or angle brackets like "http://test.com/" and <http://test.com/>
Parameters:
  original - the string to be represented to URI character sequenceIt is one of absoluteURI and relativeURI.
throws:
  URIException - If the URI cannot be created.
See Also:   URI.getDefaultProtocolCharset




URI
public URI(String scheme, String schemeSpecificPart, String fragment) throws URIException(Code)
Construct a general URI from the given components.

 URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
 absoluteURI   = scheme ":" ( hier_part | opaque_part )
 opaque_part   = uric_no_slash *uric
 

It's for absolute URI = <scheme>:<scheme-specific-part># <fragment>.
Parameters:
  scheme - the scheme string
Parameters:
  schemeSpecificPart - scheme_specific_part
Parameters:
  fragment - the fragment string
throws:
  URIException - If the URI cannot be created.
See Also:   URI.getDefaultProtocolCharset




URI
public URI(String scheme, String authority, String path, String query, String fragment) throws URIException(Code)
Construct a general URI from the given components.

 URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
 absoluteURI   = scheme ":" ( hier_part | opaque_part )
 relativeURI   = ( net_path | abs_path | rel_path ) [ "?" query ]
 hier_part     = ( net_path | abs_path ) [ "?" query ]
 

It's for absolute URI = <scheme>:<path>?<query>#< fragment> and relative URI = <path>?<query>#<fragment >.
Parameters:
  scheme - the scheme string
Parameters:
  authority - the authority string
Parameters:
  path - the path string
Parameters:
  query - the query string
Parameters:
  fragment - the fragment string
throws:
  URIException - If the new URI cannot be created.
See Also:   URI.getDefaultProtocolCharset




URI
public URI(String scheme, String userinfo, String host, int port) throws URIException(Code)
Construct a general URI from the given components.
Parameters:
  scheme - the scheme string
Parameters:
  userinfo - the userinfo string
Parameters:
  host - the host string
Parameters:
  port - the port number
throws:
  URIException - If the new URI cannot be created.
See Also:   URI.getDefaultProtocolCharset



URI
public URI(String scheme, String userinfo, String host, int port, String path) throws URIException(Code)
Construct a general URI from the given components.
Parameters:
  scheme - the scheme string
Parameters:
  userinfo - the userinfo string
Parameters:
  host - the host string
Parameters:
  port - the port number
Parameters:
  path - the path string
throws:
  URIException - If the new URI cannot be created.
See Also:   URI.getDefaultProtocolCharset



URI
public URI(String scheme, String userinfo, String host, int port, String path, String query) throws URIException(Code)
Construct a general URI from the given components.
Parameters:
  scheme - the scheme string
Parameters:
  userinfo - the userinfo string
Parameters:
  host - the host string
Parameters:
  port - the port number
Parameters:
  path - the path string
Parameters:
  query - the query string
throws:
  URIException - If the new URI cannot be created.
See Also:   URI.getDefaultProtocolCharset



URI
public URI(String scheme, String userinfo, String host, int port, String path, String query, String fragment) throws URIException(Code)
Construct a general URI from the given components.
Parameters:
  scheme - the scheme string
Parameters:
  userinfo - the userinfo string
Parameters:
  host - the host string
Parameters:
  port - the port number
Parameters:
  path - the path string
Parameters:
  query - the query string
Parameters:
  fragment - the fragment string
throws:
  URIException - If the new URI cannot be created.
See Also:   URI.getDefaultProtocolCharset



URI
public URI(String scheme, String host, String path, String fragment) throws URIException(Code)
Construct a general URI from the given components.
Parameters:
  scheme - the scheme string
Parameters:
  host - the host string
Parameters:
  path - the path string
Parameters:
  fragment - the fragment string
throws:
  URIException - If the new URI cannot be created.
See Also:   URI.getDefaultProtocolCharset



URI
public URI(URI base, String relative) throws URIException(Code)
Construct a general URI with the given relative URI string.
Parameters:
  base - the base URI
Parameters:
  relative - the relative URI string
throws:
  URIException - If the new URI cannot be created.



URI
public URI(URI base, String relative, boolean escaped) throws URIException(Code)
Construct a general URI with the given relative URI string.
Parameters:
  base - the base URI
Parameters:
  relative - the relative URI string
Parameters:
  escaped - true if URI character sequence is in escaped form. false otherwise.
throws:
  URIException - If the new URI cannot be created.
since:
   3.0



URI
public URI(URI base, URI relative) throws URIException(Code)
Construct a general URI with the given relative URI.

 URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
 relativeURI   = ( net_path | abs_path | rel_path ) [ "?" query ]
 

Resolving Relative References to Absolute Form. Examples of Resolving Relative URI References Within an object with a well-defined base URI of

 http://a/b/c/d;p?q
 

the relative URI would be resolved as follows: Normal Examples

 g:h           =  g:h
 g             =  http://a/b/c/g
 ./g           =  http://a/b/c/g
 g/            =  http://a/b/c/g/
 /g            =  http://a/g
 //g           =  http://g
 ?y            =  http://a/b/c/?y
 g?y           =  http://a/b/c/g?y
 #s            =  (current document)#s
 g#s           =  http://a/b/c/g#s
 g?y#s         =  http://a/b/c/g?y#s
 ;x            =  http://a/b/c/;x
 g;x           =  http://a/b/c/g;x
 g;x?y#s       =  http://a/b/c/g;x?y#s
 .             =  http://a/b/c/
 ./            =  http://a/b/c/
 ..            =  http://a/b/
 ../           =  http://a/b/
 ../g          =  http://a/b/g
 ../..         =  http://a/
 ../../        =  http://a/ 
 ../../g       =  http://a/g
 

Some URI schemes do not allow a hierarchical syntax matching the syntax, and thus cannot use relative references.
Parameters:
  base - the base URI
Parameters:
  relative - the relative URI
throws:
  URIException - If the new URI cannot be created.





Method Detail
clone
public synchronized Object clone() throws CloneNotSupportedException(Code)
Create and return a copy of this object, the URI-reference containing the userinfo component. Notice that the whole URI-reference including the userinfo component counld not be gotten as a String.

To copy the identical URI object including the userinfo component, it should be used. a clone of this instance




compareTo
public int compareTo(Object obj) throws ClassCastException(Code)
Compare this URI to another object.
Parameters:
  obj - the object to be compared. 0, if it's same,-1, if failed, first being compared with in the authority component
throws:
  ClassCastException - not URI argument



decode
protected static String decode(char[] component, String charset) throws URIException(Code)
Decodes URI encoded string. This is a two mapping, one from URI characters to octets, and subsequently a second from octets to original characters:

 URI character sequence->octet sequence->original character sequence
 

A URI must be separated into its components before the escaped characters within those components can be allowedly decoded.

Notice that there is a chance that URI characters that are non UTF-8 may be parsed as valid UTF-8. A recent non-scientific analysis found that EUC encoded Japanese words had a 2.7% false reading; SJIS had a 0.0005% false reading; other encoding such as ASCII or KOI-8 have a 0% false reading.

The percent "%" character always has the reserved purpose of being the escape indicator, it must be escaped as "%25" in order to be used as data within a URI.

The unescape method is internally performed within this method.
Parameters:
  component - the URI character sequence
Parameters:
  charset - the protocol charset original character sequence
throws:
  URIException - incomplete trailing escape pattern or unsupportedcharacter encoding




decode
protected static String decode(String component, String charset) throws URIException(Code)
Decodes URI encoded string. This is a two mapping, one from URI characters to octets, and subsequently a second from octets to original characters:

 URI character sequence->octet sequence->original character sequence
 

A URI must be separated into its components before the escaped characters within those components can be allowedly decoded.

Notice that there is a chance that URI characters that are non UTF-8 may be parsed as valid UTF-8. A recent non-scientific analysis found that EUC encoded Japanese words had a 2.7% false reading; SJIS had a 0.0005% false reading; other encoding such as ASCII or KOI-8 have a 0% false reading.

The percent "%" character always has the reserved purpose of being the escape indicator, it must be escaped as "%25" in order to be used as data within a URI.

The unescape method is internally performed within this method.
Parameters:
  component - the URI character sequence
Parameters:
  charset - the protocol charset original character sequence
throws:
  URIException - incomplete trailing escape pattern or unsupportedcharacter encoding
since:
   3.0




encode
protected static char[] encode(String original, BitSet allowed, String charset) throws URIException(Code)
Encodes URI string. This is a two mapping, one from original characters to octets, and subsequently a second from octets to URI characters:

 original character sequence->octet sequence->URI character sequence
 

An escaped octet is encoded as a character triplet, consisting of the percent character "%" followed by the two hexadecimal digits representing the octet code. For example, "%20" is the escaped encoding for the US-ASCII space character.

Conversion from the local filesystem character set to UTF-8 will normally involve a two step process. First convert the local character set to the UCS; then convert the UCS to UTF-8. The first step in the process can be performed by maintaining a mapping table that includes the local character set code and the corresponding UCS code. The next step is to convert the UCS character code to the UTF-8 encoding.

Mapping between vendor codepages can be done in a very similar manner as described above.

The only time escape encodings can allowedly be made is when a URI is being created from its component parts. The escape and validate methods are internally performed within this method.
Parameters:
  original - the original character sequence
Parameters:
  allowed - those characters that are allowed within a component
Parameters:
  charset - the protocol charset URI character sequence
throws:
  URIException - null component or unsupported character encoding




equals
protected boolean equals(char[] first, char[] second)(Code)
Test if the first array is equal to the second array.
Parameters:
  first - the first character array
Parameters:
  second - the second character array true if they're equal



equals
public boolean equals(Object obj)(Code)
Test an object if this URI is equal to another.
Parameters:
  obj - an object to compare true if two URI objects are equal



getAboveHierPath
public String getAboveHierPath() throws URIException(Code)
Get the level above the this hierarchy level. the above hierarchy level
throws:
  URIException - If URI.getRawCurrentHierPath(char[]) fails.
See Also:   URI.decode



getAuthority
public String getAuthority() throws URIException(Code)
Get the authority. the authority
throws:
  URIException - If URI.decode fails



getCurrentHierPath
public String getCurrentHierPath() throws URIException(Code)
Get the current hierarchy level. the current hierarchy level
throws:
  URIException - If URI.getRawCurrentHierPath(char[]) fails.
See Also:   URI.decode



getDefaultDocumentCharset
public static String getDefaultDocumentCharset()(Code)
Get the recommended default charset of the document. the default charset string



getDefaultDocumentCharsetByLocale
public static String getDefaultDocumentCharsetByLocale()(Code)
Get the default charset of the document by locale. the default charset string by locale



getDefaultDocumentCharsetByPlatform
public static String getDefaultDocumentCharsetByPlatform()(Code)
Get the default charset of the document by platform. the default charset string by platform



getDefaultProtocolCharset
public static String getDefaultProtocolCharset()(Code)
Get the default charset of the protocol.

An individual URI scheme may require a single charset, define a default charset, or provide a way to indicate the charset used.

To work globally either requires support of a number of character sets and to be able to convert between them, or the use of a single preferred character set. For support of global compatibility it is STRONGLY RECOMMENDED that clients and servers use UTF-8 encoding when exchanging URIs. the default charset string




getEscapedAboveHierPath
public String getEscapedAboveHierPath() throws URIException(Code)
Get the level above the this hierarchy level. the raw above hierarchy level
throws:
  URIException - If URI.getRawCurrentHierPath(char[]) fails.



getEscapedAuthority
public String getEscapedAuthority()(Code)
Get the escaped authority. the escaped authority



getEscapedCurrentHierPath
public String getEscapedCurrentHierPath() throws URIException(Code)
Get the escaped current hierarchy level. the escaped current hierarchy level
throws:
  URIException - If URI.getRawCurrentHierPath(char[]) fails.



getEscapedFragment
public String getEscapedFragment()(Code)
Get the escaped fragment. the escaped fragment string



getEscapedName
public String getEscapedName()(Code)
Get the escaped basename of the path. the escaped basename string



getEscapedPath
public String getEscapedPath()(Code)
Get the escaped path.

 path          = [ abs_path | opaque_part ]
 abs_path      = "/"  path_segments 
 opaque_part   = uric_no_slash *uric
 

the escaped path string




getEscapedPathQuery
public String getEscapedPathQuery()(Code)
Get the escaped query. the escaped path and query string



getEscapedQuery
public String getEscapedQuery()(Code)
Get the escaped query. the escaped query string



getEscapedURI
public String getEscapedURI()(Code)
It can be gotten the URI character sequence. It's escaped. For the purpose of the protocol to be transported, it will be useful. the escaped URI string



getEscapedURIReference
public String getEscapedURIReference()(Code)
Get the escaped URI reference string. the escaped URI reference string



getEscapedUserinfo
public String getEscapedUserinfo()(Code)
Get the escaped userinfo. the escaped userinfo
See Also:   URI.getAuthority



getFragment
public String getFragment() throws URIException(Code)
Get the fragment. the fragment string
throws:
  URIException - incomplete trailing escape pattern or unsupportedcharacter encoding
See Also:   URI.decode



getHost
public String getHost() throws URIException(Code)
Get the host.

 host          = hostname | IPv4address | IPv6reference
 

the host
throws:
  URIException - If URI.decode fails
See Also:   URI.getAuthority




getName
public String getName() throws URIException(Code)
Get the basename of the path. the basename string
throws:
  URIException - incomplete trailing escape pattern or unsupportedcharacter encoding
See Also:   URI.decode



getPath
public String getPath() throws URIException(Code)
Get the path.

 path          = [ abs_path | opaque_part ]
 

the path string
throws:
  URIException - If URI.decode fails.
See Also:   URI.decode




getPathQuery
public String getPathQuery() throws URIException(Code)
Get the path and query. the path and query string.
throws:
  URIException - incomplete trailing escape pattern or unsupportedcharacter encoding
See Also:   URI.decode



getPort
public int getPort()(Code)
Get the port. In order to get the specfic default port, the specific protocol-supported class extended from the URI class should be used. It has the server-based naming authority. the portif -1, it has the default port for the scheme or the server-basednaming authority is not supported in the specific URI.



getProtocolCharset
public String getProtocolCharset()(Code)
Get the protocol charset used by this current URI instance. It was set by the constructor for this instance. If it was not set by contructor, it will return the default protocol charset. the protocol charset string
See Also:   URI.getDefaultProtocolCharset



getQuery
public String getQuery() throws URIException(Code)
Get the query. the query string.
throws:
  URIException - incomplete trailing escape pattern or unsupportedcharacter encoding
See Also:   URI.decode



getRawAboveHierPath
public char[] getRawAboveHierPath() throws URIException(Code)
Get the level above the this hierarchy level. the raw above hierarchy level
throws:
  URIException - If URI.getRawCurrentHierPath(char[]) fails.



getRawAuthority
public char[] getRawAuthority()(Code)
Get the raw-escaped authority. the raw-escaped authority



getRawCurrentHierPath
protected char[] getRawCurrentHierPath(char[] path) throws URIException(Code)
Get the raw-escaped current hierarchy level in the given path. If the last namespace is a collection, the slash mark ('/') should be ended with at the last character of the path string.
Parameters:
  path - the path the current hierarchy level
throws:
  URIException - no hierarchy level



getRawCurrentHierPath
public char[] getRawCurrentHierPath() throws URIException(Code)
Get the raw-escaped current hierarchy level. the raw-escaped current hierarchy level
throws:
  URIException - If URI.getRawCurrentHierPath(char[]) fails.



getRawFragment
public char[] getRawFragment()(Code)
Get the raw-escaped fragment.

The optional fragment identifier is not part of a URI, but is often used in conjunction with a URI.

The format and interpretation of fragment identifiers is dependent on the media type [RFC2046] of the retrieval result.

A fragment identifier is only meaningful when a URI reference is intended for retrieval and the result of that retrieval is a document for which the identified fragment is consistently defined. the raw-escaped fragment




getRawHost
public char[] getRawHost()(Code)
Get the host.

 host          = hostname | IPv4address | IPv6reference
 

the host
See Also:   URI.getAuthority




getRawName
public char[] getRawName()(Code)
Get the raw-escaped basename of the path. the raw-escaped basename



getRawPath
public char[] getRawPath()(Code)
Get the raw-escaped path.

 path          = [ abs_path | opaque_part ]
 

the raw-escaped path




getRawPathQuery
public char[] getRawPathQuery()(Code)
Get the raw-escaped path and query. the raw-escaped path and query



getRawQuery
public char[] getRawQuery()(Code)
Get the raw-escaped query. the raw-escaped query



getRawScheme
public char[] getRawScheme()(Code)
Get the scheme. the scheme



getRawURI
public char[] getRawURI()(Code)
It can be gotten the URI character sequence. It's raw-escaped. For the purpose of the protocol to be transported, it will be useful.

It is clearly unwise to use a URL that contains a password which is intended to be secret. In particular, the use of a password within the 'userinfo' component of a URL is strongly disrecommended except in those rare cases where the 'password' parameter is intended to be public.

When you want to get each part of the userinfo, you need to use the specific methods in the specific URL. It depends on the specific URL. the URI character sequence




getRawURIReference
public char[] getRawURIReference()(Code)
Get the URI reference character sequence. the URI reference character sequence



getRawUserinfo
public char[] getRawUserinfo()(Code)
Get the raw-escaped userinfo. the raw-escaped userinfo
See Also:   URI.getAuthority



getScheme
public String getScheme()(Code)
Get the scheme. the schemenull if undefined scheme



getURI
public String getURI() throws URIException(Code)
It can be gotten the URI character sequence. the original URI string
throws:
  URIException - incomplete trailing escape pattern or unsupportedcharacter encoding
See Also:   URI.decode



getURIReference
public String getURIReference() throws URIException(Code)
Get the original URI reference string. the original URI reference string
throws:
  URIException - If URI.decode fails.



getUserinfo
public String getUserinfo() throws URIException(Code)
Get the userinfo. the userinfo
throws:
  URIException - If URI.decode fails
See Also:   URI.getAuthority



hasAuthority
public boolean hasAuthority()(Code)
Tell whether or not this URI has authority. It's the same function as the is_net_path() method. true iif this URI has authority
See Also:   URI.isNetPath



hasFragment
public boolean hasFragment()(Code)
Tell whether or not this URI has fragment. true iif this URI has fragment



hasQuery
public boolean hasQuery()(Code)
Tell whether or not this URI has query. true iif this URI has query



hasUserinfo
public boolean hasUserinfo()(Code)
Tell whether or not this URI has userinfo. true iif this URI has userinfo



hashCode
public int hashCode()(Code)
Return a hash code for this URI. a has code value for this URI



indexFirstOf
protected int indexFirstOf(String s, String delims)(Code)
Get the earlier index that to be searched for the first occurrance in one of any of the given string.
Parameters:
  s - the string to be indexed
Parameters:
  delims - the delimiters used to index the earlier index if there are delimiters



indexFirstOf
protected int indexFirstOf(String s, String delims, int offset)(Code)
Get the earlier index that to be searched for the first occurrance in one of any of the given string.
Parameters:
  s - the string to be indexed
Parameters:
  delims - the delimiters used to index
Parameters:
  offset - the from index the earlier index if there are delimiters



indexFirstOf
protected int indexFirstOf(char[] s, char delim)(Code)
Get the earlier index that to be searched for the first occurrance in one of any of the given array.
Parameters:
  s - the character array to be indexed
Parameters:
  delim - the delimiter used to index the ealier index if there are a delimiter



indexFirstOf
protected int indexFirstOf(char[] s, char delim, int offset)(Code)
Get the earlier index that to be searched for the first occurrance in one of any of the given array.
Parameters:
  s - the character array to be indexed
Parameters:
  delim - the delimiter used to index
Parameters:
  offset - The offset. the ealier index if there is a delimiter



isAbsPath
public boolean isAbsPath()(Code)
Tell whether or not the relativeURI or hier_part of this URI is abs_path. true iif the relativeURI or hier_part is abs_path



isAbsoluteURI
public boolean isAbsoluteURI()(Code)
Tell whether or not this URI is absolute. true iif this URI is absoluteURI



isHierPart
public boolean isHierPart()(Code)
Tell whether or not the absoluteURI of this URI is hier_part. true iif the absoluteURI is hier_part



isHostname
public boolean isHostname()(Code)
Tell whether or not the host part of this URI is hostname. true iif the host part is hostname



isIPv4address
public boolean isIPv4address()(Code)
Tell whether or not the host part of this URI is IPv4address. true iif the host part is IPv4address



isIPv6reference
public boolean isIPv6reference()(Code)
Tell whether or not the host part of this URI is IPv6reference. true iif the host part is IPv6reference



isNetPath
public boolean isNetPath()(Code)
Tell whether or not the relativeURI or heir_part of this URI is net_path. It's the same function as the has_authority() method. true iif the relativeURI or heir_part is net_path
See Also:   URI.hasAuthority



isOpaquePart
public boolean isOpaquePart()(Code)
Tell whether or not the absoluteURI of this URI is opaque_part. true iif the absoluteURI is opaque_part



isRegName
public boolean isRegName()(Code)
Tell whether or not the authority component of this URI is reg_name. true iif the authority component is reg_name



isRelPath
public boolean isRelPath()(Code)
Tell whether or not the relativeURI of this URI is rel_path. true iif the relativeURI is rel_path



isRelativeURI
public boolean isRelativeURI()(Code)
Tell whether or not this URI is relative. true iif this URI is relativeURI



isServer
public boolean isServer()(Code)
Tell whether or not the authority component of this URI is server. true iif the authority component is server



normalize
protected char[] normalize(char[] path) throws URIException(Code)
Normalize the given hier path part.

Algorithm taken from URI reference parser at http://www.apache.org/~fielding/uri/rev-2002/issues.html.
Parameters:
  path - the path to normalize the normalized path
throws:
  URIException - no more higher path level to be normalized




normalize
public void normalize() throws URIException(Code)
Normalizes the path part of this URI. Normalization is only meant to be performed on URIs with an absolute path. Calling this method on a relative path URI will have no effect.
throws:
  URIException - no more higher path level to be normalized
See Also:   URI.isAbsPath()



parseAuthority
protected void parseAuthority(String original, boolean escaped) throws URIException(Code)
Parse the authority component.
Parameters:
  original - the original character sequence of authority component
Parameters:
  escaped - true if original is escaped
throws:
  URIException - If an error occurs.



parseUriReference
protected void parseUriReference(String original, boolean escaped) throws URIException(Code)
In order to avoid any possilbity of conflict with non-ASCII characters, Parse a URI reference as a String with the character encoding of the local system or the document.

The following line is the regular expression for breaking-down a URI reference into its components.

 ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
 12            3  4          5       6  7        8 9
 

For example, matching the above expression to http://jakarta.apache.org/ietf/uri/#Related results in the following subexpression matches:

 $1 = http:
 scheme    =  $2 = http
 $3 = //jakarta.apache.org
 authority =  $4 = jakarta.apache.org
 path      =  $5 = /ietf/uri/
 $6 = 
 query     =  $7 = 
 $8 = #Related
 fragment  =  $9 = Related
 


Parameters:
  original - the original character sequence
Parameters:
  escaped - true if original is escaped
throws:
  URIException - If an error occurs.




prevalidate
protected boolean prevalidate(String component, BitSet disallowed)(Code)
Pre-validate the unescaped URI string within a specific component.
Parameters:
  component - the component string within the component
Parameters:
  disallowed - those characters disallowed within the component if true, it doesn't have the disallowed charactersif false, the component is undefined or an incorrect one



removeFragmentIdentifier
protected char[] removeFragmentIdentifier(char[] component)(Code)
Remove the fragment identifier of the given component.
Parameters:
  component - the component that a fragment may be included the component that the fragment identifier is removed



resolvePath
protected char[] resolvePath(char[] basePath, char[] relPath) throws URIException(Code)
Resolve the base and relative path.
Parameters:
  basePath - a character array of the basePath
Parameters:
  relPath - a character array of the relPath the resolved path
throws:
  URIException - no more higher path level to be resolved



setDefaultDocumentCharset
public static void setDefaultDocumentCharset(String charset) throws DefaultCharsetChanged(Code)
Set the default charset of the document.

Notice that it will be possible to contain mixed characters (e.g. ftp://host/KoreanNamespace/ChineseResource). To handle the Bi-directional display of these character sets, the protocol charset could be simply used again. Because it's not yet implemented that the insertion of BIDI control characters at different points during composition is extracted.

Always all the time, the setter method is always succeeded and throws DefaultCharsetChanged exception. So API programmer must follow the following way:

 import org.apache.util.URI$DefaultCharsetChanged;
 .
 .
 .
 try {
 URI.setDefaultDocumentCharset("EUC-KR");
 } catch (DefaultCharsetChanged cc) {
 // CASE 1: the exception could be ignored, when it is set by user
 if (cc.getReasonCode() == DefaultCharsetChanged.DOCUMENT_CHARSET) {
 // CASE 2: let user know the default document charset changed
 } else {
 // CASE 2: let user know the default protocol charset changed
 }
 }
 
The API programmer is responsible to set the correct charset. And each application should remember its own charset to support.
Parameters:
  charset - the default charset for the document
throws:
  DefaultCharsetChanged - default charset changed



setDefaultProtocolCharset
public static void setDefaultProtocolCharset(String charset) throws DefaultCharsetChanged(Code)
Set the default charset of the protocol.

The character set used to store files SHALL remain a local decision and MAY depend on the capability of local operating systems. Prior to the exchange of URIs they SHOULD be converted into a ISO/IEC 10646 format and UTF-8 encoded. This approach, while allowing international exchange of URIs, will still allow backward compatibility with older systems because the code set positions for ASCII characters are identical to the one byte sequence in UTF-8.

An individual URI scheme may require a single charset, define a default charset, or provide a way to indicate the charset used.

Always all the time, the setter method is always succeeded and throws DefaultCharsetChanged exception. So API programmer must follow the following way:

 import org.apache.util.URI$DefaultCharsetChanged;
 .
 .
 .
 try {
 URI.setDefaultProtocolCharset("UTF-8");
 } catch (DefaultCharsetChanged cc) {
 // CASE 1: the exception could be ignored, when it is set by user
 if (cc.getReasonCode() == DefaultCharsetChanged.PROTOCOL_CHARSET) {
 // CASE 2: let user know the default protocol charset changed
 } else {
 // CASE 2: let user know the default document charset changed
 }
 }
 
The API programmer is responsible to set the correct charset. And each application should remember its own charset to support.
Parameters:
  charset - the default charset for each protocol
throws:
  DefaultCharsetChanged - default charset changed



setEscapedAuthority
public void setEscapedAuthority(String escapedAuthority) throws URIException(Code)
Set the authority. It can be one type of server, hostport, hostname, IPv4address, IPv6reference and reg_name. Note that there is no setAuthority method by the escape encoding reason.
Parameters:
  escapedAuthority - the escaped authority string
throws:
  URIException - If URI.parseAuthority(java.lang.String,boolean) fails



setEscapedFragment
public void setEscapedFragment(String escapedFragment) throws URIException(Code)
Set the escaped fragment string.
Parameters:
  escapedFragment - the escaped fragment string
throws:
  URIException - escaped fragment not valid



setEscapedPath
public void setEscapedPath(String escapedPath) throws URIException(Code)
Set the escaped path.
Parameters:
  escapedPath - the escaped path string
throws:
  URIException - encoding error or not proper for initial instance
See Also:   URI.encode



setEscapedQuery
public void setEscapedQuery(String escapedQuery) throws URIException(Code)
Set the escaped query string.
Parameters:
  escapedQuery - the escaped query string
throws:
  URIException - escaped query not valid



setFragment
public void setFragment(String fragment) throws URIException(Code)
Set the fragment.
Parameters:
  fragment - the fragment string.
throws:
  URIException - If an error occurs.



setPath
public void setPath(String path) throws URIException(Code)
Set the path.
Parameters:
  path - the path string
throws:
  URIException - set incorrectly or fragment only
See Also:   URI.encode



setQuery
public void setQuery(String query) throws URIException(Code)
Set the query.

When a query string is not misunderstood the reserved special characters ("&", "=", "+", ",", and "$") within a query component, it is recommended to use in encoding the whole query with this method.

The additional APIs for the special purpose using by the reserved special characters used in each protocol are implemented in each protocol classes inherited from URI. So refer to the same-named APIs implemented in each specific protocol instance.
Parameters:
  query - the query string.
throws:
  URIException - incomplete trailing escape pattern or unsupportedcharacter encoding
See Also:   URI.encode




setRawAuthority
public void setRawAuthority(char[] escapedAuthority) throws URIException, NullPointerException(Code)
Set the authority. It can be one type of server, hostport, hostname, IPv4address, IPv6reference and reg_name.

 authority     = server | reg_name
 


Parameters:
  escapedAuthority - the raw escaped authority
throws:
  URIException - If URI.parseAuthority(java.lang.String,boolean) fails
throws:
  NullPointerException - null authority




setRawFragment
public void setRawFragment(char[] escapedFragment) throws URIException(Code)
Set the raw-escaped fragment.
Parameters:
  escapedFragment - the raw-escaped fragment
throws:
  URIException - escaped fragment not valid



setRawPath
public void setRawPath(char[] escapedPath) throws URIException(Code)
Set the raw-escaped path.
Parameters:
  escapedPath - the path character sequence
throws:
  URIException - encoding error or not proper for initial instance
See Also:   URI.encode



setRawQuery
public void setRawQuery(char[] escapedQuery) throws URIException(Code)
Set the raw-escaped query.
Parameters:
  escapedQuery - the raw-escaped query
throws:
  URIException - escaped query not valid



setURI
protected void setURI()(Code)
Once it's parsed successfully, set this URI.
See Also:   URI.getRawURI



toString
public String toString()(Code)
Get the escaped URI string.

On the document, the URI-reference form is only used without the userinfo component like http://jakarta.apache.org/ by the security reason. But the URI-reference form with the userinfo component could be parsed.

In other words, this URI and any its subclasses must not expose the URI-reference expression with the userinfo component like http://user:password@hostport/restricted_zone.
It means that the API client programmer should extract each user and password to access manually. Probably it will be supported in the each subclass, however, not a whole URI-reference expression. the escaped URI string
See Also:   URI.clone()




validate
protected boolean validate(char[] component, BitSet generous)(Code)
Validate the URI characters within a specific component. The component must be performed after escape encoding. Or it doesn't include escaped characters.
Parameters:
  component - the characters sequence within the component
Parameters:
  generous - those characters that are allowed within a component if true, it's the correct URI character sequence



validate
protected boolean validate(char[] component, int soffset, int eoffset, BitSet generous)(Code)
Validate the URI characters within a specific component. The component must be performed after escape encoding. Or it doesn't include escaped characters.

It's not that much strict, generous. The strict validation might be performed before being called this method.
Parameters:
  component - the characters sequence within the component
Parameters:
  soffset - the starting offset of the given component
Parameters:
  eoffset - the ending offset of the given componentif -1, it means the length of the component
Parameters:
  generous - those characters that are allowed within a component if true, it's the correct URI character sequence




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.