📄 portletcontext.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:06 CET 2008 --><TITLE>PortletContext</TITLE><META NAME="keywords" CONTENT="javax.portlet.PortletContext interface"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="PortletContext";}</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/PortletContext.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/PortletConfig.html" title="interface in javax.portlet"><B>PREV CLASS</B></A> <A HREF="../../javax/portlet/PortletException.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/PortletContext.html" target="_top"><B>FRAMES</B></A> <A HREF="PortletContext.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">javax.portlet</FONT><BR>Interface PortletContext</H2><HR><DL><DT><PRE>public interface <B>PortletContext</B></DL></PRE><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> Attributes 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><P><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> 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<java.lang.String></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 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/PortletContext.html#getContainerRuntimeOptions()">getContainerRuntimeOptions</A></B>()</CODE><BR> Returns the container container runtime options keys supported by this portlet container.</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<java.lang.String></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" title="interface in javax.portlet">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" title="interface in javax.portlet"><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" title="interface in javax.portlet">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" title="interface in javax.portlet"><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<java.lang.String></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 portlet is running.</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/PortletContext.html#log(java.lang.String)">log</A></B>(java.lang.String msg)</CODE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -