au.com.whitesquare.waf.command.response
Class CSVDataFileResponse

java.lang.Object
  extended byau.com.whitesquare.waf.command.Response
      extended byau.com.whitesquare.waf.command.response.CSVDataFileResponse

public abstract class CSVDataFileResponse
extends Response

Purpose:
Log History:
$Log$
Revision 1.1 2006/08/09 22:16:32 steve
Created base CSV file response.

Version:
$Revision$
Author:
Steve Mactaggart

Field Summary
 
Fields inherited from class au.com.whitesquare.waf.command.Response
servletContext
 
Constructor Summary
CSVDataFileResponse(String clientFileName)
           
 
Method Summary
 String generateContent()
          Generates the column headers, all of the required rows of data, and also a total line at the end.
 String getClientFileName()
          Retreives the file name that the client will save this file as.
abstract  int getColumnCount()
           
abstract  String getColumnData(int column)
           
abstract  String getColumnHeader(int column)
           
 String getContentType()
          Retreives the content type that the response will be configured with.
protected abstract  void initData()
           
static void main(String[] args)
           
abstract  boolean next()
           
 void sendResponse(HttpServletRequest req, HttpServletResponse resp)
          Writes the generated content to the responses OutputStream.
 void setClientFileName(String clientFileName)
          Configures the name the client will treat this file as.
 void setContentType(String contentType)
          Configures the Content Type of the response in relation to the data being returned.
 
Methods inherited from class au.com.whitesquare.waf.command.Response
init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVDataFileResponse

public CSVDataFileResponse(String clientFileName)
Method Detail

generateContent

public String generateContent()
Generates the column headers, all of the required rows of data, and also a total line at the end.

Returns:

main

public static void main(String[] args)

sendResponse

public void sendResponse(HttpServletRequest req,
                         HttpServletResponse resp)
                  throws Exception
Writes the generated content to the responses OutputStream.

Specified by:
sendResponse in class Response
Parameters:
req -
resp -
Throws:
Exception

getContentType

public String getContentType()
Retreives the content type that the response will be configured with.

Returns:
Returns the contentType.

setContentType

public void setContentType(String contentType)
Configures the Content Type of the response in relation to the data being returned. For images use a 'images/xxx' content type, pdf's use 'application/pdf' or any other valid MIME type.

Parameters:
contentType - The contentType to set.

getClientFileName

public String getClientFileName()
Retreives the file name that the client will save this file as.

Returns:
Returns the clientFileName.

setClientFileName

public void setClientFileName(String clientFileName)
Configures the name the client will treat this file as. If no client file name is supplied then the client will not recieve a file name at all.
This is a useful method if the application wants to change the name of the file being served from what it is known as on disk.

Parameters:
clientFileName - The clientFileName to set.

initData

protected abstract void initData()

next

public abstract boolean next()

getColumnData

public abstract String getColumnData(int column)

getColumnHeader

public abstract String getColumnHeader(int column)

getColumnCount

public abstract int getColumnCount()


Copyright © 2004 Whitesquare Software. All Rights Reserved.