Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.exist.xquery.util
Class URIUtils

    java.lang.Object
      org.exist.xquery.util.URIUtils

public class URIUtils
extends java.lang.Object

Utilities for URI related functions

Author:
  Pierrick Brihaye

Constructor Summary
`URIUtils()`

Method Summary
`static java.lang.String` | `encodeForURI(java.lang.String uriPart)`
`static XmldbURI` | `encodeXmldbUriFor(java.lang.String path)` This method creates an `XmldbURI` by encoding the provided string, then calling XmldbURI.xmldbUriFor(String) with the result of that encoding
`static java.lang.String` | `ensureUrlEncodedUtf8(java.lang.String path)` This method ensure that a collection path (e.g.
`static java.lang.String` | `escapeHtmlURI(java.lang.String uri)`
`static java.lang.String` | `iriToURI(java.lang.String uriPart)`
`static java.lang.String` | `urlDecodeUtf8(java.lang.String uri)` This method decodes the provided uri for human readability.
`static java.lang.String` | `urlDecodeUtf8(XmldbURI uri)` This method decodes the provided uri for human readability.
`static java.lang.String` | `urlEncodePartsUtf8(java.lang.String url)` This method splits the supplied url on the character '/' then URL encodes the segments between, returning a URL encoded version of the passed url, leaving any occurrence of '/' as it is.
`static java.lang.String` | `urlEncodeUtf8(java.lang.String uri)` This method is a wrapper for `URLEncoder.encode(java.lang.String,java.lang.String)` It calls this method, suppying the url parameter as the first parameter, and "UTF-8" (the W3C recommended encoding) as the second.

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

Constructor Detail

### URIUtils

    public URIUtils()

Method Detail

### encodeForURI

    public static java.lang.String encodeForURI(java.lang.String uriPart)

### iriToURI

    public static java.lang.String iriToURI(java.lang.String uriPart)

### escapeHtmlURI

    public static java.lang.String escapeHtmlURI(java.lang.String uri)

### urlEncodeUtf8

    public static java.lang.String urlEncodeUtf8(java.lang.String uri)

  This method is a wrapper for `URLEncoder.encode(java.lang.String,java.lang.String)` It calls this method, suppying the url parameter as the first parameter, and "UTF-8" (the W3C recommended encoding) as the second. UnsupportedEncodingExceptions are wrapped in a runtime exception. IMPORTANT: the java.net.URLEncoder class encodes a space (" ") as a "+". The proper method of encoding spaces in the path of a URI is with "%20", so this method will replace all instances of "+" in the encoded string with "%20" before returning. This means that XmldbURIs constructed from java.net.URLEncoder#encoded strings will not be String equivalents of XmldbURIs created with the result of calls to this function.

  Parameters:
    `uri` - The uri to encode
  Returns:
    The UTF-8 encoded value of the supplied uri

### urlDecodeUtf8

    public static java.lang.String urlDecodeUtf8(java.lang.String uri)

  This method decodes the provided uri for human readability. The method simply wraps URLDecoder.decode(uri,"UTF-8). It is places here to provide a friendly way to decode URIs encoded by urlEncodeUtf8()

  Parameters:
    `uri` - The uri to decode
  Returns:
    The decoded value of the supplied uri

### urlDecodeUtf8

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

  This method decodes the provided uri for human readability. The method simply wraps URLDecoder.decode(uri,"UTF-8). It is places here to provide a friendly way to decode URIs encoded by urlEncodeUtf8()

  Parameters:
    `uri` - The uri to decode
  Returns:
    The decoded value of the supplied uri

### urlEncodePartsUtf8

    public static java.lang.String urlEncodePartsUtf8(java.lang.String url)

  This method splits the supplied url on the character '/' then URL encodes the segments between, returning a URL encoded version of the passed url, leaving any occurrence of '/' as it is.

  Parameters:
    `url` - The path to encode
  Returns:
    A UTF-8 URL encoded string

### ensureUrlEncodedUtf8

    public static java.lang.String ensureUrlEncodedUtf8(java.lang.String path)

  This method ensure that a collection path (e.g. /db/[]) is properly URL encoded. Uses W3C recommended UTF-8 encoding.

  Parameters:
    `path` - The path to check
  Returns:
    A UTF-8 URL encoded string

### encodeXmldbUriFor

    public static XmldbURI encodeXmldbUriFor(java.lang.String path)
                                      throws java.net.URISyntaxException

  This method creates an `XmldbURI` by encoding the provided string, then calling XmldbURI.xmldbUriFor(String) with the result of that encoding

  Parameters:
    `path` - The path to encode and create an XmldbURI from
  Returns:
    A UTF-8 URI encoded string
  Throws:
    `java.net.URISyntaxException` - A URISyntaxException is thrown if the path cannot be parsed by XmldbURI, after being encoded by `urlEncodePartsUtf8`

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Wolfgang Meier. All rights reserved.