Class EntityClientHelper

  • Direct Known Subclasses:
    FileClientHelper

    public abstract class EntityClientHelper
    extends LocalClientHelper
    Connector to the local entities. That connector supports the content negotiation feature (i.e. for GET and HEAD methods) and implements the response to GET/HEAD methods.
    Author:
    Thierry Boileau
    • Constructor Detail

      • EntityClientHelper

        public EntityClientHelper​(org.restlet.Client client)
        Constructor.
        Parameters:
        client - The client to help.
    • Method Detail

      • createReference

        public org.restlet.data.Reference createReference​(java.lang.String scheme,
                                                          java.lang.String encodedParentDirPath,
                                                          java.lang.String encodedEntityName,
                                                          java.lang.String decodedVariantName)
        Generate a Reference for a variant name (which is URL decoded) and handle the translation between the incoming requested path (which is URL encoded).
        Parameters:
        scheme - The scheme of the requested resource.
        encodedParentDirPath - The encoded path of the parent directory of the requested resource.
        encodedEntityName - The encoded name of the requested resource.
        decodedVariantName - The decoded name of a returned resource.
        Returns:
        A new Reference.
      • getEntity

        public abstract Entity getEntity​(java.lang.String path)
        Returns a local entity for the given path.
        Parameters:
        path - The path of the entity.
        Returns:
        A local entity for the given path.
      • getReencodedVariantEntityName

        protected java.lang.String getReencodedVariantEntityName​(java.lang.String encodedEntityName,
                                                                 java.lang.String decodedVariantEntityName)
        Percent-encodes the given percent-decoded variant name of a resource whose percent-encoded name is given. Tries to match the longest common part of both encoded entity name and decoded variant name.
        Parameters:
        encodedEntityName - the percent-encoded name of the initial resource
        decodedVariantEntityName - the percent-decoded entity name of a variant of the initial resource.
        Returns:
        The variant percent-encoded entity name.
      • handleEntityGet

        protected void handleEntityGet​(org.restlet.Request request,
                                       org.restlet.Response response,
                                       Entity entity)
        Handles a GET call.
        Parameters:
        request - The request to answer.
        response - The response to update.
        entity - The requested entity (normal or directory).
      • handleLocal

        protected void handleLocal​(org.restlet.Request request,
                                   org.restlet.Response response,
                                   java.lang.String decodedPath)
        Description copied from class: LocalClientHelper
        Handles a local call.
        Specified by:
        handleLocal in class LocalClientHelper
        Parameters:
        request - The request to handle.
        response - The response to update.
        decodedPath - The decoded local path.