📄 portletsession.html.svn-base
字号:
<!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.5.0) on Wed Feb 06 17:53:07 CET 2008 --><TITLE>PortletSession</TITLE><META NAME="keywords" CONTENT="javax.portlet.PortletSession interface"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="PortletSession";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= 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/PortletSession.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-files/index-1.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="../../javax/portlet/PortletSecurityException.html" title="class in javax.portlet"><B>PREV CLASS</B></A> <A HREF="../../javax/portlet/PortletSessionUtil.html" title="class in javax.portlet"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?javax/portlet/PortletSession.html" target="_top"><B>FRAMES</B></A> <A HREF="PortletSession.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 | <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><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.portlet</FONT><BR>Interface PortletSession</H2><HR><DL><DT><PRE>public interface <B>PortletSession</B></DL></PRE><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><P><HR><P><!-- =========== FIELD SUMMARY =========== --><A NAME="field_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>Field Summary</B></FONT></TH></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> <!-- ========== 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> 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.Map<java.lang.String,java.lang.Object></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#getAttributeMap()">getAttributeMap</A></B>()</CODE><BR> Returns a <code>Map</code> of the session attributes in the portlet session scope.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Map<java.lang.String,java.lang.Object></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletSession.html#getAttributeMap(int)">getAttributeMap</A></B>(int scope)</CODE><BR> Returns a <code>Map</code> of the session attributes in the given session scope.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Enumeration<java.lang.String></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<java.lang.String></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" title="interface in javax.portlet">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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -