Package org.xwiki.vfs

Class VfsResourceReference

  • All Implemented Interfaces:
    ResourceReference

    public class VfsResourceReference
    extends org.xwiki.resource.entity.EntityResourceReference
    Represents a reference to a VFS resource.
    Since:
    7.4M2
    Version:
    $Id: 32862047c555a94d9f7a94a3d8f8d6bb744c3e9b $
    • Field Detail

      • TYPE

        public static final ResourceType TYPE
        Represents a VFS Resource Type.
    • Constructor Detail

      • VfsResourceReference

        @Unstable
        public VfsResourceReference​(VfsResourceReference reference)
        Create a new reference by copying the passed one.
        Parameters:
        reference - the reference to copy
        Since:
        12.3RC1
      • VfsResourceReference

        public VfsResourceReference​(URI uri,
                                    List<String> pathSegments)
        Parameters:
        uri - the URI pointing to the archive (without the path inside the archive), e.g. attach:space.page@attachment
        pathSegments - see getPathSegments()
      • VfsResourceReference

        public VfsResourceReference​(URI uri,
                                    String pathSegments)
        Parameters:
        uri - the URI pointing to the archive (without the path inside the archive), e.g. attach:space.page@attachment
        pathSegments - see getPathSegments(), specified as "/"-separated string (e.g. "path/to/file")
      • VfsResourceReference

        @Deprecated
        public VfsResourceReference​(URI fullURI)
        Deprecated.
        Since 12.4RC1, this constructor shouldn't be used anymore, in particular not for internal references such as attach:space.page@attachment/path/to/file, VfsResourceReference(String) should be used instead
        Parameters:
        fullURI - the full opaque URI containing both the reference to the archive and the path to the entry inside it, e.g. attach:space.page@attachment/path/to/file. Note that this constructor requires that the full URL to be URL-encoded.
      • VfsResourceReference

        public VfsResourceReference​(String fullReference)
        Parameters:
        fullReference - the full opaque reference containing both the reference to the archive and the path to the entry inside it, e.g. attach:space.page@attachment/path/to/file.
        Since:
        12.4RC1
    • Method Detail

      • getURI

        @Deprecated
        public URI getURI()
        Deprecated.
        Since 12.4RC1 this method shouldn't be used anymore, in favor of getReference().
        Returns:
        the URI to the VFS (e.g. attach:space.page@file.zip, http://server/path/to/zip)
      • getReference

        public String getReference()
        Returns:
        the actual reference to the VFS (e.g. attach:space.page@file.zip).
        Since:
        12.4RC1
      • getScheme

        public String getScheme()
        Returns:
        the scheme of this reference (e.g. attach).
        Since:
        12.4RC1
      • getPathSegments

        public List<String> getPathSegments()
        Returns:
        the list of segments pointing to the relative location of a resource in the VFS (e.g. {"some", "directory", "file.txt"} for some/directory/file.txt
      • getPath

        public String getPath()
        Returns:
        the String representation with "/" separating each VFS path segment, e.g. some/directory/file.txt
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class org.xwiki.resource.entity.EntityResourceReference
      • equals

        public boolean equals​(Object object)
        Overrides:
        equals in class org.xwiki.resource.entity.EntityResourceReference
      • toString

        public String toString()
        Overrides:
        toString in class org.xwiki.resource.entity.EntityResourceReference
      • toURI

        public URI toURI()
        Returns:
        the resource reference as a URI
      • getContentType

        public String getContentType()
        Returns:
        the Content-Type to return with the response
        Since:
        12.3RC1
      • setContentType

        public void setContentType​(String contentType)
        Parameters:
        contentType - the Content-Type to return with the response
        Since:
        12.3RC1