Top Description Inners Fields Constructors Methods
org.mortbay.jetty

public Class Response

extends Object
implements HttpServletResponse
Class Inheritance
All Implemented Interfaces
javax.servlet.http.HttpServletResponse, javax.servlet.ServletResponse
Imports
java.io.IOException, .PrintWriter, java.util.Collections, .Enumeration, .Locale, javax.servlet.ServletOutputStream, javax.servlet.http.Cookie, .HttpServletResponse, .HttpSession, org.mortbay.io.BufferCache.CachedBuffer, org.mortbay.jetty.handler.ContextHandler, .ErrorHandler, org.mortbay.jetty.servlet.ServletHandler, org.mortbay.log.Log, org.mortbay.util.ByteArrayISO8859Writer, .IO, .QuotedStringTokenizer, .StringUtil, .URIUtil

Response.

Implements javax.servlet.HttpServletResponse from the javax.servlet package.

Author
gregw

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static PrintWriter
private static ServletOutputStream
private BufferCache.CachedBuffer
private String
private HttpConnection
private String
private boolean
private int
private boolean
private Locale
private String
private int
private String
private int
private PrintWriter
public static final int
public static final int
public static String
SET_INCLUDE_HEADER_PREFIX

If a header name starts with this string, the header (stripped of the prefix) can be set during include using only setHeader(String, String) or addHeader(String, String).

public static final int
public static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addCookie(Cookie
the Cookie to return to the client
cookie
)

Implements javax.servlet.http.HttpServletResponse.addCookie.

Adds the specified cookie to the response.
public void
addDateHeader(String
the name of the header to set
name
,
long
the additional date value
date
)

Implements javax.servlet.http.HttpServletResponse.addDateHeader.

Adds a response header with the given name and date-value.
public void
addHeader(String
the name of the header
name
,
String
the additional header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)
value
)

Implements javax.servlet.http.HttpServletResponse.addHeader.

Adds a response header with the given name and value.
public void
addIntHeader(String
the name of the header
name
,
int
the assigned integer value
value
)

Implements javax.servlet.http.HttpServletResponse.addIntHeader.

Adds a response header with the given name and integer value.
public void
public boolean
containsHeader(String
the header name
name
)

Implements javax.servlet.http.HttpServletResponse.containsHeader.

Returns a boolean indicating whether the named response header has already been set.
public void
public void
public String
encodeRedirectURL(String
the url to be encoded.
url
)

Implements javax.servlet.http.HttpServletResponse.encodeRedirectURL.

Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged.
public String
public String
encodeURL(String
the url to be encoded.
url
)

Implements javax.servlet.http.HttpServletResponse.encodeURL.

Encodes the specified URL by including the session ID, or, if encoding is not needed, returns the URL unchanged.
public String
public void
flushBuffer()

Implements javax.servlet.ServletResponse.flushBuffer.

Forces any content in the buffer to be written to the client.
public int
getBufferSize()

Implements javax.servlet.ServletResponse.getBufferSize.

Returns the actual buffer size used for the response.
public String
getCharacterEncoding()

Implements javax.servlet.ServletResponse.getCharacterEncoding.

Returns the name of the character encoding (MIME charset) used for the body sent in this response.
public long

Returns:

the number of bytes actually written in response body
getContentCount
()

public String
getContentType()

Implements javax.servlet.ServletResponse.getContentType.

Returns the content type used for the MIME body sent in this response.
public String
getHeader(String
the name of the response header whose value to return
name
)

Implements javax.servlet.http.HttpServletResponse.getHeader.

Gets the value of the response header with the given name.
public Enumeration<E>
getHeaders(String
the name of the response header whose values to return
name
)

Implements javax.servlet.http.HttpServletResponse.getHeaders.

Gets the values of the response header with the given name.
public HttpFields
public Locale
getLocale()

Implements javax.servlet.ServletResponse.getLocale.

Returns the locale specified for this response using the setLocale method.
public ServletOutputStream
getOutputStream()

Implements javax.servlet.ServletResponse.getOutputStream.

Returns a ServletOutputStream suitable for writing binary data in the response.
public String

Returns:

The reason associated with the current status. This will be null, unless one of the setStatus methods have been called.
getReason
()

public int

Returns:

The HTTP status code that has been set for this request. This will be 200 (HttpServletResponse#SC_OK), unless explicitly set through one of the setStatus methods.
getStatus
()

Implements javax.servlet.http.HttpServletResponse.getStatus.

Gets the current status code of this response.
public PrintWriter
getWriter()

Implements javax.servlet.ServletResponse.getWriter.

Returns a PrintWriter object that can send character text to the client.
public boolean
isCommitted()

Implements javax.servlet.ServletResponse.isCommitted.

Returns a boolean indicating if the response has been committed.
public boolean
public boolean
protected void
public void
reset()

Implements javax.servlet.ServletResponse.reset.

Clears any data that exists in the buffer as well as the status code, headers.
public void
resetBuffer()

Implements javax.servlet.ServletResponse.resetBuffer.

Clears the content of the underlying buffer in the response without clearing headers or status code.
public void
sendError(int
the error status code
code
,
String
the descriptive message
message
)

Implements javax.servlet.http.HttpServletResponse.sendError.

Sends an error response to the client using the specified status and clears the buffer.

public void
sendError(int
the error status code
sc
)

Implements javax.servlet.http.HttpServletResponse.sendError.

Sends an error response to the client using the specified status code and clears the buffer.
public void
public void
sendRedirect(String
the redirect location URL
location
)

Implements javax.servlet.http.HttpServletResponse.sendRedirect.

Sends a temporary redirect response to the client using the specified redirect location URL and clears the buffer.
public void
setBufferSize(int
the preferred buffer size
size
)

Implements javax.servlet.ServletResponse.setBufferSize.

Sets the preferred buffer size for the body of the response.
public void
setCharacterEncoding(String
a String specifying only the character set defined by IANA Character Sets (http://www.iana.org/assignments/character-sets)
encoding
)

Implements javax.servlet.ServletResponse.setCharacterEncoding.

Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8.
public void
setContentLength(int
an integer specifying the length of the content being returned to the client; sets the Content-Length header
len
)

Implements javax.servlet.ServletResponse.setContentLength.

Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.
public void
setContentType(String
a String specifying the MIME type of the content
contentType
)

Implements javax.servlet.ServletResponse.setContentType.

Sets the content type of the response being sent to the client, if the response has not been committed yet.
public void
setDateHeader(String
the name of the header to set
name
,
long
the assigned date value
date
)

Implements javax.servlet.http.HttpServletResponse.setDateHeader.

Sets a response header with the given name and date-value.
public void
setHeader(String
the name of the header
name
,
String
the header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)
value
)

Implements javax.servlet.http.HttpServletResponse.setHeader.

Sets a response header with the given name and value.
public void
setIntHeader(String
the name of the header
name
,
int
the assigned integer value
value
)

Implements javax.servlet.http.HttpServletResponse.setIntHeader.

Sets a response header with the given name and integer value.
public void
setLocale(Locale
the locale of the response
locale
)

Implements javax.servlet.ServletResponse.setLocale.

Sets the locale of the response, if the response has not been committed yet.
public void
public void
setStatus(int
the status code
sc
)

Implements javax.servlet.http.HttpServletResponse.setStatus.

Sets the status code for this response.
public void
setStatus(int
the status code
sc
,
String
the status message
sm
)

Implements javax.servlet.http.HttpServletResponse.setStatus.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait