📄 portletcontext.java
字号:
/** * 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/> * <p>This method allows the portlet container to make a resource * available to portlets from any source. Resources * can be located on a local or remote * file system, in a database, or in a <code>.war</code> file. * <p/> * <p>The portlet container must implement the URL handlers * and <code>URLConnection</code> objects that are necessary * to access the resource. * <p/> * <p>This method returns <code>null</code> * if no resource is mapped to the pathname. * <p/> * <p>Some containers may allow writing to the URL returned by * this method using the methods of the URL class. * <p/> * <p>The resource content is returned directly, so be aware that * requesting a <code>.jsp</code> page returns the JSP source code. * Use a <code>RequestDispatcher</code> instead to include results of * an execution. * <p/> * <p>This method has a different purpose than * <code>java.lang.Class.getResource</code>, * which looks up resources based on a class loader. This * method does not use class loaders. * * @param path a <code>String</code> specifying * the path to the resource * @return the resource located at the named path, * or <code>null</code> if there is no resource * at that path * @throws java.net.MalformedURLException if the pathname is not given in * the correct form */ public java.net.URL getResource(String path) throws java.net.MalformedURLException; /** * Returns the portlet container attribute with the given name, * or null if there is no attribute by that name. * An attribute allows a portlet container to give the * portlet additional information not * already provided by this interface. * A list of supported attributes can be retrieved using * <code>getAttributeNames</code>. * <p/> * <p>The attribute is returned as a <code>java.lang.Object</code> * or some subclass. * Attribute names should follow the same convention as package * names. The Java Portlet API specification reserves names * matching <code>java.*</code>, <code>javax.*</code>, * and <code>sun.*</code>. * * @param name a <code>String</code> specifying the name * of the attribute * @return an <code>Object</code> containing the value * of the attribute, or <code>null</code> * if no attribute exists matching the given * name * @exception java.lang.IllegalArgumentException if name is <code>null</code>. * @see #getAttributeNames */ public java.lang.Object getAttribute(java.lang.String name); /** * 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. Use the * {@link #getAttribute} method with an attribute name * to get the value of an attribute. * * @return an <code>Enumeration</code> of attribute names * @see #getAttribute */ public java.util.Enumeration getAttributeNames(); /** * Returns a String containing the value of the named context-wide * initialization parameter, or <code>null</code> if the parameter does not exist. * This method provides configuration information which may be useful for * an entire "portlet application". * * @return a <code>String</code> containing the value * of the initialization parameter, or * <code>null</code> if the parameter does not exist. * @param name a <code>String</code> containing the name of the * requested parameter * @exception java.lang.IllegalArgumentException if name is <code>null</code>. * @see #getInitParameterNames */ public java.lang.String getInitParameter(java.lang.String name); /** * 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. * * @return an <code>Enumeration</code> of <code>String</code> * objects containing the names of the context * initialization parameters * @see #getInitParameter */ public java.util.Enumeration getInitParameterNames(); /** * Writes the specified message to a portlet log file, usually an event log. * The name and type of the portlet log file is specific to the portlet container. * <p/> * This method mapps to the <code>ServletContext.log</code> method. * The portlet container may in addition log this message in a * portlet container specific log file. * * @param msg a <code>String</code> specifying the * message to be written to the log file */ public void log(java.lang.String msg); /** * Writes an explanatory message and a stack trace for a given * Throwable exception to the portlet log file. * The name and type of the portlet log file is specific to the * portlet container, usually an event log. * <p/> * This method is mapped to the <code>ServletContext.log</code> method. * The portlet container may in addition log this message in a * portlet container specific log file. * * @param message a <code>String</code> that * describes the error or exception * @param throwable the <code>Throwable</code> error * or exception */ public void log(java.lang.String message, java.lang.Throwable throwable); /** * Removes the attribute with the given name from the portlet context. * After removal, subsequent calls to * {@link #getAttribute} to retrieve the attribute's value * will return <code>null</code>. * * @param name a <code>String</code> specifying the name * of the attribute to be removed * @exception java.lang.IllegalArgumentException if name is <code>null</code>. */ public void removeAttribute(java.lang.String name); /** * Binds an object to a given attribute name in this portlet context. * If the name specified is already used for an attribute, this method * removes the old attribute and binds the name to the new attribute. * <p/> * If a null value is passed, the effect is the same as calling * <code>removeAttribute()</code>. * <p/> * <p>Attribute names should follow the same convention as package * names. The Java Portlet API specification reserves names * matching <code>java.*</code>, <code>javax.*</code>, and * <code>sun.*</code>. * * @param name a <code>String</code> specifying the name * of the attribute * @param object an <code>Object</code> representing the * attribute to be bound * @exception java.lang.IllegalArgumentException if name is <code>null</code>. */ public void setAttribute(java.lang.String name, java.lang.Object object); /** * 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. * * @return The name of the web application or null if no name has been declared in the deployment descriptor. */ public String getPortletContextName();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -