public interface ServletResponse
Modifier and Type | Method and Description |
---|---|
void |
flushBuffer()
flush away any extant response cache.
|
int |
getBufferSize()
get the current size of the response cache buffer.
|
java.lang.String |
getCharacterEncoding()
Returns the character encoding in use by this Response
|
java.lang.String |
getContentType()
get the content type if it has been set.
|
java.util.Locale |
getLocale()
get the locale for the response.
|
ServletOutputStream |
getOutputStream()
Creates a ServletOutputStream for the servlet to write the data to.
|
java.io.PrintWriter |
getWriter()
Creates a PrintWriter for the servlet to print text to.
|
boolean |
isCommitted()
has the response cache been written to the client?
|
void |
reset()
reset the current response cache buffer.
|
void |
resetBuffer()
Resets the underlying response buffer, but does not clear the response code
or headers.
|
void |
setBufferSize(int size)
set the size of the buffer where caching is used.
|
void |
setCharacterEncoding(java.lang.String encoding)
sets the character encoding.
|
void |
setContentLength(int length)
Tells the client how many bytes to expect.
|
void |
setContentType(java.lang.String type)
Tells the client what mime type to expect
|
void |
setLocale(java.util.Locale locale)
set the locale for the response.
|
java.lang.String getCharacterEncoding()
java.lang.String getContentType()
ServletOutputStream getOutputStream() throws java.io.IOException
No encoding of data written to this stream is done by the container.
It is only possible to call getWriter
or
getOutputStream
on a response, but not both.
java.io.IOException
- if a i/o exception occursjava.lang.IllegalStateException
- if getWriter
was already
called on this responsewhich the container might use to provide a buffer
for this stream.
java.io.PrintWriter getWriter() throws java.io.IOException
It is only possible to call getWriter
or
getOutputStream
on a response, but not both.
java.io.IOException
- if a i/o exception occursjava.lang.IllegalStateException
- if getOutputStream
was
already called on this responsejava.io.UnsupportedEncodingException
- if no suitable character
encoding can be usedwhich must be called before this if you want to
specify a charset to affect this writer.
void setCharacterEncoding(java.lang.String encoding)
void setContentLength(int length)
length
- the number of bytes in the replyvoid setContentType(java.lang.String type)
type
- the mime type of the contentvoid setBufferSize(int size)
size
- the size in bytes of the bufferjava.lang.IllegalStateException
- if content has already been sent.int getBufferSize()
void flushBuffer() throws java.io.IOException
java.io.IOException
void resetBuffer()
java.lang.IllegalStateException
- if the response has already been committedboolean isCommitted()
void reset()
java.lang.IllegalStateException
- if content has already been sent.void setLocale(java.util.Locale locale)
java.util.Locale getLocale()