Package org.xwiki.url

Class ExtendedURL

  • All Implemented Interfaces:
    Cloneable

    public class ExtendedURL
    extends Object
    implements Cloneable
    Extend a URL by providing access to the URL path segments (URL-decoded). Allows representing both a full URL or a relative one.
    Since:
    6.1M2
    Version:
    $Id: 326af11942ae8056014374bbb30d91219a76c019 $
    • Constructor Detail

      • ExtendedURL

        public ExtendedURL​(List<String> segments)
        Populate the Extended URL with a list of path segments.
        Parameters:
        segments - the path segments of the URL
      • ExtendedURL

        public ExtendedURL​(List<String> segments,
                           Map<String,​List<String>> parameters)
        Populate the Extended URL with a list of path segments.
        Parameters:
        segments - the path segments of the URL
        parameters - the query string parameters of the URL
        Since:
        7.1M1
      • ExtendedURL

        public ExtendedURL​(URL url,
                           String ignorePrefix)
                    throws org.xwiki.resource.CreateResourceReferenceException
        Parameters:
        url - the URL being wrapped
        ignorePrefix - the ignore prefix must start with "/" (eg "/xwiki"). It can be empty or null too in which case it's not used
        Throws:
        org.xwiki.resource.CreateResourceReferenceException - if the passed URL is invalid which can happen if it has incorrect encoding
    • Method Detail

      • getSegments

        public List<String> getSegments()
        Returns:
        the path segments (each part of the URL separated by the path separator character)
      • getWrappedURL

        public URL getWrappedURL()
        Returns:
        the URL that this instance wraps, provided as a helper feature
      • getURI

        public URI getURI()
        Returns:
        the URI corresponding to the passed URL that this instance wraps, provided as a helper feature
      • getParameters

        public Map<String,​List<String>> getParameters()
        Returns:
        the list of query string parameters passed in the original URL
        Since:
        7.1M1
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • serialize

        public String serialize()
        Returns:
        the serialized segments as a relative URL with URL-encoded path segments. Note that the returned String starts with a URL separator ("/")