blob: 24c38777aa6eaa57e4f68bee34f3a331df52df77 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>HttpServletResponse</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="HttpServletResponse";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":38,"i6":6,"i7":38,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":18,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6,"i20":6,"i21":38,"i22":18};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"],32:["t6","Deprecated Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../jakarta/servlet/http/HttpServletRequestWrapper.html" title="class in jakarta.servlet.http"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../jakarta/servlet/http/HttpServletResponseWrapper.html" title="class in jakarta.servlet.http"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?jakarta/servlet/http/HttpServletResponse.html" target="_top">Frames</a></li>
<li><a href="HttpServletResponse.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">jakarta.servlet.http</div>
<h2 title="Interface HttpServletResponse" class="title">Interface HttpServletResponse</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><a href="../../../jakarta/servlet/ServletResponse.html" title="interface in jakarta.servlet">ServletResponse</a></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../jakarta/servlet/http/HttpServletResponseWrapper.html" title="class in jakarta.servlet.http">HttpServletResponseWrapper</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">HttpServletResponse</span>
extends <a href="../../../jakarta/servlet/ServletResponse.html" title="interface in jakarta.servlet">ServletResponse</a></pre>
<div class="block">Extends the <a href="../../../jakarta/servlet/ServletResponse.html" title="interface in jakarta.servlet"><code>ServletResponse</code></a> interface to provide HTTP-specific functionality in sending a response. For
example, it has methods to access HTTP headers and cookies.
<p>
The servlet container creates an <code>HttpServletResponse</code> object and passes it as an argument to the
servlet's service methods (<code>doGet</code>, <code>doPost</code>, etc).</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/ServletResponse.html" title="interface in jakarta.servlet"><code>ServletResponse</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_ACCEPTED">SC_ACCEPTED</a></span></code>
<div class="block">Status code (202) indicating that a request was accepted for processing, but was not completed.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_BAD_GATEWAY">SC_BAD_GATEWAY</a></span></code>
<div class="block">Status code (502) indicating that the HTTP server received an invalid response from a server it consulted when acting
as a proxy or gateway.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_BAD_REQUEST">SC_BAD_REQUEST</a></span></code>
<div class="block">Status code (400) indicating the request sent by the client was syntactically incorrect.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_CONFLICT">SC_CONFLICT</a></span></code>
<div class="block">Status code (409) indicating that the request could not be completed due to a conflict with the current state of the
resource.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_CONTINUE">SC_CONTINUE</a></span></code>
<div class="block">Status code (100) indicating the client can continue.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_CREATED">SC_CREATED</a></span></code>
<div class="block">Status code (201) indicating the request succeeded and created a new resource on the server.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_EXPECTATION_FAILED">SC_EXPECTATION_FAILED</a></span></code>
<div class="block">Status code (417) indicating that the server could not meet the expectation given in the Expect request header.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_FORBIDDEN">SC_FORBIDDEN</a></span></code>
<div class="block">Status code (403) indicating the server understood the request but refused to fulfill it.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_FOUND">SC_FOUND</a></span></code>
<div class="block">Status code (302) indicating that the resource reside temporarily under a different URI.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_GATEWAY_TIMEOUT">SC_GATEWAY_TIMEOUT</a></span></code>
<div class="block">Status code (504) indicating that the server did not receive a timely response from the upstream server while acting
as a gateway or proxy.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_GONE">SC_GONE</a></span></code>
<div class="block">Status code (410) indicating that the resource is no longer available at the server and no forwarding address is
known.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_HTTP_VERSION_NOT_SUPPORTED">SC_HTTP_VERSION_NOT_SUPPORTED</a></span></code>
<div class="block">Status code (505) indicating that the server does not support or refuses to support the HTTP protocol version that
was used in the request message.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_INTERNAL_SERVER_ERROR">SC_INTERNAL_SERVER_ERROR</a></span></code>
<div class="block">Status code (500) indicating an error inside the HTTP server which prevented it from fulfilling the request.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_LENGTH_REQUIRED">SC_LENGTH_REQUIRED</a></span></code>
<div class="block">Status code (411) indicating that the request cannot be handled without a defined
<code><em>Content-Length</em></code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_METHOD_NOT_ALLOWED">SC_METHOD_NOT_ALLOWED</a></span></code>
<div class="block">Status code (405) indicating that the method specified in the <code><em>Request-Line</em></code> is not allowed for
the resource identified by the <code><em>Request-URI</em></code>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_MOVED_PERMANENTLY">SC_MOVED_PERMANENTLY</a></span></code>
<div class="block">Status code (301) indicating that the resource has permanently moved to a new location, and that future references
should use a new URI with their requests.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_MOVED_TEMPORARILY">SC_MOVED_TEMPORARILY</a></span></code>
<div class="block">Status code (302) indicating that the resource has temporarily moved to another location, but that future references
should still use the original URI to access the resource.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_MULTIPLE_CHOICES">SC_MULTIPLE_CHOICES</a></span></code>
<div class="block">Status code (300) indicating that the requested resource corresponds to any one of a set of representations, each
with its own specific location.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_NO_CONTENT">SC_NO_CONTENT</a></span></code>
<div class="block">Status code (204) indicating that the request succeeded but that there was no new information to return.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_NON_AUTHORITATIVE_INFORMATION">SC_NON_AUTHORITATIVE_INFORMATION</a></span></code>
<div class="block">Status code (203) indicating that the meta information presented by the client did not originate from the server.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_NOT_ACCEPTABLE">SC_NOT_ACCEPTABLE</a></span></code>
<div class="block">Status code (406) indicating that the resource identified by the request is only capable of generating response
entities which have content characteristics not acceptable according to the accept headers sent in the request.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_NOT_FOUND">SC_NOT_FOUND</a></span></code>
<div class="block">Status code (404) indicating that the requested resource is not available.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_NOT_IMPLEMENTED">SC_NOT_IMPLEMENTED</a></span></code>
<div class="block">Status code (501) indicating the HTTP server does not support the functionality needed to fulfill the request.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_NOT_MODIFIED">SC_NOT_MODIFIED</a></span></code>
<div class="block">Status code (304) indicating that a conditional GET operation found that the resource was available and not modified.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_OK">SC_OK</a></span></code>
<div class="block">Status code (200) indicating the request succeeded normally.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_PARTIAL_CONTENT">SC_PARTIAL_CONTENT</a></span></code>
<div class="block">Status code (206) indicating that the server has fulfilled the partial GET request for the resource.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_PAYMENT_REQUIRED">SC_PAYMENT_REQUIRED</a></span></code>
<div class="block">Status code (402) reserved for future use.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_PRECONDITION_FAILED">SC_PRECONDITION_FAILED</a></span></code>
<div class="block">Status code (412) indicating that the precondition given in one or more of the request-header fields evaluated to
false when it was tested on the server.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_PROXY_AUTHENTICATION_REQUIRED">SC_PROXY_AUTHENTICATION_REQUIRED</a></span></code>
<div class="block">Status code (407) indicating that the client <em>MUST</em> first authenticate itself with the proxy.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_REQUEST_ENTITY_TOO_LARGE">SC_REQUEST_ENTITY_TOO_LARGE</a></span></code>
<div class="block">Status code (413) indicating that the server is refusing to process the request because the request entity is larger
than the server is willing or able to process.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_REQUEST_TIMEOUT">SC_REQUEST_TIMEOUT</a></span></code>
<div class="block">Status code (408) indicating that the client did not produce a request within the time that the server was prepared
to wait.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_REQUEST_URI_TOO_LONG">SC_REQUEST_URI_TOO_LONG</a></span></code>
<div class="block">Status code (414) indicating that the server is refusing to service the request because the
<code><em>Request-URI</em></code> is longer than the server is willing to interpret.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_REQUESTED_RANGE_NOT_SATISFIABLE">SC_REQUESTED_RANGE_NOT_SATISFIABLE</a></span></code>
<div class="block">Status code (416) indicating that the server cannot serve the requested byte range.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_RESET_CONTENT">SC_RESET_CONTENT</a></span></code>
<div class="block">Status code (205) indicating that the agent <em>SHOULD</em> reset the document view which caused the request to be
sent.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_SEE_OTHER">SC_SEE_OTHER</a></span></code>
<div class="block">Status code (303) indicating that the response to the request can be found under a different URI.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_SERVICE_UNAVAILABLE">SC_SERVICE_UNAVAILABLE</a></span></code>
<div class="block">Status code (503) indicating that the HTTP server is temporarily overloaded, and unable to handle the request.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_SWITCHING_PROTOCOLS">SC_SWITCHING_PROTOCOLS</a></span></code>
<div class="block">Status code (101) indicating the server is switching protocols according to Upgrade header.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_TEMPORARY_REDIRECT">SC_TEMPORARY_REDIRECT</a></span></code>
<div class="block">Status code (307) indicating that the requested resource resides temporarily under a different URI.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_UNAUTHORIZED">SC_UNAUTHORIZED</a></span></code>
<div class="block">Status code (401) indicating that the request requires HTTP authentication.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_UNSUPPORTED_MEDIA_TYPE">SC_UNSUPPORTED_MEDIA_TYPE</a></span></code>
<div class="block">Status code (415) indicating that the server is refusing to service the request because the entity of the request is
in a format not supported by the requested resource for the requested method.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_USE_PROXY">SC_USE_PROXY</a></span></code>
<div class="block">Status code (305) indicating that the requested resource <em>MUST</em> be accessed through the proxy given by the
<code><em>Location</em></code> field.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t5" class="tableTab"><span><a href="javascript:show(16);">Default Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#addCookie-jakarta.servlet.http.Cookie-">addCookie</a></span>(<a href="../../../jakarta/servlet/http/Cookie.html" title="class in jakarta.servlet.http">Cookie</a>&nbsp;cookie)</code>
<div class="block">Adds the specified cookie to the response.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#addDateHeader-java.lang.String-long-">addDateHeader</a></span>(java.lang.String&nbsp;name,
long&nbsp;date)</code>
<div class="block">Adds a response header with the given name and date-value.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#addHeader-java.lang.String-java.lang.String-">addHeader</a></span>(java.lang.String&nbsp;name,
java.lang.String&nbsp;value)</code>
<div class="block">Adds a response header with the given name and value.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#addIntHeader-java.lang.String-int-">addIntHeader</a></span>(java.lang.String&nbsp;name,
int&nbsp;value)</code>
<div class="block">Adds a response header with the given name and integer value.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#containsHeader-java.lang.String-">containsHeader</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Returns a boolean indicating whether the named response header has already been set.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#encodeRedirectUrl-java.lang.String-">encodeRedirectUrl</a></span>(java.lang.String&nbsp;url)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">As of version 2.1, use encodeRedirectURL(String url) instead</span></div>
</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#encodeRedirectURL-java.lang.String-">encodeRedirectURL</a></span>(java.lang.String&nbsp;url)</code>
<div class="block">Encodes the specified URL for use in the <code>sendRedirect</code> method or, if encoding is not needed, returns the
URL unchanged.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#encodeUrl-java.lang.String-">encodeUrl</a></span>(java.lang.String&nbsp;url)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">As of version 2.1, use encodeURL(String url) instead</span></div>
</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#encodeURL-java.lang.String-">encodeURL</a></span>(java.lang.String&nbsp;url)</code>
<div class="block">Encodes the specified URL by including the session ID, or, if encoding is not needed, returns the URL unchanged.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#getHeader-java.lang.String-">getHeader</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Gets the value of the response header with the given name.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>java.util.Collection&lt;java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#getHeaderNames--">getHeaderNames</a></span>()</code>
<div class="block">Gets the names of the headers of this response.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>java.util.Collection&lt;java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#getHeaders-java.lang.String-">getHeaders</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Gets the values of the response header with the given name.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#getStatus--">getStatus</a></span>()</code>
<div class="block">Gets the current status code of this response.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>default java.util.function.Supplier&lt;java.util.Map&lt;java.lang.String,java.lang.String&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#getTrailerFields--">getTrailerFields</a></span>()</code>
<div class="block">Gets the supplier of trailer headers.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#sendError-int-">sendError</a></span>(int&nbsp;sc)</code>
<div class="block">Sends an error response to the client using the specified status code and clears the buffer.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#sendError-int-java.lang.String-">sendError</a></span>(int&nbsp;sc,
java.lang.String&nbsp;msg)</code>
<div class="block">
Sends an error response to the client using the specified status and clears the buffer.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#sendRedirect-java.lang.String-">sendRedirect</a></span>(java.lang.String&nbsp;location)</code>
<div class="block">Sends a temporary redirect response to the client using the specified redirect location URL and clears the buffer.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#setDateHeader-java.lang.String-long-">setDateHeader</a></span>(java.lang.String&nbsp;name,
long&nbsp;date)</code>
<div class="block">Sets a response header with the given name and date-value.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#setHeader-java.lang.String-java.lang.String-">setHeader</a></span>(java.lang.String&nbsp;name,
java.lang.String&nbsp;value)</code>
<div class="block">Sets a response header with the given name and value.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#setIntHeader-java.lang.String-int-">setIntHeader</a></span>(java.lang.String&nbsp;name,
int&nbsp;value)</code>
<div class="block">Sets a response header with the given name and integer value.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#setStatus-int-">setStatus</a></span>(int&nbsp;sc)</code>
<div class="block">Sets the status code for this response.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#setStatus-int-java.lang.String-">setStatus</a></span>(int&nbsp;sc,
java.lang.String&nbsp;sm)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">As of version 2.1, due to ambiguous meaning of the message parameter. To set a status code use
<code>setStatus(int)</code>, to send an error with a description use <code>sendError(int, String)</code>.
Sets the status code and message for this response.</span></div>
</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>default void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpServletResponse.html#setTrailerFields-java.util.function.Supplier-">setTrailerFields</a></span>(java.util.function.Supplier&lt;java.util.Map&lt;java.lang.String,java.lang.String&gt;&gt;&nbsp;supplier)</code>
<div class="block">Sets the supplier of trailer headers.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.jakarta.servlet.ServletResponse">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;jakarta.servlet.<a href="../../../jakarta/servlet/ServletResponse.html" title="interface in jakarta.servlet">ServletResponse</a></h3>
<code><a href="../../../jakarta/servlet/ServletResponse.html#flushBuffer--">flushBuffer</a>, <a href="../../../jakarta/servlet/ServletResponse.html#getBufferSize--">getBufferSize</a>, <a href="../../../jakarta/servlet/ServletResponse.html#getCharacterEncoding--">getCharacterEncoding</a>, <a href="../../../jakarta/servlet/ServletResponse.html#getContentType--">getContentType</a>, <a href="../../../jakarta/servlet/ServletResponse.html#getLocale--">getLocale</a>, <a href="../../../jakarta/servlet/ServletResponse.html#getOutputStream--">getOutputStream</a>, <a href="../../../jakarta/servlet/ServletResponse.html#getWriter--">getWriter</a>, <a href="../../../jakarta/servlet/ServletResponse.html#isCommitted--">isCommitted</a>, <a href="../../../jakarta/servlet/ServletResponse.html#reset--">reset</a>, <a href="../../../jakarta/servlet/ServletResponse.html#resetBuffer--">resetBuffer</a>, <a href="../../../jakarta/servlet/ServletResponse.html#setBufferSize-int-">setBufferSize</a>, <a href="../../../jakarta/servlet/ServletResponse.html#setCharacterEncoding-java.lang.String-">setCharacterEncoding</a>, <a href="../../../jakarta/servlet/ServletResponse.html#setContentLength-int-">setContentLength</a>, <a href="../../../jakarta/servlet/ServletResponse.html#setContentLengthLong-long-">setContentLengthLong</a>, <a href="../../../jakarta/servlet/ServletResponse.html#setContentType-java.lang.String-">setContentType</a>, <a href="../../../jakarta/servlet/ServletResponse.html#setLocale-java.util.Locale-">setLocale</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="SC_CONTINUE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_CONTINUE</h4>
<pre>static final&nbsp;int SC_CONTINUE</pre>
<div class="block">Status code (100) indicating the client can continue.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_CONTINUE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_SWITCHING_PROTOCOLS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_SWITCHING_PROTOCOLS</h4>
<pre>static final&nbsp;int SC_SWITCHING_PROTOCOLS</pre>
<div class="block">Status code (101) indicating the server is switching protocols according to Upgrade header.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_SWITCHING_PROTOCOLS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_OK">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_OK</h4>
<pre>static final&nbsp;int SC_OK</pre>
<div class="block">Status code (200) indicating the request succeeded normally.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_OK">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_CREATED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_CREATED</h4>
<pre>static final&nbsp;int SC_CREATED</pre>
<div class="block">Status code (201) indicating the request succeeded and created a new resource on the server.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_CREATED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_ACCEPTED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_ACCEPTED</h4>
<pre>static final&nbsp;int SC_ACCEPTED</pre>
<div class="block">Status code (202) indicating that a request was accepted for processing, but was not completed.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_ACCEPTED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_NON_AUTHORITATIVE_INFORMATION">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_NON_AUTHORITATIVE_INFORMATION</h4>
<pre>static final&nbsp;int SC_NON_AUTHORITATIVE_INFORMATION</pre>
<div class="block">Status code (203) indicating that the meta information presented by the client did not originate from the server.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_NON_AUTHORITATIVE_INFORMATION">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_NO_CONTENT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_NO_CONTENT</h4>
<pre>static final&nbsp;int SC_NO_CONTENT</pre>
<div class="block">Status code (204) indicating that the request succeeded but that there was no new information to return.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_NO_CONTENT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_RESET_CONTENT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_RESET_CONTENT</h4>
<pre>static final&nbsp;int SC_RESET_CONTENT</pre>
<div class="block">Status code (205) indicating that the agent <em>SHOULD</em> reset the document view which caused the request to be
sent.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_RESET_CONTENT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_PARTIAL_CONTENT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_PARTIAL_CONTENT</h4>
<pre>static final&nbsp;int SC_PARTIAL_CONTENT</pre>
<div class="block">Status code (206) indicating that the server has fulfilled the partial GET request for the resource.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_PARTIAL_CONTENT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_MULTIPLE_CHOICES">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_MULTIPLE_CHOICES</h4>
<pre>static final&nbsp;int SC_MULTIPLE_CHOICES</pre>
<div class="block">Status code (300) indicating that the requested resource corresponds to any one of a set of representations, each
with its own specific location.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_MULTIPLE_CHOICES">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_MOVED_PERMANENTLY">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_MOVED_PERMANENTLY</h4>
<pre>static final&nbsp;int SC_MOVED_PERMANENTLY</pre>
<div class="block">Status code (301) indicating that the resource has permanently moved to a new location, and that future references
should use a new URI with their requests.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_MOVED_PERMANENTLY">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_MOVED_TEMPORARILY">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_MOVED_TEMPORARILY</h4>
<pre>static final&nbsp;int SC_MOVED_TEMPORARILY</pre>
<div class="block">Status code (302) indicating that the resource has temporarily moved to another location, but that future references
should still use the original URI to access the resource.
This definition is being retained for backwards compatibility. SC_FOUND is now the preferred definition.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_MOVED_TEMPORARILY">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_FOUND">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_FOUND</h4>
<pre>static final&nbsp;int SC_FOUND</pre>
<div class="block">Status code (302) indicating that the resource reside temporarily under a different URI. Since the redirection might
be altered on occasion, the client should continue to use the Request-URI for future requests.(HTTP/1.1) To represent
the status code (302), it is recommended to use this variable.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_FOUND">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_SEE_OTHER">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_SEE_OTHER</h4>
<pre>static final&nbsp;int SC_SEE_OTHER</pre>
<div class="block">Status code (303) indicating that the response to the request can be found under a different URI.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_SEE_OTHER">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_NOT_MODIFIED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_NOT_MODIFIED</h4>
<pre>static final&nbsp;int SC_NOT_MODIFIED</pre>
<div class="block">Status code (304) indicating that a conditional GET operation found that the resource was available and not modified.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_NOT_MODIFIED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_USE_PROXY">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_USE_PROXY</h4>
<pre>static final&nbsp;int SC_USE_PROXY</pre>
<div class="block">Status code (305) indicating that the requested resource <em>MUST</em> be accessed through the proxy given by the
<code><em>Location</em></code> field.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_USE_PROXY">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_TEMPORARY_REDIRECT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_TEMPORARY_REDIRECT</h4>
<pre>static final&nbsp;int SC_TEMPORARY_REDIRECT</pre>
<div class="block">Status code (307) indicating that the requested resource resides temporarily under a different URI. The temporary URI
<em>SHOULD</em> be given by the <code><em>Location</em></code> field in the response.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_TEMPORARY_REDIRECT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_BAD_REQUEST">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_BAD_REQUEST</h4>
<pre>static final&nbsp;int SC_BAD_REQUEST</pre>
<div class="block">Status code (400) indicating the request sent by the client was syntactically incorrect.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_BAD_REQUEST">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_UNAUTHORIZED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_UNAUTHORIZED</h4>
<pre>static final&nbsp;int SC_UNAUTHORIZED</pre>
<div class="block">Status code (401) indicating that the request requires HTTP authentication.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_UNAUTHORIZED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_PAYMENT_REQUIRED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_PAYMENT_REQUIRED</h4>
<pre>static final&nbsp;int SC_PAYMENT_REQUIRED</pre>
<div class="block">Status code (402) reserved for future use.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_PAYMENT_REQUIRED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_FORBIDDEN">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_FORBIDDEN</h4>
<pre>static final&nbsp;int SC_FORBIDDEN</pre>
<div class="block">Status code (403) indicating the server understood the request but refused to fulfill it.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_FORBIDDEN">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_NOT_FOUND">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_NOT_FOUND</h4>
<pre>static final&nbsp;int SC_NOT_FOUND</pre>
<div class="block">Status code (404) indicating that the requested resource is not available.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_NOT_FOUND">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_METHOD_NOT_ALLOWED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_METHOD_NOT_ALLOWED</h4>
<pre>static final&nbsp;int SC_METHOD_NOT_ALLOWED</pre>
<div class="block">Status code (405) indicating that the method specified in the <code><em>Request-Line</em></code> is not allowed for
the resource identified by the <code><em>Request-URI</em></code>.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_METHOD_NOT_ALLOWED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_NOT_ACCEPTABLE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_NOT_ACCEPTABLE</h4>
<pre>static final&nbsp;int SC_NOT_ACCEPTABLE</pre>
<div class="block">Status code (406) indicating that the resource identified by the request is only capable of generating response
entities which have content characteristics not acceptable according to the accept headers sent in the request.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_NOT_ACCEPTABLE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_PROXY_AUTHENTICATION_REQUIRED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_PROXY_AUTHENTICATION_REQUIRED</h4>
<pre>static final&nbsp;int SC_PROXY_AUTHENTICATION_REQUIRED</pre>
<div class="block">Status code (407) indicating that the client <em>MUST</em> first authenticate itself with the proxy.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_PROXY_AUTHENTICATION_REQUIRED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_REQUEST_TIMEOUT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_REQUEST_TIMEOUT</h4>
<pre>static final&nbsp;int SC_REQUEST_TIMEOUT</pre>
<div class="block">Status code (408) indicating that the client did not produce a request within the time that the server was prepared
to wait.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_REQUEST_TIMEOUT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_CONFLICT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_CONFLICT</h4>
<pre>static final&nbsp;int SC_CONFLICT</pre>
<div class="block">Status code (409) indicating that the request could not be completed due to a conflict with the current state of the
resource.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_CONFLICT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_GONE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_GONE</h4>
<pre>static final&nbsp;int SC_GONE</pre>
<div class="block">Status code (410) indicating that the resource is no longer available at the server and no forwarding address is
known. This condition <em>SHOULD</em> be considered permanent.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_GONE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_LENGTH_REQUIRED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_LENGTH_REQUIRED</h4>
<pre>static final&nbsp;int SC_LENGTH_REQUIRED</pre>
<div class="block">Status code (411) indicating that the request cannot be handled without a defined
<code><em>Content-Length</em></code>.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_LENGTH_REQUIRED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_PRECONDITION_FAILED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_PRECONDITION_FAILED</h4>
<pre>static final&nbsp;int SC_PRECONDITION_FAILED</pre>
<div class="block">Status code (412) indicating that the precondition given in one or more of the request-header fields evaluated to
false when it was tested on the server.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_PRECONDITION_FAILED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_REQUEST_ENTITY_TOO_LARGE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_REQUEST_ENTITY_TOO_LARGE</h4>
<pre>static final&nbsp;int SC_REQUEST_ENTITY_TOO_LARGE</pre>
<div class="block">Status code (413) indicating that the server is refusing to process the request because the request entity is larger
than the server is willing or able to process.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_REQUEST_URI_TOO_LONG">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_REQUEST_URI_TOO_LONG</h4>
<pre>static final&nbsp;int SC_REQUEST_URI_TOO_LONG</pre>
<div class="block">Status code (414) indicating that the server is refusing to service the request because the
<code><em>Request-URI</em></code> is longer than the server is willing to interpret.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_REQUEST_URI_TOO_LONG">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_UNSUPPORTED_MEDIA_TYPE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_UNSUPPORTED_MEDIA_TYPE</h4>
<pre>static final&nbsp;int SC_UNSUPPORTED_MEDIA_TYPE</pre>
<div class="block">Status code (415) indicating that the server is refusing to service the request because the entity of the request is
in a format not supported by the requested resource for the requested method.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_REQUESTED_RANGE_NOT_SATISFIABLE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_REQUESTED_RANGE_NOT_SATISFIABLE</h4>
<pre>static final&nbsp;int SC_REQUESTED_RANGE_NOT_SATISFIABLE</pre>
<div class="block">Status code (416) indicating that the server cannot serve the requested byte range.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_EXPECTATION_FAILED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_EXPECTATION_FAILED</h4>
<pre>static final&nbsp;int SC_EXPECTATION_FAILED</pre>
<div class="block">Status code (417) indicating that the server could not meet the expectation given in the Expect request header.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_EXPECTATION_FAILED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_INTERNAL_SERVER_ERROR">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_INTERNAL_SERVER_ERROR</h4>
<pre>static final&nbsp;int SC_INTERNAL_SERVER_ERROR</pre>
<div class="block">Status code (500) indicating an error inside the HTTP server which prevented it from fulfilling the request.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_NOT_IMPLEMENTED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_NOT_IMPLEMENTED</h4>
<pre>static final&nbsp;int SC_NOT_IMPLEMENTED</pre>
<div class="block">Status code (501) indicating the HTTP server does not support the functionality needed to fulfill the request.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_NOT_IMPLEMENTED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_BAD_GATEWAY">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_BAD_GATEWAY</h4>
<pre>static final&nbsp;int SC_BAD_GATEWAY</pre>
<div class="block">Status code (502) indicating that the HTTP server received an invalid response from a server it consulted when acting
as a proxy or gateway.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_BAD_GATEWAY">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_SERVICE_UNAVAILABLE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_SERVICE_UNAVAILABLE</h4>
<pre>static final&nbsp;int SC_SERVICE_UNAVAILABLE</pre>
<div class="block">Status code (503) indicating that the HTTP server is temporarily overloaded, and unable to handle the request.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_GATEWAY_TIMEOUT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SC_GATEWAY_TIMEOUT</h4>
<pre>static final&nbsp;int SC_GATEWAY_TIMEOUT</pre>
<div class="block">Status code (504) indicating that the server did not receive a timely response from the upstream server while acting
as a gateway or proxy.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_GATEWAY_TIMEOUT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SC_HTTP_VERSION_NOT_SUPPORTED">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SC_HTTP_VERSION_NOT_SUPPORTED</h4>
<pre>static final&nbsp;int SC_HTTP_VERSION_NOT_SUPPORTED</pre>
<div class="block">Status code (505) indicating that the server does not support or refuses to support the HTTP protocol version that
was used in the request message.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.servlet.http.HttpServletResponse.SC_HTTP_VERSION_NOT_SUPPORTED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="addCookie-jakarta.servlet.http.Cookie-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addCookie</h4>
<pre>void&nbsp;addCookie(<a href="../../../jakarta/servlet/http/Cookie.html" title="class in jakarta.servlet.http">Cookie</a>&nbsp;cookie)</pre>
<div class="block">Adds the specified cookie to the response. This method can be called multiple times to set more than one cookie.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cookie</code> - the Cookie to return to the client</dd>
</dl>
</li>
</ul>
<a name="containsHeader-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>containsHeader</h4>
<pre>boolean&nbsp;containsHeader(java.lang.String&nbsp;name)</pre>
<div class="block">Returns a boolean indicating whether the named response header has already been set.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the header name</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the named response header has already been set; <code>false</code> otherwise</dd>
</dl>
</li>
</ul>
<a name="encodeURL-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encodeURL</h4>
<pre>java.lang.String&nbsp;encodeURL(java.lang.String&nbsp;url)</pre>
<div class="block">Encodes the specified URL by including the session ID, or, if encoding is not needed, returns the URL unchanged. The
implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL.
For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary.
<p>
For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL
rewriting cannot be used with browsers which do not support cookies.
<p>
If the URL is relative, it is always relative to the current HttpServletRequest.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>url</code> - the url to be encoded.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the encoded URL if encoding is needed; the unchanged URL otherwise.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the url is not valid</dd>
</dl>
</li>
</ul>
<a name="encodeRedirectURL-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encodeRedirectURL</h4>
<pre>java.lang.String&nbsp;encodeRedirectURL(java.lang.String&nbsp;url)</pre>
<div class="block">Encodes the specified URL for use in the <code>sendRedirect</code> method or, if encoding is not needed, returns the
URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be
encoded in the URL. For example, if the browser supports cookies, or session tracking is turned off, URL encoding is
unnecessary. Because the rules for making this determination can differ from those used to decide whether to encode a
normal link, this method is separated from the <code>encodeURL</code> method.
<p>
All URLs sent to the <code>HttpServletResponse.sendRedirect</code> method should be run through this method.
Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
<p>
If the URL is relative, it is always relative to the current HttpServletRequest.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>url</code> - the url to be encoded.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the encoded URL if encoding is needed; the unchanged URL otherwise.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the url is not valid</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/http/HttpServletResponse.html#sendRedirect-java.lang.String-"><code>sendRedirect(java.lang.String)</code></a>,
<a href="../../../jakarta/servlet/http/HttpServletResponse.html#encodeUrl-java.lang.String-"><code>encodeUrl(java.lang.String)</code></a></dd>
</dl>
</li>
</ul>
<a name="encodeUrl-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encodeUrl</h4>
<pre>@Deprecated
java.lang.String&nbsp;encodeUrl(java.lang.String&nbsp;url)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of version 2.1, use encodeURL(String url) instead</span></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>url</code> - the url to be encoded.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the encoded URL if encoding is needed; the unchanged URL otherwise.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the url is not valid</dd>
</dl>
</li>
</ul>
<a name="encodeRedirectUrl-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encodeRedirectUrl</h4>
<pre>@Deprecated
java.lang.String&nbsp;encodeRedirectUrl(java.lang.String&nbsp;url)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of version 2.1, use encodeRedirectURL(String url) instead</span></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>url</code> - the url to be encoded.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the encoded URL if encoding is needed; the unchanged URL otherwise.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the url is not valid</dd>
</dl>
</li>
</ul>
<a name="sendError-int-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendError</h4>
<pre>void&nbsp;sendError(int&nbsp;sc,
java.lang.String&nbsp;msg)
throws java.io.IOException</pre>
<div class="block"><p>
Sends an error response to the client using the specified status and clears the buffer. The server defaults to
creating the response to look like an HTML-formatted server error page containing the specified message, setting the
content type to "text/html". The caller is <strong>not</strong> responsible for escaping or re-encoding the message
to ensure it is safe with respect to the current response encoding and content type. This aspect of safety is the
responsibility of the container, as it is generating the error page containing the message. The server will preserve
cookies and may clear or update any headers needed to serve the error page as a valid response.
</p>
<p>
If an error-page declaration has been made for the web application corresponding to the status code passed in, it
will be served back in preference to the suggested msg parameter and the msg parameter will be ignored.
</p>
<p>
If the response has already been committed, this method throws an IllegalStateException. After using this method, the
response should be considered to be committed and should not be written to.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sc</code> - the error status code</dd>
<dd><code>msg</code> - the descriptive message</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - If an input or output exception occurs</dd>
<dd><code>java.lang.IllegalStateException</code> - If the response was committed</dd>
</dl>
</li>
</ul>
<a name="sendError-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendError</h4>
<pre>void&nbsp;sendError(int&nbsp;sc)
throws java.io.IOException</pre>
<div class="block">Sends an error response to the client using the specified status code and clears the buffer.
The server will preserve cookies and may clear or update any headers needed to serve the error page as a valid
response.
If an error-page declaration has been made for the web application corresponding to the status code passed in, it
will be served back the error page
<p>
If the response has already been committed, this method throws an IllegalStateException. After using this method, the
response should be considered to be committed and should not be written to.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sc</code> - the error status code</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - If an input or output exception occurs</dd>
<dd><code>java.lang.IllegalStateException</code> - If the response was committed before this method call</dd>
</dl>
</li>
</ul>
<a name="sendRedirect-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendRedirect</h4>
<pre>void&nbsp;sendRedirect(java.lang.String&nbsp;location)
throws java.io.IOException</pre>
<div class="block">Sends a temporary redirect response to the client using the specified redirect location URL and clears the buffer.
The buffer will be replaced with the data set by this method. Calling this method sets the status code to
<a href="../../../jakarta/servlet/http/HttpServletResponse.html#SC_FOUND"><code>SC_FOUND</code></a> 302 (Found). This method can accept relative URLs;the servlet container must convert the relative
URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/'
the container interprets it as relative to the current request URI. If the location is relative with a leading '/'
the container interprets it as relative to the servlet container root. If the location is relative with two leading
'/' the container interprets it as a network-path reference (see <a href="http://www.ietf.org/rfc/rfc3986.txt"> RFC
3986: Uniform Resource Identifier (URI): Generic Syntax</a>, section 4.2 &quot;Relative Reference&quot;).
<p>
If the response has already been committed, this method throws an IllegalStateException. After using this method, the
response should be considered to be committed and should not be written to.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>location</code> - the redirect location URL</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - If an input or output exception occurs</dd>
<dd><code>java.lang.IllegalStateException</code> - If the response was committed or if a partial URL is given and cannot be converted
into a valid URL</dd>
</dl>
</li>
</ul>
<a name="setDateHeader-java.lang.String-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDateHeader</h4>
<pre>void&nbsp;setDateHeader(java.lang.String&nbsp;name,
long&nbsp;date)</pre>
<div class="block">Sets a response header with the given name and date-value. The date is specified in terms of milliseconds since the
epoch. If the header had already been set, the new value overwrites the previous one. The <code>containsHeader</code>
method can be used to test for the presence of a header before setting its value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the header to set</dd>
<dd><code>date</code> - the assigned date value</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/http/HttpServletResponse.html#containsHeader-java.lang.String-"><code>containsHeader(java.lang.String)</code></a>,
<a href="../../../jakarta/servlet/http/HttpServletResponse.html#addDateHeader-java.lang.String-long-"><code>addDateHeader(java.lang.String, long)</code></a></dd>
</dl>
</li>
</ul>
<a name="addDateHeader-java.lang.String-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addDateHeader</h4>
<pre>void&nbsp;addDateHeader(java.lang.String&nbsp;name,
long&nbsp;date)</pre>
<div class="block">Adds a response header with the given name and date-value. The date is specified in terms of milliseconds since the
epoch. This method allows response headers to have multiple values.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the header to set</dd>
<dd><code>date</code> - the additional date value</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/http/HttpServletResponse.html#setDateHeader-java.lang.String-long-"><code>setDateHeader(java.lang.String, long)</code></a></dd>
</dl>
</li>
</ul>
<a name="setHeader-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setHeader</h4>
<pre>void&nbsp;setHeader(java.lang.String&nbsp;name,
java.lang.String&nbsp;value)</pre>
<div class="block">Sets a response header with the given name and value. If the header had already been set, the new value overwrites
the previous one. The <code>containsHeader</code> method can be used to test for the presence of a header before
setting its value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the header</dd>
<dd><code>value</code> - the header value If it contains octet string, it should be encoded according to RFC 2047
(http://www.ietf.org/rfc/rfc2047.txt)</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/http/HttpServletResponse.html#containsHeader-java.lang.String-"><code>containsHeader(java.lang.String)</code></a>,
<a href="../../../jakarta/servlet/http/HttpServletResponse.html#addHeader-java.lang.String-java.lang.String-"><code>addHeader(java.lang.String, java.lang.String)</code></a></dd>
</dl>
</li>
</ul>
<a name="addHeader-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addHeader</h4>
<pre>void&nbsp;addHeader(java.lang.String&nbsp;name,
java.lang.String&nbsp;value)</pre>
<div class="block">Adds a response header with the given name and value. This method allows response headers to have multiple values.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the header</dd>
<dd><code>value</code> - the additional header value If it contains octet string, it should be encoded according to RFC 2047
(http://www.ietf.org/rfc/rfc2047.txt)</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/http/HttpServletResponse.html#setHeader-java.lang.String-java.lang.String-"><code>setHeader(java.lang.String, java.lang.String)</code></a></dd>
</dl>
</li>
</ul>
<a name="setIntHeader-java.lang.String-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setIntHeader</h4>
<pre>void&nbsp;setIntHeader(java.lang.String&nbsp;name,
int&nbsp;value)</pre>
<div class="block">Sets a response header with the given name and integer value. If the header had already been set, the new value
overwrites the previous one. The <code>containsHeader</code> method can be used to test for the presence of a header
before setting its value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the header</dd>
<dd><code>value</code> - the assigned integer value</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/http/HttpServletResponse.html#containsHeader-java.lang.String-"><code>containsHeader(java.lang.String)</code></a>,
<a href="../../../jakarta/servlet/http/HttpServletResponse.html#addIntHeader-java.lang.String-int-"><code>addIntHeader(java.lang.String, int)</code></a></dd>
</dl>
</li>
</ul>
<a name="addIntHeader-java.lang.String-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addIntHeader</h4>
<pre>void&nbsp;addIntHeader(java.lang.String&nbsp;name,
int&nbsp;value)</pre>
<div class="block">Adds a response header with the given name and integer value. This method allows response headers to have multiple
values.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the header</dd>
<dd><code>value</code> - the assigned integer value</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/http/HttpServletResponse.html#setIntHeader-java.lang.String-int-"><code>setIntHeader(java.lang.String, int)</code></a></dd>
</dl>
</li>
</ul>
<a name="setStatus-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setStatus</h4>
<pre>void&nbsp;setStatus(int&nbsp;sc)</pre>
<div class="block">Sets the status code for this response.
<p>
This method is used to set the return status code when there is no error (for example, for the SC_OK or
SC_MOVED_TEMPORARILY status codes).
<p>
If this method is used to set an error code, then the container's error page mechanism will not be triggered. If
there is an error and the caller wishes to invoke an error page defined in the web application, then
<a href="../../../jakarta/servlet/http/HttpServletResponse.html#sendError-int-java.lang.String-"><code>sendError(int, java.lang.String)</code></a> must be used instead.
<p>
This method preserves any cookies and other response headers.
<p>
Valid status codes are those in the 2XX, 3XX, 4XX, and 5XX ranges. Other status codes are treated as container
specific.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sc</code> - the status code</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/http/HttpServletResponse.html#sendError-int-java.lang.String-"><code>sendError(int, java.lang.String)</code></a></dd>
</dl>
</li>
</ul>
<a name="setStatus-int-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setStatus</h4>
<pre>@Deprecated
void&nbsp;setStatus(int&nbsp;sc,
java.lang.String&nbsp;sm)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of version 2.1, due to ambiguous meaning of the message parameter. To set a status code use
<code>setStatus(int)</code>, to send an error with a description use <code>sendError(int, String)</code>.
Sets the status code and message for this response.</span></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sc</code> - the status code</dd>
<dd><code>sm</code> - the status message</dd>
</dl>
</li>
</ul>
<a name="getStatus--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStatus</h4>
<pre>int&nbsp;getStatus()</pre>
<div class="block">Gets the current status code of this response.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the current status code of this response</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Servlet 3.0</dd>
</dl>
</li>
</ul>
<a name="getHeader-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getHeader</h4>
<pre>java.lang.String&nbsp;getHeader(java.lang.String&nbsp;name)</pre>
<div class="block">Gets the value of the response header with the given name.
<p>
If a response header with the given name exists and contains multiple values, the value that was added first will be
returned.
<p>
This method considers only response headers set or added via <a href="../../../jakarta/servlet/http/HttpServletResponse.html#setHeader-java.lang.String-java.lang.String-"><code>setHeader(java.lang.String, java.lang.String)</code></a>, <a href="../../../jakarta/servlet/http/HttpServletResponse.html#addHeader-java.lang.String-java.lang.String-"><code>addHeader(java.lang.String, java.lang.String)</code></a>,
<a href="../../../jakarta/servlet/http/HttpServletResponse.html#setDateHeader-java.lang.String-long-"><code>setDateHeader(java.lang.String, long)</code></a>, <a href="../../../jakarta/servlet/http/HttpServletResponse.html#addDateHeader-java.lang.String-long-"><code>addDateHeader(java.lang.String, long)</code></a>, <a href="../../../jakarta/servlet/http/HttpServletResponse.html#setIntHeader-java.lang.String-int-"><code>setIntHeader(java.lang.String, int)</code></a>, or <a href="../../../jakarta/servlet/http/HttpServletResponse.html#addIntHeader-java.lang.String-int-"><code>addIntHeader(java.lang.String, int)</code></a>, respectively.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the response header whose value to return</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value of the response header with the given name, or <tt>null</tt> if no header with the given name has
been set on this response</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Servlet 3.0</dd>
</dl>
</li>
</ul>
<a name="getHeaders-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getHeaders</h4>
<pre>java.util.Collection&lt;java.lang.String&gt;&nbsp;getHeaders(java.lang.String&nbsp;name)</pre>
<div class="block">Gets the values of the response header with the given name.
<p>
This method considers only response headers set or added via <a href="../../../jakarta/servlet/http/HttpServletResponse.html#setHeader-java.lang.String-java.lang.String-"><code>setHeader(java.lang.String, java.lang.String)</code></a>, <a href="../../../jakarta/servlet/http/HttpServletResponse.html#addHeader-java.lang.String-java.lang.String-"><code>addHeader(java.lang.String, java.lang.String)</code></a>,
<a href="../../../jakarta/servlet/http/HttpServletResponse.html#setDateHeader-java.lang.String-long-"><code>setDateHeader(java.lang.String, long)</code></a>, <a href="../../../jakarta/servlet/http/HttpServletResponse.html#addDateHeader-java.lang.String-long-"><code>addDateHeader(java.lang.String, long)</code></a>, <a href="../../../jakarta/servlet/http/HttpServletResponse.html#setIntHeader-java.lang.String-int-"><code>setIntHeader(java.lang.String, int)</code></a>, or <a href="../../../jakarta/servlet/http/HttpServletResponse.html#addIntHeader-java.lang.String-int-"><code>addIntHeader(java.lang.String, int)</code></a>, respectively.
<p>
Any changes to the returned <code>Collection</code> must not affect this <code>HttpServletResponse</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the response header whose values to return</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a (possibly empty) <code>Collection</code> of the values of the response header with the given name</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Servlet 3.0</dd>
</dl>
</li>
</ul>
<a name="getHeaderNames--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getHeaderNames</h4>
<pre>java.util.Collection&lt;java.lang.String&gt;&nbsp;getHeaderNames()</pre>
<div class="block">Gets the names of the headers of this response.
<p>
This method considers only response headers set or added via <a href="../../../jakarta/servlet/http/HttpServletResponse.html#setHeader-java.lang.String-java.lang.String-"><code>setHeader(java.lang.String, java.lang.String)</code></a>, <a href="../../../jakarta/servlet/http/HttpServletResponse.html#addHeader-java.lang.String-java.lang.String-"><code>addHeader(java.lang.String, java.lang.String)</code></a>,
<a href="../../../jakarta/servlet/http/HttpServletResponse.html#setDateHeader-java.lang.String-long-"><code>setDateHeader(java.lang.String, long)</code></a>, <a href="../../../jakarta/servlet/http/HttpServletResponse.html#addDateHeader-java.lang.String-long-"><code>addDateHeader(java.lang.String, long)</code></a>, <a href="../../../jakarta/servlet/http/HttpServletResponse.html#setIntHeader-java.lang.String-int-"><code>setIntHeader(java.lang.String, int)</code></a>, or <a href="../../../jakarta/servlet/http/HttpServletResponse.html#addIntHeader-java.lang.String-int-"><code>addIntHeader(java.lang.String, int)</code></a>, respectively.
<p>
Any changes to the returned <code>Collection</code> must not affect this <code>HttpServletResponse</code>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a (possibly empty) <code>Collection</code> of the names of the headers of this response</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Servlet 3.0</dd>
</dl>
</li>
</ul>
<a name="setTrailerFields-java.util.function.Supplier-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTrailerFields</h4>
<pre>default&nbsp;void&nbsp;setTrailerFields(java.util.function.Supplier&lt;java.util.Map&lt;java.lang.String,java.lang.String&gt;&gt;&nbsp;supplier)</pre>
<div class="block">Sets the supplier of trailer headers.
<p>
The trailer header field value is defined as a comma-separated list (see Section 3.2.2 and Section 4.1.2 of RFC
7230).
</p>
<p>
The supplier will be called within the scope of whatever thread/call causes the response content to be completed.
Typically this will be any thread calling close() on the output stream or writer.
</p>
<p>
The trailers that run afoul of the provisions of section 4.1.2 of RFC 7230 are ignored.
</p>
<p>
The RFC requires the name of every key that is to be in the supplied Map is included in the comma separated list that
is the value of the "Trailer" response header. The application is responsible for ensuring this requirement is met.
Failure to do so may lead to interoperability failures.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>supplier</code> - the supplier of trailer headers</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if it is invoked after the response has has been committed, or the trailer is not
supported in the request, for instance, the underlying protocol is HTTP 1.0, or the response is not in chunked
encoding in HTTP 1.1.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Servlet 4.0</dd>
</dl>
</li>
</ul>
<a name="getTrailerFields--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getTrailerFields</h4>
<pre>default&nbsp;java.util.function.Supplier&lt;java.util.Map&lt;java.lang.String,java.lang.String&gt;&gt;&nbsp;getTrailerFields()</pre>
<div class="block">Gets the supplier of trailer headers.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>Supplier</code> of trailer headers</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Servlet 4.0</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../jakarta/servlet/http/HttpServletRequestWrapper.html" title="class in jakarta.servlet.http"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../jakarta/servlet/http/HttpServletResponseWrapper.html" title="class in jakarta.servlet.http"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?jakarta/servlet/http/HttpServletResponse.html" target="_top">Frames</a></li>
<li><a href="HttpServletResponse.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>