org.intermine.web.logic.export.http
Class StandardHttpExporter

java.lang.Object
  extended by org.intermine.web.logic.export.http.HttpExporterBase
      extended by org.intermine.web.logic.export.http.StandardHttpExporter
All Implemented Interfaces:
TableHttpExporter
Direct Known Subclasses:
CSVHttpExporter, ExcelHttpExporter, 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.


Constructor Summary
StandardHttpExporter()
          Constructor.
 
Method Summary
 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)
          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 org.intermine.web.logic.export.http.HttpExporterBase
getResultRows
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)
Perform export.

Specified by:
export in interface TableHttpExporter
Parameters:
pt - exported PagedTable
request - request
response - response
form - the form

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