📄 portletcontext.html.svn-base
字号:
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><BR> Writes the specified message to a portlet log file, usually an event log.</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, java.lang.Throwable)">log</A></B>(java.lang.String message, java.lang.Throwable throwable)</CODE><BR> Writes an explanatory message and a stack trace for a given Throwable exception to the portlet log file.</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#removeAttribute(java.lang.String)">removeAttribute</A></B>(java.lang.String name)</CODE><BR> Removes the attribute with the given name from the portlet context.</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#setAttribute(java.lang.String, java.lang.Object)">setAttribute</A></B>(java.lang.String name, java.lang.Object object)</CODE><BR> Binds an object to a given attribute name in this portlet context.</TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getServerInfo()"><!-- --></A><H3>getServerInfo</H3><PRE>public java.lang.String <B>getServerInfo</B>()</PRE><DL><DD>Returns the name and version of the portlet container in which the portlet is running. <P> The form of the returned string is <code>containername/versionnumber</code>.<DD><DL><DT><B>Returns:</B><DD>the string containing at least name and version number</DL></DD></DL><HR><A NAME="getRequestDispatcher(java.lang.String)"><!-- --></A><H3>getRequestDispatcher</H3><PRE>public <A HREF="../../javax/portlet/PortletRequestDispatcher.html">PortletRequestDispatcher</A> <B>getRequestDispatcher</B>(java.lang.String path)</PRE><DL><DD>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. A <code>PortletRequestDispatcher</code> object can be used include the resource in a response. The resource can be dynamic or static. <p>The pathname must begin with a slash (<code> / </code>) and is interpreted as relative to the current context root. <p>This method returns <code>null</code> if the <code>PortletContext</code> cannot return a <code>PortletRequestDispatcher</code> for any reason.<DD><DL><DT><B>Parameters:</B><DD><CODE>path</CODE> - a <code>String</code> specifying the pathname to the resource<DT><B>Returns:</B><DD>a <code>PortletRequestDispatcher</code> object that acts as a wrapper for the resource at the specified path.<DT><B>See Also: </B><DD><A HREF="../../javax/portlet/PortletRequestDispatcher.html"><CODE>PortletRequestDispatcher</CODE></A></DL></DD></DL><HR><A NAME="getNamedDispatcher(java.lang.String)"><!-- --></A><H3>getNamedDispatcher</H3><PRE>public <A HREF="../../javax/portlet/PortletRequestDispatcher.html">PortletRequestDispatcher</A> <B>getNamedDispatcher</B>(java.lang.String name)</PRE><DL><DD>Returns a <A HREF="../../javax/portlet/PortletRequestDispatcher.html"><CODE>PortletRequestDispatcher</CODE></A> object that acts as a wrapper for the named servlet. <p>Servlets (and also JSP pages) may be given names via server administration or via a web application deployment descriptor. <p>This method returns <code>null</code> if the <code>PortletContext</code> cannot return a <code>PortletRequestDispatcher</code> for any reason.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying the name of a servlet to be wrapped<DT><B>Returns:</B><DD>a <code>PortletRequestDispatcher</code> object that acts as a wrapper for the named servlet<DT><B>See Also: </B><DD><A HREF="../../javax/portlet/PortletRequestDispatcher.html"><CODE>PortletRequestDispatcher</CODE></A></DL></DD></DL><HR><A NAME="getResourceAsStream(java.lang.String)"><!-- --></A><H3>getResourceAsStream</H3><PRE>public java.io.InputStream <B>getResourceAsStream</B>(java.lang.String path)</PRE><DL><DD>Returns the resource located at the given path as an InputStream object. The data in the InputStream can be of any type or length. The method returns null if no resource exists at the given path. <p> In order to access protected resources the path has to be prefixed with <code>/WEB-INF/</code> (for example <code>/WEB-INF/myportlet/myportlet.jsp</code>). Otherwise, the direct path is used (for example <code>/myportlet/myportlet.jsp</code>).<DD><DL><DT><B>Parameters:</B><DD><CODE>path</CODE> - the path to the resource<DT><B>Returns:</B><DD>the input stream</DL></DD></DL><HR><A NAME="getMajorVersion()"><!-- --></A><H3>getMajorVersion</H3><PRE>public int <B>getMajorVersion</B>()</PRE><DL><DD>Returns the major version of the Portlet API that this portlet container supports.<DD><DL><DT><B>Returns:</B><DD>the major version<DT><B>See Also: </B><DD><A HREF="../../javax/portlet/PortletContext.html#getMinorVersion()"><CODE>getMinorVersion()</CODE></A></DL></DD></DL><HR><A NAME="getMinorVersion()"><!-- --></A><H3>getMinorVersion</H3><PRE>public int <B>getMinorVersion</B>()</PRE><DL><DD>Returns the minor version of the Portlet API that this portlet container supports.<DD><DL><DT><B>Returns:</B><DD>the minor version<DT><B>See Also: </B><DD><A HREF="../../javax/portlet/PortletContext.html#getMajorVersion()"><CODE>getMajorVersion()</CODE></A></DL></DD></DL><HR><A NAME="getMimeType(java.lang.String)"><!-- --></A><H3>getMimeType</H3><PRE>public java.lang.String <B>getMimeType</B>(java.lang.String file)</PRE><DL><DD>Returns the MIME type of the specified file, or <code>null</code> if the MIME type is not known. The MIME type is determined by the configuration of the portlet container and may be specified in a web application deployment descriptor. Common MIME types are <code>text/html</code> and <code>image/gif</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>file</CODE> - a <code>String</code> specifying the name of a file<DT><B>Returns:</B><DD>a <code>String</code> specifying the MIME type of the file</DL></DD></DL><HR><A NAME="getRealPath(java.lang.String)"><!-- --></A><H3>getRealPath</H3><PRE>public java.lang.String <B>getRealPath</B>(java.lang.String path)</PRE><DL><DD>Returns a <code>String</code> containing the real path for a given virtual path. For example, the path <code>/index.html</code> returns the absolute file path of the portlet container file system. <p>The real path returned will be in a form appropriate to the computer and operating system on which the portlet container is running, including the proper path separators. This method returns <code>null</code> if the portlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a <code>.war</code> archive).<DD><DL><DT><B>Parameters:</B><DD><CODE>path</CODE> - a <code>String</code> specifying a virtual path<DT><B>Returns:</B><DD>a <code>String</code> specifying the real path, or null if the transformation cannot be performed.</DL></DD></DL><HR><A NAME="getResourcePaths(java.lang.String)"><!-- --></A><H3>getResourcePaths</H3><PRE>public java.util.Set <B>getResourcePaths</B>(java.lang.String path)</PRE><DL><DD>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. Paths indicating subdirectory paths end with a slash (<code>/</code>). The returned paths are all relative to the root of the web application and have a leading slash. For example, for a web application containing<br><br> <code> /welcome.html<br> /catalog/index.html<br> /catalog/products.html<br> /catalog/offers/books.html<br> /catalog/offers/music.html<br> /customer/login.jsp<br> /WEB-INF/web.xml<br> /WEB-INF/classes/com.acme.OrderPortlet.class,<br><br> </code> <code>getResourcePaths("/")</code> returns <code>{"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}</code><br> <code>getResourcePaths("/catalog/")</code> returns <code>{"/catalog/index.html", "/catalog/products.html", "/catalog/offers/"}</code>.<br><DD><DL><DT><B>Parameters:</B><DD><CODE>path</CODE> - the partial path used to match the resources, which must start with a slash<DT><B>Returns:</B><DD>a Set containing the directory listing, or <code>null</code> if there are no resources in the web application of which the path begins with the supplied path.</DL></DD></DL><HR><A NAME="getResource(java.lang.String)"><!-- --></A><H3>getResource</H3><PRE>public java.net.URL <B>getResource</B>(java.lang.String path) throws java.net.MalformedURLException</PRE><DL><DD>Returns a URL to the resource that is mapped to a specified path. The path must begin with a slash (<code>/</code>) and is interpreted as relative to the current context root. <p>This method allows the portlet container to make a resource available to portlets from any source. Resources
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -