public class TLcdHttpServletResponseWrapper extends Object implements ILcdResponse
HttpServletResponse
objects.Modifier and Type | Field and Description |
---|---|
protected javax.servlet.http.HttpServletResponse |
fHttpServletResponse |
protected PrintWriter |
fWriter |
Constructor and Description |
---|
TLcdHttpServletResponseWrapper(javax.servlet.http.HttpServletResponse aHttpServletResponse)
Creates a new wrapper object.
|
Modifier and Type | Method and Description |
---|---|
void |
addDateHeader(String aName,
long aValue)
Adds a response header with the given name and date-value.
|
void |
addHeader(String aName,
String aValue)
Adds a response header with the given name and value.
|
void |
addIntHeader(String aName,
int aValue)
Adds a response header with the given name and integer value.
|
boolean |
containsHeader(String aName)
Returns true if the response header with the given name has already been set.
|
void |
flush()
Flushes all pending data being written for this response.
|
javax.servlet.http.HttpServletResponse |
getHttpServletResponse() |
OutputStream |
getOutputStream()
Returns an
OutputStream to which the server can write its
response. |
PrintWriter |
getWriter()
Returns a
PrintWriter to which the server can write its
response. |
void |
setContentLength(int aContentLength)
Specifies the size of the data returned by this response.
|
void |
setContentType(String aContentType)
Sets the content type (MIME type) of the response.
|
void |
setDateHeader(String aName,
long aValue)
Sets a response header with the given name and date-value.
|
void |
setHeader(String aName,
String aValue)
Sets a response header with the given name and value.
|
void |
setIntHeader(String aName,
int aValue)
Sets a response header with the given name and integer value.
|
void |
setStatus(int aStatus)
Sets the HTTP status code for this response.
|
protected javax.servlet.http.HttpServletResponse fHttpServletResponse
protected PrintWriter fWriter
public TLcdHttpServletResponseWrapper(javax.servlet.http.HttpServletResponse aHttpServletResponse)
aHttpServletResponse
- The HttpServletResponse
object around which to build a wrapper.public boolean containsHeader(String aName)
aName
- the header namepublic void setDateHeader(String aName, long aValue)
setDateHeader
in interface ILcdResponse
aName
- the name of the header to setaValue
- the assigned date valuepublic void addDateHeader(String aName, long aValue)
aName
- the name of the header to setaValue
- the assigned date valuepublic void setIntHeader(String aName, int aValue)
aName
- the name of the header to setaValue
- the assigned integer valuepublic void addIntHeader(String aName, int aValue)
aName
- the name of the header to setaValue
- the assigned integer valuepublic void setHeader(String aName, String aValue)
containsHeader(String)
can be used to test for the presence of a header before setting its value.setHeader
in interface ILcdResponse
aName
- the header nameaValue
- the header valuepublic void addHeader(String aName, String aValue)
aName
- the header nameaValue
- the header valuepublic OutputStream getOutputStream() throws IOException
ILcdResponse
OutputStream
to which the server can write its
response.getOutputStream
in interface ILcdResponse
OutputStream
IOException
- if the output stream cannot be retrievedpublic void setContentType(String aContentType)
ILcdResponse
setContentType
in interface ILcdResponse
aContentType
- A MIME type, e.g. "text/xml".public void setContentLength(int aContentLength)
ILcdResponse
setContentLength
in interface ILcdResponse
aContentLength
- The data size of the response.public void setStatus(int aStatus)
setStatus
in interface ILcdResponse
aStatus
- the HTTP status code for this response.public PrintWriter getWriter() throws IOException
ILcdResponse
PrintWriter
to which the server can write its
response.getWriter
in interface ILcdResponse
PrintWriter
IOException
- if the PrintWriter
cannot be created.public void flush() throws IOException
ILcdResponse
flush
in interface ILcdResponse
IOException
- if the flush operation fails.public javax.servlet.http.HttpServletResponse getHttpServletResponse()