@Status(stage=DEVELOPMENT, unitTests=ABSENT) @Reviews(value=@Review(by="Kees Schotanus",at="2010-10-24",reason="Preliminary checkin")) public abstract class AbstractCsvServlet extends AbstractHttpServlet
Name | Description | Default |
---|---|---|
fileName | Name of the csv file | output.csv |
rowSeparator | The separator that separates rows | The default line.separator for the platform |
columnSeparator | The separator that separates columns | comma |
attachment | Determines whether the csv file is opened in the browser or in Excel. The value can be false ("0" or "false") or true (any other value). | true |
contentType | Determines the mime type | application/vnd.ms-excel |
writeCsvData(HttpServletRequest, HttpServletResponse)
method.Constructor and Description |
---|
AbstractCsvServlet() |
Modifier and Type | Method and Description |
---|---|
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Processes the get request.
|
Character |
getColumnSeparator()
Gets the column separator.
|
String |
getContentType()
Gets the content type for this csv output.
|
String |
getFileName()
Gets the file name to write the csv output to.
|
String |
getRowSeparator()
Gets the row separator.
|
String |
getServletInfo()
Returns information about the servlet.
|
void |
init(javax.servlet.ServletConfig servletConfig)
Process init parameters.
|
boolean |
isAttachment()
Determines whether csv output is shown as an attachment or within the browser.
|
protected abstract void |
writeCsvData(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Writes the csv output.
|
clearSessionData, destroy, getActiveRequests, getLocale, getRequiredInitParameter, getSessionInfo, service
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public String getServletInfo()
getServletInfo
in interface javax.servlet.Servlet
getServletInfo
in class AbstractHttpServlet
public void init(javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
servletConfig
- Servlet Configuration.javax.servlet.ServletException
- When the super class throws this exception.public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
doGet
in class javax.servlet.http.HttpServlet
request
- The request.response
- The response.javax.servlet.ServletException
- When a servlet exception occurs.IOException
- When something goes wrong while creating output.public String getFileName()
public String getRowSeparator()
public Character getColumnSeparator()
public boolean isAttachment()
public String getContentType()
protected abstract void writeCsvData(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
request
- The request object.response
- The response object.
IOException
- When an exception occurs while writing the csv data.Copyright © 2008–2018. All rights reserved.