public class Download extends AbstractFoundationComponent
Wraps the Download foundation component, providing methods for editing it. See /libs/foundation/components/download in the repository for implementation details.
  • Field Details

  • Constructor Details

    • Download

      public Download(ComponentClient client, String pagePath, String location, String nameHint)
      The constructor stores all the component path information like parentPage, name etc.
      Parameters:
      client - The FoundationClient that's creating this instance.
      pagePath - path to the page that will contain the component.
      location - relative location to the parent node inside the page that will contain the component node.
      nameHint - name to be used for the component node. Might get altered by the server if a naming conflict occurs. The AbstractComponent.getName() method will return the correct name after (String,int...) has been called.
  • Method Details

    • getResourceType

      public String getResourceType()
      Description copied from class: AbstractComponent
      The resource type for the component, e.g. foundation/components/text. this will be set in the sling:resourceType property of the node.
      Specified by:
      getResourceType in class AbstractComponent
      Returns:
      the resource type
    • setDownload

      public org.apache.sling.testing.clients.SlingHttpResponse setDownload(String mimeType, String fileName, String resourcePath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Uploads the file to be used for the download component.
      Parameters:
      mimeType - mime type of file
      fileName - file name
      resourcePath - path to the resource
      expectedStatus - list of allowed HTTP Status to be returned. if not set, status 200 is assumed
      Returns:
      a SlingHttpResponse wrapping the HTML response returned by Sling
      Throws:
      org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
    • setReference

      public org.apache.sling.testing.clients.SlingHttpResponse setReference(String fileReference, String fileName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Sets the reference to a file in the repository to be used by the download component.
      Parameters:
      fileReference - reference to file
      fileName - file name
      expectedStatus - list of allowed HTTP Status to be returned. if not set, status 200 is assumed
      Returns:
      a SlingHttpResponse wrapping the HTML response returned by Sling
      Throws:
      org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle