Class Gate

java.lang.Object
overit.geocall.servlet.gate.Gate
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ConcreteGate

public abstract class Gate extends Object implements Serializable
This class defines all the method used to download a file (from a Source.
See Also:
  • Field Details

    • _fileName

      protected String _fileName
    • _browserPolicy

      protected BrowserPolicy _browserPolicy
    • _disposition

      protected String _disposition
  • Constructor Details

    • Gate

      public Gate(String fileName, BrowserPolicy browserPolicy)
      Creates a new Gate
      Parameters:
      fileName - The name of the file
      browserPolicy - The BrowserPolicy
  • Method Details

    • toGetParams

      protected static final String toGetParams(Map<String,String> m)
    • getFileName

      public String getFileName()
      Returns the full name of the file, composed by the @{code path} and the basename
      Returns:
      The name of the file
    • getFileName

      public String getFileName(boolean full)
      Returns the name of the file
      Parameters:
      full - true to ask the full name, false to ask only for the basename
      Returns:
      The name of the file
    • getBrowserPolicy

      public BrowserPolicy getBrowserPolicy()
      Returns the BrowserPolicy
      Returns:
      The BrowserPolicy
    • setDisposition

      public void setDisposition(String disposition)
      Sets the disposition, possible values are: "i" to indicate the page border, "d" to download or save with name, "w" to open in a tab or a window
      Parameters:
      disposition - The disposition
    • getDispositon

      public String getDispositon()
      Returns the disposition
      Returns:
      Possible return values are: "i" to indicate the page border, "d" to download or save with name, "w" to open in a tab or a window
    • getSource

      public abstract Source getSource()
      Returns the Source
      Returns:
      The Source
    • getUrl

      public abstract String getUrl()
      Returns the URL
      Returns:
      The URL
    • getContentDisposition

      public String getContentDisposition()
      transforms the disposition values of i,w,d in a standard Content-Disposition http header if the disposition is 'd' the returned value is "attachment", if 'i' it returns "inline" and otherwise it is null
      Returns:
      the equivalent Content-Disposition header
    • download

      public void download(HttpServletRequest req, HttpServletResponse res) throws IOException
      Download a file
      Parameters:
      req - The HttpServletRequest
      res - The HttpServletResponse
      Throws:
      IOException - if an I/O exception occurs
    • upload

      public void upload(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException
      Upload a new binary file. If the URL refers to a folder, it is possible to specify the resources file name via the x-geocall-resource-name custom header
      Parameters:
      req - The HttpServletRequest
      resp - The HttpServletResponse
      Throws:
      IOException - in case of uploaded binary read error or if it can not be correctly saved.
      ServletException
    • output

      public void output(OutputStream os, boolean compressed) throws IOException
      Write in the OutputStream
      Parameters:
      os - The OutputStream
      compressed - Boolean value indicating if is compressed
      Throws:
      IOException - If an I/O error occurs