Interface ServletResponse
- All Known Subinterfaces:
HttpServletResponse
public interface ServletResponse
A servlet can use this class to pass information to the client.
- Since:
- Servlet API 1.0
- Version:
- Servlet API 2.2
-
Method Summary
Modifier and TypeMethodDescriptionvoidXXXintXXXReturns the characterset encoding in use by this ResponseXXXCreates a ServletOutputStream for the servlet to write the data to.Creates a PrintWriter for the servlet to print text to.booleanXXXvoidreset()XXXvoidsetBufferSize(int size) XXXvoidsetContentLength(int length) Tells the client how many bytes to expect.voidsetContentType(String type) Tells the client what mime type to expectvoidXXX
-
Method Details
-
setContentLength
void setContentLength(int length) Tells the client how many bytes to expect.- Parameters:
length- the number of bytes in the reply- Since:
- Servlet API 1.0
-
setContentType
Tells the client what mime type to expect- Parameters:
type- the mime type of the content- Since:
- Servlet API 1.0
-
getOutputStream
Creates a ServletOutputStream for the servlet to write the data to.setContentLengthandsetContentTypecan only be called before anything is written to this stream. It is only possible to callgetWriterorgetOutputStreamon a response, but not both.- Returns:
- ServletOutputStream to write binary data
- Throws:
IOException- if a i/o exception occursIllegalStateException- ifgetWriterwas already called on this response- Since:
- Servlet API 1.0
-
getWriter
Creates a PrintWriter for the servlet to print text to. The contenttype must be set before calling this method. It is only possible to callgetWriterorgetOutputStreamon a response, but not both.- Returns:
- the created PrintWriter
- Throws:
IOException- if a i/o exception occursIllegalStateException- ifgetOutputStreamwas already called on this responseUnsupportedEncodingException- if no suitable character encoding can be used- Since:
- Servlet API 2.0
-
getCharacterEncoding
String getCharacterEncoding()Returns the characterset encoding in use by this Response- Returns:
- the characterset encoding
- Since:
- Servlet API 2.0
-
setBufferSize
void setBufferSize(int size) XXX -
getBufferSize
int getBufferSize()XXX -
reset
void reset()XXX -
isCommitted
boolean isCommitted()XXX -
flushBuffer
-
setLocale
XXX -
getLocale
Locale getLocale()XXX
-