The ServletContext Interface Java Help

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.

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

Description
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.

JavaHelpOnline.com

  • Feel free to send us an inquiry, we will reply back in hours.
 

Verification

Posted on September 18, 2014 in Servlets

Share the Story

About the Author

Back to Top