Java Doc for URI.java in  » XML » xerces-2_9_1 » org » apache » xerces » util » 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 » XML » xerces 2_9_1 » org.apache.xerces.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.xerces.util.URI

URI
public class URI implements Serializable(Code)
A class to represent a Uniform Resource Identifier (URI). This class is designed to handle the parsing of URIs and provide access to the various components (scheme, host, port, userinfo, path, query string and fragment) that may constitute a URI.

Parsing of a URI specification is done according to the URI syntax described in RFC 2396, and amended by RFC 2732.

Every absolute URI consists of a scheme, followed by a colon (':'), followed by a scheme-specific part. For URIs that follow the "generic URI" syntax, the scheme-specific part begins with two slashes ("//") and may be followed by an authority segment (comprised of user information, host, and port), path segment, query segment and fragment. Note that RFC 2396 no longer specifies the use of the parameters segment and excludes the "user:password" syntax as part of the authority segment. If "user:password" appears in a URI, the entire user/password string is stored as userinfo.

For URIs that do not follow the "generic URI" syntax (e.g. mailto), the entire scheme-specific part is treated as the "path" portion of the URI.

Note that, unlike the java.net.URL class, this class does not provide any built-in network access functionality nor does it provide any scheme-specific functionality (for example, it does not know a default port for a specific scheme). Rather, it only knows the grammar and basic set of operations that can be applied to a URI.
version:
   $Id: URI.java 447241 2006-09-18 05:12:57Z mrglavas $


Inner Class :public static class MalformedURIException extends IOException

Field Summary
final static  longserialVersionUID
     Serialization version.

Constructor Summary
public  URI()
     Construct a new and uninitialized URI.
public  URI(URI p_other)
     Construct a new URI from another URI.
public  URI(String p_uriSpec)
     Construct a new URI from a URI specification string.
public  URI(String p_uriSpec, boolean allowNonAbsoluteURI)
     Construct a new URI from a URI specification string.
public  URI(URI p_base, String p_uriSpec)
     Construct a new URI from a base URI and a URI specification string.
public  URI(URI p_base, String p_uriSpec, boolean allowNonAbsoluteURI)
     Construct a new URI from a base URI and a URI specification string. The URI specification string may be a relative URI. Construct a relative URI if boolean is assigned to "true" and p_uriSpec is not valid absolute URI and p_base is null instead of throwing an exception.
public  URI(String p_scheme, String p_schemeSpecificPart)
     Construct a new URI that does not follow the generic URI syntax.
public  URI(String p_scheme, String p_host, String p_path, String p_queryString, String p_fragment)
     Construct a new URI that follows the generic URI syntax from its component parts.
public  URI(String p_scheme, String p_userinfo, String p_host, int p_port, String p_path, String p_queryString, String p_fragment)
     Construct a new URI that follows the generic URI syntax from its component parts.

Method Summary
public  voidabsolutize(URI p_base)
     Absolutize URI with given base URI.
public  voidappendPath(String p_addToPath)
     Append to the end of the path of this URI.
public  booleanequals(Object p_test)
     Determines if the passed-in Object is equivalent to this URI.
Parameters:
  p_test - the Object to test for equality.
public  StringgetAuthority()
     Get the authority for this URI.
public  StringgetFragment()
     Get the fragment for this URI. the fragment for this URI.
public  StringgetHost()
     Get the host for this URI.
public  StringgetPath(boolean p_includeQueryString, boolean p_includeFragment)
     Get the path for this URI (optionally with the query string and fragment).
public  StringgetPath()
     Get the path for this URI.
public  intgetPort()
     Get the port for this URI.
public  StringgetQueryString()
     Get the query string for this URI. the query string for this URI.
public  StringgetRegBasedAuthority()
     Get the registry based authority for this URI.
public  StringgetScheme()
     Get the scheme for this URI.
public  StringgetSchemeSpecificPart()
     Get the scheme-specific part for this URI (everything following the scheme and the first colon).
public  StringgetUserinfo()
     Get the userinfo for this URI.
public  booleanisAbsoluteURI()
     Returns whether this URI represents an absolute URI.
public static  booleanisConformantSchemeName(String p_scheme)
     Determine whether a scheme conforms to the rules for a scheme name.
public  booleanisGenericURI()
     Get the indicator as to whether this URI uses the "generic URI" syntax.
public static  booleanisWellFormedAddress(String address)
     Determine whether a string is syntactically capable of representing a valid IPv4 address, IPv6 reference or the domain name of a network host.
public static  booleanisWellFormedIPv4Address(String address)
    

Determines whether a string is an IPv4 address as defined by RFC 2373, and under the further constraint that it must be a 32-bit address.

public static  booleanisWellFormedIPv6Reference(String address)
    

Determines whether a string is an IPv6 reference as defined by RFC 2732, where IPv6address is defined in RFC 2373.

public  voidsetFragment(String p_fragment)
     Set the fragment for this URI.
public  voidsetHost(String p_host)
    

Set the host for this URI.

public  voidsetPath(String p_path)
     Set the path for this URI.
public  voidsetPort(int p_port)
     Set the port for this URI.
public  voidsetQueryString(String p_queryString)
     Set the query string for this URI.
public  voidsetRegBasedAuthority(String authority)
    
public  voidsetScheme(String p_scheme)
     Set the scheme for this URI.
public  voidsetUserinfo(String p_userinfo)
     Set the userinfo for this URI.
public  StringtoString()
     Get the URI as a string specification.

Field Detail
serialVersionUID
final static long serialVersionUID(Code)
Serialization version.




Constructor Detail
URI
public URI()(Code)
Construct a new and uninitialized URI.



URI
public URI(URI p_other)(Code)
Construct a new URI from another URI. All fields for this URI are set equal to the fields of the URI passed in.
Parameters:
  p_other - the URI to copy (cannot be null)



URI
public URI(String p_uriSpec) throws MalformedURIException(Code)
Construct a new URI from a URI specification string. If the specification follows the "generic URI" syntax, (two slashes following the first colon), the specification will be parsed accordingly - setting the scheme, userinfo, host,port, path, query string and fragment fields as necessary. If the specification does not follow the "generic URI" syntax, the specification is parsed into a scheme and scheme-specific part (stored as the path) only.
Parameters:
  p_uriSpec - the URI specification string (cannot be null orempty)
exception:
  MalformedURIException - if p_uriSpec violates any syntaxrules



URI
public URI(String p_uriSpec, boolean allowNonAbsoluteURI) throws MalformedURIException(Code)
Construct a new URI from a URI specification string. If the specification follows the "generic URI" syntax, (two slashes following the first colon), the specification will be parsed accordingly - setting the scheme, userinfo, host,port, path, query string and fragment fields as necessary. If the specification does not follow the "generic URI" syntax, the specification is parsed into a scheme and scheme-specific part (stored as the path) only. Construct a relative URI if boolean is assigned to "true" and p_uriSpec is not valid absolute URI, instead of throwing an exception.
Parameters:
  p_uriSpec - the URI specification string (cannot be null orempty)
Parameters:
  allowNonAbsoluteURI - true to permit non-absolute URIs, false otherwise.
exception:
  MalformedURIException - if p_uriSpec violates any syntaxrules



URI
public URI(URI p_base, String p_uriSpec) throws MalformedURIException(Code)
Construct a new URI from a base URI and a URI specification string. The URI specification string may be a relative URI.
Parameters:
  p_base - the base URI (cannot be null if p_uriSpec is null orempty)
Parameters:
  p_uriSpec - the URI specification string (cannot be null orempty if p_base is null)
exception:
  MalformedURIException - if p_uriSpec violates any syntaxrules



URI
public URI(URI p_base, String p_uriSpec, boolean allowNonAbsoluteURI) throws MalformedURIException(Code)
Construct a new URI from a base URI and a URI specification string. The URI specification string may be a relative URI. Construct a relative URI if boolean is assigned to "true" and p_uriSpec is not valid absolute URI and p_base is null instead of throwing an exception.
Parameters:
  p_base - the base URI (cannot be null if p_uriSpec is null orempty)
Parameters:
  p_uriSpec - the URI specification string (cannot be null orempty if p_base is null)
Parameters:
  allowNonAbsoluteURI - true to permit non-absolute URIs, false otherwise.
exception:
  MalformedURIException - if p_uriSpec violates any syntaxrules



URI
public URI(String p_scheme, String p_schemeSpecificPart) throws MalformedURIException(Code)
Construct a new URI that does not follow the generic URI syntax. Only the scheme and scheme-specific part (stored as the path) are initialized.
Parameters:
  p_scheme - the URI scheme (cannot be null or empty)
Parameters:
  p_schemeSpecificPart - the scheme-specific part (cannot benull or empty)
exception:
  MalformedURIException - if p_scheme violates anysyntax rules



URI
public URI(String p_scheme, String p_host, String p_path, String p_queryString, String p_fragment) throws MalformedURIException(Code)
Construct a new URI that follows the generic URI syntax from its component parts. Each component is validated for syntax and some basic semantic checks are performed as well. See the individual setter methods for specifics.
Parameters:
  p_scheme - the URI scheme (cannot be null or empty)
Parameters:
  p_host - the hostname, IPv4 address or IPv6 reference for the URI
Parameters:
  p_path - the URI path - if the path contains '?' or '#',then the query string and/or fragment will beset from the path; however, if the query andfragment are specified both in the path and asseparate parameters, an exception is thrown
Parameters:
  p_queryString - the URI query string (cannot be specifiedif path is null)
Parameters:
  p_fragment - the URI fragment (cannot be specified if pathis null)
exception:
  MalformedURIException - if any of the parameters violatessyntax rules or semantic rules



URI
public URI(String p_scheme, String p_userinfo, String p_host, int p_port, String p_path, String p_queryString, String p_fragment) throws MalformedURIException(Code)
Construct a new URI that follows the generic URI syntax from its component parts. Each component is validated for syntax and some basic semantic checks are performed as well. See the individual setter methods for specifics.
Parameters:
  p_scheme - the URI scheme (cannot be null or empty)
Parameters:
  p_userinfo - the URI userinfo (cannot be specified if hostis null)
Parameters:
  p_host - the hostname, IPv4 address or IPv6 reference for the URI
Parameters:
  p_port - the URI port (may be -1 for "unspecified"; cannotbe specified if host is null)
Parameters:
  p_path - the URI path - if the path contains '?' or '#',then the query string and/or fragment will beset from the path; however, if the query andfragment are specified both in the path and asseparate parameters, an exception is thrown
Parameters:
  p_queryString - the URI query string (cannot be specifiedif path is null)
Parameters:
  p_fragment - the URI fragment (cannot be specified if pathis null)
exception:
  MalformedURIException - if any of the parameters violatessyntax rules or semantic rules




Method Detail
absolutize
public void absolutize(URI p_base)(Code)
Absolutize URI with given base URI.
Parameters:
  p_base - base URI for absolutization



appendPath
public void appendPath(String p_addToPath) throws MalformedURIException(Code)
Append to the end of the path of this URI. If the current path does not end in a slash and the path to be appended does not begin with a slash, a slash will be appended to the current path before the new segment is added. Also, if the current path ends in a slash and the new segment begins with a slash, the extra slash will be removed before the new segment is appended.
Parameters:
  p_addToPath - the new segment to be added to the current path
exception:
  MalformedURIException - if p_addToPath contains syntaxerrors



equals
public boolean equals(Object p_test)(Code)
Determines if the passed-in Object is equivalent to this URI.
Parameters:
  p_test - the Object to test for equality. true if p_test is a URI with all values equal to thisURI, false otherwise



getAuthority
public String getAuthority()(Code)
Get the authority for this URI. the authority



getFragment
public String getFragment()(Code)
Get the fragment for this URI. the fragment for this URI. Null is returned if therewas no "#" in the URI spec, empty string if there was a"#" but no fragment following it.



getHost
public String getHost()(Code)
Get the host for this URI. the host for this URI (null if not specified).



getPath
public String getPath(boolean p_includeQueryString, boolean p_includeFragment)(Code)
Get the path for this URI (optionally with the query string and fragment).
Parameters:
  p_includeQueryString - if true (and query string is not null),then a "?" followed by the query stringwill be appended
Parameters:
  p_includeFragment - if true (and fragment is not null),then a "#" followed by the fragmentwill be appended the path for this URI possibly including the query stringand fragment



getPath
public String getPath()(Code)
Get the path for this URI. Note that the value returned is the path only and does not include the query string or fragment. the path for this URI.



getPort
public int getPort()(Code)
Get the port for this URI. the port for this URI (-1 if not specified).



getQueryString
public String getQueryString()(Code)
Get the query string for this URI. the query string for this URI. Null is returned if therewas no "?" in the URI spec, empty string if there was a"?" but no query string following it.



getRegBasedAuthority
public String getRegBasedAuthority()(Code)
Get the registry based authority for this URI. the registry based authority (null if not specified).



getScheme
public String getScheme()(Code)
Get the scheme for this URI. the scheme for this URI



getSchemeSpecificPart
public String getSchemeSpecificPart()(Code)
Get the scheme-specific part for this URI (everything following the scheme and the first colon). See RFC 2396 Section 5.2 for spec. the scheme-specific part for this URI



getUserinfo
public String getUserinfo()(Code)
Get the userinfo for this URI. the userinfo for this URI (null if not specified).



isAbsoluteURI
public boolean isAbsoluteURI()(Code)
Returns whether this URI represents an absolute URI. true if this URI represents an absolute URI, falseotherwise



isConformantSchemeName
public static boolean isConformantSchemeName(String p_scheme)(Code)
Determine whether a scheme conforms to the rules for a scheme name. A scheme is conformant if it starts with an alphanumeric, and contains only alphanumerics, '+','-' and '.'. true if the scheme is conformant, false otherwise



isGenericURI
public boolean isGenericURI()(Code)
Get the indicator as to whether this URI uses the "generic URI" syntax. true if this URI uses the "generic URI" syntax, falseotherwise



isWellFormedAddress
public static boolean isWellFormedAddress(String address)(Code)
Determine whether a string is syntactically capable of representing a valid IPv4 address, IPv6 reference or the domain name of a network host. A valid IPv4 address consists of four decimal digit groups separated by a '.'. Each group must consist of one to three digits. See RFC 2732 Section 3, and RFC 2373 Section 2.2, for the definition of IPv6 references. A hostname consists of domain labels (each of which must begin and end with an alphanumeric but may contain '-') separated & by a '.'. See RFC 2396 Section 3.2.2. true if the string is a syntactically valid IPv4 address, IPv6 reference or hostname



isWellFormedIPv4Address
public static boolean isWellFormedIPv4Address(String address)(Code)

Determines whether a string is an IPv4 address as defined by RFC 2373, and under the further constraint that it must be a 32-bit address. Though not expressed in the grammar, in order to satisfy the 32-bit address constraint, each segment of the address cannot be greater than 255 (8 bits of information).

IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT

true if the string is a syntactically valid IPv4 address



isWellFormedIPv6Reference
public static boolean isWellFormedIPv6Reference(String address)(Code)

Determines whether a string is an IPv6 reference as defined by RFC 2732, where IPv6address is defined in RFC 2373. The IPv6 address is parsed according to Section 2.2 of RFC 2373, with the additional constraint that the address be composed of 128 bits of information.

IPv6reference = "[" IPv6address "]"

Note: The BNF expressed in RFC 2373 Appendix B does not accurately describe section 2.2, and was in fact removed from RFC 3513, the successor of RFC 2373.

true if the string is a syntactically valid IPv6 reference



setFragment
public void setFragment(String p_fragment) throws MalformedURIException(Code)
Set the fragment for this URI. A non-null value is valid only if this is a URI conforming to the generic URI syntax and the path value is not null.
Parameters:
  p_fragment - the fragment for this URI
exception:
  MalformedURIException - if p_fragment is not null and thisURI does not conform to the genericURI syntax or if the path is null



setHost
public void setHost(String p_host) throws MalformedURIException(Code)

Set the host for this URI. If null is passed in, the userinfo field is also set to null and the port is set to -1.

Note: This method overwrites registry based authority if it previously existed in this URI.


Parameters:
  p_host - the host for this URI
exception:
  MalformedURIException - if p_host is not a valid IPaddress or DNS hostname.



setPath
public void setPath(String p_path) throws MalformedURIException(Code)
Set the path for this URI. If the supplied path is null, then the query string and fragment are set to null as well. If the supplied path includes a query string and/or fragment, these fields will be parsed and set as well. Note that, for URIs following the "generic URI" syntax, the path specified should start with a slash. For URIs that do not follow the generic URI syntax, this method sets the scheme-specific part.
Parameters:
  p_path - the path for this URI (may be null)
exception:
  MalformedURIException - if p_path contains invalidcharacters



setPort
public void setPort(int p_port) throws MalformedURIException(Code)
Set the port for this URI. -1 is used to indicate that the port is not specified, otherwise valid port numbers are between 0 and 65535. If a valid port number is passed in and the host field is null, an exception is thrown.
Parameters:
  p_port - the port number for this URI
exception:
  MalformedURIException - if p_port is not -1 and not avalid port number



setQueryString
public void setQueryString(String p_queryString) throws MalformedURIException(Code)
Set the query string for this URI. A non-null value is valid only if this is an URI conforming to the generic URI syntax and the path value is not null.
Parameters:
  p_queryString - the query string for this URI
exception:
  MalformedURIException - if p_queryString is not null and thisURI does not conform to the genericURI syntax or if the path is null



setRegBasedAuthority
public void setRegBasedAuthority(String authority) throws MalformedURIException(Code)

Sets the registry based authority for this URI.

Note: This method overwrites server based authority if it previously existed in this URI.


Parameters:
  authority - the registry based authority for this URI
exception:
  MalformedURIException - it authority is not awell formed registry based authority



setScheme
public void setScheme(String p_scheme) throws MalformedURIException(Code)
Set the scheme for this URI. The scheme is converted to lowercase before it is set.
Parameters:
  p_scheme - the scheme for this URI (cannot be null)
exception:
  MalformedURIException - if p_scheme is not a conformantscheme name



setUserinfo
public void setUserinfo(String p_userinfo) throws MalformedURIException(Code)
Set the userinfo for this URI. If a non-null value is passed in and the host value is null, then an exception is thrown.
Parameters:
  p_userinfo - the userinfo for this URI
exception:
  MalformedURIException - if p_userinfo contains invalidcharacters



toString
public String toString()(Code)
Get the URI as a string specification. See RFC 2396 Section 5.2. the URI string specification



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.