?? httpsession.html
字號:
</DL><HR><A NAME="getId()"><!-- --></A><H3>getId</H3><PRE>public java.lang.String <B>getId</B>()</PRE><DL><DD>Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the servlet container and is implementation dependent.<DD><DL><DT><B>Returns:</B><DD>a string specifying the identifier assigned to this session</DL></DD></DL><HR><A NAME="getLastAccessedTime()"><!-- --></A><H3>getLastAccessedTime</H3><PRE>public long <B>getLastAccessedTime</B>()</PRE><DL><DD>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.<DD><DL><DT><B>Returns:</B><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</DL></DD></DL><HR><A NAME="getServletContext()"><!-- --></A><H3>getServletContext</H3><PRE>public <A HREF="../../../javax/servlet/ServletContext.html">ServletContext</A> <B>getServletContext</B>()</PRE><DL><DD>Returns the ServletContext to which this session belongs.<DD><DL><DT><B>Returns:</B><DD>The ServletContext object for the web application<DT><B>Since: </B><DD>2.3</DD></DL></DD></DL><HR><A NAME="setMaxInactiveInterval(int)"><!-- --></A><H3>setMaxInactiveInterval</H3><PRE>public void <B>setMaxInactiveInterval</B>(int interval)</PRE><DL><DD>Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.<DD><DL><DT><B>Parameters:</B><DD><CODE>interval</CODE> - An integer specifying the number of seconds</DL></DD></DL><HR><A NAME="getMaxInactiveInterval()"><!-- --></A><H3>getMaxInactiveInterval</H3><PRE>public int <B>getMaxInactiveInterval</B>()</PRE><DL><DD>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. A negative time indicates the session should never timeout.<DD><DL><DT><B>Returns:</B><DD>an integer specifying the number of seconds this session remains open between client requests<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)"><CODE>setMaxInactiveInterval(int)</CODE></A></DL></DD></DL><HR><A NAME="getSessionContext()"><!-- --></A><H3>getSessionContext</H3><PRE>public <A HREF="../../../javax/servlet/http/HttpSessionContext.html">HttpSessionContext</A> <B>getSessionContext</B>()</PRE><DL><DD><B>Deprecated.</B> <I>As of Version 2.1, this method is deprecated and has no replacement. It will be removed in a future version of the Java Servlet API.</I><P></DL><HR><A NAME="getAttribute(java.lang.String)"><!-- --></A><H3>getAttribute</H3><PRE>public java.lang.Object <B>getAttribute</B>(java.lang.String name)</PRE><DL><DD>Returns the object bound with the specified name in this session, or <code>null</code> if no object is bound under the name.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a string specifying the name of the object<DT><B>Returns:</B><DD>the object with the specified name<DT><B>Throws:</B><DD>IllegalStateException - if this method is called on an invalidated session</DL></DD></DL><HR><A NAME="getValue(java.lang.String)"><!-- --></A><H3>getValue</H3><PRE>public java.lang.Object <B>getValue</B>(java.lang.String name)</PRE><DL><DD><B>Deprecated.</B> <I>As of Version 2.2, this method is replaced by <A HREF="../../../javax/servlet/http/HttpSession.html#getAttribute(java.lang.String)"><CODE>getAttribute(java.lang.String)</CODE></A>.</I><P><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a string specifying the name of the object<DT><B>Returns:</B><DD>the object with the specified name<DT><B>Throws:</B><DD>IllegalStateException - if this method is called on an invalidated session</DL></DD></DL><HR><A NAME="getAttributeNames()"><!-- --></A><H3>getAttributeNames</H3><PRE>public java.util.Enumeration <B>getAttributeNames</B>()</PRE><DL><DD>Returns an <code>Enumeration</code> of <code>String</code> objects containing the names of all the objects bound to this session.<DD><DL><DT><B>Returns:</B><DD>an <code>Enumeration</code> of <code>String</code> objects specifying the names of all the objects bound to this session<DT><B>Throws:</B><DD>IllegalStateException - if this method is called on an invalidated session</DL></DD></DL><HR><A NAME="getValueNames()"><!-- --></A><H3>getValueNames</H3><PRE>public java.lang.String[] <B>getValueNames</B>()</PRE><DL><DD><B>Deprecated.</B> <I>As of Version 2.2, this method is replaced by <A HREF="../../../javax/servlet/http/HttpSession.html#getAttributeNames()"><CODE>getAttributeNames()</CODE></A></I><P><DD><DL><DT><B>Returns:</B><DD>an array of <code>String</code> objects specifying the names of all the objects bound to this session<DT><B>Throws:</B><DD>IllegalStateException - if this method is called on an invalidated session</DL></DD></DL><HR><A NAME="setAttribute(java.lang.String, java.lang.Object)"><!-- --></A><H3>setAttribute</H3><PRE>public void <B>setAttribute</B>(java.lang.String name, java.lang.Object value)</PRE><DL><DD>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>.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the name to which the object is bound; cannot be null<DD><CODE>value</CODE> - the object to be bound<DT><B>Throws:</B><DD>IllegalStateException - if this method is called on an invalidated session</DL></DD></DL><HR><A NAME="putValue(java.lang.String, java.lang.Object)"><!-- --></A><H3>putValue</H3><PRE>public void <B>putValue</B>(java.lang.String name, java.lang.Object value)</PRE><DL><DD><B>Deprecated.</B> <I>As of Version 2.2, this method is replaced by <A HREF="../../../javax/servlet/http/HttpSession.html#setAttribute(java.lang.String, java.lang.Object)"><CODE>setAttribute(java.lang.String, java.lang.Object)</CODE></A></I><P><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the name to which the object is bound; cannot be null<DD><CODE>value</CODE> - the object to be bound; cannot be null<DT><B>Throws:</B><DD>IllegalStateException - if this method is called on an invalidated session</DL></DD></DL><HR><A NAME="removeAttribute(java.lang.String)"><!-- --></A><H3>removeAttribute</H3><PRE>public void <B>removeAttribute</B>(java.lang.String name)</PRE><DL><DD>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.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the object to remove from this session<DT><B>Throws:</B><DD>IllegalStateException - if this method is called on an invalidated session</DL></DD></DL><HR><A NAME="removeValue(java.lang.String)"><!-- --></A><H3>removeValue</H3><PRE>public void <B>removeValue</B>(java.lang.String name)</PRE><DL><DD><B>Deprecated.</B> <I>As of Version 2.2, this method is replaced by <A HREF="../../../javax/servlet/http/HttpSession.html#removeAttribute(java.lang.String)"><CODE>removeAttribute(java.lang.String)</CODE></A></I><P><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the object to remove from this session<DT><B>Throws:</B><DD>IllegalStateException - if this method is called on an invalidated session</DL></DD></DL><HR><A NAME="invalidate()"><!-- --></A><H3>invalidate</H3><PRE>public void <B>invalidate</B>()</PRE><DL><DD>Invalidates this session then unbinds any objects bound to it.<DD><DL><DT><B>Throws:</B><DD>IllegalStateException - if this method is called on an already invalidated session</DL></DD></DL><HR><A NAME="isNew()"><!-- --></A><H3>isNew</H3><PRE>public boolean <B>isNew</B>()</PRE><DL><DD>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.<DD><DL><DT><B>Returns:</B><DD><code>true</code> if the server has created a session, but the client has not yet joined<DT><B>Throws:</B><DD>IllegalStateException - if this method is called on an already invalidated session</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/servlet/http/HttpServletResponse.html"><B>PREV CLASS</B></A> <A HREF="../../../javax/servlet/http/HttpSessionActivationListener.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="HttpSession.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR></BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -