| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!--NewPage--> |
| <HTML> |
| <HEAD> |
| <!-- Generated by javadoc (build 1.6.0_65) on Fri Mar 04 17:58:56 EST 2016 --> |
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <TITLE> |
| Session (Apache Shiro 1.2.4 API) |
| </TITLE> |
| |
| <META NAME="date" CONTENT="2016-03-04"> |
| |
| <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> |
| |
| <SCRIPT type="text/javascript"> |
| function windowTitle() |
| { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="Session (Apache Shiro 1.2.4 API)"; |
| } |
| } |
| </SCRIPT> |
| <NOSCRIPT> |
| </NOSCRIPT> |
| |
| </HEAD> |
| |
| <BODY BGCOLOR="white" onload="windowTitle();"> |
| <HR> |
| |
| |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <A NAME="navbar_top"><!-- --></A> |
| <A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_top_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| <TR ALIGN="center" VALIGN="top"> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="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="class-use/Session.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="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="../../../../org/apache/shiro/session/ProxiedSession.html" title="class in org.apache.shiro.session"><B>PREV CLASS</B></A> |
| <A HREF="../../../../org/apache/shiro/session/SessionException.html" title="class in org.apache.shiro.session"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../index.html?org/apache/shiro/session/Session.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="Session.html" target="_top"><B>NO FRAMES</B></A> |
| <SCRIPT type="text/javascript"> |
| <!-- |
| if(window==top) { |
| document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| } |
| //--> |
| </SCRIPT> |
| <NOSCRIPT> |
| <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> |
| </NOSCRIPT> |
| |
| |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| SUMMARY: NESTED | 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> |
| <A NAME="skip-navbar_top"></A> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| |
| <HR> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <H2> |
| <FONT SIZE="-1"> |
| org.apache.shiro.session</FONT> |
| <BR> |
| Interface Session</H2> |
| <DL> |
| <DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../../org/apache/shiro/session/mgt/ValidatingSession.html" title="interface in org.apache.shiro.session.mgt">ValidatingSession</A></DD> |
| </DL> |
| <DL> |
| <DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../org/apache/shiro/session/mgt/DelegatingSession.html" title="class in org.apache.shiro.session.mgt">DelegatingSession</A>, <A HREF="../../../../org/apache/shiro/web/session/HttpServletSession.html" title="class in org.apache.shiro.web.session">HttpServletSession</A>, <A HREF="../../../../org/apache/shiro/session/mgt/ImmutableProxiedSession.html" title="class in org.apache.shiro.session.mgt">ImmutableProxiedSession</A>, <A HREF="../../../../org/apache/shiro/session/ProxiedSession.html" title="class in org.apache.shiro.session">ProxiedSession</A>, <A HREF="../../../../org/apache/shiro/session/mgt/SimpleSession.html" title="class in org.apache.shiro.session.mgt">SimpleSession</A></DD> |
| </DL> |
| <HR> |
| <DL> |
| <DT><PRE>public interface <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.37"><B>Session</B></A></DL> |
| </PRE> |
| |
| <P> |
| A <code>Session</code> is a stateful data context associated with a single Subject (user, daemon process, |
| etc) who interacts with a software system over a period of time. |
| <p/> |
| A <code>Session</code> is intended to be managed by the business tier and accessible via other |
| tiers without being tied to any given client technology. This is a <em>great</em> benefit to Java |
| systems, since until now, the only viable session mechanisms were the |
| <code>javax.servlet.http.HttpSession</code> or Stateful Session EJB's, which many times |
| unnecessarily coupled applications to web or ejb technologies. |
| <P> |
| |
| <P> |
| <DL> |
| <DT><B>Since:</B></DT> |
| <DD>0.1</DD> |
| </DL> |
| <HR> |
| |
| <P> |
| |
| <!-- ========== METHOD SUMMARY =========== --> |
| |
| <A NAME="method_summary"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
| <B>Method Summary</B></FONT></TH> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#getAttribute(java.lang.Object)">getAttribute</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key)</CODE> |
| |
| <BR> |
| Returns the object bound to this session identified by the specified key.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#getAttributeKeys()">getAttributeKeys</A></B>()</CODE> |
| |
| <BR> |
| Returns the keys of all the attributes stored under this session.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#getHost()">getHost</A></B>()</CODE> |
| |
| <BR> |
| Returns the host name or IP string of the host that originated this session, or <code>null</code> |
| if the host is unknown.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#getId()">getId</A></B>()</CODE> |
| |
| <BR> |
| Returns the unique identifier assigned by the system upon session creation.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util">Date</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#getLastAccessTime()">getLastAccessTime</A></B>()</CODE> |
| |
| <BR> |
| Returns the last time the application received a request or method invocation from the user associated |
| with this session.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util">Date</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#getStartTimestamp()">getStartTimestamp</A></B>()</CODE> |
| |
| <BR> |
| Returns the time the session was started; that is, the time the system created the instance.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> long</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#getTimeout()">getTimeout</A></B>()</CODE> |
| |
| <BR> |
| Returns the time in milliseconds that the session session may remain idle before expiring.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#removeAttribute(java.lang.Object)">removeAttribute</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key)</CODE> |
| |
| <BR> |
| Removes (unbinds) the object bound to this session under the specified <code>key</code> name.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#setAttribute(java.lang.Object, java.lang.Object)">setAttribute</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key, |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> value)</CODE> |
| |
| <BR> |
| Binds the specified <code>value</code> to this session, uniquely identified by the specifed |
| <code>key</code> name.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#setTimeout(long)">setTimeout</A></B>(long maxIdleTimeInMillis)</CODE> |
| |
| <BR> |
| Sets the time in milliseconds that the session may remain idle before expiring.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#stop()">stop</A></B>()</CODE> |
| |
| <BR> |
| Explicitly stops (invalidates) this session and releases all associated resources.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/session/Session.html#touch()">touch</A></B>()</CODE> |
| |
| <BR> |
| Explicitly updates the <A HREF="../../../../org/apache/shiro/session/Session.html#getLastAccessTime()"><CODE>lastAccessTime</CODE></A> of this session to the current time when |
| this method is invoked.</TD> |
| </TR> |
| </TABLE> |
| |
| <P> |
| |
| <!-- ============ METHOD DETAIL ========== --> |
| |
| <A NAME="method_detail"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
| <B>Method Detail</B></FONT></TH> |
| </TR> |
| </TABLE> |
| |
| <A NAME="getId()"><!-- --></A><H3> |
| getId</H3> |
| <PRE> |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</A> <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.49"><B>getId</B></A>()</PRE> |
| <DL> |
| <DD>Returns the unique identifier assigned by the system upon session creation. |
| <p/> |
| All return values from this method are expected to have proper <code>toString()</code>, |
| <code>equals()</code>, and <code>hashCode()</code> implementations. Good candidates for such |
| an identifier are <A HREF="http://java.sun.com/javase/6/docs/api/java/util/UUID.html?is-external=true" title="class or interface in java.util"><CODE>UUID</CODE></A>s, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang"><CODE>Integer</CODE></A>s, and |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang"><CODE>String</CODE></A>s. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>The unique identifier assigned to the session upon creation.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getStartTimestamp()"><!-- --></A><H3> |
| getStartTimestamp</H3> |
| <PRE> |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util">Date</A> <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.56"><B>getStartTimestamp</B></A>()</PRE> |
| <DL> |
| <DD>Returns the time the session was started; that is, the time the system created the instance. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>The time the system created the session.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getLastAccessTime()"><!-- --></A><H3> |
| getLastAccessTime</H3> |
| <PRE> |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util">Date</A> <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.65"><B>getLastAccessTime</B></A>()</PRE> |
| <DL> |
| <DD>Returns the last time the application received a request or method invocation from the user associated |
| with this session. Application calls to this method do not affect this access time. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>The time the user last interacted with the system.<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/session/Session.html#touch()"><CODE>touch()</CODE></A></DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getTimeout()"><!-- --></A><H3> |
| getTimeout</H3> |
| <PRE> |
| long <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.82"><B>getTimeout</B></A>() |
| throws <A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></PRE> |
| <DL> |
| <DD>Returns the time in milliseconds that the session session may remain idle before expiring. |
| <ul> |
| <li>A negative return value means the session will never expire.</li> |
| <li>A non-negative return value (0 or greater) means the session expiration will occur if idle for that |
| length of time.</li> |
| </ul> |
| <b>*Note:</b> if you are used to the <code>HttpSession</code>'s <code>getMaxInactiveInterval()</code> method, the scale on |
| this method is different: Shiro Sessions use millisecond values for timeout whereas |
| <code>HttpSession.getMaxInactiveInterval</code> uses seconds. Always use millisecond values with Shiro sessions. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>the time in milliseconds the session may remain idle before expiring. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></CODE> - if the session has been stopped or expired prior to calling this method.<DT><B>Since:</B></DT> |
| <DD>0.2</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="setTimeout(long)"><!-- --></A><H3> |
| setTimeout</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.100"><B>setTimeout</B></A>(long maxIdleTimeInMillis) |
| throws <A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></PRE> |
| <DL> |
| <DD>Sets the time in milliseconds that the session may remain idle before expiring. |
| <ul> |
| <li>A negative value means the session will never expire.</li> |
| <li>A non-negative value (0 or greater) means the session expiration will occur if idle for that |
| length of time.</li> |
| </ul> |
| <p/> |
| <b>*Note:</b> if you are used to the <code>HttpSession</code>'s <code>getMaxInactiveInterval()</code> method, the scale on |
| this method is different: Shiro Sessions use millisecond values for timeout whereas |
| <code>HttpSession.getMaxInactiveInterval</code> uses seconds. Always use millisecond values with Shiro sessions. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>maxIdleTimeInMillis</CODE> - the time in milliseconds that the session may remain idle before expiring. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></CODE> - if the session has been stopped or expired prior to calling this method.<DT><B>Since:</B></DT> |
| <DD>0.2</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getHost()"><!-- --></A><H3> |
| getHost</H3> |
| <PRE> |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.109"><B>getHost</B></A>()</PRE> |
| <DL> |
| <DD>Returns the host name or IP string of the host that originated this session, or <code>null</code> |
| if the host is unknown. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>the host name or IP string of the host that originated this session, or <code>null</code> |
| if the host address is unknown.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="touch()"><!-- --></A><H3> |
| touch</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.141"><B>touch</B></A>() |
| throws <A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></PRE> |
| <DL> |
| <DD>Explicitly updates the <A HREF="../../../../org/apache/shiro/session/Session.html#getLastAccessTime()"><CODE>lastAccessTime</CODE></A> of this session to the current time when |
| this method is invoked. This method can be used to ensure a session does not time out. |
| <p/> |
| Most programmers won't use this method directly and will instead rely on the last access time to be updated |
| automatically as a result of an incoming web request or remote procedure call/method invocation. |
| <p/> |
| However, this method is particularly useful when supporting rich-client applications such as |
| Java Web Start appp, Java or Flash applets, etc. Although rare, it is possible in a rich-client |
| environment that a user continuously interacts with the client-side application without a |
| server-side method call ever being invoked. If this happens over a long enough period of |
| time, the user's server-side session could time-out. Again, such cases are rare since most |
| rich-clients frequently require server-side method invocations. |
| <p/> |
| In this example though, the user's session might still be considered valid because |
| the user is actively "using" the application, just not communicating with the |
| server. But because no server-side method calls are invoked, there is no way for the server |
| to know if the user is sitting idle or not, so it must assume so to maintain session |
| integrity. This <code>touch()</code> method could be invoked by the rich-client application code during those |
| times to ensure that the next time a server-side method is invoked, the invocation will not |
| throw an <A HREF="../../../../org/apache/shiro/session/ExpiredSessionException.html" title="class in org.apache.shiro.session"><CODE>ExpiredSessionException</CODE></A>. In short terms, it could be used periodically |
| to ensure a session does not time out. |
| <p/> |
| How often this rich-client "maintenance" might occur is entirely dependent upon |
| the application and would be based on variables such as session timeout configuration, |
| usage characteristics of the client application, network utilization and application server |
| performance. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></CODE> - if this session has stopped or expired prior to calling this method.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="stop()"><!-- --></A><H3> |
| stop</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.160"><B>stop</B></A>() |
| throws <A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></PRE> |
| <DL> |
| <DD>Explicitly stops (invalidates) this session and releases all associated resources. |
| <p/> |
| If this session has already been authenticated (i.e. the <code>Subject</code> that |
| owns this session has logged-in), calling this method explicitly might have undesired side effects: |
| <p/> |
| It is common for a <code>Subject</code> implementation to retain authentication state in the |
| <code>Session</code>. If the session |
| is explicitly stopped by application code by calling this method directly, it could clear out any |
| authentication state that might exist, thereby effectively "unauthenticating" the <code>Subject</code>. |
| <p/> |
| As such, you might consider <A HREF="../../../../org/apache/shiro/subject/Subject.html#logout()"><CODE>logging-out</CODE></A> the 'owning' |
| <code>Subject</code> instead of manually calling this method, as a log out is expected to stop the |
| corresponding session automatically, and also allows framework code to execute additional cleanup logic. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></CODE> - if this session has stopped or expired prior to calling this method.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getAttributeKeys()"><!-- --></A><H3> |
| getAttributeKeys</H3> |
| <PRE> |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>> <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.171"><B>getAttributeKeys</B></A>() |
| throws <A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></PRE> |
| <DL> |
| <DD>Returns the keys of all the attributes stored under this session. If there are no |
| attributes, this returns an empty collection. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>the keys of all attributes stored under this session, or an empty collection if |
| there are no session attributes. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></CODE> - if this session has stopped or expired prior to calling this method.<DT><B>Since:</B></DT> |
| <DD>0.2</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getAttribute(java.lang.Object)"><!-- --></A><H3> |
| getAttribute</H3> |
| <PRE> |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.183"><B>getAttribute</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key) |
| throws <A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></PRE> |
| <DL> |
| <DD>Returns the object bound to this session identified by the specified key. If there is no |
| object bound under the key, <code>null</code> is returned. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>key</CODE> - the unique name of the object bound to this session |
| <DT><B>Returns:</B><DD>the object bound under the specified <code>key</code> name or <code>null</code> if there is |
| no object bound under that name. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></CODE> - if this session has stopped or expired prior to calling |
| this method.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="setAttribute(java.lang.Object, java.lang.Object)"><!-- --></A><H3> |
| setAttribute</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.198"><B>setAttribute</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key, |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> value) |
| throws <A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></PRE> |
| <DL> |
| <DD>Binds the specified <code>value</code> to this session, uniquely identified by the specifed |
| <code>key</code> name. If there is already an object bound under the <code>key</code> name, that |
| existing object will be replaced by the new <code>value</code>. |
| <p/> |
| If the <code>value</code> parameter is null, it has the same effect as if |
| <A HREF="../../../../org/apache/shiro/session/Session.html#removeAttribute(java.lang.Object)"><CODE>removeAttribute</CODE></A> was called. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>key</CODE> - the name under which the <code>value</code> object will be bound in this session<DD><CODE>value</CODE> - the object to bind in this session. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></CODE> - if this session has stopped or expired prior to calling |
| this method.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="removeAttribute(java.lang.Object)"><!-- --></A><H3> |
| removeAttribute</H3> |
| <PRE> |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> <A HREF="../../../../src-html/org/apache/shiro/session/Session.html#line.209"><B>removeAttribute</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key) |
| throws <A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></PRE> |
| <DL> |
| <DD>Removes (unbinds) the object bound to this session under the specified <code>key</code> name. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>key</CODE> - the name uniquely identifying the object to remove |
| <DT><B>Returns:</B><DD>the object removed or <code>null</code> if there was no object bound under the name |
| <code>key</code>. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/session/InvalidSessionException.html" title="class in org.apache.shiro.session">InvalidSessionException</A></CODE> - if this session has stopped or expired prior to calling |
| this method.</DL> |
| </DD> |
| </DL> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <HR> |
| |
| |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <A NAME="navbar_bottom"><!-- --></A> |
| <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_bottom_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| <TR ALIGN="center" VALIGN="top"> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="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="class-use/Session.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="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="../../../../org/apache/shiro/session/ProxiedSession.html" title="class in org.apache.shiro.session"><B>PREV CLASS</B></A> |
| <A HREF="../../../../org/apache/shiro/session/SessionException.html" title="class in org.apache.shiro.session"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../index.html?org/apache/shiro/session/Session.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="Session.html" target="_top"><B>NO FRAMES</B></A> |
| <SCRIPT type="text/javascript"> |
| <!-- |
| if(window==top) { |
| document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| } |
| //--> |
| </SCRIPT> |
| <NOSCRIPT> |
| <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> |
| </NOSCRIPT> |
| |
| |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| SUMMARY: NESTED | 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> |
| <A NAME="skip-navbar_bottom"></A> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| |
| <HR> |
| Copyright © 2004-2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved. |
| </BODY> |
| </HTML> |