📄 portletcontext.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 PortletContext</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/PortletConfig.html"><B>PREV CLASS</B></A> <A HREF="../../javax/portlet/PortletPreferences.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="PortletContext.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><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.portlet</FONT><BR>Interface PortletContext</H2><HR><DL><DT>public interface <B>PortletContext</B></DL><P>The <CODE>PortletContext</CODE> interface defines a portlet view of the portlet container. The <CODE>PortletContext</CODE> also makes resources available to the portlet. Using the context, a portlet can access the portlet log, and obtain URL references to resources. <p>There is one context per "portlet application" per Java Virtual Machine. (A "portlet application" is a collection of portlets, servlets, and content installed under a specific subset of the server URL namespace, such as <code>/catalog</code>. They are possibly installed via a <code>.war</code> file.) As a web application, a portlet application also has a servlet context. The portlet context leverages most of its functionality from the servlet context of the portlet application. <p> Attibutes stored in the context are global for <I>all</I> users and <I>all</I> components in the portlet application. <p> In the case of a web application marked "distributed" in its deployment descriptor, there will be one context instance for each virtual machine. In this situation, the context cannot be used as a location to share global information (because the information is not truly global). Use an external resource, such as a database to achieve sharing on a global scope.<P><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== 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/PortletContext.html#getAttribute(java.lang.String)">getAttribute</A></B>(java.lang.String name)</CODE><BR> Returns the portlet container attribute with the given name, or null if there is no attribute by that name.</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/PortletContext.html#getAttributeNames()">getAttributeNames</A></B>()</CODE><BR> Returns an <code>Enumeration</code> containing the attribute names available within this portlet context, or an emtpy <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.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletContext.html#getInitParameter(java.lang.String)">getInitParameter</A></B>(java.lang.String name)</CODE><BR> Returns a String containing the value of the named context-wide initialization parameter, or <code>null</code> if the parameter does not exist.</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/PortletContext.html#getInitParameterNames()">getInitParameterNames</A></B>()</CODE><BR> Returns the names of the context initialization parameters as an <code>Enumeration</code> of String objects, or an empty Enumeration if the context has no initialization parameters.</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/PortletContext.html#getMajorVersion()">getMajorVersion</A></B>()</CODE><BR> Returns the major version of the Portlet API that this portlet container supports.</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/PortletContext.html#getMimeType(java.lang.String)">getMimeType</A></B>(java.lang.String file)</CODE><BR> Returns the MIME type of the specified file, or <code>null</code> if the MIME type is not known.</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/PortletContext.html#getMinorVersion()">getMinorVersion</A></B>()</CODE><BR> Returns the minor version of the Portlet API that this portlet container supports.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/portlet/PortletRequestDispatcher.html">PortletRequestDispatcher</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletContext.html#getNamedDispatcher(java.lang.String)">getNamedDispatcher</A></B>(java.lang.String name)</CODE><BR> Returns a <A HREF="../../javax/portlet/PortletRequestDispatcher.html"><CODE>PortletRequestDispatcher</CODE></A> object that acts as a wrapper for the named servlet.</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/PortletContext.html#getPortletContextName()">getPortletContextName</A></B>()</CODE><BR> Returns the name of this portlet application correponding to this PortletContext as specified in the <code>web.xml</code> deployment descriptor for this web application by the <code>display-name</code> element.</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/PortletContext.html#getRealPath(java.lang.String)">getRealPath</A></B>(java.lang.String path)</CODE><BR> Returns a <code>String</code> containing the real path for a given virtual path.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/portlet/PortletRequestDispatcher.html">PortletRequestDispatcher</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletContext.html#getRequestDispatcher(java.lang.String)">getRequestDispatcher</A></B>(java.lang.String path)</CODE><BR> Returns a <A HREF="../../javax/portlet/PortletRequestDispatcher.html"><CODE>PortletRequestDispatcher</CODE></A> object that acts as a wrapper for the resource located at the given path.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.net.URL</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletContext.html#getResource(java.lang.String)">getResource</A></B>(java.lang.String path)</CODE><BR> Returns a URL to the resource that is mapped to a specified path.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.io.InputStream</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletContext.html#getResourceAsStream(java.lang.String)">getResourceAsStream</A></B>(java.lang.String path)</CODE><BR> Returns the resource located at the given path as an InputStream object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Set</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/portlet/PortletContext.html#getResourcePaths(java.lang.String)">getResourcePaths</A></B>(java.lang.String path)</CODE><BR> Returns a directory-like listing of all the paths to resources within the web application longest sub-path of which matches the supplied path argument.</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/PortletContext.html#getServerInfo()">getServerInfo</A></B>()</CODE><BR> Returns the name and version of the portlet container in which the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -