The ServletContext .Interface

The requestContext interface is implemented hy the server. It enables servlets to obtain information about their environment. One important note: The gcrScrvlett ) and getScrvlctNames( ) methods are dangerous touse, because they can corrupt the server’s state machine.

String get
getOutputStream( )
throws IOException
PrintWriter getWriter( }
throws IOException
void setContentLength(int size}
void setContentType(String type}

Returns the character encoding for the response.
Returns a ServletOutputStream that can be used to write binary data to the response. An IllegalStateException is thrown if gc.tWritcc() has already been invoked for this request.
Returns a PrintWriter that can be used to write character data to the response. An IllegalStateException is thrown if gc tOulout Strcam( ) has already been invoked For this request.
Sets the content length for the response to size.
Sets the content type for the response to type.

[vfb id=1]

Share This