📄 portletsession.html.svn-base
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Mon Sep 08 18:33:40 CEST 2003 --><TITLE>Portlet API (V1.0) : Interface PortletSession</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <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="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>Portlet API (V1.0) </EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/portlet/PortletResponse.html"><B>PREV CLASS</B></A> <A HREF="../../javax/portlet/PortletURL.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="PortletSession.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.portlet</FONT><BR>Interface PortletSession</H2><HR><DL><DT>public interface <B>PortletSession</B></DL><P>The <CODE>PortletSession</CODE> interface provides a way to identify a user across more than one request and to store transient information about that user. <p> A <code>PortletSession</code> is created per user client per portlet application. <p> A portlet can bind an object attribute into a <code>PortletSession</code> by name. The <code>PortletSession</code> interface defines two scopes for storing objects: <ul> <li><code>APPLICATION_SCOPE</code> <li><code>PORTLET_SCOPE</code> </ul> All objects stored in the session using the <code>APPLICATION_SCOPE</code> must be available to all the portlets, servlets and JSPs that belongs to the same portlet application and that handles a request identified as being a part of the same session. Objects stored in the session using the <code>PORTLET_SCOPE</code> must be available to the portlet during requests for the same portlet window that the objects where stored from. Attributes stored in the <code>PORTLET_SCOPE</code> are not protected from other web components of the portlet application. They are just conveniently namespaced. <P> The portlet session is based on the <code>HttpSession</code>. Therefore all <code>HttpSession</code> listeners do apply to the portlet session and attributes set in the portlet session are visible in the <code>HttpSession</code> and vice versa.<P><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#APPLICATION_SCOPE">APPLICATION_SCOPE</A></B></CODE><BR> This constant defines an application wide scope for the session attribute.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#PORTLET_SCOPE">PORTLET_SCOPE</A></B></CODE><BR> This constant defines the scope of the session attribute to be private to the portlet and its included resources.</TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.Object</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#getAttribute(java.lang.String)">getAttribute</A></B>(java.lang.String name)</CODE><BR> Returns the object bound with the specified name in this session under the <code>PORTLET_SCOPE</code>, or <code>null</code> if no object is bound under the name in that scope.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.Object</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#getAttribute(java.lang.String, int)">getAttribute</A></B>(java.lang.String name, int scope)</CODE><BR> Returns the object bound with the specified name in this session, or <code>null</code> if no object is bound under the name in the given scope.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Enumeration</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#getAttributeNames()">getAttributeNames</A></B>()</CODE><BR> Returns an <code>Enumeration</code> of String objects containing the names of all the objects bound to this session under the <code>PORTLET_SCOPE</code>, or an empty <code>Enumeration</code> if no attributes are available.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Enumeration</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#getAttributeNames(int)">getAttributeNames</A></B>(int scope)</CODE><BR> Returns an <code>Enumeration</code> of String objects containing the names of all the objects bound to this session in the given scope, or an empty <code>Enumeration</code> if no attributes are available in the given scope.</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="../../javax/portlet/PortletSession.html#getCreationTime()">getCreationTime</A></B>()</CODE><BR> Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#getId()">getId</A></B>()</CODE><BR> Returns a string containing the unique identifier assigned to this session.</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="../../javax/portlet/PortletSession.html#getLastAccessedTime()">getLastAccessedTime</A></B>()</CODE><BR> Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#getMaxInactiveInterval()">getMaxInactiveInterval</A></B>()</CODE><BR> Returns the maximum time interval, in seconds, for which the portlet container keeps this session open between client accesses.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/portlet/PortletContext.html">PortletContext</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#getPortletContext()">getPortletContext</A></B>()</CODE><BR> Returns the portlet application context associated with this session.</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="../../javax/portlet/PortletSession.html#invalidate()">invalidate</A></B>()</CODE><BR> Invalidates this session (all scopes) and unbinds any objects bound to it.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#isNew()">isNew</A></B>()</CODE><BR> Returns true if the client does not yet know about the session or if the client chooses not to join the session.</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="../../javax/portlet/PortletSession.html#removeAttribute(java.lang.String)">removeAttribute</A></B>(java.lang.String name)</CODE><BR> Removes the object bound with the specified name under the <code>PORTLET_SCOPE</code> from this session.</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="../../javax/portlet/PortletSession.html#removeAttribute(java.lang.String, int)">removeAttribute</A></B>(java.lang.String name, int scope)</CODE><BR> Removes the object bound with the specified name and the given scope from this session.</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="../../javax/portlet/PortletSession.html#setAttribute(java.lang.String, java.lang.Object)">setAttribute</A></B>(java.lang.String name, java.lang.Object value)</CODE><BR> Binds an object to this session under the <code>PORTLET_SCOPE</code>, using the name specified.</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="../../javax/portlet/PortletSession.html#setAttribute(java.lang.String, java.lang.Object, int)">setAttribute</A></B>(java.lang.String name, java.lang.Object value, int scope)</CODE><BR> Binds an object to this session in the given scope, using the name specified.</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="../../javax/portlet/PortletSession.html#setMaxInactiveInterval(int)">setMaxInactiveInterval</A></B>(int interval)</CODE><BR> Specifies the time, in seconds, between client requests, before the portlet container invalidates this session.</TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="APPLICATION_SCOPE"><!-- --></A><H3>APPLICATION_SCOPE</H3><PRE>public static final int <B>APPLICATION_SCOPE</B></PRE><DL><DD>This constant defines an application wide scope for the session attribute. <code>APPLICATION_SCOPE</code> session attributes enable Portlets within one portlet application to share data. <p> Portlets may need to prefix attributes set in this scope with some ID, to avoid overwriting each other's attributes in the case where two portlets of the same portlet definition are created. <p> Value: <code>0x01</code></DL><HR><A NAME="PORTLET_SCOPE"><!-- --></A><H3>PORTLET_SCOPE</H3><PRE>public static final int <B>PORTLET_SCOPE</B></PRE><DL><DD>This constant defines the scope of the session attribute to be private to the portlet and its included resources. <p> Value: <code>0x02</code></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -