blob: 8543d72e94317508188c32a6659483406f96da42 [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>HttpSession</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="HttpSession";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":38,"i8":38,"i9":38,"i10":6,"i11":6,"i12":38,"i13":6,"i14":38,"i15":6,"i16":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract 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/HttpServletResponseWrapper.html" title="class in jakarta.servlet.http"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../jakarta/servlet/http/HttpSessionActivationListener.html" title="interface 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/HttpSession.html" target="_top">Frames</a></li>
<li><a href="HttpSession.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>Field&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>Field&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 HttpSession" class="title">Interface HttpSession</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">HttpSession</span></pre>
<div class="block">Provides a way to identify a user across more than one page request or visit to a Web site and to store information
about that user.
<p>
The servlet container uses this interface to create a session between an HTTP client and an HTTP server. The session
persists for a specified time period, across more than one connection or page request from the user. A session
usually corresponds to one user, who may visit a site many times. The server can maintain a session in many ways such
as using cookies or rewriting URLs.
<p>
This interface allows servlets to
<ul>
<li>View and manipulate information about a session, such as the session identifier, creation time, and last accessed
time
<li>Bind objects to sessions, allowing user information to persist across multiple user connections
</ul>
<p>
When an application stores an object in or removes an object from a session, the session checks whether the object
implements <a href="../../../jakarta/servlet/http/HttpSessionBindingListener.html" title="interface in jakarta.servlet.http"><code>HttpSessionBindingListener</code></a>. If it does, the servlet notifies the object that it has been bound to
or unbound from the session. Notifications are sent after the binding methods complete. For session that are
invalidated or expire, notifications are sent after the session has been invalidated or expired.
<p>
When container migrates a session between VMs in a distributed container setting, all session attributes implementing
the <a href="../../../jakarta/servlet/http/HttpSessionActivationListener.html" title="interface in jakarta.servlet.http"><code>HttpSessionActivationListener</code></a> interface are notified.
<p>
A servlet should be able to handle cases in which the client does not choose to join a session, such as when cookies
are intentionally turned off. Until the client joins the session, <code>isNew</code> returns <code>true</code>. If
the client chooses not to join the session, <code>getSession</code> will return a different session on each request,
and <code>isNew</code> will always return <code>true</code>.
<p>
Session information is scoped only to the current web application (<code>ServletContext</code>), so information
stored in one context will not be directly visible in another.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/http/HttpSessionBindingListener.html" title="interface in jakarta.servlet.http"><code>HttpSessionBindingListener</code></a>,
<a href="../../../jakarta/servlet/http/HttpSessionContext.html" title="interface in jakarta.servlet.http"><code>HttpSessionContext</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== 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="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>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#getAttribute-java.lang.String-">getAttribute</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Returns the object bound with the specified name in this session, or <code>null</code> if no object is bound under
the name.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>java.util.Enumeration&lt;java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#getAttributeNames--">getAttributeNames</a></span>()</code>
<div class="block">Returns an <code>Enumeration</code> of <code>String</code> objects containing the names of all the objects bound to
this session.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#getCreationTime--">getCreationTime</a></span>()</code>
<div class="block">Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#getId--">getId</a></span>()</code>
<div class="block">Returns a string containing the unique identifier assigned to this session.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#getLastAccessedTime--">getLastAccessedTime</a></span>()</code>
<div class="block">Returns the last time the client sent a request associated with this session, as the number of milliseconds since
midnight January 1, 1970 GMT, and marked by the time the container received the request.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#getMaxInactiveInterval--">getMaxInactiveInterval</a></span>()</code>
<div class="block">Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client
accesses.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="../../../jakarta/servlet/ServletContext.html" title="interface in jakarta.servlet">ServletContext</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#getServletContext--">getServletContext</a></span>()</code>
<div class="block">Returns the ServletContext to which this session belongs.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../../jakarta/servlet/http/HttpSessionContext.html" title="interface in jakarta.servlet.http">HttpSessionContext</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#getSessionContext--">getSessionContext</a></span>()</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">As of Version 2.1, this method is deprecated and has no replacement. It will be removed in a future
version of Jakarta Servlets.</span></div>
</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#getValue-java.lang.String-">getValue</a></span>(java.lang.String&nbsp;name)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">As of Version 2.2, this method is replaced by <a href="../../../jakarta/servlet/http/HttpSession.html#getAttribute-java.lang.String-"><code>getAttribute(java.lang.String)</code></a>.</span></div>
</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/HttpSession.html#getValueNames--">getValueNames</a></span>()</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">As of Version 2.2, this method is replaced by <a href="../../../jakarta/servlet/http/HttpSession.html#getAttributeNames--"><code>getAttributeNames()</code></a></span></div>
</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#invalidate--">invalidate</a></span>()</code>
<div class="block">Invalidates this session then unbinds any objects bound to it.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#isNew--">isNew</a></span>()</code>
<div class="block">Returns <code>true</code> if the client does not yet know about the session or if the client chooses not to join the
session.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#putValue-java.lang.String-java.lang.Object-">putValue</a></span>(java.lang.String&nbsp;name,
java.lang.Object&nbsp;value)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">As of Version 2.2, this method is replaced by <a href="../../../jakarta/servlet/http/HttpSession.html#setAttribute-java.lang.String-java.lang.Object-"><code>setAttribute(java.lang.String, java.lang.Object)</code></a></span></div>
</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/servlet/http/HttpSession.html#removeAttribute-java.lang.String-">removeAttribute</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Removes the object bound with the specified name from this session.</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/HttpSession.html#removeValue-java.lang.String-">removeValue</a></span>(java.lang.String&nbsp;name)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">As of Version 2.2, this method is replaced by <a href="../../../jakarta/servlet/http/HttpSession.html#removeAttribute-java.lang.String-"><code>removeAttribute(java.lang.String)</code></a></span></div>
</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/HttpSession.html#setAttribute-java.lang.String-java.lang.Object-">setAttribute</a></span>(java.lang.String&nbsp;name,
java.lang.Object&nbsp;value)</code>
<div class="block">Binds an object to this session, using the name specified.</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/HttpSession.html#setMaxInactiveInterval-int-">setMaxInactiveInterval</a></span>(int&nbsp;interval)</code>
<div class="block">Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getCreationTime--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCreationTime</h4>
<pre>long&nbsp;getCreationTime()</pre>
<div class="block">Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a <code>long</code> specifying when this session was created, expressed in milliseconds since 1/1/1970 GMT</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an invalidated session</dd>
</dl>
</li>
</ul>
<a name="getId--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getId</h4>
<pre>java.lang.String&nbsp;getId()</pre>
<div class="block">Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the servlet
container and is implementation dependent.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a string specifying the identifier assigned to this session</dd>
</dl>
</li>
</ul>
<a name="getLastAccessedTime--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLastAccessedTime</h4>
<pre>long&nbsp;getLastAccessedTime()</pre>
<div class="block">Returns the last time the client sent a request associated with this session, as the number of milliseconds since
midnight January 1, 1970 GMT, and marked by the time the container received the request.
<p>
Actions that your application takes, such as getting or setting a value associated with the session, do not affect
the access time.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a <code>long</code> representing the last time the client sent a request associated with this session,
expressed in milliseconds since 1/1/1970 GMT</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an invalidated session</dd>
</dl>
</li>
</ul>
<a name="getServletContext--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getServletContext</h4>
<pre><a href="../../../jakarta/servlet/ServletContext.html" title="interface in jakarta.servlet">ServletContext</a>&nbsp;getServletContext()</pre>
<div class="block">Returns the ServletContext to which this session belongs.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The ServletContext object for the web application</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Servlet 2.3</dd>
</dl>
</li>
</ul>
<a name="setMaxInactiveInterval-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMaxInactiveInterval</h4>
<pre>void&nbsp;setMaxInactiveInterval(int&nbsp;interval)</pre>
<div class="block">Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
<p>
An <tt>interval</tt> value of zero or less indicates that the session should never timeout.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>interval</code> - An integer specifying the number of seconds</dd>
</dl>
</li>
</ul>
<a name="getMaxInactiveInterval--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMaxInactiveInterval</h4>
<pre>int&nbsp;getMaxInactiveInterval()</pre>
<div class="block">Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client
accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be
set with the <code>setMaxInactiveInterval</code> method.
<p>
A return value of zero or less indicates that the session will never timeout.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an integer specifying the number of seconds this session remains open between client requests</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/servlet/http/HttpSession.html#setMaxInactiveInterval-int-"><code>setMaxInactiveInterval(int)</code></a></dd>
</dl>
</li>
</ul>
<a name="getSessionContext--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSessionContext</h4>
<pre>@Deprecated
<a href="../../../jakarta/servlet/http/HttpSessionContext.html" title="interface in jakarta.servlet.http">HttpSessionContext</a>&nbsp;getSessionContext()</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of Version 2.1, this method is deprecated and has no replacement. It will be removed in a future
version of Jakarta Servlets.</span></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the <a href="../../../jakarta/servlet/http/HttpSessionContext.html" title="interface in jakarta.servlet.http"><code>HttpSessionContext</code></a> for this session.</dd>
</dl>
</li>
</ul>
<a name="getAttribute-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAttribute</h4>
<pre>java.lang.Object&nbsp;getAttribute(java.lang.String&nbsp;name)</pre>
<div class="block">Returns the object bound with the specified name in this session, or <code>null</code> if no object is bound under
the name.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - a string specifying the name of the object</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the object with the specified name</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an invalidated session</dd>
</dl>
</li>
</ul>
<a name="getValue-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValue</h4>
<pre>@Deprecated
java.lang.Object&nbsp;getValue(java.lang.String&nbsp;name)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of Version 2.2, this method is replaced by <a href="../../../jakarta/servlet/http/HttpSession.html#getAttribute-java.lang.String-"><code>getAttribute(java.lang.String)</code></a>.</span></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - a string specifying the name of the object</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the object with the specified name</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an invalidated session</dd>
</dl>
</li>
</ul>
<a name="getAttributeNames--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAttributeNames</h4>
<pre>java.util.Enumeration&lt;java.lang.String&gt;&nbsp;getAttributeNames()</pre>
<div class="block">Returns an <code>Enumeration</code> of <code>String</code> objects containing the names of all the objects bound to
this session.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an <code>Enumeration</code> of <code>String</code> objects specifying the names of all the objects bound to
this session</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an invalidated session</dd>
</dl>
</li>
</ul>
<a name="getValueNames--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValueNames</h4>
<pre>@Deprecated
java.lang.String[]&nbsp;getValueNames()</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of Version 2.2, this method is replaced by <a href="../../../jakarta/servlet/http/HttpSession.html#getAttributeNames--"><code>getAttributeNames()</code></a></span></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an array of <code>String</code> objects specifying the names of all the objects bound to this session</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an invalidated session</dd>
</dl>
</li>
</ul>
<a name="setAttribute-java.lang.String-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAttribute</h4>
<pre>void&nbsp;setAttribute(java.lang.String&nbsp;name,
java.lang.Object&nbsp;value)</pre>
<div class="block">Binds an object to this session, using the name specified. If an object of the same name is already bound to the
session, the object is replaced.
<p>
After this method executes, and if the new object implements <code>HttpSessionBindingListener</code>, the container
calls <code>HttpSessionBindingListener.valueBound</code>. The container then notifies any
<code>HttpSessionAttributeListener</code>s in the web application.
<p>
If an object was already bound to this session of this name that implements <code>HttpSessionBindingListener</code>,
its <code>HttpSessionBindingListener.valueUnbound</code> method is called.
<p>
If the value passed in is null, this has the same effect as calling <code>removeAttribute()</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name to which the object is bound; cannot be null</dd>
<dd><code>value</code> - the object to be bound</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an invalidated session</dd>
</dl>
</li>
</ul>
<a name="putValue-java.lang.String-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putValue</h4>
<pre>@Deprecated
void&nbsp;putValue(java.lang.String&nbsp;name,
java.lang.Object&nbsp;value)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of Version 2.2, this method is replaced by <a href="../../../jakarta/servlet/http/HttpSession.html#setAttribute-java.lang.String-java.lang.Object-"><code>setAttribute(java.lang.String, java.lang.Object)</code></a></span></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name to which the object is bound; cannot be null</dd>
<dd><code>value</code> - the object to be bound; cannot be null</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an invalidated session</dd>
</dl>
</li>
</ul>
<a name="removeAttribute-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeAttribute</h4>
<pre>void&nbsp;removeAttribute(java.lang.String&nbsp;name)</pre>
<div class="block">Removes the object bound with the specified name from this session. If the session does not have an object bound with
the specified name, this method does nothing.
<p>
After this method executes, and if the object implements <code>HttpSessionBindingListener</code>, the container calls
<code>HttpSessionBindingListener.valueUnbound</code>. The container then notifies any
<code>HttpSessionAttributeListener</code>s in the web application.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the object to remove from this session</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an invalidated session</dd>
</dl>
</li>
</ul>
<a name="removeValue-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeValue</h4>
<pre>@Deprecated
void&nbsp;removeValue(java.lang.String&nbsp;name)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of Version 2.2, this method is replaced by <a href="../../../jakarta/servlet/http/HttpSession.html#removeAttribute-java.lang.String-"><code>removeAttribute(java.lang.String)</code></a></span></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the object to remove from this session</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an invalidated session</dd>
</dl>
</li>
</ul>
<a name="invalidate--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>invalidate</h4>
<pre>void&nbsp;invalidate()</pre>
<div class="block">Invalidates this session then unbinds any objects bound to it.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an already invalidated session</dd>
</dl>
</li>
</ul>
<a name="isNew--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>isNew</h4>
<pre>boolean&nbsp;isNew()</pre>
<div class="block">Returns <code>true</code> if the client does not yet know about the session or if the client chooses not to join the
session. For example, if the server used only cookie-based sessions, and the client had disabled the use of cookies,
then a session would be new on each request.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the server has created a session, but the client has not yet joined</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called on an already invalidated session</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/HttpServletResponseWrapper.html" title="class in jakarta.servlet.http"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../jakarta/servlet/http/HttpSessionActivationListener.html" title="interface 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/HttpSession.html" target="_top">Frames</a></li>
<li><a href="HttpSession.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>Field&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>Field&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>