Name
ServletResponse
Synopsis
The ServletResponse
object sends MIME encoded data back to the client. The interface defines a getOutputStream()
method that returns a ServletOutputStream
for sending binary data and a getWriter()
method that returns a PrintWriter
for sending textual data. The setContentType()
and setContentLength()
methods can be used to explicitly set the content type and content length (often necessary for keep-alive connections and other tasks). If you call setContentType()
, you should do so before you call getWriter()
, as getWriter()
consults the content type to determine which charset to use.
public interface ServletResponse { // Property Accessor Methods (by property name) public abstract int getBufferSize(); // 2.2 public abstract void setBufferSize( int size); // 2.2 public abstract String getCharacterEncoding(); public abstract boolean isCommitted(); // 2.2 public abstract void setContentLength( int len); public abstract void setContentType( String type); public abstract java.util.Locale getLocale(); // 2.2 public abstract void setLocale( java.util.Locale loc); // 2.2 public abstract ServletOutputStream getOutputStream( ) throws IOException; public abstract PrintWriter getWriter( ) throws IOException; // Public Instance Methods public abstract void flushBuffer() throws IOException; // 2.2 public abstract void reset(); // 2.2 public abstract void resetBuffer(); // 2.3 }
Implementations
ServletResponseWrapper
, javax.servlet.http.HttpServletResponse
Passed To
Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.