Class StandardHttpExporter

  • All Implemented Interfaces:
    TableHttpExporter
    Direct Known Subclasses:
    CSVHttpExporter, TabHttpExporter

    public abstract class StandardHttpExporter
    extends HttpExporterBase
    implements TableHttpExporter
    Abstract class implementing functionality common for exporters exporting table in simple format like comma separated format. The business logic of export is performed with exporter obtained via getExport method and so each subclass can redefine it overwriting this method.
    Author:
    Jakub Kulaviak
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.apache.log4j.Logger LOG  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canExport​(PagedTable pt)
      Check if this TableExporter can export the given PagedTable.
      void export​(PagedTable pt, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, TableExportForm form, java.util.Collection<Path> unionPathCollection, java.util.Collection<Path> newPathCollection)
      Perform export.
      protected abstract Exporter getExporter​(java.io.OutputStream out, java.lang.String separator, java.util.List<java.lang.String> headers)
      Do the export.
      java.util.List<Path> getInitialExportPaths​(PagedTable pt)
      The initial export path list is just the paths from the columns of the PagedTable.
      protected abstract void setResponseHeader​(javax.servlet.http.HttpServletResponse response, boolean doGzip)
      Sets header and content type of result in response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        protected static final org.apache.log4j.Logger LOG
    • Constructor Detail

      • StandardHttpExporter

        public StandardHttpExporter()
        Constructor.
    • Method Detail

      • canExport

        public boolean canExport​(PagedTable pt)
        Description copied from interface: TableHttpExporter
        Check if this TableExporter can export the given PagedTable.
        Specified by:
        canExport in interface TableHttpExporter
        Parameters:
        pt - PagedTable
        Returns:
        true if given PagedTable can be exported with this exporter
      • export

        public void export​(PagedTable pt,
                           javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response,
                           TableExportForm form,
                           java.util.Collection<Path> unionPathCollection,
                           java.util.Collection<Path> newPathCollection)
        Perform export.
        Specified by:
        export in interface TableHttpExporter
        Parameters:
        pt - exported PagedTable
        request - request
        response - response
        form - the form
        unionPathCollection - view paths
        newPathCollection - columns paths
      • getInitialExportPaths

        public java.util.List<Path> getInitialExportPaths​(PagedTable pt)
        The initial export path list is just the paths from the columns of the PagedTable. Return a list of the Paths to show the user as initial export columns or header contents. The List is likely to be based on the columns of the PagedTable plus or minus special cases for this exporter.
        Specified by:
        getInitialExportPaths in interface TableHttpExporter
        Parameters:
        pt - the PagedTable
        Returns:
        the Paths
      • getExporter

        protected abstract Exporter getExporter​(java.io.OutputStream out,
                                                java.lang.String separator,
                                                java.util.List<java.lang.String> headers)
        Do the export.
        Parameters:
        out - output stream
        separator - line separator
        headers - if non-null, a list of the column headers which will be written by export()
        Returns:
        exporter that will perform the business logic of export.
      • setResponseHeader

        protected abstract void setResponseHeader​(javax.servlet.http.HttpServletResponse response,
                                                  boolean doGzip)
        Sets header and content type of result in response.
        Parameters:
        response - response
        doGzip - whether to compress the stream