Class DownloadOutput

java.lang.Object
com.invirgance.convirgance.web.output.DownloadOutput
All Implemented Interfaces:
com.invirgance.convirgance.output.Output

@Wiring public class DownloadOutput extends Object implements com.invirgance.convirgance.output.Output
A wrapper to force the user's browser to download the output instead of opening it. This is typically used to force a download of spreadsheet formats like CSV, though it can be used to wrap browser formats like JSON. A filename can be optionally specified to set the name of the file to download. Curly braces can be used to inject parameters into the filename. For example, setting filename to "Report {generate_date}.csv" would replace {generate_date} with the value from the parameters list.
Author:
jbanes
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the MIME type of the wrapped Output object.
    The name of the downloaded file.
    com.invirgance.convirgance.output.Output
    Returns the Output object being wrapped.
    void
    setFilename(String filename)
    Set the name of the downloaded file.
    void
    setOutput(com.invirgance.convirgance.output.Output output)
    Set the Output object to wrap.
    com.invirgance.convirgance.output.OutputCursor
    write(com.invirgance.convirgance.target.Target target)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.invirgance.convirgance.output.Output

    write
  • Constructor Details

    • DownloadOutput

      public DownloadOutput()
  • Method Details

    • getOutput

      public com.invirgance.convirgance.output.Output getOutput()
      Returns the Output object being wrapped.
      Returns:
      the wrapped output
    • setOutput

      public void setOutput(com.invirgance.convirgance.output.Output output)
      Set the Output object to wrap.
      Parameters:
      output - generates the data downloaded by the client
    • getFilename

      public String getFilename()
      The name of the downloaded file.
      Returns:
      the name of the downloaded file or null if no filename was set
    • setFilename

      public void setFilename(String filename)
      Set the name of the downloaded file. Values from the parameters list can be injected using curly braces. For example, setting filename to "Report {generate_date}.csv" would replace {generate_date} with the value from the parameters list.
      Parameters:
      filename - the name of the downloaded file
    • write

      public com.invirgance.convirgance.output.OutputCursor write(com.invirgance.convirgance.target.Target target)
      Specified by:
      write in interface com.invirgance.convirgance.output.Output
    • getContentType

      public String getContentType()
      Returns the MIME type of the wrapped Output object.
      Specified by:
      getContentType in interface com.invirgance.convirgance.output.Output
      Returns:
      the MIME type of the output