## org.exist.xmldb
Class XmldbURI

    java.lang.Object
      org.exist.xmldb.XmldbURI

All Implemented Interfaces:
  java.lang.Comparable

Direct Known Subclasses:
  FullXmldbURI

public class XmldbURI
extends java.lang.Object
implements java.lang.Comparable

A utility class for xmldb URis. Since, java.net.URI is final this class acts as a wrapper.

Author:
  Pierrick Brihaye <pierrick.brihaye@free.fr>

Field Summary
`static java.lang.String` `API_LOCAL`
`static java.lang.String` `API_REST`
`static java.lang.String` `API_WEBDAV`
`static java.lang.String` `API_XMLRPC`
`static XmldbURI` `CONFIG_COLLECTION_URI`
`static java.lang.String` `DEFAULT_INSTANCE_NAME`
`static java.lang.String` `EMBEDDED_SERVER_AUTHORITY`
`static XmldbURI` `EMBEDDED_SERVER_URI`
`static XmldbURI` `EMPTY_URI`
`static int` `NO_PORT`
`static XmldbURI` `RELATIVE_ROOT_COLLECTION_URI`
`static XmldbURI` `ROOT_COLLECTION_URI`
`static XmldbURI` `SYSTEM_COLLECTION_URI`
`static XmldbURI` `TEMP_COLLECTION_URI`
`static java.lang.String` `XMLDB_SCHEME`
`static java.lang.String` `XMLDB_URI_PREFIX`

Method Summary
`XmldbURI` `append(java.lang.String uri)`
`XmldbURI` `append(XmldbURI uri)`
`XmldbURI` `appendInternal(XmldbURI uri)`
`static java.lang.String` `checkPath(java.lang.String currentPath, java.lang.String parentPath)`
`static java.lang.String` `checkPath2(java.lang.String fileName, java.lang.String parentPath)` Deprecated. Legacy method used here and there in the code
`int` `compareTo(java.lang.Object ob)`
`static XmldbURI` `create(java.lang.String uri)`
`static XmldbURI` `create(java.lang.String accessURI, java.lang.String collectionPath)`
`static XmldbURI` `create(java.net.URI uri)`
`static XmldbURI` `createInternal(java.lang.String collectionPath)`
`boolean` `endsWith(java.lang.String string)`
`boolean` `endsWith(XmldbURI xmldbUri)`
`boolean` `equals(java.lang.Object ob)`
`boolean` `equalsInternal(XmldbURI other)`
`java.lang.String` `getApiName()`
`java.lang.String` `getAuthority()`
`java.lang.String` `getCollectionPath()`
`java.lang.String` `getContext()`
`java.lang.String` `getFragment()`
`java.lang.String` `getHost()`
`java.lang.String` `getInstanceName()`
`static java.lang.String[]` `getPathComponents(java.lang.String collectionPath)`
`XmldbURI[]` `getPathSegments()` This function returns a relative XmldbURI with the value after the last / in the collection path of the URI
`int` `getPort()`
`java.lang.String` `getQuery()`
`java.lang.String` `getRawAuthority()`
`java.lang.String` `getRawCollectionPath()` Method to return the collection path with reserved characters percent encoded
`java.lang.String` `getRawFragment()`
`java.lang.String` `getRawQuery()`
`java.lang.String` `getRawUserInfo()`
`java.net.URI` `getURI()` This returns a proper heirarchical URI - the xmldb scheme is trimmed from the beginning.
`java.lang.String` `getUserInfo()`
`java.net.URI` `getXmldbURI()` This returns an xmldb uri.
`int` `hashCode()`
`boolean` `isAbsolute()`
`boolean` `isCollectionPathAbsolute()`
`boolean` `isContextAbsolute()`
`XmldbURI` `lastSegment()` This function returns a relative XmldbURI with the value after the last / in the collection path of the URI
`java.lang.String` `makeAbsolute(java.lang.String name)` Deprecated. Legacy method used here and there in the code and copied as such
`static java.lang.String` `normalizeCollectionName(java.lang.String name)` Deprecated. Legacy method used here and there in the code and copied as such
`XmldbURI` `normalizeCollectionPath()`
`XmldbURI` `normalizeContext()`
`int` `numSegments()` This function returns a relative XmldbURI with the value after the last / in the collection path of the URI
`XmldbURI` `prepend(XmldbURI xmldbUri)`
`static java.lang.String` `recoverPseudoURIs(java.lang.String pseudoURI)` Deprecated. By definition, using this method is strongly discouraged
`java.net.URI` `relativizeCollectionPath(java.net.URI uri)`
`java.net.URI` `relativizeContext(java.net.URI uri)`
`XmldbURI` `removeLastSegment()` This function returns a string with everything after the last / removed
`java.net.URI` `resolveCollectionPath(java.net.URI uri)`
`XmldbURI` `resolveCollectionPath(XmldbURI child)`
`java.net.URI` `resolveContext(java.lang.String str)`
`java.net.URI` `resolveContext(java.net.URI uri)`
`boolean` `startsWith(java.lang.String string)`
`boolean` `startsWith(XmldbURI xmldbUri)`
`java.lang.String` `toASCIIString()`
`XmldbURI` `toCollectionPathURI()`
`java.lang.String` `toString()`
`java.net.URL` `toURL()`
`XmldbURI` `trimFromBeginning(java.lang.String string)`
`XmldbURI` `trimFromBeginning(XmldbURI xmldbUri)`
`static XmldbURI` `xmldbUriFor(java.lang.String xmldbURI)`
`static XmldbURI` `xmldbUriFor(java.lang.String accessURI, java.lang.String collectionPath)`
`static XmldbURI` `xmldbUriFor(java.net.URI uri)`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### NO_PORT

    public static final int NO_PORT

See Also:
  Constant Field Values

### XMLDB_SCHEME

    public static final java.lang.String XMLDB_SCHEME

See Also:
  Constant Field Values

### XMLDB_URI_PREFIX

    public static final java.lang.String XMLDB_URI_PREFIX

See Also:
  Constant Field Values

### DEFAULT_INSTANCE_NAME

    public static final java.lang.String DEFAULT_INSTANCE_NAME

See Also:
  Constant Field Values

### EMBEDDED_SERVER_AUTHORITY

    public static final java.lang.String EMBEDDED_SERVER_AUTHORITY

See Also:
  Constant Field Values

### ROOT_COLLECTION_URI

    public static final XmldbURI ROOT_COLLECTION_URI

### RELATIVE_ROOT_COLLECTION_URI

    public static final XmldbURI RELATIVE_ROOT_COLLECTION_URI

### SYSTEM_COLLECTION_URI

    public static final XmldbURI SYSTEM_COLLECTION_URI

### CONFIG_COLLECTION_URI

    public static final XmldbURI CONFIG_COLLECTION_URI

### TEMP_COLLECTION_URI

    public static final XmldbURI TEMP_COLLECTION_URI

### EMPTY_URI

    public static final XmldbURI EMPTY_URI

### EMBEDDED_SERVER_URI

    public static final XmldbURI EMBEDDED_SERVER_URI

### API_XMLRPC

    public static final java.lang.String API_XMLRPC

See Also:
  Constant Field Values

### API_WEBDAV

    public static final java.lang.String API_WEBDAV

See Also:
  Constant Field Values

### API_REST

    public static final java.lang.String API_REST

See Also:
  Constant Field Values

### API_LOCAL

    public static final java.lang.String API_LOCAL

See Also:
  Constant Field Values

Method Detail

### xmldbUriFor

    public static XmldbURI xmldbUriFor(java.net.URI uri)
                                throws java.net.URISyntaxException

  Throws:
    `java.net.URISyntaxException`

### xmldbUriFor

    public static XmldbURI xmldbUriFor(java.lang.String xmldbURI)
                                throws java.net.URISyntaxException

  Throws:
    `java.net.URISyntaxException`

### xmldbUriFor

    public static XmldbURI xmldbUriFor(java.lang.String accessURI,
                                       java.lang.String collectionPath)
                                throws java.net.URISyntaxException

  Throws:
    `java.net.URISyntaxException`

### create

    public static XmldbURI create(java.net.URI uri)

### create

    public static XmldbURI create(java.lang.String uri)

### create

    public static XmldbURI create(java.lang.String accessURI,
                                  java.lang.String collectionPath)

### createInternal

    public static XmldbURI createInternal(java.lang.String collectionPath)

### getURI

    public java.net.URI getURI()

  This returns a proper heirarchical URI - the xmldb scheme is trimmed from the beginning. The scheme will be the instance name, and all other fields will be populated as would be expected from a heirarchical URI

  See Also:
    `getXmldbURI()`

### getXmldbURI

    public java.net.URI getXmldbURI()

  This returns an xmldb uri. This is the most generic sort of uri - the only fields set in the uri are scheme and schemeSpecificPart

### getInstanceName

    public java.lang.String getInstanceName()

### getRawCollectionPath

    public java.lang.String getRawCollectionPath()

  Method to return the collection path with reserved characters percent encoded

  Returns:
    Returns the encoded collection path

### getCollectionPath

    public java.lang.String getCollectionPath()

### toCollectionPathURI

    public XmldbURI toCollectionPathURI()

### getApiName

    public java.lang.String getApiName()

### getContext

    public java.lang.String getContext()

### compareTo

    public int compareTo(java.lang.Object ob)
                  throws java.lang.ClassCastException

  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  Throws:
    `java.lang.ClassCastException`

### lastSegment

    public XmldbURI lastSegment()

  This function returns a relative XmldbURI with the value after the last / in the collection path of the URI

  Returns:
    A relative XmldbURI containing the value after the last / in the collection path

### numSegments

    public int numSegments()

  This function returns a relative XmldbURI with the value after the last / in the collection path of the URI

  Returns:
    A relative XmldbURI containing the value after the last / in the collection path

### getPathSegments

    public XmldbURI[] getPathSegments()

  This function returns a relative XmldbURI with the value after the last / in the collection path of the URI

  Returns:
    A relative XmldbURI containing the value after the last / in the collection path

### removeLastSegment

    public XmldbURI removeLastSegment()

  This function returns a string with everything after the last / removed

  Returns:
    A relative XmldbURI containing the value after the last / in the collection path

### append

    public XmldbURI append(java.lang.String uri)

### append

    public XmldbURI append(XmldbURI uri)

### appendInternal

    public XmldbURI appendInternal(XmldbURI uri)

### recoverPseudoURIs

    public static java.lang.String recoverPseudoURIs(java.lang.String pseudoURI)
                                              throws java.net.URISyntaxException

  Deprecated. By definition, using this method is strongly discouraged

  Ugly workaround for non-URI compliant pathes

  Parameters:
    `pseudoURI` - What is supposed to be a URI
  Returns:
    an supposedly correctly escaped URI string representation</string>
  Throws:
    `java.net.URISyntaxException`

### equals

    public boolean equals(java.lang.Object ob)

### equalsInternal

    public boolean equalsInternal(XmldbURI other)

### isAbsolute

    public boolean isAbsolute()

### isContextAbsolute

    public boolean isContextAbsolute()

### normalizeContext

    public XmldbURI normalizeContext()

### relativizeContext

    public java.net.URI relativizeContext(java.net.URI uri)

### resolveContext

    public java.net.URI resolveContext(java.lang.String str)
                                throws java.lang.NullPointerException,
                                       java.lang.IllegalArgumentException

  Throws:
    `java.lang.NullPointerException`
    `java.lang.IllegalArgumentException`

### resolveContext

    public java.net.URI resolveContext(java.net.URI uri)
                                throws java.lang.NullPointerException

  Throws:
    `java.lang.NullPointerException`

### isCollectionPathAbsolute

    public boolean isCollectionPathAbsolute()

### normalizeCollectionPath

    public XmldbURI normalizeCollectionPath()

### relativizeCollectionPath

    public java.net.URI relativizeCollectionPath(java.net.URI uri)

### resolveCollectionPath

    public XmldbURI resolveCollectionPath(XmldbURI child)
                                   throws java.lang.NullPointerException,
                                          java.lang.IllegalArgumentException

  Throws:
    `java.lang.NullPointerException`
    `java.lang.IllegalArgumentException`

### resolveCollectionPath

    public java.net.URI resolveCollectionPath(java.net.URI uri)
                                       throws java.lang.NullPointerException

  Throws:
    `java.lang.NullPointerException`

### toASCIIString

    public java.lang.String toASCIIString()

### toURL

    public java.net.URL toURL()
                       throws java.lang.IllegalArgumentException,
                              java.net.MalformedURLException

  Throws:
    `java.lang.IllegalArgumentException`
    `java.net.MalformedURLException`

### startsWith

    public boolean startsWith(XmldbURI xmldbUri)

### startsWith

    public boolean startsWith(java.lang.String string)
                       throws java.net.URISyntaxException

  Throws:
    `java.net.URISyntaxException`

### endsWith

    public boolean endsWith(XmldbURI xmldbUri)

### endsWith

    public boolean endsWith(java.lang.String string)
                     throws java.net.URISyntaxException

  Throws:
    `java.net.URISyntaxException`

### prepend

    public XmldbURI prepend(XmldbURI xmldbUri)

### trimFromBeginning

    public XmldbURI trimFromBeginning(XmldbURI xmldbUri)

### trimFromBeginning

    public XmldbURI trimFromBeginning(java.lang.String string)
                               throws java.net.URISyntaxException

  Throws:
    `java.net.URISyntaxException`

### toString

    public java.lang.String toString()

### getPathComponents

    public static java.lang.String[] getPathComponents(java.lang.String collectionPath)

### checkPath

    public static java.lang.String checkPath(java.lang.String currentPath,
                                             java.lang.String parentPath)

### checkPath2

    public static java.lang.String checkPath2(java.lang.String fileName,
                                              java.lang.String parentPath)

  Deprecated. Legacy method used here and there in the code

  Parameters:
    `fileName` -
    `parentPath` -

### makeAbsolute

    public java.lang.String makeAbsolute(java.lang.String name)

  Deprecated. Legacy method used here and there in the code and copied as such

  Parameters:
    `name` -

### normalizeCollectionName

    public static final java.lang.String normalizeCollectionName(java.lang.String name)

  Deprecated. Legacy method used here and there in the code and copied as such

  Parameters:
    `name` -

### getAuthority

    public java.lang.String getAuthority()

### getFragment

    public java.lang.String getFragment()

### getPort

    public int getPort()

### getQuery

    public java.lang.String getQuery()

### getRawAuthority

    public java.lang.String getRawAuthority()

### getHost

    public java.lang.String getHost()

### getUserInfo

    public java.lang.String getUserInfo()

### getRawFragment

    public java.lang.String getRawFragment()

### getRawQuery

    public java.lang.String getRawQuery()

### getRawUserInfo

    public java.lang.String getRawUserInfo()

### hashCode

    public int hashCode()

Copyright (C) Wolfgang Meier. All rights reserved.