portlet-api-2.0-spec-1.0/0000755000175000017500000000000011354474716014747 5ustar drazzibdrazzibportlet-api-2.0-spec-1.0/pom.xml0000644000175000017500000000746111202413200016241 0ustar drazzibdrazzib org.apache.portals portals-pom 1.2 4.0.0 portlet-api_2.0_spec 1.0 bundle Java Portlet Specification V2.0 The Java Portlet API version 2.0 developed by the Java Community Process JSR-286 Expert Group. http://portals.apache.org/portlet-spec/portlet-api-2.0 javax.servlet servlet-api 2.4 provided scm:svn:http://svn.apache.org/repos/asf/portals/portlet-spec/tags/portlet-api_2.0_spec-1.0 scm:svn:https://svn.apache.org/repos/asf/portals/portlet-spec/tags/portlet-api_2.0_spec-1.0 http://svn.apache.org/viewvc/portals/portlet-spec/tags/portlet-api_2.0_spec-1.0 org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 org.apache.felix maven-bundle-plugin 2.0.0 true javax.portlet.filter;version=2.0.0, javax.portlet;version=2.0.0 javax.servlet.http;version=2.4,* ${project.name} ${project.version} ${project.url} org.apache.felix maven-bundle-plugin apache-release org.apache.maven.plugins maven-assembly-plugin portlet-api-2.0-spec-1.0/LICENSE0000644000175000017500000002613611200670244015744 0ustar drazzibdrazzib Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. portlet-api-2.0-spec-1.0/NOTICE0000644000175000017500000000037411200670244015637 0ustar drazzibdrazzib Java Portlet Specification V2.0 Copyright 2004-2009 Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). Original code © Copyright IBM Corp. 2006, 2007 All rights reserved. portlet-api-2.0-spec-1.0/src/0000755000175000017500000000000011354474716015536 5ustar drazzibdrazzibportlet-api-2.0-spec-1.0/src/main/0000755000175000017500000000000011354474716016462 5ustar drazzibdrazzibportlet-api-2.0-spec-1.0/src/main/appended-resources/0000755000175000017500000000000011354474716022252 5ustar drazzibdrazzibportlet-api-2.0-spec-1.0/src/main/appended-resources/META-INF/0000755000175000017500000000000011354474716023412 5ustar drazzibdrazzibportlet-api-2.0-spec-1.0/src/main/appended-resources/META-INF/NOTICE.vm0000644000175000017500000000010411200670114024706 0ustar drazzibdrazzibOriginal code © Copyright IBM Corp. 2006, 2007 All rights reserved. portlet-api-2.0-spec-1.0/src/main/java/0000755000175000017500000000000011354474716017403 5ustar drazzibdrazzibportlet-api-2.0-spec-1.0/src/main/java/javax/0000755000175000017500000000000011354474716020514 5ustar drazzibdrazzibportlet-api-2.0-spec-1.0/src/main/java/javax/portlet/0000755000175000017500000000000011354474716022205 5ustar drazzibdrazzibportlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PreferencesValidator.java0000644000175000017500000000355511201125563027147 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The PreferencesValidator allows to validate the set of * preferences of the associated portlet just before they are * stored in the persistent store. *

* The portlet container invokes the validate method as * part of the invocation of the store method of the * PortletPreferences. */ public interface PreferencesValidator { /** * If the preferences values are successfully validated the call to this method * must finish gracefully. Otherwise it must throw a ValidatorException. * * @param preferences preferences to validate * * @throws ValidatorException if the given preferences contains invalid * settings * */ public void validate(PortletPreferences preferences) throws ValidatorException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletConfig.java0000644000175000017500000002340611201125563025614 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The PortletConfig interface provides the portlet with * its configuration. The configuration holds information about the * portlet that is valid for all users. The configuration is retrieved * from the portlet definition in the deployment descriptor. * The portlet can only read the configuration data. *

* The configuration information contains the portlet name, the portlet * initialization parameters, the portlet resource bundle and the portlet * application context. * * @see Portlet */ public interface PortletConfig { /** * Returns the name of the portlet. *

* The name may be provided via server administration, assigned in the * portlet application deployment descriptor with the portlet-name * tag. * * @return the portlet name */ public String getPortletName (); /** * Returns the PortletContext of the portlet application * the portlet is in. * * @return a PortletContext object, used by the * caller to interact with its portlet container * * @see PortletContext */ public PortletContext getPortletContext (); /** * Gets the resource bundle for the given locale based on the * resource bundle defined in the deployment descriptor * with resource-bundle tag or the inlined resources * defined in the deployment descriptor. * * @param locale the locale for which to retrieve the resource bundle * * @return the resource bundle for the given locale * */ public java.util.ResourceBundle getResourceBundle(java.util.Locale locale); /** * Returns a String containing the value of the named initialization parameter, * or null if the parameter does not exist. * * @param name a String specifying the name * of the initialization parameter * * @return a String containing the value * of the initialization parameter * * @exception java.lang.IllegalArgumentException * if name is null. */ public String getInitParameter(java.lang.String name); /** * Returns the names of the portlet initialization parameters as an * Enumeration of String objects, or an empty Enumeration if the * portlet has no initialization parameters. * * @return an Enumeration of String * objects containing the names of the portlet * initialization parameters, or an empty Enumeration if the * portlet has no initialization parameters. */ public java.util.Enumeration getInitParameterNames(); /** * Returns the names of the public render parameters supported by the portlet * as an Enumeration of String objects, * or an empty Enumeration if the * portlet has not defined public render parameters. *

* Public render parameters are defined in the portlet deployment descriptor * with the supported-public-render-parameter element. * * @return an Enumeration of String * objects containing the names of the public * render parameters, or an empty Enumeration if the * portlet has not defined support for any public render parameters * in the portlet deployment descriptor. * @since 2.0 */ public java.util.Enumeration getPublicRenderParameterNames(); /** * Returns the default namespace for events and public render parameters. * This namespace is defined in the portlet deployment descriptor * with the default-namespace element. *

* If no default namespace is defined in the portlet deployment * descriptor this methods returns the XML default namespace * XMLConstants.NULL_NS_URI. * * @return the default namespace defined in the portlet deployment * descriptor, or XMLConstants.NULL_NS_URI is non is * defined. * @since 2.0 */ public java.lang.String getDefaultNamespace(); /** * Returns the QNames of the publishing events supported by the portlet * as an Enumeration of QName objects, * or an empty Enumeration if the * portlet has not defined any publishing events. *

* Publishing events are defined in the portlet deployment descriptor * with the supported-publishing-event element. *

* Note that this call does not return any events published that have not been * declared in the deployment descriptor as supported. *

* If the event was defined using the name element instead of * the qname element the defined default namespace * is added as namespace for the returned QName. * * @return an Enumeration of QName * objects containing the names of the publishing events, * or an empty Enumeration if the * portlet has not defined any support for publishing events in * the deployment descriptor. * @since 2.0 */ public java.util.Enumeration getPublishingEventQNames(); /** * Returns the QNames of the processing events supported by the portlet * as an Enumeration of QName objects, * or an empty Enumeration if the * portlet has not defined any processing events. *

* Processing events are defined in the portlet deployment descriptor * with the supported-processing-event element. *

* If the event was defined using the name element instead of * the qname element the defined default namespace * is added as namespace for the returned QName. * * @return an Enumeration of QName * objects containing the names of the processing events, * or an empty Enumeration if the * portlet has not defined any support for processing events in * the deployment descriptor. * @since 2.0 */ public java.util.Enumeration getProcessingEventQNames(); /** * Returns the locales supported by the portlet * as an Enumeration of Locale objects, * or an empty Enumeration if the * portlet has not defined any supported locales. *

* Supported locales are defined in the portlet deployment descriptor * with the supported-locale element. * * @return an Enumeration of Locale * objects containing the supported locales, * or an empty Enumeration if the * portlet has not defined any supported locales in * the deployment descriptor. * @since 2.0 */ public java.util.Enumeration getSupportedLocales(); /** * Returns the container runtime options * and values for this portlet. *

* The portlet can set container runtime * options in the portlet.xml via the * container-runtime-option element with a name and a * value on the application and portlet level.
* If a container runtime option is set on the portlet application * level and on the portlet level with the same name the setting * on the portlet level takes precedence and overwrites the one * set on the portal application level. *

* The map returned from this method will provide the subset the * portlet container supports of the options the portlet has specified * in the portlet.xml. Options that the portlet container * does not support will not be returned in this map. *

* The map will contain name of the runtime option as key of type String * and the runtime options as values of type String array (String[]) * with the values specified in the portlet.xml deployment descriptor. * * @since 2.0 * * @return an immutable Map containing portlet * container runtime options names as keys and the * container runtime values as map values, or an empty Map * if no portlet container runtime options are set * in the portlet.xml or supported by this portlet container. * The keys in the map are of type String. The values in the map are of type * String array (String[]). */ public java.util.Map getContainerRuntimeOptions(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/package-info.java0000644000175000017500000000377411201654502025367 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ /** * The javax.portlet package defines the API for Java Portlet Specification V2.0. *

* A portlet is a Java technology based web component, managed by a portlet container, * that processes requests and generates dynamic content. Portlets provide a presentation * layer to Information Systems. *

* Portlets generate fragments of markup (e.g. HTML, XHTML, WML). A portal combines markup * fragments generated by different portlets into a portal page. *

* A portlet container manages the lifecyle of portlets. It also provides the required runtime environment. *

* Portlets are bundled in Portlet Applications as web applications using the WAR file format. * A portlet application consists of two deployment descriptors: one to specify * the web application resources (web.xml) and one to specify the portlet resources * (portlet.xml). The portlet.xml must follow the schema defined by the * http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd namespace. *

*/ package javax.portlet; portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletModeException.java0000644000175000017500000000614611201125563027154 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The PortletModeException is thrown when a portlet * tries to use or set a portlet mode that is not supported by the current * runtime environment or the portlet. */ public class PortletModeException extends PortletException { private transient PortletMode _mode = null; private static final long serialVersionUID = 1L; /** * Constructs a new portlet mode exception with the given text and the * portlet mode that caused this exception. The * portlet container may use the text and portlet mode write it to a log. * * @param text * the exception text * @param mode * the mode causing the exception */ public PortletModeException (String text, PortletMode mode) { super (text); _mode = mode; } /** * Constructs a new portlet mode exception when the portlet needs to do * the following: *

* * @param text * the exception text * @param cause * the root cause * @param mode * the mode causing the exception */ public PortletModeException (String text, Throwable cause, PortletMode mode) { super(text, cause); _mode = mode; } /** * Constructs a new portlet mode exception when the portlet needs to throw an * exception. The exception message is based on the localized message * of the underlying exception and the portlet mode that caused this exception. * * @param cause * the root cause * @param mode * the mode causing the exception */ public PortletModeException (Throwable cause, PortletMode mode) { super(cause); _mode = mode; } /** * Returns the unsupported portlet mode causing this exception. * * @return the portlet mode that caused this exception */ public PortletMode getMode() { return _mode; } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ProcessAction.java0000644000175000017500000000332611201125563025610 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Annotation for marking a method for processing * a specific action. * The GenericPortlet tries to dispatch to methods annotated * with the tag @ProcessAction for any received * processAction call. * * @since 2.0 */ @Target(ElementType.METHOD) @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public @interface ProcessAction { /** * Name of the action. * Must be set on the * ActionURL as value of the * parameter javax.portlet.action. * * @return action name */ String name(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletContext.java0000644000175000017500000004013411201125563026030 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.net.MalformedURLException; /** * The PortletContext interface defines a portlet view * of the portlet container. * The PortletContext also makes resources available * to the portlet. Using the context, a portlet can access * the portlet log, and obtain URL references to resources. * *

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 /catalog. * They are possibly installed via a .war 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. *

* Attributes stored in the context are global for all users and all * components in the portlet application. *

* 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. */ public interface PortletContext { /** * Returns the name and version of the portlet container in which the * portlet is running. * *

* The form of the returned string is containername/versionnumber. * * * @return the string containing at least name and version number */ public String getServerInfo (); /** * Returns a {@link PortletRequestDispatcher} object that acts * as a wrapper for the resource located at the given path. * A PortletRequestDispatcher object can be used include the * resource in a response. The resource can be dynamic or static. * *

The pathname must begin with a slash ( / ) and is interpreted as relative * to the current context root. * *

This method returns null if the PortletContext * cannot return a PortletRequestDispatcher * for any reason. * * * @param path a String specifying the pathname * to the resource * @return a PortletRequestDispatcher object * that acts as a wrapper for the resource * at the specified path. * @see PortletRequestDispatcher */ public PortletRequestDispatcher getRequestDispatcher(String path); /** * Returns a {@link PortletRequestDispatcher} object that acts * as a wrapper for the named servlet. * *

Servlets (and also JSP pages) may be given names via server * administration or via a web application deployment descriptor. * *

This method returns null if the * PortletContext cannot return a * PortletRequestDispatcher for any reason. * * * @param name a String specifying the name * of a servlet to be wrapped * * @return a PortletRequestDispatcher object * that acts as a wrapper for the named servlet * * @see PortletRequestDispatcher * */ public PortletRequestDispatcher getNamedDispatcher(String name); /** * 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. *

* In order to access protected resources the path has to be prefixed with * /WEB-INF/ (for example /WEB-INF/myportlet/myportlet.jsp). * Otherwise, the direct path is used * (for example /myportlet/myportlet.jsp). * * @param path the path to the resource * * @return the input stream */ public java.io.InputStream getResourceAsStream (String path); /** * Returns the major version of the Portlet API that this portlet * container supports. * * @return the major version * * @see #getMinorVersion() */ public int getMajorVersion (); /** * Returns the minor version of the Portlet API that this portlet * container supports. * * @return the minor version * * @see #getMajorVersion() */ public int getMinorVersion (); /** * Returns the MIME type of the specified file, or null 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 text/html and image/gif. * * * @param file a String specifying the name * of a file * * @return a String specifying the MIME type of the file * */ public String getMimeType(String file); /** * Returns a String containing the real path * for a given virtual path. For example, the path /index.html * returns the absolute file path of the portlet container file system. * *

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 null * 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 .war archive). * * @param path a String specifying a virtual path * * @return a String specifying the real path, * or null if the transformation cannot be performed. */ public String getRealPath(String path); /** * 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 (/). 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

* * /welcome.html
* /catalog/index.html
* /catalog/products.html
* /catalog/offers/books.html
* /catalog/offers/music.html
* /customer/login.jsp
* /WEB-INF/web.xml
* /WEB-INF/classes/com.acme.OrderPortlet.class,

*
* * getResourcePaths("/") returns * {"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}
* getResourcePaths("/catalog/") returns * {"/catalog/index.html", "/catalog/products.html", "/catalog/offers/"}.
* * @param path * the partial path used to match the resources, which must start with a slash * @return a Set containing the directory listing, or null if there * are no resources in the web application of which the path * begins with the supplied path. */ public java.util.Set getResourcePaths(String path); /** * Returns a URL to the resource that is mapped to a specified * path. The path must begin with a slash (/) and is interpreted * as relative to the current context root. * *

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 .war file. * *

The portlet container must implement the URL handlers * and URLConnection objects that are necessary * to access the resource. * *

This method returns null * if no resource is mapped to the pathname. * *

Some containers may allow writing to the URL returned by * this method using the methods of the URL class. * *

The resource content is returned directly, so be aware that * requesting a .jsp page returns the JSP source code. * Use a RequestDispatcher instead to include results of * an execution. * *

This method has a different purpose than * java.lang.Class.getResource, * which looks up resources based on a class loader. This * method does not use class loaders. * * @param path a String specifying * the path to the resource * * @return the resource located at the named path, * or null if there is no resource * at that path * * @exception 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 * getAttributeNames. * *

The attribute is returned as a java.lang.Object * or some subclass. * Attribute names should follow the same convention as package * names. The Java Portlet API specification reserves names * matching java.*, javax.*, * and sun.*. * * * @param name a String specifying the name * of the attribute * * @return an Object containing the value * of the attribute, or null * if no attribute exists matching the given * name * * @see #getAttributeNames * * @exception java.lang.IllegalArgumentException * if name is null. */ public java.lang.Object getAttribute(java.lang.String name); /** * Returns an Enumeration containing the attribute names * available within this portlet context, or an empty * Enumeration if no attributes are available. Use the * {@link #getAttribute} method with an attribute name * to get the value of an attribute. * * @return an Enumeration of attribute names * * @see #getAttribute */ public java.util.Enumeration getAttributeNames(); /** * Returns a String containing the value of the named context-wide * initialization parameter, or null if the parameter does not exist. * This method provides configuration information which may be useful for * an entire "portlet application". * * @param name a String containing the name of the * requested parameter * * @return a String containing the value * of the initialization parameter, or * null if the parameter does not exist. * * @see #getInitParameterNames * * @exception java.lang.IllegalArgumentException * if name is null. */ public java.lang.String getInitParameter(java.lang.String name); /** * Returns the names of the context initialization parameters as an * Enumeration of String objects, or an empty Enumeration if the context * has no initialization parameters. * * @return an Enumeration of String * 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. *

* This method mapps to the ServletContext.log method. * The portlet container may in addition log this message in a * portlet container specific log file. * * @param msg a String 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. *

* This method is mapped to the ServletContext.log method. * The portlet container may in addition log this message in a * portlet container specific log file. * * @param message a String that * describes the error or exception * @param throwable the Throwable 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 null. * * @param name a String specifying the name * of the attribute to be removed * * @exception java.lang.IllegalArgumentException * if name is null. */ 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. *

* If a null value is passed, the effect is the same as calling * removeAttribute(). * *

Attribute names should follow the same convention as package * names. The Java Portlet API specification reserves names * matching java.*, javax.*, and * sun.*. * * @param name a String specifying the name * of the attribute * @param object an Object representing the * attribute to be bound * * @exception java.lang.IllegalArgumentException * if name is null. */ 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 web.xml deployment descriptor for this web application by the * display-name element. * * * @return The name of the web application or null if no name has been declared in the deployment descriptor. */ public String getPortletContextName(); /** * Returns the container container runtime options * keys supported by this portlet container. * * @since 2.0 * * @return container runtime options keys supported by this * container as String values. */ public java.util.Enumeration getContainerRuntimeOptions(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletRequest.java0000644000175000017500000010275611201125563026045 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.util.Locale; /** * The PortletRequest defines the base interface to provide client * request information to a portlet. The portlet container uses two specialized * versions of this interface when invoking a portlet, ActionRequest * and RenderRequest. The portlet container creates these objects and * passes them as arguments to the portlet's processAction and * render methods. * * @see ActionRequest * @see RenderRequest */ public interface PortletRequest { /** Used to retrieve user information attributes with the * getAttribute call. The user information is returned * as a Map object. The portlet must define the * user information attribute it is interested in inside the * user-attribute section of the deployment descriptor. * If an attribute is not supported * by the current runtime system it will not show up in the user * attribute map.
* If the user-attribute is supported by the runtime system, but not * defined for a particular user, then for that user the attribute * exists in the returned map and the attribute has a null value. *

* If the user-attribute is not defined for the current user it * will not show up in the Map. *

* The value is javax.portlet.userinfo. */ public static final String USER_INFO = "javax.portlet.userinfo"; /** * Used to retrieve an instance of the javax.ccpp.Profile * with the getAttribute call. The returned profile is based * on the current portlet request and may contain additional CC/PP * information set by the portal / portlet container. *

* The value is javax.portlet.ccpp. * * @since 2.0 */ public static final String CCPP_PROFILE = "javax.portlet.ccpp"; /** * String identifier for Basic authentication. Value "BASIC". */ public static final String BASIC_AUTH = "BASIC"; /** * String identifier for Form based authentication. Value "FORM". */ public static final String FORM_AUTH = "FORM"; /** * String identifier for Certification based authentication. Value "CLIENT_CERT". */ public static final String CLIENT_CERT_AUTH = "CLIENT_CERT"; /** * String identifier for Digest based authentication. Value "DIGEST". */ public static final String DIGEST_AUTH = "DIGEST"; /** * P3P user information constants. *

* Note: these are only available in the Java SE 5.0 supported version * of the API. * * @since 2.0 */ public enum P3PUserInfos { USER_BDATE_YMD_YEAR("user.bdate.ymd.year"), USER_BDATE_YMD_MONTH("user.bdate.ymd.month"), USER_BDATE_YMD_DAY("user.bdate.ymd.day"), USER_BDATE_HMS_HOUR("user.bdate.hms.hour"), USER_BDATE_HMS_MINUTE("user.bdate.hms.minute"), USER_BDATE_HMS_SECOND("user.bdate.hms.second"), USER_BDATE_FRACTIONSECOND("user.bdate.fractionsecond"), USER_BDATE_TIMEZONE("user.bdate.timezone"), USER_GENDER("user.gender"), USER_EMPLOYER("user.employer"), USER_DEPARTMENT("user.department"), USER_JOBTITLE("user.jobtitle"), USER_NAME_PREFIX("user.name.prefix"), USER_NAME_GIVEN("user.name.given"), USER_NAME_FAMILY("user.name.family"), USER_NAME_MIDDLE("user.name.middle"), USER_NAME_SUFFIX("user.name.suffix"), USER_NAME_NICKNAME("user.name.nickName"), USER_LOGIN_ID("user.login.id"), USER_HOMEINFO_POSTAL_NAME("user.home-info.postal.name"), USER_HOMEINFO_POSTAL_STREET("user.home-info.postal.street"), USER_HOMEINFO_POSTAL_CITY("user.home-info.postal.city"), USER_HOMEINFO_POSTAL_STATEPROV("user.home-info.postal.stateprov"), USER_HOMEINFO_POSTAL_POSTALCODE("user.home-info.postal.postalcode"), USER_HOMEINFO_POSTAL_COUNTRY("user.home-info.postal.country"), USER_HOMEINFO_POSTAL_ORGANIZATION("user.home-info.postal.organization"), USER_HOMEINFO_TELECOM_TELEPHONE_INTCODE("user.home-info.telecom.telephone.intcode"), USER_HOMEINFO_TELECOM_TELEPHONE_LOCCODE("user.home-info.telecom.telephone.loccode"), USER_HOMEINFO_TELECOM_TELEPHONE_NUMBER("user.home-info.telecom.telephone.number"), USER_HOMEINFO_TELECOM_TELEPHONE_EXT("user.home-info.telecom.telephone.ext"), USER_HOMEINFO_TELECOM_TELEPHONE_COMMENT("user.home-info.telecom.telephone.comment"), USER_HOMEINFO_TELECOM_FAX_INTCODE("user.home-info.telecom.fax.intcode"), USER_HOMEINFO_TELECOM_FAX_LOCCODE("user.home-info.telecom.fax.loccode"), USER_HOMEINFO_TELECOM_FAX_NUMBER("user.home-info.telecom.fax.number"), USER_HOMEINFO_TELECOM_FAX_EXT("user.home-info.telecom.fax.ext"), USER_HOMEINFO_TELECOM_FAX_COMMENT("user.home-info.telecom.fax.comment"), USER_HOMEINFO_TELECOM_MOBILE_INTCODE("user.home-info.telecom.mobile.intcode"), USER_HOMEINFO_TELECOM_MOBILE_LOCCODE("user.home-info.telecom.mobile.loccode"), USER_HOMEINFO_TELECOM_MOBILE_NUMBER("user.home-info.telecom.mobile.number"), USER_HOMEINFO_TELECOM_MOBILE_EXT("user.home-info.telecom.mobile.ext"), USER_HOMEINFO_TELECOM_MOBILE_COMMENT("user.home-info.telecom.mobile.comment"), USER_HOMEINFO_TELECOM_PAGER_INTCODE("user.home-info.telecom.pager.intcode"), USER_HOMEINFO_TELECOM_PAGER_LOCCODE("user.home-info.telecom.pager.loccode"), USER_HOMEINFO_TELECOM_PAGER_NUMBER("user.home-info.telecom.pager.number"), USER_HOMEINFO_TELECOM_PAGER_EXT("user.home-info.telecom.pager.ext"), USER_HOMEINFO_TELECOM_PAGER_COMMENT("user.home-info.telecom.pager.comment"), USER_HOMEINFO_ONLINE_EMAIL("user.home-info.online.email"), USER_HOMEINFO_ONLINE_URI("user.home-info.online.uri"), USER_BUSINESSINFO_POSTAL_NAME("user.business-info.postal.name"), USER_BUSINESSINFO_POSTAL_STREET("user.business-info.postal.street"), USER_BUSINESSINFO_POSTAL_CITY("user.business-info.postal.city"), USER_BUSINESSINFO_POSTAL_STATEPROV("user.business-info.postal.stateprov"), USER_BUSINESSINFO_POSTAL_POSTALCODE("user.business-info.postal.postalcode"), USER_BUSINESSINFO_POSTAL_COUNTRY("user.business-info.postal.country"), USER_BUSINESSINFO_POSTAL_ORGANIZATION("user.business-info.postal.organization"), USER_BUSINESSINFO_TELECOM_TELEPHONE_INTCODE("user.business-info.telecom.telephone.intcode"), USER_BUSINESSINFO_TELECOM_TELEPHONE_LOCCODE("user.business-info.telecom.telephone.loccode"), USER_BUSINESSINFO_TELECOM_TELEPHONE_NUMBER("user.business-info.telecom.telephone.number"), USER_BUSINESSINFO_TELECOM_TELEPHONE_EXT("user.business-info.telecom.telephone.ext"), USER_BUSINESSINFO_TELECOM_TELEPHONE_COMMENT("user.business-info.telecom.telephone.comment"), USER_BUSINESSINFO_TELECOM_FAX_INTCODE("user.business-info.telecom.fax.intcode"), USER_BUSINESSINFO_TELECOM_FAX_LOCCODE("user.business-info.telecom.fax.loccode"), USER_BUSINESSINFO_TELECOM_FAX_NUMBER("user.business-info.telecom.fax.number"), USER_BUSINESSINFO_TELECOM_FAX_EXT("user.business-info.telecom.fax.ext"), USER_BUSINESSINFO_TELECOM_FAX_COMMENT("user.business-info.telecom.fax.comment"), USER_BUSINESSINFO_TELECOM_MOBILE_INTCODE("user.business-info.telecom.mobile.intcode"), USER_BUSINESSINFO_TELECOM_MOBILE_LOCCODE("user.business-info.telecom.mobile.loccode"), USER_BUSINESSINFO_TELECOM_MOBILE_NUMBER("user.business-info.telecom.mobile.number"), USER_BUSINESSINFO_TELECOM_MOBILE_EXT("user.business-info.telecom.mobile.ext"), USER_BUSINESSINFO_TELECOM_MOBILE_COMMENT("user.business-info.telecom.mobile.comment"), USER_BUSINESSINFO_TELECOM_PAGER_INTCODE("user.business-info.telecom.pager.intcode"), USER_BUSINESSINFO_TELECOM_PAGER_LOCCODE("user.business-info.telecom.pager.loccode"), USER_BUSINESSINFO_TELECOM_PAGER_NUMBER("user.business-info.telecom.pager.number"), USER_BUSINESSINFO_TELECOM_PAGER_EXT("user.business-info.telecom.pager.ext"), USER_BUSINESSINFO_TELECOM_PAGER_COMMENT("user.business-info.telecom.pager.comment"), USER_BUSINESSINFO_ONLINE_EMAIL("user.business-info.online.email"), USER_BUSINESSINFO_ONLINE_URI("user.business-info.online.uri"); P3PUserInfos(String value) {this.value = value; } private final String value; public String toString() {return value;} } /** * String identifier for the portlet action lifecycle phase. In this * phase the portlet request and response are from type * ActionRequest and ActionResponse. *

* The value of the constant is ACTION_PHASE. * * @since 2.0 */ public static final String ACTION_PHASE = "ACTION_PHASE"; /** * String identifier for the portlet event lifecycle phase. In this * phase the portlet request and response are from type * EventRequest and EventResponse. *

* The value of the constant is EVENT_PHASE. * * @since 2.0 */ public static final String EVENT_PHASE = "EVENT_PHASE"; /** * String identifier for the portlet render lifecycle phase. In this * phase the portlet request and response are from type * RenderRequest and RenderResponse. *

* The value of the constant is RENDER_PHASE. * * @since 2.0 */ public static final String RENDER_PHASE = "RENDER_PHASE"; /** * String identifier for the portlet resource serving lifecycle phase. In this * phase the portlet request and response are from type * ResourceRequest and ResourceResponse. *

* The value of the constant is RESOURCE_PHASE. * * @since 2.0 */ public static final String RESOURCE_PHASE = "RESOURCE_PHASE"; /** * Provides the portlet lifecycle phase of the current request * as request attribute. *

* Valid values are: ACTION_PHASE, EVENT_PHASE, RENDER_PHASE, * RESOURCE_SERVING_PHASE. *

* The value of the constant is javax.portlet.lifecylce_phase. * * @since 2.0 */ public static final String LIFECYCLE_PHASE = "javax.portlet.lifecycle_phase"; /** * The RENDER_PART portlet request attribute is set by portals * that are streaming based and therefore need to split the * render phase into two parts: first the RENDER_HEADERS part * where the portlet should only set the header related data * and the portlet title, and second the RENDER_MARKUP part * in which the portlet should produce its markup. *

* Non-streaming portals will not set this attribute and thus * the portlet should set headers, portlet title and produce * its markup in a single render request. *

* The value of the constant is javax.portlet.render_part. * * @since 2.0 */ public static final String RENDER_PART = "javax.portlet.render_part"; /** * The RENDER_HEADERS is a possible value of the RENDER_PART * request attribute and denotes that the portlet should set * the intended headers and the portlet title of this render * request. *

* The value of the constant is RENDER_HEADERS. * * @since 2.0 */ public static final String RENDER_HEADERS = "RENDER_HEADERS"; /** * The RENDER_MARKUP is a possible value of the RENDER_PART * request attribute and denotes that the portlet should * produce its markup for this render request. *

* The value of the constant is RENDER_MARKUP. * * @since 2.0 */ public static final String RENDER_MARKUP = "RENDER_MARKUP"; /** * The action scope ID that the portlet container uses * for storing the current action scope as render parameter * if the javax.portlet.actionScopedRequestAttributes * container runtime option is used by the portlet. *

* The value is javax.portlet.as. * @since 2.0 */ public static final String ACTION_SCOPE_ID = "javax.portlet.as"; /** * Returns true, if the given window state is valid * to be set for this portlet in the context * of the current request. * * @param state window state to checked * * @return true, if it is valid for this portlet * in this request to change to the * given window state * */ public boolean isWindowStateAllowed(WindowState state); /** * Returns true, if the given portlet mode is a valid * one to set for this portlet in the context * of the current request. * * @param mode portlet mode to check * * @return true, if it is valid for this portlet * in this request to change to the * given portlet mode * */ public boolean isPortletModeAllowed(PortletMode mode); /** * Returns the current portlet mode of the portlet. * * @return the portlet mode */ public PortletMode getPortletMode (); /** * Returns the current window state of the portlet. * * @return the window state */ public WindowState getWindowState (); /** * Returns the preferences object associated with the portlet. * * @return the portlet preferences */ public PortletPreferences getPreferences (); /** * Returns the current portlet session or, if there is no current session, * creates one and returns the new session. *

* Creating a new portlet session will result in creating * a new HttpSession on which the portlet session is based on. * * @return the portlet session */ public PortletSession getPortletSession (); /** * Returns the current portlet session or, if there is no current session * and the given flag is true, creates one and returns * the new session. *

* If the given flag is false and there is no current * portlet session, this method returns null. *

* Creating a new portlet session will result in creating * a new HttpSession on which the portlet session is based on. * * @param create * true to create a new session,
* false to return null if there * is no current session * @return the portlet session * */ public PortletSession getPortletSession (boolean create); /** * Returns the value of the specified request property * as a String. If the request did not include a property * of the specified name, this method returns null. *

* A portlet can access portal/portlet-container specific properties * through this method and, if available, the * headers of the HTTP client request. *

* This method should only be used if the * property has only one value. If the property might have * more than one value, use {@link #getProperties}. *

* If this method is used with a multivalued * parameter, the value returned is equal to the first value * in the Enumeration returned by getProperties. * * @param name a String specifying the * property name * * @return a String containing the * value of the requested * property, or null * if the request does not * have a property of that name. * * @exception java.lang.IllegalArgumentException * if name is null. */ public String getProperty(String name); /** * Returns all the values of the specified request property * as a Enumeration of String objects. *

* If the request did not include any properties * of the specified name, this method returns an empty * Enumeration. * The property name is case insensitive. You can use * this method with any request property. * * @param name a String specifying the * property name * * @return a Enumeration containing * the values of the requested property. If * the request does not have any properties of * that name return an empty Enumeration. * * @exception java.lang.IllegalArgumentException * if name is null. */ public java.util.Enumeration getProperties(String name); /** * * Returns a Enumeration of all the property names * this request contains. If the request has no * properties, this method returns an empty Enumeration. * * * @return an Enumeration of all the * property names sent with this * request; if the request has * no properties, an empty Enumeration. */ public java.util.Enumeration getPropertyNames(); /** * Returns the context of the calling portal. * * @return the context of the calling portal */ public PortalContext getPortalContext(); /** * Returns the name of the authentication scheme used for the * connection between client and portal, * for example, BASIC_AUTH, CLIENT_CERT_AUTH, * a custom one or null if there was no authentication. * * @return one of the static members BASIC_AUTH, * FORM_AUTH, CLIENT_CERT_AUTH, * DIGEST_AUTH (suitable for == comparison) * indicating the authentication scheme, * a custom one, or * null if the request was * not authenticated. */ public java.lang.String getAuthType(); /** * Returns the context path which is the path prefix associated with the deployed * portlet application. If the portlet application is rooted at the * base of the web server URL namespace (also known as "default" context), * this path must be an empty string. Otherwise, it must be the path the * portlet application is rooted to, the path must start with a '/' and * it must not end with a '/' character. *

* To encode a URL the {@link PortletResponse#encodeURL} method must be used. * * @return a String specifying the * portion of the request URL that indicates the context * of the request * * @see PortletResponse#encodeURL */ public String getContextPath(); /** * Returns the login of the user making this request, if the user * has been authenticated, or null if the user has not been authenticated. * * @return a String specifying the login * of the user making this request, or null * if the user login is not known. * */ public java.lang.String getRemoteUser(); /** * Returns a java.security.Principal object containing the name of the * current authenticated user. * * @return a java.security.Principal containing * the name of the user making this request, or * null if the user has not been * authenticated. */ public java.security.Principal getUserPrincipal(); /** * Returns a boolean indicating whether the authenticated user is * included in the specified logical "role". Roles and role membership can be * defined using deployment descriptors. If the user has not been * authenticated, the method returns false. * * @param role a String specifying the name * of the role * * @return a boolean indicating whether * the user making this request belongs to a given role; * false if the user has not been * authenticated. */ public boolean isUserInRole(java.lang.String role); /** * * Returns the value of the named attribute as an Object, * or null if no attribute of the given name exists. *

* Attribute names should follow the same conventions as package * names. This specification reserves names matching java.*, * and javax.*. *

* In a distributed portlet web application the Object * needs to be serializable. * * @param name a String specifying the name of * the attribute * * @return an Object containing the value * of the attribute, or null if * the attribute does not exist. * * @exception java.lang.IllegalArgumentException * if name is null. * */ public Object getAttribute(String name); /** * Returns an Enumeration containing the * names of the attributes available to this request. * This method returns an empty Enumeration * if the request has no attributes available to it. * * * @return an Enumeration of strings * containing the names * of the request attributes, or an empty * Enumeration if the request * has no attributes available to it. */ public java.util.Enumeration getAttributeNames(); /** * Returns the value of a request parameter as a String, * or null if the parameter does not exist. Request parameters * are extra information sent with the request. The returned parameter * are "x-www-form-urlencoded" decoded. *

* Only parameters targeted to the current portlet are accessible. *

* This method should only be used if the * parameter has only one value. If the parameter might have * more than one value, use {@link #getParameterValues}. *

* If this method is used with a multivalued * parameter, the value returned is equal to the first value * in the array returned by getParameterValues. * * * * @param name a String specifying the * name of the parameter * * @return a String representing the * single value of the parameter * * @see #getParameterValues * * @exception java.lang.IllegalArgumentException * if name is null. * */ public String getParameter(String name); /** * * Returns an Enumeration of String * objects containing the names of the parameters contained * in this request. If the request has * no parameters, the method returns an * empty Enumeration. *

* Only parameters targeted to the current portlet are returned. * * * @return an Enumeration of String * objects, each String containing * the name of a request parameter; or an * empty Enumeration if the * request has no parameters. */ public java.util.Enumeration getParameterNames(); /** * Returns an array of String objects containing * all of the values the given request parameter has, or * null if the parameter does not exist. * The returned parameters are "x-www-form-urlencoded" decoded. *

* If the parameter has a single value, the array has a length * of 1. * * * @param name a String containing the name of * the parameter the value of which is requested * * @return an array of String objects * containing the parameter values. * * @see #getParameter * * @exception java.lang.IllegalArgumentException * if name is null. * */ public String[] getParameterValues(String name); /** * Returns a Map of the parameters of this request. * Request parameters are extra information sent with the request. * The returned parameters are "x-www-form-urlencoded" decoded. *

* The values in the returned Map are from type * String array (String[]). *

* If no parameters exist this method returns an empty Map. * * @return an immutable Map containing parameter names as * keys and parameter values as map values, or an empty Map * if no parameters exist. The keys in the parameter * map are of type String. The values in the parameter map are of type * String array (String[]). */ public java.util.Map getParameterMap(); /** * Returns a boolean indicating whether this request was made * using a secure channel between client and the portal, such as HTTPS. * * @return true, if the request was made using a secure channel. */ public boolean isSecure(); /** * Stores an attribute in this request. * *

Attribute names should follow the same conventions as * package names. Names beginning with java.*, * javax.*, and com.sun.* are * reserved. *
If the value passed into this method is null, * the effect is the same as calling {@link #removeAttribute}. * * * @param name a String specifying * the name of the attribute * * @param o the Object to be stored * * * @exception java.lang.IllegalArgumentException * if name is null. */ public void setAttribute(String name, Object o); /** * * Removes an attribute from this request. This method is not * generally needed, as attributes only persist as long as the request * is being handled. * *

Attribute names should follow the same conventions as * package names. Names beginning with java.*, * javax.*, and com.sun.* are * reserved. * * @param name a String specifying * the name of the attribute to be removed * * * @exception java.lang.IllegalArgumentException * if name is null. */ public void removeAttribute(String name); /** * * Returns the session ID indicated in the client request. * This session ID may not be a valid one, it may be an old * one that has expired or has been invalidated. * If the client request * did not specify a session ID, this method returns * null. * * @return a String specifying the session * ID, or null if the request did * not specify a session ID * * @see #isRequestedSessionIdValid * */ public String getRequestedSessionId(); /** * * Checks whether the requested session ID is still valid. * * @return true if this * request has an id for a valid session * in the current session context; * false otherwise * * @see #getRequestedSessionId * @see #getPortletSession */ public boolean isRequestedSessionIdValid(); /** * Returns the portal preferred content type for the response. *

* The following restrictions apply: *

* * @return preferred MIME type of the response */ public String getResponseContentType(); /** * Gets a list of content types which the portal accepts for the response. * This list is ordered with the most preferable types listed first. *

* The following restrictions apply: *

* * @return ordered list of MIME types for the response */ public java.util.Enumeration getResponseContentTypes(); /** * Returns the preferred Locale in which the portal will accept content. * The Locale may be based on the Accept-Language header of the client. * * @return the preferred Locale in which the portal will accept content. */ public java.util.Locale getLocale(); /** * Returns an Enumeration of Locale objects indicating, in decreasing * order starting with the preferred locale in which the portal will * accept content for this request. * The Locales may be based on the Accept-Language header of the client. * * @return an Enumeration of Locales, in decreasing order, in which * the portal will accept content for this request */ public java.util.Enumeration getLocales(); /** * Returns the name of the scheme used to make this request. * For example, http, https, or ftp. * Different schemes have different rules for constructing URLs, * as noted in RFC 1738. * * @return a String containing the name * of the scheme used to make this request */ public String getScheme(); /** * Returns the host name of the server that received the request. * * @return a String containing the name * of the server to which the request was sent */ public String getServerName(); /** * Returns the port number on which this request was received. * * @return an integer specifying the port number */ public int getServerPort(); /** * Returns the portlet window ID. The portlet window ID is * unique for this portlet window and is constant for the lifetime * of the portlet window. *

* This ID is the same that is used by the portlet container for * scoping the portlet-scope session attributes. * * @since 2.0 * @return the portlet window ID */ public String getWindowID(); /** * Returns an array containing all of the Cookie properties. *

* This method returns null if no cookies exist. * * @since 2.0 * @return array of cookie properties, or * null if no cookies exist. * @see MimeResponse#addProperty(Cookie) */ public javax.servlet.http.Cookie[] getCookies(); /** * Returns a Map of the private parameters of this request. * Private parameters are not shared with other portlets or components. * The returned parameters are "x-www-form-urlencoded" decoded. *

* The values in the returned Map are from type * String array (String[]). *

* If no private parameters exist this method returns an empty Map. * * @since 2.0 * @return an immutable Map containing private parameter names as * keys and private parameter values as map values, or an empty Map * if no private parameters exist. The keys in the parameter * map are of type String. The values in the parameter map are of type * String array (String[]). */ public java.util.Map getPrivateParameterMap(); /** * Returns a Map of the public parameters of this request. * Public parameters may be shared with other portlets or components and * defined in the portlet deployment descriptor with the * supported-public-render-parameter element. * The returned parameters are "x-www-form-urlencoded" decoded. *

* The values in the returned Map are from type * String array (String[]). *

* If no public parameters exist this method returns an empty Map. * * @since 2.0 * @return an immutable Map containing public parameter names as * keys and public parameter values as map values, or an empty Map * if no public parameters exist. The keys in the parameter * map are of type String. The values in the parameter map are of type * String array (String[]). */ public java.util.Map getPublicParameterMap(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletRequestDispatcher.java0000644000175000017500000001363511201125563030051 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The PortletRequestDispatcher interface defines an object that * receives requests from the client and sends them to the specified resources * (such as a servlet, HTML file, or JSP file) on the server. The portlet * container creates the PortletRequestDispatcher object, which * is used as a wrapper around a server resource located at a particular path or * given by a particular name. * */ public interface PortletRequestDispatcher { /** * * Includes the content of a resource (servlet, JSP page, HTML file) in the * response. In essence, this method enables programmatic server-side * includes. *

* The included servlet cannot set or change the response status code or set * headers; any attempt to make a change is ignored. *

* This method is kept in order to provide backward compatibility with * version 1.0. Please use {@link #include(PortletRequest, PortletResponse)} instead * of this method. * * @param request * a {@link RenderRequest} object that contains the client * request. Must be either the render request passed to the * portlet in render or a wrapped version of this * render request. * * @param response * a {@link RenderResponse} object that contains the render * response. Must be either the render response passed to the * portlet in render or a wrapped version of this * render response. * * @exception PortletException * if the included resource throws a ServletException, or * other exceptions that are not Runtime- or IOExceptions. * * @exception java.io.IOException * if the included resource throws this exception * * */ public void include(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException; /** * * Includes the content of a resource (servlet, JSP page, HTML file) in the * response. In essence, this method enables programmatic server-side * includes. *

* The included servlet cannot set or change the response status code or set * headers; any attempt to make a change is ignored. * * * @param request * a {@link PortletRequest} object that contains the portlet * request. Must be either the original request passed to the * portlet or a wrapped version of this request. * * @param response * a {@link PortletResponse} object that contains the portlet * response. Must be either the portlet response passed to the * portlet or a wrapped version of this response. * * @exception PortletException * if the included resource throws a ServletException, or * other exceptions that are not Runtime- or IOExceptions. * * @exception java.io.IOException * if the included resource throws this exception * * @since 2.0 */ public void include(PortletRequest request, PortletResponse response) throws PortletException, java.io.IOException; /** * Forwards a portlet request from a portlet to another resource (servlet, JSP file, or HTML file) * on the server. This method allows the portlet to do preliminary processing of a * request and another resource to generate the response. *

* The forward method should be called before the response has been * committed to the portlet container (before response body output has been flushed). * If the response already has been committed, this method throws an * IllegalStateException. Uncommitted output in the response buffer * is automatically cleared before the forward. *

* The request and response parameters must be either the same objects as were passed to * the calling portlet or be wrapped versions of these. * * @param request a request object that represents the request to the * portlet * @param response a reponse object that contains the portlet response * * @exception PortletException * if the included resource throws a ServletException, or * other exceptions that are not Runtime- or IOExceptions. * @exception java.io.IOException * if the included resource throws this exception * @exception java.lang.IllegalStateException * if the response was already committed * @since 2.0 */ public void forward(PortletRequest request, PortletResponse response) throws PortletException, java.io.IOException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletPreferences.java0000644000175000017500000002541511201125563026652 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The PortletPreferences interface allows the portlet to store * configuration data. It is not the * purpose of this interface to replace general purpose databases. *

* There are two different types of preferences: *

*

* Changes are persisted when the store method is called. The store method * can only be invoked within the scope of a processAction call. * Changes that are not persisted are discarded when the * processAction or render method ends. */ public interface PortletPreferences { /** * Returns true, if the value of this key is defined as read-only and thus * cannot be modified by the user. *

* Modifiable preferences can be changed by the * portlet in any standard portlet mode (EDIT, HELP, VIEW). * Per default every preference is modifiable. *

* Read-only preferences cannot be changed by the * portlet in any standard portlet mode, but inside of custom modes, * like the CONFIG mode, it may be allowed changing them. *

* Preferences are read-only, if they are defined in the * deployment descriptor with read-only set to true, * or if the portlet container restricts write access. *

* Note that even if this call returns false and the * preference key is modifiable in general it does not mean that it * is modifiable in the scope of the current request, e.g. if this * request is a render request. * * @return false, if the value of this key can be changed, or * if the key is not known * * @exception java.lang.IllegalArgumentException * if key is null. */ public boolean isReadOnly(String key); /** * Returns the first String value associated with the specified key of this preference. * If there is one or more preference values associated with the given key * it returns the first associated value. * If there are no preference values associated with the given key, or the * backing preference database is unavailable, it returns the given * default value. * A null value is treated as a non-existent value. * * @param key key for which the associated value is to be returned * @param def the value to be returned in the event that there is no * value available associated with this key. * * @return the value associated with key, or def * if no value is associated with key, or the backing * store is inaccessible. * * @exception java.lang.IllegalArgumentException * if key is null. (A * null value for def is permitted.) * * @see #getValues(String, String[]) */ public String getValue(String key, String def); /** * Returns the String array value associated with the specified key in this preference. * *

Returns the specified default if there is no value * associated with the key, or if the backing store is inaccessible. * A null value is treated as a non-existent value. * *

If the implementation supports stored defaults and such a * default exists and is accessible, it is used in favor of the * specified default. * * * @param key key for which associated value is to be returned. * @param def the value to be returned in the event that this * preference node has no value associated with key * or the associated value cannot be interpreted as a String array, * or the backing store is inaccessible. * * @return the String array value associated with * key, or def if the * associated value does not exist. * * @exception java.lang.IllegalArgumentException if key is null. (A * null value for def is permitted.) * * @see #getValue(String,String) */ public String[] getValues(String key, String[] def); /** * Associates the specified String value with the specified key in this * preference. *

* The key cannot be null, but null values * for the value parameter are allowed. *

* If the same key contained already a String or String[] * value it must be replaced by the new value. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * * @exception ReadOnlyException * if this preference cannot be modified for this request * @exception java.lang.IllegalArgumentException if key is null, * or key.length() * or value.length are to long. The maximum length * for key and value are implementation specific. * * @see #setValues(String, String[]) */ public void setValue(String key, String value) throws ReadOnlyException; /** * Associates the specified String array value with the specified key in this * preference. *

* The key cannot be null, but null values * in the values parameter are allowed. *

* If the same key contained already a String or String[] * value it must be replaced by the new value. * * @param key key with which the value is to be associated * @param values values to be associated with key * * @exception java.lang.IllegalArgumentException if key is null, or * key.length() * is to long or value.size is to large. The maximum * length for key and maximum size for value are implementation specific. * @exception ReadOnlyException * if this preference cannot be modified for this request * * @see #setValue(String,String) */ public void setValues(String key, String[] values) throws ReadOnlyException; /** * Returns all of the keys that have an associated value, * or an empty Enumeration if no keys are * available. * * @return an Enumeration of the keys that have an associated value, * or an empty Enumeration if no keys are * available. */ public java.util.Enumeration getNames(); /** * Returns a Map of the preferences. *

* The values in the returned Map are from type * String array (String[]). *

* If no preferences exist this method returns an empty Map. * * @return an immutable Map containing preference names as * keys and preference values as map values, or an empty Map * if no preference exist. The keys in the preference * map are of type String. The values in the preference map are of type * String array (String[]). */ public java.util.Map getMap(); /** * Resets or removes the value associated with the specified key. *

* If this implementation supports stored defaults, and there is such * a default for the specified preference, the given key will be * reset to the stored default. *

* If there is no default available the key will be removed. * * @param key to reset * * @exception java.lang.IllegalArgumentException if key is null. * @exception ReadOnlyException * if this preference cannot be modified for this request */ public void reset(String key) throws ReadOnlyException; /** * Commits all changes made to the preferences via the * set methods in the persistent store. *

* If this call returns successful, all changes are made * persistent. If this call fails, no changes are made * in the persistent store. This call is an atomic operation * regardless of how many preference attributes have been modified. *

* All changes made to preferences not followed by a call * to the store method are discarded when the * portlet finishes the processAction method. *

* If a validator is defined for this preferences in the * deployment descriptor, this validator is called before * the actual store is performed to check whether the given * preferences are valid. If this check fails a * ValidatorException is thrown. * * @exception java.io.IOException * if changes cannot be written into * the backend store * @exception ValidatorException * if the validation performed by the * associated validator fails * @exception java.lang.IllegalStateException * if this method is called inside a render call * * @see PreferencesValidator */ public void store() throws java.io.IOException, ValidatorException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ClientDataRequest.java0000644000175000017500000001407411201125563026417 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The ClientDataRequest represents the request information * of the HTTP request issued from the client to the portal.
* It extends the PortletRequest interface. * * @since 2.0 * @see PortletRequest */ public interface ClientDataRequest extends PortletRequest { /** * Retrieves the body of the HTTP request from client to * portal as binary data using * an InputStream. Either this method or * {@link #getReader} may be called to read the body, but not both. *

* For HTTP POST data of type application/x-www-form-urlencoded * this method throws an IllegalStateException * as this data has been already processed by the * portal/portlet-container and is available as request parameters. * * @return an input stream containing the body of the request * * @exception java.lang.IllegalStateException * if getReader was already called, or it is a * HTTP POST data of type application/x-www-form-urlencoded * @exception java.io.IOException * if an input or output exception occurred */ public java.io.InputStream getPortletInputStream () throws java.io.IOException; /** * Overrides the name of the character encoding used in the body of this * request. This method must be called prior to reading input * using {@link #getReader} or {@link #getPortletInputStream}. *

* This method only sets the character set for the Reader that the * {@link #getReader} method returns. * * @param enc a String containing the name of * the character encoding. * * @exception java.io.UnsupportedEncodingException if this is not a valid encoding * @exception java.lang.IllegalStateException if this method is called after * reading request parameters or reading input using * getReader() */ public void setCharacterEncoding(String enc) throws java.io.UnsupportedEncodingException; /** * Retrieves the body of the HTTP request from the client to the portal * as character data using * a BufferedReader. The reader translates the character * data according to the character encoding used on the body. * Either this method or {@link #getPortletInputStream} may be called to read the * body, not both. *

* For HTTP POST data of type application/x-www-form-urlencoded * this method throws an IllegalStateException * as this data has been already processed by the * portal/portlet-container and is available as request parameters. * * @return a BufferedReader * containing the body of the request * * @exception java.io.UnsupportedEncodingException * if the character set encoding used is * not supported and the text cannot be decoded * @exception java.lang.IllegalStateException * if {@link #getPortletInputStream} method * has been called on this request, it is a * HTTP POST data of type application/x-www-form-urlencoded. * @exception java.io.IOException * if an input or output exception occurred * * @see #getPortletInputStream */ public java.io.BufferedReader getReader() throws java.io.UnsupportedEncodingException, java.io.IOException; /** * Returns the name of the character encoding used in the body of this request. * This method returns null if the request * does not specify a character encoding. * * @return a String containing the name of * the character encoding, or null * if the request does not specify a character encoding. */ public java.lang.String getCharacterEncoding(); /** * Returns the MIME type of the body of the request, * or null if the type is not known. * * @return a String containing the name * of the MIME type of the request, or null * if the type is not known. */ public java.lang.String getContentType(); /** * Returns the length, in bytes, of the request body * which is made available by the input stream, or -1 if the * length is not known. * * * @return an integer containing the length of the * request body or -1 if the length is not known * */ public int getContentLength(); /** * Returns the name of the HTTP method with which this request was made, * for example, GET, POST, or PUT. * * @since 2.0 * @return a String specifying the name of the HTTP method with which * this request was made */ public String getMethod(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/CacheControl.java0000644000175000017500000001350711201125563025402 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The CacheControl interface represents cache settings * for a piece of markup. The settings are only valid for the current * request. * * @since 2.0 */ public interface CacheControl { /** * Get the currently set expiration time. * If no expiration time is set on this response the * default defined in the portlet deployment descriptor * with the expiration-cache tag is returned, * or 0 if no default is defined. *

* This call returns the same value as the * getProperty(EXPIRATION_CACHE) * call. * * @return the currently set expiration time in seconds, * or 0 if no expiration time * is set. */ public int getExpirationTime(); /** * Sets a new expiration time for the current response * in seconds. *

* If the expiration value is set to 0, caching is disabled for this * portlet; if the value is set to -1, the cache does not expire. *

* This call is equivalent to calling * setProperty(EXPIRATION_CACHE). * * @param time expiration time in seconds */ public void setExpirationTime(int time); /** * Returns a boolean indicating whether the * caching scope is set to public for the current response. * If no caching scope is set on this response, the default * defined in the deployment descriptor with the * cache-scope tag is returned, * or false if no default is defined. *

* Public cache scope indicates that the cache entry can be shared across * users. Non-public, or private cache scope indicates that the cache entry * must not be shared across users. *

* This call is equivalent to calling * getProperty(CACHE_SCOPE).equals(PUBLIC_SCOPE). * * @return true if the cache scope is public for the * current response. */ public boolean isPublicScope(); /** * Sets the caching scope for the current response * to public with true as * publicScope and to private with * false as publicScope. *

* Public cache scope indicates that the cache entry can be shared across * users. Non-public, or private cache scope indicates that the cache entry * must not be shared across users. *

* This call is equivalent to calling * (publicScope ? setProperty(CACHE_SCOPE, PUBLIC_SCOPE | * setProperty(CACHE_SCOPE, PRIVATE_SCOPE). * * @param publicScope indicating if the cache entry can be shared across users */ public void setPublicScope(boolean publicScope); /** * Returns the ETag for the current response that is * used as validation tag, or null * if no ETag is set on the response. *

* This call is equivalent to calling * getProperty(ETAG). * * @return the ETag for the current response that is * used as validation tag, or null * if no ETag is set. */ public String getETag(); /** * Sets an ETag for the current response that is * used as validation tag. If an ETag was already * set it is replaced with the new value. *

* This call is equivalent to calling * setProperty(ETAG, token). *

* Setting the ETag to null removes * the currently set ETag. * * @param token the ETag token */ public void setETag(String token); /** * Returns a boolean indicating whether the * cached content for the provided ETag at the request * can still be considerated valid. * If not set, the default is false. *

* This call is equivalent to calling * getProperty(USE_CACHED_CONTENT) and getting a non-null * value back. * * @return boolean indicating whether the * caching scope is set to public for the current response */ public boolean useCachedContent(); /** * Sets the indication whether the cached content * for the provided ETag at the request is still valid or not. * If set to true no output should be rendered, * but a new expiration time should be set for the * markup with the given ETag . *

* This call is equivalent to calling * setProperty(USE_CACHED_CONTENT, "true"). * * @param useCachedContent boolean indication whether the * the cached content is still valid or not */ public void setUseCachedContent(boolean useCachedContent); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/BaseURL.java0000644000175000017500000002250411201125563024270 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The BaseURL defines the basic capabilities * of a portlet URL pointing back to the portlet. * * @since 2.0 */ public interface BaseURL { /** * Sets the given String parameter to this URL. *

* This method replaces all parameters with the given key. *

* The PortletURL implementation 'x-www-form-urlencoded' encodes * all parameter names and values. Developers should not encode them. *

* A portlet container may prefix the attribute names internally * in order to preserve a unique namespace for the portlet. *

* A parameter value of null indicates that this * parameter should be removed. * * @param name * the parameter name * @param value * the parameter value * * @exception java.lang.IllegalArgumentException * if name is null. */ public void setParameter (String name, String value); /** * Sets the given String array parameter to this URL. *

* This method replaces all parameters with the given key. *

* The PortletURL implementation 'x-www-form-urlencoded' encodes * all parameter names and values. Developers should not encode them. *

* A portlet container may prefix the attribute names internally * in order to preserve a unique namespace for the portlet. * * @param name * the parameter name * @param values * the parameter values * * @exception java.lang.IllegalArgumentException * if name is null. */ public void setParameter (String name, String[] values); /** * Sets a parameter map for this URL. *

* All previously set parameters are cleared. *

* The PortletURL implementation 'x-www-form-urlencoded' encodes * all parameter names and values. Developers should not encode them. *

* A portlet container may prefix the attribute names internally, * in order to preserve a unique namespace for the portlet. * * @param parameters Map containing parameter names for * the render phase as * keys and parameter values as map * values. The keys in the parameter * map must be of type String. The values * in the parameter map must be of type * String array (String[]). * * @exception java.lang.IllegalArgumentException * if parameters is null, if * any of the keys in the Map are null, * if any of the keys is not a String, or if any of * the values is not a String array. */ public void setParameters(java.util.Map parameters); /** * Indicated the security setting for this URL. *

* Secure set to true indicates that the portlet requests * a secure connection between the client and the portlet window for * this URL. Secure set to false indicates that the portlet * does not need a secure connection for this URL. If the security is not * set for a URL, it should stay the same as the current request. * * @param secure true, if portlet requests to have a secure connection * between its portlet window and the client; false, if * the portlet does not require a secure connection. * * @throws PortletSecurityException if the run-time environment does * not support the indicated setting */ public void setSecure (boolean secure) throws PortletSecurityException; /** * Returns the portlet URL string representation to be embedded in the * markup.
* Note that the returned String may not be a valid URL, as it may * be rewritten by the portal/portlet-container before returning the * markup to the client. *

* The returned URL is not XML escaped. *

* For writing URLs to an output stream the {@link #write(java.io.Writer)} or * {@link #write(java.io.Writer, boolean)} method should be used as these are * more efficient. * * @return the encoded URL as a string */ public String toString (); /** * Returns a Map of the parameters * currently set on this portlet URL via the * setParameter or setParameters * methods. *

* The values in the returned Map are from type * String array (String[]). *

* If no parameters exist this method returns an empty Map. * * @return Map containing parameter names as * keys and parameter values as map values, or an empty Map * if no parameters exist. The keys in the parameter * map are of type String. The values in the parameter map are of type * String array (String[]). * * @since 2.0 */ public java.util.Map getParameterMap(); /** * Writes the portlet URL to the output stream using the provided writer. *

* Note that the URL written to the output stream may not be a valid URL, as it may * be rewritten by the portal/portlet-container before returning the * markup to the client. *

* The URL written to the output stream is always XML escaped. For writing * non-escaped URLs use {@link #write(java.io.Writer, boolean)}. * * @param out the writer to write the portlet URL to * @throws java.io.IOException if an I/O error occured while writing the URL * * @since 2.0 */ public void write(java.io.Writer out) throws java.io.IOException; /** * Writes the portlet URL to the output stream using the provided writer. * If the parameter escapeXML is set to true the URL will be escaped to be * valid XML characters, i.e. <, >, &, ', " will get converted * into their corresponding character entity codes (< to &<, > to &>, * & to &&, ' to &', " to &"). * If escapeXML is set to false no escaping will be done. *

* Note that the URL written to the output stream may not be a valid URL, as it may * be rewritten by the portal/portlet-container before returning the * markup to the client. * * @param out the writer to write the portlet URL to * @param escapeXML denotes if the URL should be XML escaped before written to the output * stream or not * @throws java.io.IOException if an I/O error occurred while writing the URL * * @since 2.0 */ public void write(java.io.Writer out, boolean escapeXML) throws java.io.IOException; /** * Adds a String property to an existing key on the URL. *

* This method allows URL properties to have multiple values. *

* Properties can be used by portlets to provide vendor specific information * to the URL. * * @param key * the key of the property * @param value * the value of the property * * @exception java.lang.IllegalArgumentException * if key is null. * * @since 2.0 */ public void addProperty(String key, String value); /** * Sets a String property on the URL. *

* Properties can be used by portlets to provide vendor specific information * to the URL. *

* This method resets all properties previously added with the same key. * * @param key * the key of the property * @param value * the value of the property * * @exception java.lang.IllegalArgumentException * if key is null. * * @since 2.0 */ public void setProperty(String key, String value); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ValidatorException.java0000644000175000017500000001021311201125563026631 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; /** * The ValidatorException is thrown by the * validate method of a PreferencesValidator when * the validation of a preference failed. */ public class ValidatorException extends PortletException { private transient ArrayList failedKeyVector = new ArrayList(); private static final long serialVersionUID = 1L; private ValidatorException () { } /** * Constructs a new validator exception with the given text. The * portlet container may use the text write it to a log. *

* The collection of failed keys may contain all failed keys, only the * first key that failed validation, or may be null. * * @param text * the exception text * @param failedKeys * keys that failed the validation; may be null */ public ValidatorException (String text, Collection failedKeys) { super (text); if ( failedKeys != null ) failedKeyVector.addAll(failedKeys); } /** * Constructs a new portlet validator exception. * Used, when the portlet needs to do one of the following: *

*

* The Collection of failed keys may contain all failed keys, only the * first key that failed validation, or may be null. * * @param text * the exception text * @param cause * the root cause * @param failedKeys * keys that failed the validation; may be null */ public ValidatorException (String text, Throwable cause, Collection failedKeys) { super(text, cause); if ( failedKeys != null ) failedKeyVector.addAll(failedKeys); } /** * Constructs a new portlet validator exception when the portlet needs to throw an * exception. The exception message is based on the localized message * of the underlying exception. *

* The Collection of failed keys may contain all failed keys, only the * first key that failed validation, or may be null. * * @param cause * the root cause * @param failedKeys * keys that failed the validation; may be null */ public ValidatorException (Throwable cause, Collection failedKeys) { super(cause); if ( failedKeys != null ) failedKeyVector.addAll(failedKeys); } /** * Returns the keys that failed the validation. *

* The Enumeration of failed keys may contain all failed keys, only the * first key that failed validation, or an empty * Enumeration if no failed keys are available. * * @return the keys that failed validation, or an empty * Enumeration if no failed keys are available. */ public Enumeration getFailedKeys() { return Collections.enumeration(failedKeyVector); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/EventPortlet.java0000644000175000017500000000516611201125563025473 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.io.IOException; /** * The EventPortlet interface allows * portlets receiving events. *

* Events are part of the action processing and must * be finished before the rendering phase can start. * Portlets can receive events issued by other portlets or * portlet container defined events. *

* Portlets should declare the events it would like to receive * via the supported-processing-event tag and events published * via the supported-publishing-event tag in the portlet * deployment descriptor. *

* The event model is a loosely coupled model where the wiring between * published and receiving events is done at the portal / portlet container * level. * * @since 2.0 */ public interface EventPortlet { /** * Called by the portlet container requesting the portlet * to process a specific event. * * @param request the event request * @param response the event response * @exception PortletException * if the portlet has problems fulfilling the * request * @exception UnavailableException * if the portlet is unavailable to process the event at this time * @exception PortletSecurityException * if the portlet cannot fullfill this request because of security reasons * @exception IOException * if the streaming causes an I/O problem */ public void processEvent (EventRequest request, EventResponse response) throws PortletException, java.io.IOException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/RenderResponse.java0000644000175000017500000000730511201125563025773 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The RenderResponse defines an object to assist a portlet in * sending a response to the portal. It extends the MimeResponse * interface to provide specific render response functionality to portlets.
* The portlet container creates a RenderResponse object and * passes it as argument to the portlet's render method. * * @see RenderRequest * @see PortletResponse * @see MimeResponse */ public interface RenderResponse extends MimeResponse { /** * This method sets the title of the portlet. *

* The value can be a text String * * @param title * portlet title as text String or resource URI */ public void setTitle(String title); /** * This method allows the portlet to tell the portal the next possible * portlet modes that the make sense from the portlet point of view. *

* If set, the portal should honor these enumeration of portlet modes and * only provide the end user with choices to the provided portlet modes or a * subset of these modes based on access control considerations. *

* If the portlet does not set any next possible portlet modes the default * is that all portlet modes that the portlet has defined supporting in the * portlet deployment descriptor are meaningful new portlet modes. * * @param portletModes * Enumeration of PortletMode objects with the * next possible portlet modes that the make sense from the * portlet point of view, must not be null or an * empty enumeration. * @since 2.0 */ public void setNextPossiblePortletModes(java.util.Collection portletModes); /** * Sets the MIME type for the render response. The portlet should set the * content type before calling {@link #getWriter} or * {@link #getPortletOutputStream}. *

* Calling setContentType after getWriter or * getOutputStream does not change the content type. *

* The portlet container will ignore any character encoding * specified as part of the content type for render * calls. * * @param type * the content MIME type * * @throws java.lang.IllegalArgumentException * if the given type is not in the list * returned by PortletRequest.getResponseContentTypes * * @see PortletRequest#getResponseContentTypes * @see #getContentType */ public void setContentType(String type); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ReadOnlyException.java0000644000175000017500000000456211201125563026433 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The ReadOnlyException is thrown when a portlet tries * to change the value for a read-only preference attribute. */ public class ReadOnlyException extends PortletException { private static final long serialVersionUID = 1L; private ReadOnlyException () { } /** * Constructs a new read-only exception with the given text. The * portlet container may use the text write it to a log. * * @param text * the exception text */ public ReadOnlyException (String text) { super (text); } /** * Constructs a new read-only exception when the portlet needs to do * the following: *

    * throw an exception *
  • include a message about the "root cause" that interfered * with its normal operation *
  • include a description message *
* * @param text * the exception text * @param cause * the root cause */ public ReadOnlyException (String text, Throwable cause) { super(text, cause); } /** * Constructs a new read-only exception when the portlet needs to throw an * exception. The exception message is based on the localized message * of the underlying exception. * * @param cause * the root cause */ public ReadOnlyException (Throwable cause) { super(cause); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletException.java0000644000175000017500000000462411201125563026346 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The PortletException class defines a general exception * that a portlet can throw when it is unable to perform its operation * successfully. */ public class PortletException extends java.lang.Exception { private static final long serialVersionUID = 1L; /** * Constructs a new portlet exception. */ public PortletException () { super(); } /** * Constructs a new portlet exception with the given text. The * portlet container may use the text write it to a log. * * @param text * the exception text */ public PortletException (String text) { super (text); } /** * Constructs a new portlet exception when the portlet needs to do * the following: *
    *
  • throw an exception *
  • include the "root cause" exception *
  • include a description message *
* * @param text * the exception text * @param cause * the root cause */ public PortletException (String text, Throwable cause) { super(text, cause); } /** * Constructs a new portlet exception when the portlet needs to throw an * exception. The exception's message is based on the localized message * of the underlying exception. * * @param cause * the root cause */ public PortletException (Throwable cause) { super(cause); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/EventRequest.java0000644000175000017500000000400711201125563025463 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The EventRequest represents the request sent to the portlet * to handle an event. * It extends the PortletRequest interface to provide event request * information to portlets.
* The portlet container creates an EventRequest object and * passes it as argument to the portlet's processEvent method. * * @see ActionRequest * @see PortletRequest * @since 2.0 */ public interface EventRequest extends PortletRequest { /** * Returns the event that triggered the call to the processEvent method. * * @return the event that triggered the current processEvent call. */ public Event getEvent(); /** * Returns the name of the HTTP method with which the original action request was made, * for example, POST, or PUT. * * @since 2.0 * @return a String specifying the name of the HTTP method with which * this request was made */ public String getMethod(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ActionResponse.java0000644000175000017500000001122211201125563025762 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The ActionResponse interface represents the portlet * response to an action request. * It extends the StateAwareResponse interface to provide specific * action response functionality to portlets.
* The portlet container creates an ActionResponse object and * passes it as argument to the portlet's processAction method. * * @see StateAwareResponse * @see PortletResponse * @see ActionRequest */ public interface ActionResponse extends StateAwareResponse { /** * Instructs the portlet container to send a redirect response * to the client using the specified redirect location URL. *

* This method only accepts an absolute URL (e.g. * http://my.co/myportal/mywebap/myfolder/myresource.gif) * or a full path URI (e.g. /myportal/mywebap/myfolder/myresource.gif). * If required, * the portlet container may encode the given URL before the * redirection is issued to the client. *

* The sendRedirect method can not be invoked after any of the * following methods of the ActionResponse interface has been called: *

    *
  • setPortletMode
  • *
  • setWindowState
  • *
  • setRenderParameter
  • *
  • setRenderParameters
  • *
  • removePublicRenderParamter
  • *
* * @param location the redirect location URL * * @exception java.io.IOException * if an input or output exception occurs. * @exception java.lang.IllegalArgumentException * if a relative path URL is given * @exception java.lang.IllegalStateException * if the method is invoked after any of above mentioned methods of * the ActionResponse interface has been called. */ public void sendRedirect(String location) throws java.io.IOException; /** * Instructs the portlet container to send a redirect response * to the client using the specified redirect location URL and * encode a render URL as parameter on the redirect URL. *

* This method only accepts an absolute URL (e.g. * http://my.co/myportal/mywebap/myfolder/myresource.gif) * or a full path URI (e.g. /myportal/mywebap/myfolder/myresource.gif). * If required, * the portlet container may encode the given URL before the * redirection is issued to the client. *

* The portlet container will attach a render URL with the currently set portlet mode, window state * and render parameters on the ActionResponse and the current public render parameters. * The attached URL will be available as query parameter value under the key provided with the * renderUrlParamName parameter. *

* New values for *

    *
  • setPortletMode *
  • setWindowState *
  • setRenderParameter *
  • setRenderParameters *
* are only used for creating the render URL and not remembered after the redirect * is issued. * * @param location the redirect location URL * @param renderUrlParamName name of the query parameter under which the portlet container should * store a render URL to this portlet * * @exception java.io.IOException * if an input or output exception occurs. * @exception java.lang.IllegalArgumentException * if a relative path URL is given * * @since 2.0 */ public void sendRedirect(String location, String renderUrlParamName) throws java.io.IOException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletSecurityException.java0000644000175000017500000000473211201125563030076 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * A portlet should throw a PortletSecurityException * when a call fails because of security reasons.
* Additionally it can be thrown by the portal/portlet-container. */ public class PortletSecurityException extends PortletException { private static final long serialVersionUID = 1L; private PortletSecurityException () { } /** * Constructs a new security exception with the given text. The * portlet container may use the text write it to a log. * * @param text * the exception text */ public PortletSecurityException (String text) { super (text); } /** * Constructs a new portlet security exception when the portlet needs to do * the following: *
    * throw an exception *
  • include a message about the "root cause" that interfered * with its normal operation *
  • include a description message *
* * @param text * the exception text * @param cause * the root cause */ public PortletSecurityException (String text, Throwable cause) { super(text, cause); } /** * Constructs a new portlet security exception when the portlet needs to throw an * exception. The exception message is based on the localized message * of the underlying exception. * * @param cause * the root cause */ public PortletSecurityException (Throwable cause) { super(cause); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletURL.java0000644000175000017500000001221611201125563025046 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The PortletURL interface represents a URL * that reference the portlet itself. *

* A PortletURL is created through the RenderResponse * or ResourceResponse. * Parameters, a portlet mode, a window state and a security level * can be added to PortletURL objects. *

* There are two types of PortletURLs: *

    *
  • Action URLs, they are created with createActionURL, and * trigger an action request followed by a render request. *
  • Render URLs, they are created with createRenderURL, and * trigger a render request. *
*

* The string representation of a PortletURL does not need to be a valid * URL at the time the portlet is generating its content. It may contain * special tokens that will be converted to a valid URL, by the portal, * before the content is returned to the client. */ public interface PortletURL extends BaseURL { /** * Indicates the window state the portlet should be in, if this * portlet URL triggers a request. *

* A URL can not have more than one window state attached to it. * If more than one window state is set only the last one set * is attached to the URL. * * @param windowState * the portlet window state * * @exception WindowStateException * if the portlet cannot switch to this state, * because the portal does not support this state, the portlet has not * declared in its deployment descriptor that it supports this state, or the current * user is not allowed to switch to this state. * The PortletRequest.isWindowStateAllowed() method can be used * to check if the portlet can set a given window state. * @see PortletRequest#isWindowStateAllowed */ public void setWindowState (WindowState windowState) throws WindowStateException; /** * Indicates the portlet mode the portlet must be in, if this * portlet URL triggers a request. *

* A URL can not have more than one portlet mode attached to it. * If more than one portlet mode is set only the last one set * is attached to the URL. * * @param portletMode * the portlet mode * * @exception PortletModeException * if the portlet cannot switch to this mode, * because the portal does not support this mode, the portlet has not * declared in its deployment descriptor that it supports this mode for the current markup, * or the current user is not allowed to switch to this mode. * The PortletRequest.isPortletModeAllowed() method can be used * to check if the portlet can set a given portlet mode. * @see PortletRequest#isPortletModeAllowed */ public void setPortletMode (PortletMode portletMode) throws PortletModeException; /** * Returns the currently set portlet mode on this PortletURL. * * @since 2.0 * * @return the portlet mode, or null if none is set */ public PortletMode getPortletMode (); /** * Returns the currently set window state on this PortletURL. * * @since 2.0 * * @return the window state, or null if none is set */ public WindowState getWindowState (); /** * Removes the specified public render parameter. * The name must reference a public render parameter defined * in the portlet deployment descriptor under the * public-render-parameter element with the * identifier mapping to the parameter name. *

* Note that calling this method on a PortletURL of type * Action URL does not have any effect. * * @param name a String specifying * the name of the public render parameter to be removed * * @exception java.lang.IllegalArgumentException * if name is null. * @since 2.0 */ public void removePublicRenderParameter(String name); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ProcessEvent.java0000644000175000017500000000434711201125563025460 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Annotation for marking a method for handling * a specific event. * The GenericPortlet tries to dispatch to methods annotated * with the tag @ProcessEvent for any received event. * * @since 2.0 */ @Target(ElementType.METHOD) @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public @interface ProcessEvent { /** * Event QName. * Must be in the format:
* "{" + Namespace URI + "}" + local part.
* If the Namespace URI equals(XMLConstants.NULL_NS_URI), * only the local part is used * (like the javax.xml.namespace.QName.toString() method). * * @return event QName. */ String qname() default ""; /** * Local part of the event name. * The namespace for the events is either taken from the default-event-namespace element * in the portlet deployment descriptor, or if this element is not provided * the XML default namespace XMLConstants.NULL_NS_URI is used. * * @return local part of the event name. */ String name() default ""; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ResourceResponse.java0000644000175000017500000001176511201125563026350 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The ResourceResponse defines an object to assist a portlet * for rendering a resource. *

* The difference between the RenderResponse is that for the * ResourceResponse the output of this response is delivered * directly to the client without any additional markup added by the portal. * It is therefore allowed for the portlet to return binary content in this * response. *

* A portlet can set HTTP headers for the response via the setProperty or * addProperty call in the ResourceResponse. * To be successfully transmitted back to the client, headers must be set * before the response is committed. Headers set after the response is * committed will be ignored by the portlet container. *

* The portlet container creates a ResourceResponse object and * passes it as argument to the portlet's serveResource method. * * @see ResourceServingPortlet * @see MimeResponse * @since 2.0 */ public interface ResourceResponse extends MimeResponse { /** * Constant for setting the HTTP status code via the * setProperty method. */ public static final String HTTP_STATUS_CODE = "portlet.http-status-code"; /** * Sets the locale of the response, setting the headers * (including the Content-Type's charset) as appropriate. * This method should be called before a call to getWriter(). * By default, the response locale is the default locale provided * by the portlet container. * * @param loc the new locale of the response */ public void setLocale(java.util.Locale loc); /** * Sets the character encoding (MIME charset) of the response being * sent to the client, for example, to UTF-8. If the character encoding * has already been set by either the portlet container, * setContentType(java.lang.String) or * setLocale(java.util.Locale), this method overrides it. Calling * setContentType(java.lang.String) with the String of * text/html and calling this method with the String of * UTF-8 is equivalent with calling setContentType * with the String of text/html; charset=UTF-8. *

* This method can be called repeatedly to change the character encoding. * This method has no effect if it is called after getWriter has been called * or after the response has been committed. * * @param charset a String specifying only the character set defined by * IANA Character Sets (http://www.iana.org/assignments/character-sets) */ public void setCharacterEncoding(java.lang.String charset); /** * Sets the length of the content body in the response. * * @param len an integer specifying the length of the content being returned */ public void setContentLength(int len); /** * @throws java.lang.IllegalStateException * if the cacheability level of the resource URL * triggering this serveResource call * is not PAGE and thus does not allow * for creating render URLs. */ public PortletURL createRenderURL(); /** * @throws java.lang.IllegalStateException * if the cacheability level of the resource URL * triggering this serveResource call * is not PAGE and thus does not allow * for creating action URLs. */ public PortletURL createActionURL(); /** * @throws java.lang.IllegalStateException * if the cacheability level of the resource URL * triggering this serveResource call, * or one of the parent calls, have defined a stricter * cachability level. */ public ResourceURL createResourceURL(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/GenericPortlet.java0000644000175000017500000006612711201125563025772 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.Collection; import java.util.Enumeration; import java.util.HashMap; import java.util.Locale; import java.util.Map; import javax.xml.namespace.QName; /** * The GenericPortlet class provides a default implementation for * the Portlet interface. *

* It provides an abstract class to be subclassed to create portlets. A subclass * of GenericPortlet should either use one of the following annotations: *

    *
  • @ProcessAction
  • *
  • @ProcessEvent
  • *
  • @RenderMode
  • *
* or override at least one method, usually * one of the following: *
    *
  • processAction, to handle action requests
  • *
  • doView, to handle render requests when in VIEW mode
  • *
  • doEdit, to handle render requests when in EDIT mode
  • *
  • doHelp, to handle render request when in HELP mode
  • *
  • init and destroy, to manage resources that are held for the life of the * servlet
  • *
*

* Normally there is no need to override the render or the doDispatch methods. * Render handles render requests setting the title of the portlet in the * response and invoking doDispatch. doDispatch dispatches the request to one of * the doView, doEdit or doHelp method depending on the portlet mode indicated * in the request. *

* Portlets typically run on multithreaded servers, so please note that a * portlet must handle concurrent requests and be careful to synchronize access * to shared resources. Shared resources include in-memory data such as instance * or class variables and external objects such as files, database connections, * and network connections. */ public abstract class GenericPortlet implements Portlet, PortletConfig, EventPortlet, ResourceServingPortlet { private transient PortletConfig config; private transient Map processActionHandlingMethodsMap = new HashMap(); private transient Map processEventHandlingMethodsMap = new HashMap(); private transient Map renderModeHandlingMethodsMap = new HashMap(); /** * Does nothing. */ public GenericPortlet() { } /** * Called by the portlet container to indicate to a portlet that the portlet * is being placed into service. *

* The default implementation stores the PortletConfig object * and checks for annotated methods with the annotations *

    *
  • @ProcessAction
  • *
  • @ProcessEvent
  • *
  • @RenderMode
  • *
* and stores these in a hashmap for later dispatching. *

* The portlet container calls the init method exactly once * after instantiating the portlet. The init method must * complete successfully before the portlet can receive any requests. * *

* The portlet container cannot place the portlet into service if the * init method does one of the following: *

    *
  1. it throws a PortletException *
  2. it does not return within a time period defined by the Web server *
* * * @param config * a PortletConfig object containing the portlet * configuration and initialization parameters * * @exception PortletException * if an exception has occurred that interferes with the * portlet normal operation. * @exception UnavailableException * if the portlet cannot perform the initialization at this * time. */ public void init(PortletConfig config) throws PortletException { this.config = config; cacheAnnotatedMethods(); this.init(); } /** * * A convenience method which can be overridden so that there's no need to * call super.init(config). * *

* Instead of overriding {@link #init(PortletConfig)}, simply override this * method and it will be called by * GenericPortlet.init(PortletConfig config). The * PortletConfig object can still be retrieved via {@link * #getPortletConfig}. * * @exception PortletException * if an exception has occurred that interferes with the * portlet normal operation. * @exception UnavailableException * if the portlet is unavailable to perform init */ public void init() throws PortletException { } /** * Called by the portlet container to allow the portlet to process an action * request. This method is called if the client request was originated by a * URL created (by the portlet) with the * RenderResponse.createActionURL() method. *

* The default implementation tries to dispatch to a method * annotated with @ProcessAction that matches the action parameter * value ActionRequest.ACTION_NAME or, if no * such method is found throws a PortletException.
* Note that the annotated methods needs to be public in order * to be allowed to be called by GenericPortlet. * * @param request * the action request * @param response * the action response * @exception PortletException * if the portlet cannot fulfilling the request * @exception UnavailableException * if the portlet is unavailable to process the action at * this time * @exception PortletSecurityException * if the portlet cannot fullfill this request because of * security reasons * @exception java.io.IOException * if the streaming causes an I/O problem */ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException { String action = request.getParameter(ActionRequest.ACTION_NAME); try { // check if action is cached Method actionMethod = processActionHandlingMethodsMap.get(action); if (actionMethod != null) { actionMethod.invoke(this, request, response); return; } } catch (Exception e) { throw new PortletException(e); } // if no action processing method was found throw exc throw new PortletException("processAction method not implemented"); } /** * The default implementation of this method sets the headers using the * doHeaders method, sets the title using the * getTitle method and invokes the doDispatch * method. *

* It also evaluates the RENDER_PART request attribute and if * set calls the doHeaders, getNextPossiblePortletModes and * getTitle methods for the RENDER_HEADERS * part and the doDispatch method for the * RENDER_MARKUP part.
* If the RENDER_PART request attribute is not set all of the * above methods will be called. * * @param request * the render request * @param response * the render response * * @exception PortletException * if the portlet cannot fulfilling the request * @exception UnavailableException * if the portlet is unavailable to perform render at this * time * @exception PortletSecurityException * if the portlet cannot fullfill this request because of * security reasons * @exception java.io.IOException * if the streaming causes an I/O problem * */ public void render(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException { Object renderPartAttrValue = request.getAttribute(RenderRequest.RENDER_PART); if (renderPartAttrValue != null) { // streaming portal calling if (renderPartAttrValue.equals(RenderRequest.RENDER_HEADERS)) { doHeaders(request, response); Collection nextModes = getNextPossiblePortletModes(request); if (nextModes != null) response.setNextPossiblePortletModes(nextModes); response.setTitle(getTitle(request)); } else if (renderPartAttrValue.equals(RenderRequest.RENDER_MARKUP)) { doDispatch(request, response); } else { throw new PortletException("Unknown value of the 'javax.portlet.render_part' request attribute"); } } else { // buffered portal calling doHeaders(request, response); Collection nextModes = getNextPossiblePortletModes(request); if (nextModes != null) response.setNextPossiblePortletModes(nextModes); response.setTitle(getTitle(request)); doDispatch(request, response); } } /** * Used by the render method to get the title. *

* The default implementation gets the title from the ResourceBundle of the * PortletConfig of the portlet. The title is retrieved using the * 'javax.portlet.title' resource name. *

* Portlets can overwrite this method to provide dynamic titles (e.g. based * on locale, client, and session information). Examples are: *

    *
  • language-dependent titles for multi-lingual portals
  • *
  • shorter titles for WAP phones
  • *
  • the number of messages in a mailbox portlet
  • *
* * @return the portlet title for this window * @throws java.lang.IllegalStateException * if no portlet config object is available */ protected java.lang.String getTitle(RenderRequest request) { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getResourceBundle(request.getLocale()).getString("javax.portlet.title"); } /** * The default implementation of this method routes the render request to: *
    *
  1. method annotated with @RenderMode and the name of the * portlet mode
  2. *
  3. a set of helper methods depending on the current portlet mode the portlet * is currently in. These methods are: *
      *
    • doView for handling view requests
    • *
    • doEdit for handling edit requests
    • *
    • doHelp for handling help requests
    • *
    *
  4. * *

    * If the window state of this portlet is minimized, this * method does not invoke any of the portlet mode rendering methods. *

    * For handling custom portlet modes the portlet should either use the * @RenderMode annotation or override this * method. Note that the annotated methods needs to be public in order * to be allowed to be called by GenericPortlet. * * @param request * the render request * @param response * the render response * * @exception PortletException * if the portlet cannot fulfilling the request * @exception UnavailableException * if the portlet is unavailable to perform render at this * time * @exception PortletSecurityException * if the portlet cannot fullfill this request because of * security reasons * @exception java.io.IOException * if the streaming causes an I/O problem * * @see #doView(RenderRequest, RenderResponse) * @see #doEdit(RenderRequest, RenderResponse) * @see #doHelp(RenderRequest, RenderResponse) */ protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException { WindowState state = request.getWindowState(); if (!state.equals(WindowState.MINIMIZED)) { PortletMode mode = request.getPortletMode(); // first look if there are methods annotated for // handling the rendering of this mode try { // check if mode is cached Method renderMethod = renderModeHandlingMethodsMap.get(mode.toString()); if (renderMethod != null) { renderMethod.invoke(this, request, response); return; } } catch (Exception e) { throw new PortletException(e); } // if not, try the default doXYZ methods if (mode.equals(PortletMode.VIEW)) { doView(request, response); } else if (mode.equals(PortletMode.EDIT)) { doEdit(request, response); } else if (mode.equals(PortletMode.HELP)) { doHelp(request, response); } else { throw new PortletException("unknown portlet mode: " + mode); } } } /** * Helper method to serve up the mandatory view mode. *

    * The default implementation throws an exception. * * @param request * the portlet request * @param response * the render response * * @exception PortletException * if the portlet cannot fulfilling the request * @exception UnavailableException * if the portlet is unavailable to perform render at this * time * @exception PortletSecurityException * if the portlet cannot fullfill this request because of * security reasons * @exception java.io.IOException * if the streaming causes an I/O problem * */ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException { throw new PortletException("doView method not implemented"); } /** * Helper method to serve up the edit mode. *

    * The default implementation throws an exception. * * @param request * the portlet request * @param response * the render response * * @exception PortletException * if the portlet cannot fulfilling the request * @exception UnavailableException * if the portlet is unavailable to perform render at this * time * @exception PortletSecurityException * if the portlet cannot fullfill this request because of * security reasons * @exception java.io.IOException * if the streaming causes an I/O problem * */ protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException { throw new PortletException("doEdit method not implemented"); } /** * Helper method to serve up the help mode. *

    * The default implementation throws an exception. * * @param request * the portlet request * @param response * the render response * * @exception PortletException * if the portlet cannot fulfilling the request * @exception UnavailableException * if the portlet is unavailable to perform render at this * time * @exception PortletSecurityException * if the portlet cannot fullfill this request because of * security reasons * @exception java.io.IOException * if the streaming causes an I/O problem */ protected void doHelp(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException { throw new PortletException("doHelp method not implemented"); } /** * Returns the PortletConfig object of this portlet. * * @return the PortletConfig object of this portlet */ public PortletConfig getPortletConfig() { return config; } /** * Called by the portlet container to indicate to a portlet that the portlet * is being taken out of service. *

    * The default implementation does nothing. * */ public void destroy() { // do nothing } // ------------------------------------------------------------------------- // implement PortletConfig // ------------------------------------------------------------------------- /** * Returns the name of this portlet. * * @return the portlet name * * @see PortletConfig#getPortletName() */ public String getPortletName() { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getPortletName(); } /** * Returns the PortletContext of the portlet application the * portlet is in. * * @return the portlet application context */ public PortletContext getPortletContext() { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getPortletContext(); } /** * Gets the resource bundle for the given locale based on the resource * bundle defined in the deployment descriptor with * resource-bundle tag or the inlined resources defined in * the deployment descriptor. * * @return the resource bundle for the given locale */ public java.util.ResourceBundle getResourceBundle(java.util.Locale locale) { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getResourceBundle(locale); } /** * Returns a String containing the value of the named initialization * parameter, or null if the parameter does not exist. * * @param name * a String specifying the name of the * initialization parameter * * @return a String containing the value of the * initialization parameter * * @exception java.lang.IllegalArgumentException * if name is null. */ public String getInitParameter(java.lang.String name) { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getInitParameter(name); } /** * Returns the names of the portlet initialization parameters as an * Enumeration of String objects, or an empty Enumeration if the portlet has * no initialization parameters. * * @return an Enumeration of String objects * containing the names of the portlet initialization parameters, or * an empty Enumeration if the portlet has no initialization * parameters. */ public java.util.Enumeration getInitParameterNames() { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getInitParameterNames(); } /* * (non-Javadoc) * * @see javax.portlet.PortletConfig#getProcessingEventQNames() */ public Enumeration getProcessingEventQNames() { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getProcessingEventQNames(); } /* * (non-Javadoc) * * @see javax.portlet.PortletConfig#getPublishingEventQNames() */ public Enumeration getPublishingEventQNames() { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getPublishingEventQNames(); } /* * (non-Javadoc) * * @see javax.portlet.PortletConfig#getSupportedLocales() */ public Enumeration getSupportedLocales() { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getSupportedLocales(); } /* (non-Javadoc) * @see javax.portlet.PortletConfig#getContainerRuntimeOptions() */ public Map getContainerRuntimeOptions() { return config.getContainerRuntimeOptions(); } // ------------------------------------------------------------------------- // V 2.0 additions // ------------------------------------------------------------------------- /** * Default resource serving. *

    * The default implemention of this method is to call a * RequestDispatcher.foward with the ResourceID of the ResourceRequest. *

    * If no ResourceID is set on the resource URL the default implementation * does nothing. * * @since 2.0 */ public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException { if (request.getResourceID() != null) { PortletRequestDispatcher rd = getPortletConfig().getPortletContext().getRequestDispatcher( request.getResourceID()); if (rd != null) rd.forward(request, response); } } /** * The default implementation tries to dispatch to a method * annotated with @ProcessEvent that matches the * event name or, if no * such method is found just sets the current render parameters on * the response.
    * Note that the annotated methods needs to be public in order * to be allowed to be called by GenericPortlet. * * @see javax.portlet.EventPortlet#processEvent(javax.portlet.EventRequest, * javax.portlet.EventResponse) * @since 2.0 */ public void processEvent(EventRequest request, EventResponse response) throws PortletException, IOException { String eventName = request.getEvent().getQName().toString(); try { // check for exact match Method eventMethod = processEventHandlingMethodsMap.get(eventName); if (eventMethod != null) { eventMethod.invoke(this, request, response); return; } else { // Search for the longest possible matching wildcard annotation int endPos = eventName.indexOf('}'); int dotPos = eventName.lastIndexOf('.'); while (dotPos > endPos) { String wildcardLookup = eventName.substring(0, dotPos + 1); eventMethod = processEventHandlingMethodsMap.get(wildcardLookup); if (eventMethod != null) { eventMethod.invoke(this, request, response); return; } if (dotPos == 0) { break; } dotPos = eventName.lastIndexOf('.', dotPos - 1); } } } catch (Exception e) { throw new PortletException(e); } // if no event processing method was found just keep render params response.setRenderParameters(request); } /** * Used by the render method to set the response properties and headers. *

    * The portlet should override this method and set its response header using * this method in order to ensure that they are set before anything is * written to the output stream. *

    * The default implemention of this method is emtpy. * * @param request the render request * @param response the render response * @since 2.0 */ protected void doHeaders(RenderRequest request, RenderResponse response) { return; } /** * Used by the render method to set the next possible portlet modes. *

    * The portlet should override this method and set the next possible portlet * modes using this method in order to ensure that they are set before * anything is written to the output stream. *

    * The default implemention of this method returns null. * * @since 2.0 */ protected java.util.Collection getNextPossiblePortletModes(RenderRequest request) { return null; } /** * Returns the names of the public render parameters supported by the * portlet as an Enumeration of String objects, or an empty * Enumeration if the portlet has no public render * parameters. * * @return an Enumeration of String objects * containing the names of the public render parameters, or an empty * Enumeration if the portlet does not define any * public render parameters. * * @see javax.portlet.PortletConfig#getPublicRenderParameterNames() */ public Enumeration getPublicRenderParameterNames() { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getPublicRenderParameterNames(); } /** * Returns the default namespace for events and public parameters. This * namespace is defined in the portlet deployment descriptor with the * default-namespace element. *

    * If no default namespace is defined in the portlet deployment descriptor * this methods returns the XML default namespace * XMLConstants.NULL_NS_URI. * * @return the default namespace defined in the portlet deployment * descriptor, or XMLConstants.NULL_NS_URI is non is * defined. * * @see javax.portlet.PortletConfig#getDefaultNamespace() */ public String getDefaultNamespace() { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getDefaultNamespace(); } private void cacheAnnotatedMethods() { // cache all annotated and visible public methods for (Method method : this.getClass().getMethods()) { Annotation[] annotations = method.getAnnotations(); if (annotations != null) { for (Annotation annotation : annotations) { Class annotationType = annotation.annotationType(); if (ProcessAction.class.equals(annotationType)) { String name = ((ProcessAction) annotation).name(); if (name != null && name.length() > 0) processActionHandlingMethodsMap.put(name, method); } else if (ProcessEvent.class.equals(annotationType)) { String qname = ((ProcessEvent) annotation).qname(); if (qname == null || qname.length() <= 0) { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); String name = ((ProcessEvent) annotation).name(); if (name != null && name.length() > 0) { qname = new QName(config.getDefaultNamespace(), name).toString(); processEventHandlingMethodsMap.put(qname, method); } } else processEventHandlingMethodsMap.put(qname, method); } else if (RenderMode.class.equals(annotationType)) { String name = ((RenderMode) annotation).name(); if (name != null && name.length() > 0) renderModeHandlingMethodsMap.put(name.toLowerCase(), method); } } } } } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/WindowState.java0000644000175000017500000001046411201125563025305 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.util.Locale; /** * The WindowState class represents * the possible window states that a portlet window can assume. *

    * This class defines a standard set of the most basic portlet window states. * Additional window states may be defined by calling the constructor of * this class. If a portal/portlet-container does not support a * custom window state defined in the portlet application deployment descriptor, * the custom window state will be ignored by the portal/portlet container. */ public class WindowState { /** * The NORMAL window state indicates that a portlet * may be sharing the page with other portlets. It may also * indicate that the target device has limited display capabilities. * Therefore, a portlet should restrict the size of its rendered * output in this window state. *

    * The string value for this state is "normal". */ public final static WindowState NORMAL = new WindowState ("normal"); /** * The MAXIMIZED window state is an indication * that a portlet may be the only portlet being rendered in the * portal page, or that the portlet has more space compared to other portlets * in the portal page. A portlet may generate richer content * when its window state is MAXIMIZED. *

    * The string value for this state is "maximized". */ public final static WindowState MAXIMIZED = new WindowState ("maximized"); /** * When a portlet is in MINIMIZED window state, * the portlet should only render minimal output or no output at all. *

    * The string value for this state is "minimized". */ public final static WindowState MINIMIZED = new WindowState ("minimized"); private String _name; /** * Creates a new window state with the given name. *

    * Upper case letters in the name are converted to * lower case letters. * * @param name The name of the window state */ public WindowState(String name) { if (name==null) { throw new IllegalArgumentException("WindowState name can not be NULL"); } _name = name.toLowerCase(Locale.ENGLISH); } /** * Returns a String representation of this window state. * Window state names are always lower case names. * * @return String representation of this window state. */ public String toString() { return _name; } /** * Returns the hash code value for this window state. * The hash code is constructed by producing the * hash value of the String value of this window state. * * @return hash code value for this window state */ public int hashCode() { return _name.hashCode(); } /** * Compares the specified object with this window state * for equality. Returns true if the * Strings equals method for the String * representing the two window states returns true. * * @param object the window state to compare this window state with. * * @return true, if the specified object is equal with this window state. */ public boolean equals(Object object) { if ( object instanceof WindowState ) return _name.equals(((WindowState) object)._name); else return false; } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/RenderMode.java0000644000175000017500000000314711201125563025061 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Annotation for marking a method for handling * a specific portlet mode in the render phase. * The GenericPortlet tries to dispatch to methods annotated * with the tag @RenderMode for any received render call. * * @since 2.0 */ @Target(ElementType.METHOD) @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public @interface RenderMode { /** * Name of the render mode. * * @return render mode name */ String name(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletSession.java0000644000175000017500000003564711201125563026044 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.util.Map; /** * The PortletSession interface provides a way to identify a user * across more than one request and to store transient information about that user. *

    * A PortletSession is created per user client per portlet application. *

    * A portlet can bind an object attribute into a PortletSession by name. * The PortletSession interface defines two scopes for storing objects: *

      *
    • APPLICATION_SCOPE *
    • PORTLET_SCOPE *
    * All objects stored in the session using the APPLICATION_SCOPE * 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 PORTLET_SCOPE must be * available to the portlet during requests for the same portlet window * that the objects where stored from. Attributes stored in the * PORTLET_SCOPE are not protected from other web components * of the portlet application. They are just conveniently namespaced. *

    * The portlet session is based on the HttpSession. Therefore all * HttpSession listeners do apply to the portlet session and * attributes set in the portlet session are visible in the HttpSession * and vice versa. */ public interface PortletSession { /** * This constant defines an application wide scope for the session attribute. * APPLICATION_SCOPE session attributes enable Portlets * within one portlet application to share data. *

    * Portlets may need to prefix attributes set in this scope with some * ID, to avoid overwriting each other's attributes in the * case where two portlets of the same portlet definition * are created. *

    * Value: 0x01 */ public static final int APPLICATION_SCOPE = 0x01; /** * This constant defines the scope of the session attribute to be * private to the portlet and its included resources. *

    * Value: 0x02 */ public static final int PORTLET_SCOPE = 0x02; /** * Returns the object bound with the specified name in this session * under the PORTLET_SCOPE, or null if no * object is bound under the name in that scope. * * @param name a string specifying the name of the object * * @return the object with the specified name for * the PORTLET_SCOPE. * * @exception java.lang.IllegalStateException if this method is called on an * invalidated session. * @exception java.lang.IllegalArgumentException * if name is null. */ public java.lang.Object getAttribute(java.lang.String name); /** * Returns the object bound with the specified name in this session, * or null if no object is bound under the name in the given scope. * * @param name a string specifying the name of the object * @param scope session scope of this attribute * * @return the object with the specified name * * @exception java.lang.IllegalStateException if this method is called on an * invalidated session, or the scope is unknown to the container. * @exception java.lang.IllegalArgumentException * if name is null. */ public java.lang.Object getAttribute(java.lang.String name,int scope); /** * Returns an Enumeration of String objects containing the names of * all the objects bound to this session under the PORTLET_SCOPE, or an * empty Enumeration if no attributes are available. * * @return an Enumeration of * String objects specifying the * names of all the objects bound to * this session, or an empty Enumeration * if no attributes are available. * * @exception java.lang.IllegalStateException if this method is called on an * invalidated session */ public java.util.Enumeration getAttributeNames(); /** * Returns an Enumeration of String objects containing the names of * all the objects bound to this session in the given scope, or an * empty Enumeration if no attributes are available in the * given scope. * * @param scope session scope of the attribute names * * @return an Enumeration of * String objects specifying the * names of all the objects bound to * this session, or an empty Enumeration * if no attributes are available in the given scope. * * @exception java.lang.IllegalStateException if this method is called on an * invalidated session, or the scope is unknown to the container. */ public java.util.Enumeration getAttributeNames(int scope); /** * Returns the time when this session was created, measured in * milliseconds since midnight January 1, 1970 GMT. * * @return a long specifying * when this session was created, * expressed in * milliseconds since 1/1/1970 GMT * * @exception java.lang.IllegalStateException if this method is called on an * invalidated session */ public long getCreationTime(); /** * Returns a string containing the unique identifier assigned to this session. * * @return a string specifying the identifier * assigned to this session */ public java.lang.String getId(); /** * Returns the last time the client sent a request associated with this session, * as the number of milliseconds since midnight January 1, 1970 GMT. * *

    Actions that your portlet takes, such as getting or setting * a value associated with the session, do not affect the access * time. * * @return a long * representing the last time * the client sent a request associated * with this session, expressed in * milliseconds since 1/1/1970 GMT */ public long getLastAccessedTime(); /** * Returns the maximum time interval, in seconds, for which the portlet container * keeps this session open between client accesses. After this interval, * the portlet container invalidates the session. The maximum time * interval can be set * with the setMaxInactiveInterval method. * A negative time indicates the session should never timeout. * * @return an integer specifying the number of * seconds this session remains open * between client requests * * @see #setMaxInactiveInterval */ public int getMaxInactiveInterval(); /** * Invalidates this session (all scopes) and unbinds any objects bound to it. *

    * Invalidating the portlet session will result in invalidating the underlying * HttpSession * * @exception java.lang.IllegalStateException if this method is called on a * session which has already been invalidated */ public void invalidate(); /** * Returns true if the client does not yet know about the session or * if the client chooses not to join the session. * * @return true if the * server has created a session, * but the client has not joined yet. * * @exception java.lang.IllegalStateException if this method is called on a * session which has already been invalidated * */ public boolean isNew(); /** * Removes the object bound with the specified name under * the PORTLET_SCOPE from * this session. If the session does not have an object * bound with the specified name, this method does nothing. * * @param name the name of the object to be * removed from this session in the * PORTLET_SCOPE. * * @exception java.lang.IllegalStateException * if this method is called on a * session which has been invalidated * @exception java.lang.IllegalArgumentException * if name is null. */ public void removeAttribute(String name) ; /** * Removes the object bound with the specified name and the given scope from * this session. If the session does not have an object * bound with the specified name, this method does nothing. * * @param name the name of the object to be * removed from this session * @param scope session scope of this attribute * * @exception java.lang.IllegalStateException * if this method is called on a * session which has been invalidated * @exception java.lang.IllegalArgumentException * if name is null. */ public void removeAttribute(String name, int scope) ; /** * Binds an object to this session under the PORTLET_SCOPE, using the name specified. * If an object of the same name in this scope is already bound to the session, * that object is replaced. * *

    After this method has been executed, and if the new object * implements HttpSessionBindingListener, * the container calls * HttpSessionBindingListener.valueBound. The container then * notifies any HttpSessionAttributeListeners in the web * application. *

    If an object was already bound to this session * that implements HttpSessionBindingListener, its * HttpSessionBindingListener.valueUnbound method is called. * *

    If the value is null, this has the same effect as calling * removeAttribute(). * * * @param name the name to which the object is bound under * the PORTLET_SCOPE; * this cannot be null. * @param value the object to be bound * * @exception java.lang.IllegalStateException if this method is called on a * session which has been invalidated * @exception java.lang.IllegalArgumentException * if name is null. */ public void setAttribute(java.lang.String name, java.lang.Object value); /** * Binds an object to this session in the given scope, using the name specified. * If an object of the same name in this scope is already bound to the session, * that object is replaced. * *

    After this method has been executed, and if the new object * implements HttpSessionBindingListener, * the container calls * HttpSessionBindingListener.valueBound. The container then * notifies any HttpSessionAttributeListeners in the web * application. *

    If an object was already bound to this session * that implements HttpSessionBindingListener, its * HttpSessionBindingListener.valueUnbound method is called. * *

    If the value is null, this has the same effect as calling * removeAttribute(). * * * @param name the name to which the object is bound; * this cannot be null. * @param value the object to be bound * @param scope session scope of this attribute * * @exception java.lang.IllegalStateException if this method is called on a * session which has been invalidated * @exception java.lang.IllegalArgumentException * if name is null or scope is unknown to the container. */ public void setAttribute(java.lang.String name, java.lang.Object value, int scope); /** * Specifies the time, in seconds, between client requests, before the * portlet container invalidates this session. A negative time * indicates the session should never timeout. * * @param interval An integer specifying the number * of seconds */ public void setMaxInactiveInterval(int interval); /** * Returns the portlet application context associated with this session. * * @return the portlet application context */ public PortletContext getPortletContext (); /** * Returns a Map of the session attributes in * the portlet session scope. *

    * The keys are of type String and the values in the * returned Map are from type Object. *

    * If no session attributes exist this method returns an empty Map. * * @return an immutable Map containing the session attributes in the * portlet session scope as keys and attribute values as map values, or an empty Map * if no session attributes exist. The keys in the * map are of type String, the values of type * Object. * @since 2.0 */ public Map getAttributeMap(); /** * Returns a Map of the session attributes in * the given session scope. *

    * The keys are of type String and the values in the * returned Map are from type Object. *

    * If no session attributes exist this method returns an empty Map. * * @param scope session scope of this attribute * * @return an immutable Map containing the session attributes in the * given scope as keys and attribute values as map values, or an empty Map * if no session attributes exist. The keys in the * map are of type String, the values of type * Object. * @since 2.0 */ public Map getAttributeMap(int scope); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ActionRequest.java0000644000175000017500000000324111201125563025616 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The ActionRequest represents the request sent to the portlet * to handle an action.
    * It extends the ClientDataRequest interface and provides action request * information to portlets. *

    * The portlet container creates an ActionRequest object and * passes it as argument to the portlet's processAction method. * * @see ClientDataRequest */ public interface ActionRequest extends ClientDataRequest { /** * Predefined action name for usage with the * @ProcessAction annotation. * * @since 2.0 */ public static final String ACTION_NAME = "javax.portlet.action"; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortalContext.java0000644000175000017500000000773611201125563025653 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The PortalContext interface gives the portlet * the ability to retrieve information about the portal calling this portlet. *

    * The portlet can only read the PortalContext data. */ public interface PortalContext { /** * Property indicating if the portal application supports the * MimeResponse property MARKUP_HEAD_ELEMENT. *

    * A non-null value indicates that the portal application supports * the MARKUP_HEAD_ELEMENT property. *

    * The value is "javax.portlet.markup.head.element.support". * * @since 2.0 */ public static final String MARKUP_HEAD_ELEMENT_SUPPORT = "javax.portlet.markup.head.element.support"; /** * Returns the portal property with the given name, * or a null if there is * no property by that name. * * @param name property name * * @return portal property with key name * * @exception java.lang.IllegalArgumentException * if name is null. */ public java.lang.String getProperty(java.lang.String name); /** * Returns all portal property names, or an empty * Enumeration if there are no property names. * * @return All portal property names as an * Enumeration of String objects */ public java.util.Enumeration getPropertyNames(); /** * Returns all supported portlet modes by the portal * as an enumeration of PortletMode objects. *

    * The portlet modes must at least include the * standard portlet modes EDIT, HELP, VIEW. * * @return All supported portal modes by the portal * as an enumeration of PortletMode objects. */ public java.util.Enumeration getSupportedPortletModes(); /** * Returns all supported window states by the portal * as an enumeration of WindowState objects. *

    * The window states must at least include the * standard window states MINIMIZED, NORMAL, MAXIMIZED. * * @return All supported window states by the portal * as an enumeration of WindowState objects. */ public java.util.Enumeration getSupportedWindowStates(); /** * Returns information about the portal like vendor, version, etc. *

    * The form of the returned string is servername/versionnumber. For * example, the reference implementation Pluto may return the string * Pluto/1.0. *

    * The portlet container may return other optional information after the * primary string in parentheses, for example, Pluto/1.0 * (JDK 1.3.1; Windows NT 4.0 x86). * * @return a String containing at least the portal name and version number */ public java.lang.String getPortalInfo(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/RenderRequest.java0000644000175000017500000000463211201125563025625 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The RenderRequest represents the request sent to the portlet * to handle a render. * It extends the PortletRequest interface to provide render request * information to portlets.
    * The portlet container creates a RenderRequest object and * passes it as argument to the portlet's render method. * * @see PortletRequest * @see ActionRequest */ public interface RenderRequest extends PortletRequest { /** * This property is set by the container if the portlet container * has a cached response for the given validation tag. The property can be * retrieved using the getProperty method. *

    * The value is "portlet.ETag ". * * @since 2.0 */ public static final String ETAG = "portlet.ETag"; /** * Returns the validation tag if the portlet container * has a cached response for this validation tag, or * null if no cached response exists. *

    * This call returns the same value as * RenderRequest.getProperty(RenderRequest.ETAG). * * @return the validation tag if the portlet container * has a cached response for this validation tag, or * null if no cached response exists. * * @since 2.0 */ public String getETag(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/UnavailableException.java0000644000175000017500000001043611201125563027136 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The portlet should throw the UnavailableException when * the portlet is either temporarily or permanently unavailable to handle requests. * **/ public class UnavailableException extends PortletException { private boolean permanent; // needs admin action? private int seconds; // unavailability estimate private static final long serialVersionUID = 1L; /** * * Constructs a new exception with a descriptive * message indicating that the portlet is permanently * unavailable. * * @param text a String specifying the * descriptive message * */ public UnavailableException(String text) { super(text); permanent = true; } /** * Constructs a new exception with a descriptive message * indicating that the portlet is temporarily unavailable * and giving an estimate of how long it will be unavailable. * *

    In some cases, the portlet cannot make an estimate. For * example, the portlet might know that a server it needs is * not running, but it might not be able to report how long it will take * to be restored to functionality. This can be indicated with * a negative or zero value for the seconds argument. * * @param text a String specifying the * descriptive message. This message can be written * to a log file or displayed for the user. * * @param seconds an integer specifying the number of seconds * for which the portlet expects to be unavailable; if * this is zero or negative, it indicates that the portlet * cannot make an estimate. * */ public UnavailableException(String text, int seconds) { super(text); if (seconds <= 0) this.seconds = -1; else this.seconds = seconds; permanent = false; } /** * * Returns a boolean indicating * whether the portlet is permanently unavailable. * If so, something is wrong with the portlet, and the * system administrator must take some corrective action. * * @return true if the portlet is * permanently unavailable; false * if the portlet is temporarily * unavailable. * */ public boolean isPermanent() { return permanent; } /** * Returns the time in seconds for which the portlet can be expected to * be unavailable. *

    * If the portlet is called again while it is still unavailable, it * indicates the same time estimate. No effort is * made to correct for the time elapsed since the exception was * first reported. *

    * If this method returns zero or a negative number, the portlet * is permanently unavailable or cannot provide an estimate of * how long it will be unavailable. * * @return an integer specifying the number of seconds * the portlet will be temporarily unavailable, * or zero or a negative number if the portlet is permanently * unavailable or cannot make an estimate. * */ public int getUnavailableSeconds() { return permanent ? -1 : seconds; } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ResourceURL.java0000644000175000017500000001342311201125563025205 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The ResourceURL defines a resource URL that when clicked will * result in a serveResource call of the * ResourceServingPortlet interface. *

    * Each resource URL has a specific cache level assigned with it. This level * can be either FULL, PORTLET or PAGE and denotes * the cacheability of the resource in the browser. *

    * The default cache level of a resource URL is either the cache level of the * parent resource URL, or PAGE if no parent resource URL is * available. * * @since 2.0 */ public interface ResourceURL extends BaseURL { /** * The URL of type FULL does not need to contain the current * state of the page or the current render parameters, portlet mode, or * window state of the portlet. Thus the portlet may not be able to * access the portlet mode, window state, or render parameters in the * serveResource call. *

    * Only URLs of the type FULL are allowed in the response. * The same restriction is true for all downstream URLs that result from * this response call. Attempts to create URLs that are not of type * FULL will result in an IllegalStateException. *

    * URLs of the type FULL have the highest cacheability in the * browser as they do not depend on any state of the portlet or page. */ public static final String FULL = "cacheLevelFull"; /** * The URL of type PORTLRET does not need to contain the * current state of the page, but the current render parameters, portlet * mode, or window state of the portlet must be accessible to the portlet. *

    * Only URLs of the type PORTLET or FULL are * allowed in the response. The same restriction * is true for all downstream URLs that result from this response. * Attempts to create URLs that are not of type * PORTLET or FULL will result in an * IllegalStateException. *

    * URLs of the type PORTLET are cacheable on the portlet * level in the browser and can be served from the browser cache for as long * as the state of this portlet does not change. */ public static final String PORTLET = "cacheLevelPortlet"; /** * The URL of type PAGE may contain artifacts that require * knowledge of the state of the complete page, like * PortletURLs. *

    * URLs of the type PAGE are only cacheable on the page level * and can only be served from the browser cache as long as no state on the * page changes. */ public static final String PAGE = "cacheLevelPage"; /** * Property that the portlet can set for resources with caching * type FULL via the setProperty method * on the ResourceURL. *

    * When set, this property indicates to the portal application * that it can share this resource across different portlet applications. *

    * The value of this property should be a QName in the * format of javax.xml.namespace.QName.toString(). */ public static final String SHARED = "javax.portlet.shared"; /** * Allows setting a resource ID that can be retrieved when serving the * resource through the {@link ResourceRequest#getResourceID} method. * * @param resourceID * ID for this resource URL */ public void setResourceID(String resourceID); /** * Returns the cache level of this resource URL. *

    * Possible return values are: FULL, PORTLET * or PAGE. * * @return the cache level of this resource URL. */ public String getCacheability(); /** * Sets the cache level of this resource URL. *

    * Possible values are: FULL, PORTLET * or PAGE. *

    * Note that if this URL is created inside a * serveResource call it must have * at minimum the same cacheablity, or a more * restrictive one, as the parent resource URL, * otherwise an IllegalStateException is thrown. *

    * The default cache level of a resource URL is either the cache level of the * parent resource URL, or PAGE if no parent resource URL is * available. * * @param cacheLevel the cache level of this resource URL. * @throws java.lang.IllegalStateException * if this resource URL has a weaker cache level * than the parent resource URL. * @throws java.lang.IllegalArgumentException * if the cacheLevel is unknown to the portlet container */ public void setCacheability(String cacheLevel); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/Event.java0000644000175000017500000000410611201125563024112 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The Event interface represents an event that the portlet has received * in the event processing phase. *

    * The Event interface encapsulates the event name and event payload, * it does not represent the event object itself. *

    * The portlet must define the events it is able to receive in the portlet deployment * descriptor with the supported-processing-event. * * @since 2.0 * @see EventPortlet */ public interface Event { /** * Get the event QName. * * @return the QName of the event, never null. */ public javax.xml.namespace.QName getQName(); /** * Get the local part of the event name. * * @return the local part of the event, never null. */ public java.lang.String getName(); /** * Get the event payload. * * @return event payload, must be serializable. * May return null if this event has no payload. */ public java.io.Serializable getValue(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/MimeResponse.java0000644000175000017500000003537011201125563025446 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The MimeResponse defines the base interface to assist a * portlet in returning MIME content. * * @since 2.0 */ public interface MimeResponse extends PortletResponse { /** * Property to set the expiration time in seconds for this response using * the setProperty method intended to be used in * forwarded or included servlets/JSPs. *

    * If the expiration value is set to 0, caching is disabled for this * portlet; if the value is set to -1, the cache does not expire. *

    * A default can be defined in the portlet deployment descriptor * with the expiration-cache tag, otherwise it is 0. *

    * Non-integer values are treated as 0. *

    * The value is "portlet.expiration-cache". * * @see CacheControl */ public static final String EXPIRATION_CACHE = "portlet.expiration-cache"; /** * Property to set the cache scope for this response using the * setProperty method intended to be used in * forwarded or included servlets/JSPs. *

    * Predefined cache scopes are: PUBLIC_SCOPE and PRIVATE_SCOPE. *

    * A default can be defined in the portlet deployment descriptor * with the cache-scope tag, otherwise it is PRIVATE_SCOPE. *

    * Values that are not either PUBLIC_SCOPE or PRIVATE_SCOPE * are treated as PRIVATE_SCOPE. *

    * The value is "portlet.cache-scope". * * @see CacheControl * @since 2.0 */ public static final String CACHE_SCOPE = "portlet.cache-scope"; /** * Public cache scope, indicating that the cache entry can be shared across * users. The value is "portlet.public-scope". * * @since 2.0 */ public static final String PUBLIC_SCOPE = "portlet.public-scope"; /** * Private cache scope, indicating that the cache entry must not be shared * across users. The value is "portlet.private-scope". * * @since 2.0 */ public static final String PRIVATE_SCOPE = "portlet.private-scope"; /** * Property to tell the portlet container the new ETag for this response * intended to be used in forwarded or included servlets/JSPs. *

    * This property needs to be set using the setProperty method. *

    * The value is "portlet.ETag ". * * @see CacheControl * @since 2.0 */ public static final String ETAG = "portlet.ETag"; /** * Property to tell the portlet container to use the cached markup * for the validation token provided in the request. This property * needs to be set using the setProperty method with a non-null * value and is intended to be used in forwarded or included servlets/JSPs. * The value itself is not evaluated. *

    * The value is "portlet.use-cached-content ". * * @see CacheControl * @since 2.0 */ public static final String USE_CACHED_CONTENT = "portlet.use-cached-content"; /** * Property intended to be a hint to the portal application that the returned * content is completely namespaced. * This includes all markup id elements, form fields, etc. * One example where this is might be used is for portal applications that * are form-based and thus need to re-write any forms included in the portlet * markup. *

    * This property needs to be set using the setProperty method with a non-null * value. The value itself is not evaluated. *

    * The value is "X-JAVAX-PORTLET-NAMESPACED-RESPONSE". * * @since 2.0 */ public static final String NAMESPACED_RESPONSE = "X-JAVAX-PORTLET-NAMESPACED-RESPONSE"; /** * Property intended to be a hint to the portal application that the provided * DOM element should be added to the markup head section of the response to the * client. *

    * Support for this property is optional and the portlet can verify if the * calling portal supports this property via the MARKUP_HEAD_ELEMENT_SUPPORT * property on the PortalContext. *

    * Even if the calling portal support this property delivery of the DOM * element to the client cannot be guaranteed, e.g. due to possible security * rules of the portal application or elements that conflict with the * response of other portlets. *

    * This property needs to be set using the * setProperty(String key,org.w3c.dom.Element element) * method. *

    * The value is "javax.portlet.markup.head.element". * * @since 2.0 */ public static final String MARKUP_HEAD_ELEMENT = "javax.portlet.markup.head.element"; /** * Returns the MIME type that can be used to contribute markup to the render * response. *

    * If no content type was set previously using the {@link #setContentType} * method this method returns null. * * @see #setContentType * * @return the MIME type of the response, or null if no * content type is set */ public String getContentType(); /** * Sets the MIME type for the response. The portlet should set the * content type before calling {@link #getWriter} or * {@link #getPortletOutputStream}. If the content type is not * the {@link PortletRequest#getResponseContentType} value is * set as response content type by the portlet container. *

    * Calling setContentType after getWriter or * getOutputStream does not change the content type. *

    * * @param type * the content MIME type * * @see PortletRequest#getResponseContentTypes * @see #getContentType */ public void setContentType(String type); /** * Returns the name of the charset used for the MIME body sent in this * response. * *

    * See RFC 2047 for * more information about character encoding and MIME. * * @return a String specifying the name of the charset, for * example, ISO-8859-1 * */ public String getCharacterEncoding(); /** * Returns a PrintWriter object that can send character text to the portal. *

    * Before calling this method the content type of the render response should * be set using the {@link #setContentType} method. *

    * Either this method or {@link #getPortletOutputStream} may be called to * write the body, not both. * * @return a PrintWriter object that can return character * data to the portal * * @exception java.io.IOException * if an input or output exception occurred * @exception java.lang.IllegalStateException * if the getPortletOutputStream method has * been called on this response. * * @see #setContentType * @see #getPortletOutputStream */ public java.io.PrintWriter getWriter() throws java.io.IOException; /** * Returns the locale assigned to the response. * * @return Locale of this response */ public java.util.Locale getLocale(); /** * Sets the preferred buffer size for the body of the response. The portlet * container will use a buffer at least as large as the size requested. *

    * This method must be called before any response body content is written; * if content has been written, or the portlet container does not support * buffering, this method may throw an IllegalStateException. * * @param size * the preferred buffer size * * @exception java.lang.IllegalStateException * if this method is called after content has been written, * or the portlet container does not support buffering * * @see #getBufferSize * @see #flushBuffer * @see #isCommitted * @see #reset */ public void setBufferSize(int size); /** * Returns the actual buffer size used for the response. If no buffering is * used, this method returns 0. * * @return the actual buffer size used * * @see #setBufferSize * @see #flushBuffer * @see #isCommitted * @see #reset */ public int getBufferSize(); /** * Forces any content in the buffer to be written to the underlying output stream. A call to * this method automatically commits the response. * * @exception java.io.IOException * if an error occurred when writing the output * * @see #setBufferSize * @see #getBufferSize * @see #isCommitted * @see #reset */ public void flushBuffer() throws java.io.IOException; /** * Clears the content of the underlying buffer in the response without * clearing properties set. If the response has been committed, this method * throws an IllegalStateException. * * @exception IllegalStateException * if this method is called after response is committed * * @see #setBufferSize * @see #getBufferSize * @see #isCommitted * @see #reset */ public void resetBuffer(); /** * Returns a boolean indicating if the response has been committed. * * @return a boolean indicating if the response has been committed * * @see #setBufferSize * @see #getBufferSize * @see #flushBuffer * @see #reset */ public boolean isCommitted(); /** * Clears any data that exists in the buffer as well as the properties set. * If the response has been committed, this method throws an * IllegalStateException. * * @exception java.lang.IllegalStateException * if the response has already been committed * * @see #setBufferSize * @see #getBufferSize * @see #flushBuffer * @see #isCommitted */ public void reset(); /** * Returns a OutputStream suitable for writing binary data in * the response. The portlet container does not encode the binary data. *

    * Before calling this method the content type of the render response must * be set using the {@link #setContentType} method. *

    * Calling flush() on the OutputStream commits the response. *

    * Either this method or {@link #getWriter} may be called to write the body, * not both. * * @return a OutputStream for writing binary data * * @exception java.lang.IllegalStateException * if the getWriter method has been called on * this response. * * @exception java.io.IOException * if an input or output exception occurred * * @see #setContentType * @see #getWriter */ public java.io.OutputStream getPortletOutputStream() throws java.io.IOException; /** * Creates a portlet URL targeting the portlet. If no portlet mode, window * state or security modifier is set in the PortletURL the current values * are preserved. If a request is triggered by the PortletURL, it results in * a render request. *

    * The returned URL can be further extended by adding portlet-specific * parameters and portlet modes and window states. *

    * The created URL will per default not contain any parameters of the * current render request. * * @return a portlet render URL */ public PortletURL createRenderURL(); /** * Creates a portlet URL targeting the portlet. If no portlet mode, window * state or security modifier is set in the PortletURL the current values * are preserved. If a request is triggered by the PortletURL, it results in * an action request. *

    * The returned URL can be further extended by adding portlet-specific * parameters and portlet modes and window states. *

    * The created URL will per default not contain any parameters of the * current render request. * * @return a portlet action URL */ public PortletURL createActionURL(); /** * Creates a portlet URL targeting the portlet. If no security modifier is * set in the PortletURL the current values are preserved. The current * render parameters, portlet mode and window state are preserved. *

    * If a request is triggered by the PortletURL, it results in a serve * resource request of the ResourceServingPortlet interface. *

    * The returned URL can be further extended by adding portlet-specific * parameters . *

    * The created URL will per default contain the current * cacheability setting of the parent resource. * If no parent resource is available, PAGE is the default. * * @since 2.0 * @return a portlet resource URL */ public ResourceURL createResourceURL(); /** * Returns the cache control object allowing to set * specific cache settings valid for the markup * returned in this response. * * @return Cache control for the current response. * * @since 2.0 */ public CacheControl getCacheControl(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletURLGenerationListener.java0000644000175000017500000000433211201125563030570 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * Portlet applications can register portlet URL listeners in order to filter URLs * before they get generated. * In order to receive a callback from the portlet container before a * portlet URL is generated the portlet application needs to implement this * interface and register it in the deployment descriptor with the * listener element. * * @since 2.0 */ public interface PortletURLGenerationListener { /** * Callback being called by the portlet container * before toString or write * are executed on action URLs. * * @param actionURL action URL to be generated */ public void filterActionURL(PortletURL actionURL); /** * Callback being called by the portlet container * before toString or write * are executed on render URLs. * * @param renderURL render URL to be generated */ public void filterRenderURL(PortletURL renderURL); /** * Callback being called by the portlet container * before toString or write * are executed on resource URLs. * * @param resourceURL resource URL to be generated */ public void filterResourceURL(ResourceURL resourceURL); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletMode.java0000644000175000017500000001207211201125563025270 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.util.Locale; /** * The PortletMode class represents * the possible modes that a portlet can assume. *

    * A portlet mode indicates the function a portlet is performing. * Normally, portlets perform different tasks and create different * content depending on the function they are currently performing. * When invoking a portlet, the portlet container provides the * current portlet mode to the portlet. *

    * Portlets can programmatically change their portlet * mode when processing an action request. *

    * This class defines the default portlet modes EDIT, HELP, VIEW. * Additional portlet modes may be defined by calling the constructor * of this class. If a portal/portlet-container does not support a * custom portlet mode defined in the portlet application deployment descriptor, * the custom portlet mode will be ignored by the portal/portlet container. */ public class PortletMode { /** * The expected functionality for a portlet in VIEW portlet mode * is to generate markup reflecting the current state of the portlet. * For example, the VIEW portlet mode of a portlet may * include one or more screens that the user can navigate and interact * with, or it may consist of static content that does not require any * user interaction. *

    * This mode must be supported by the portlet. *

    * The string value for this mode is "view". */ public final static PortletMode VIEW = new PortletMode ("view"); /** * Within the EDIT portlet mode, a portlet should provide * content and logic that lets a user customize the behavior of the portlet. * The EDIT portlet mode may include one or more screens among which * users can navigate to enter their customization data. *

    * Typically, portlets in EDIT portlet mode will * set or update portlet preferences. *

    * This mode is optional. *

    * The string value for this mode is "edit". */ public final static PortletMode EDIT = new PortletMode ("edit"); /** * When in HELP portlet mode, a portlet should provide help * information about the portlet. This help information could be * a simple help screen explaining the entire portlet in * coherent text or it could be context-sensitive help. *

    * This mode is optional. *

    * The string value for this mode is "help". */ public final static PortletMode HELP = new PortletMode ("help"); private String _name; /** * Creates a new portlet mode with the given name. *

    * Upper case letters in the name are converted to * lower case letters. * * @param name The name of the portlet mode */ public PortletMode(String name) { if (name==null) { throw new IllegalArgumentException("PortletMode name can not be NULL"); } _name = name.toLowerCase(Locale.ENGLISH); } /** * Returns a String representation of this portlet mode. * Portlet mode names are always lower case names. * * @return String representation of this portlet mode */ public String toString() { return _name; } /** * Returns the hash code value for this portlet mode. * The hash code is constructed by producing the * hash value of the String value of this mode. * * @return hash code value for this portlet mode */ public int hashCode() { return _name.hashCode(); } /** * Compares the specified object with this portlet mode * for equality. Returns true if the * Strings equals method for the String * representing the two portlet modes returns true. * * @param object the portlet mode to compare this portlet mode with * * @return true, if the specified object is equal with this portlet mode */ public boolean equals(Object object) { if ( object instanceof PortletMode ) return _name.equals(((PortletMode) object)._name); else return false; } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/StateAwareResponse.java0000644000175000017500000002575411201125563026624 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The StateAwareResponse represents a response that can modify * state information or send events.
    * It extends the PortletResponse interface. * * @since 2.0 * @see PortletResponse */ public interface StateAwareResponse extends PortletResponse { /** * Sets the window state of a portlet to the given window state. *

    * Possible values are the standard window states and any custom window * states supported by the portal and the portlet. Standard window states * are: *

      *
    • MINIMIZED *
    • NORMAL *
    • MAXIMIZED *
    * * @param windowState * the new portlet window state * * @exception WindowStateException * if the portlet cannot switch to the specified window * state. To avoid this exception the portlet can check the * allowed window states with * Request.isWindowStateAllowed(). * @exception java.lang.IllegalStateException * if the method is invoked after sendRedirect * has been called. * * @see WindowState */ public void setWindowState(WindowState windowState) throws WindowStateException; /** * Sets the portlet mode of a portlet to the given portlet mode. *

    * Possible values are the standard portlet modes and any custom portlet * modes supported by the portal and the portlet. Portlets must declare in * the deployment descriptor the portlet modes they support for each markup * type. Standard portlet modes are: *

      *
    • EDIT *
    • HELP *
    • VIEW *
    *

    * Note: The portlet may still be called in a different window state in the * next render call, depending on the portlet container / portal. * * @param portletMode * the new portlet mode * * @exception PortletModeException * if the portlet cannot switch to this portlet mode, because * the portlet or portal does not support it for this markup, * or the current user is not allowed to switch to this * portlet mode. To avoid this exception the portlet can * check the allowed portlet modes with * Request.isPortletModeAllowed(). * @exception java.lang.IllegalStateException * if the method is invoked after sendRedirect * has been called. */ public void setPortletMode(PortletMode portletMode) throws PortletModeException; /** * Sets a parameter map for the render request. *

    * All previously set render parameters are cleared. *

    * These parameters will be accessible in all sub-sequent render calls via * the PortletRequest.getParameter call until a new request * is targeted to the portlet. *

    * The given parameters do not need to be encoded prior to calling this * method. *

    * The portlet should not modify the map any further after calling * this method. * * @param parameters * Map containing parameter names for the render phase as keys * and parameter values as map values. The keys in the parameter * map must be of type String. The values in the parameter map * must be of type String array (String[]). * * @exception java.lang.IllegalArgumentException * if parameters is null, if any of the * keys in the Map are null, if any of * the keys is not a String, or if any of the values is not a * String array. * @exception java.lang.IllegalStateException * if the method is invoked after sendRedirect * has been called. */ public void setRenderParameters(java.util.Map parameters); /** * Sets a String parameter for the render request. *

    * These parameters will be accessible in all sub-sequent render calls via * the PortletRequest.getParameter call until a request is * targeted to the portlet. *

    * This method replaces all parameters with the given key. *

    * The given parameter do not need to be encoded prior to calling this * method. * * @param key * key of the render parameter * @param value * value of the render parameter * * @exception java.lang.IllegalArgumentException * if key is null. * @exception java.lang.IllegalStateException * if the method is invoked after sendRedirect * has been called. */ public void setRenderParameter(String key, String value); /** * Sets a String array parameter for the render request. *

    * These parameters will be accessible in all sub-sequent render calls via * the PortletRequest.getParameter call until a request is * targeted to the portlet. *

    * This method replaces all parameters with the given key. *

    * The given parameter do not need to be encoded prior to calling this * method. * * @param key * key of the render parameter * @param values * values of the render parameter * * @exception java.lang.IllegalArgumentException * if key or value are null. * @exception java.lang.IllegalStateException * if the method is invoked after sendRedirect * has been called. */ public void setRenderParameter(String key, String[] values); /** * Publishes an Event with the given payload. *

    * The object type of the value must be compliant with the specified event * type in the portlet deployment descriptor. *

    * The value must have a valid JAXB binding and be serializable. * * @param name * the event name to publish, must not be null * @param value * the value of this event, must have a valid JAXB binding and * be serializable, or null. * * @exception java.lang.IllegalArgumentException * if name is null, the value is not * serializable, the value does not have a valid JAXB binding, the * object type of the value is not the same as specified in * the portlet deployment descriptor for this event name. * @since 2.0 */ public void setEvent(javax.xml.namespace.QName name, java.io.Serializable value); /** * Publishes an Event with the given payload in the default namespace. *

    * The name is treated as local part of the event QName and the namespace * is either taken from the default-event-namespace element * in the portlet deployment descriptor, or if this element is not provided * the XML default namespace XMLConstants.NULL_NS_URI is used. *

    * The object type of the value must be compliant with the specified event * type in the portlet deployment descriptor. *

    * The value must have a valid JAXB binding and be serializable. * * @param name * the local part of the event name to publish, must not be null * @param value * the value of this event, must have a valid JAXB binding and * be serializable, or null. * * @exception java.lang.IllegalArgumentException * if name is null, the value is not * serializable, the value does not have a valid JAXB binding, the * object type of the value is not the same as specified in * the portlet deployment descriptor for this event name. * @since 2.0 */ public void setEvent(String name, java.io.Serializable value); /** * Returns a Map of the render parameters currently set on * this response. *

    * The values in the returned Map are from type String array (String[]). *

    * If no parameters exist this method returns an empty Map. * * @since 2.0 * * @return Map containing render parameter names as keys and * parameter values as map values, or an empty Map if * no parameters exist. The keys in the parameter map are of type * String. The values in the parameter map are of type String array (String[]). */ public java.util.Map getRenderParameterMap(); /** * Returns the currently set portlet mode on this reponse. * * @since 2.0 * * @return the portlet mode, or null if none is set */ public PortletMode getPortletMode(); /** * Returns the currently set window state on this response. * * @since 2.0 * * @return the window state, or null if none is set */ public WindowState getWindowState(); /** * Removes the specified public render parameter. * The name must reference a public render parameter defined * in the portlet deployment descriptor under the * public-render-parameter element with the * identifier mapping to the parameter name. * * @param name a String specifying * the name of the public render parameter to be removed * * @exception java.lang.IllegalArgumentException * if name is null. * @since 2.0 */ public void removePublicRenderParameter(String name); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ResourceRequest.java0000644000175000017500000001315511201125563026175 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The ResourceRequest interface represents the request * send to the portlet for rendering resources. * * It extends the ClientDataRequest interface and provides resource request * information to portlets. *

    * The portlet container creates an ResourceRequest object and * passes it as argument to the portlet's serveResource method. *

    * The ResourceRequest is provided with the current portlet mode, window state, * and render parameters that the portlet can access via the * PortletResourceRequest with getPortletMode and, * getWindowState, or one of the getParameter methods. * ResourceURLs cannot change the current portlet mode, window state or * render parameters. Parameters set on a resource URL are not render parameters * but parameters for serving this resource and will last only for only * this the current serveResource request.
    * If a parameter is set that has the same name as a render parameter that this * resource URL contains, the render parameter must be the last entry in the * parameter value array. * * @see ClientDataRequest * @see ResourceServingPortlet * @since 2.0 */ public interface ResourceRequest extends ClientDataRequest { /** * This property is set by the container if the container * has a cached response for the given validation tag. The property can be * retrieved using the getProperty method. *

    * The value is "portlet.ETag ". */ public static final String ETAG = "portlet.ETag"; /** * Returns the validation tag if the portlet container * has a cached response for this validation tag, or * null if no cached response exists. *

    * This call returns the same value as * ResourceRequest.getProperty(ResourceRequest.ETAG). * * @return the validation tag if the portlet container * has a cached response for this validation tag, or * null if no cached response exists. */ public String getETag(); /** * Returns the resource ID set on the ResourceURL or null * if no resource ID was set on the URL. * * @return the resource ID set on the ResourceURL,or null * if no resource ID was set on the URL. */ public String getResourceID(); /** * Returns a Map of the private render parameters of this request. * Private parameters are not shared with other portlets or components. * The returned parameters are "x-www-form-urlencoded" decoded. *

    * The parameters returned do not include the resource parameters that * the portlet may have set on the resource URL triggering this * serveResource call. *

    * The values in the returned Map are from type * String array (String[]). *

    * If no private parameters exist this method returns an empty Map. * * @return an immutable Map containing private parameter names as * keys and private parameter values as map values, or an empty Map * if no private parameters exist. The keys in the parameter * map are of type String. The values in the parameter map are of type * String array (String[]). */ public java.util.Map getPrivateRenderParameterMap(); /** * Returns the portal preferred content type for the response. *

    * The returned content type should be based on the HTTP Accept header * provided by the client. * * @return preferred content type of the response */ public String getResponseContentType(); /** * Gets a list of content types which the portal accepts for the response. * This list is ordered with the most preferable types listed first. *

    * The returned content types should be based on the HTTP Accept header * provided by the client. * * @return ordered list of content types for the response */ public java.util.Enumeration getResponseContentTypes(); /** * Returns the cache level of this resource request. *

    * Possible return values are: * ResourceURL.FULL, ResourceURL.PORTLET * or ResourceURL.PAGE. * * @return the cache level of this resource request. */ public String getCacheability(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/Portlet.java0000644000175000017500000001553611201125563024473 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; import java.io.IOException; /** * The Portlet interface is used by the portlet container to * invoke the portlets. Every portlet has to implement this interface, * either by directly implementing it, or by using an existing class * implementing the Portlet interface. *

    * A portlet is a Java technology-based web component. It is managed by the portlet container and * processes requests and generates dynamic content as response. Portlets are used by portals as * pluggable user interface components. *

    * The content generated by a portlet is called a fragment. A fragment is a piece of * markup (e.g. HTML, XHTML, WML) adhering to certain rules and can be aggregated * with other fragments into a complete document. The content of a portlet is normally * aggregated with the content of other portlets into the portal page. *

    * The portlet container instantiates portlets, manages their lifecycle * and invoking them to process requests. The lifecycle consists of: *

      *
    • initializing the portlet using using the init method *
    • request processsing *
    • taking the portlet out of service using the destroy method *
    *

    * Request processing is divided into two types: *

      *
    • action requests handled through the processAction method, * to perform actions targeted to the portlet *
    • render requests handled through the render method, * to perform the render operation *
    */ public interface Portlet { /** * Called by the portlet container to indicate to a portlet that the * portlet is being placed into service. * *

    The portlet container calls the init * method exactly once after instantiating the portlet. * The init method must complete successfully * before the portlet can receive any requests. * *

    The portlet container cannot place the portlet into service * if the init method *

      *
    1. Throws a PortletException *
    2. Does not return within a time period defined by the portlet container. *
    * * * @param config a PortletConfig object * containing the portlet's * configuration and initialization parameters * * @exception PortletException if an exception has occurred that * interferes with the portlet's normal * operation. * @exception UnavailableException if the portlet cannot perform the initialization at this time. * * */ public void init(PortletConfig config) throws PortletException; /** * Called by the portlet container to allow the portlet to process * an action request. This method is called if the client request was * originated by a URL created (by the portlet) with the * RenderResponse.createActionURL() method. *

    * Typically, in response to an action request, a portlet updates state * based on the information sent in the action request parameters. * In an action the portlet may: *

      *
    • issue a redirect *
    • change its window state *
    • change its portlet mode *
    • modify its persistent state *
    • set render parameters *
    *

    * A client request triggered by an action URL translates into one * action request and many render requests, one per portlet in the portal page. * The action processing must be finished before the render requests * can be issued. * * @param request * the action request * @param response * the action response * @exception PortletException * if the portlet has problems fulfilling the * request * @exception UnavailableException * if the portlet is unavailable to process the action at this time * @exception PortletSecurityException * if the portlet cannot fullfill this request because of security reasons * @exception IOException * if the streaming causes an I/O problem */ public void processAction (ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException; /** * Called by the portlet container to allow the portlet to generate * the content of the response based on its current state. * * @param request * the render request * @param response * the render response * * @exception PortletException * if the portlet has problems fulfilling the * rendering request * @exception UnavailableException * if the portlet is unavailable to perform render at this time * @exception PortletSecurityException * if the portlet cannot fullfill this request because of security reasons * @exception java.io.IOException * if the streaming causes an I/O problem */ public void render (RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException; /** * * Called by the portlet container to indicate to a portlet that the * portlet is being taken out of service. *

    * Before the portlet container calls the destroy method, it should * allow any threads that are currently processing requests within * the portlet object to complete execution. To avoid * waiting forever, the portlet container can optionally wait for * a predefined time before destroying the portlet object. * *

    This method enables the portlet to do the following: *

      *
    • clean up any resources that it holds (for example, memory, * file handles, threads) *
    • make sure that any persistent state is * synchronized with the portlet current state in memory. *
    */ public void destroy(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/EventResponse.java0000644000175000017500000000437711201125563025643 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The EventResponse interface represents the portlet * response to an event request. * It extends the StateAwareResponse interface.
    * The portlet container creates an EventResponse object and * passes it as argument to the portlet's processEvent method. * * @see StateAwareResponse * @see PortletResponse * @since 2.0 */ public interface EventResponse extends StateAwareResponse { /** * Maintain the current render parameters of the request for * the response. *

    * All previously set render parameters are cleared. *

    * These parameters will be accessible in all * subsequent render calls via the * PortletRequest.getParameter call until * a new request is targeted to the portlet. *

    * The given parameters do not need to be encoded * prior to calling this method. * * @param request The request the portlet has been provided * with by the portlet container for the current * processEvent call, must not be * null. */ public void setRenderParameters(EventRequest request); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/0000755000175000017500000000000011354474716023472 5ustar drazzibdrazzibportlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/package-info.java0000644000175000017500000000167211202051315026641 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /** * The javax.portlet.filter package defines the filter APIs for the Java Portlet Specification. */ package javax.portlet.filter;portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/EventFilter.java0000644000175000017500000001256311201141010026534 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.io.IOException; import javax.portlet.EventRequest; import javax.portlet.EventResponse; import javax.portlet.PortletException; /** * The EventFilter is an object that performs filtering * tasks on either the event request to a portlet, or on the event response from * a portlet, or both. *

    * Filters perform filtering in the doFilter method. Every Filter has * access to a FilterConfig object from which it can obtain * its initialization parameters, a reference to the PortletContext * which it can use, for example, to load resources needed for filtering tasks. *

    * Filters are configured in the portlet deployment descriptor of a * portlet application. * * @since 2.0 */ public interface EventFilter extends PortletFilter { /** * The doFilter method of the Filter is called by the * portlet container each time a event request/response pair is passed * through the chain due to a client request for a portlet method * at the end of the chain. *

    * The FilterChain passed in to this method allows * the Filter to pass on the event request and response to the next * component in the chain. *

    * The doFilter method of a filter will typically be implemented * following this or some subset of the following pattern: *

      *
    • The method examines the request information.
    • *
    • The method may wrap the request object passed in to * its doFilter method with a customized implementation * the request wrapper ActionRequestWrapper * in order to modify request data.
    • *
    • The method may wrap the response object passed in to its * doFilter method with a customized implementation * of the response wrapper ActionResponseWrapper * to modify response data.
    • *
    • The filter may invoke the next component in the filter chain. * The next component may be another filter, or if the filter * making the invocation is the last filter configured in the * deployment descriptor for this chain, the next component * is the target method of the portlet. The invocation of the * next component is effected by calling the doFilter * method on the FilterChain object, and passing in * the request and response with which it was called or passing * in wrapped versions it may have created. * The filter chain's implementation of the doFilter * method, provided by the portlet container, must locate the * next component in the filter chain and invoke its doFilter * method, passing in the appropriate request and response objects. * Alternatively, the filter chain can block the request by not * making the call to invoke the next component, leaving the filter * responsible for filling out the response object.
    • *
    • After invocation of the next filter in the chain, the filter * may examine the response data.
    • *
    • Alternatively, the filter may have thrown an exception to * indicate an error in processing. If the filter throws an * UnavailableException during its doFilter * processing, the portlet container must not attempt continued * processing down the filter chain. It may choose to retry the * whole chain at a later time if the exception is not marked permanent.
    • *
    • When the last filter in the chain has been invoked, the next * component accessed is the target method on the portlet at * the end of the chain.
    • *
    * * @param request the current event request * @param response the current event response * @param chain the remaining filter chain * @throws IOException if an IO error occurred in the filter processing * @throws PortletException if a portlet exception occurred in the filter processing */ public void doFilter(EventRequest request, EventResponse response, FilterChain chain) throws IOException, PortletException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/EventRequestWrapper.java0000644000175000017500000000560011201125563030311 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import javax.portlet.Event; import javax.portlet.EventRequest; /** * The EventRequestWrapper provides a convenient * implementation of the EventRequest interface * that can be subclassed by developers wishing to adapt the request. * This class implements the Wrapper or Decorator pattern. * Methods default to calling through to the wrapped request object. * * @since 2.0 * @see EventRequest */ public class EventRequestWrapper extends PortletRequestWrapper implements EventRequest { EventRequest request; /** * Creates an EventRequest adaptor * wrapping the given request object. * * @param request the event request to wrap * @throws java.lang.IllegalArgumentException if the request is null */ public EventRequestWrapper(EventRequest request) { super(request); this.request = request; } /** * Return the wrapped request object. * * @return the wrapped request */ public EventRequest getRequest() { return request; } /** * Sets the request object being wrapped. * * @param request the request to set * @throws java.lang.IllegalArgumentException if the request is null. */ public void setRequest(EventRequest request) { if ( request == null) throw new java.lang.IllegalArgumentException("Request is null"); this.request = request; } /** * The default behavior of this method is to call * getEvent() on the wrapped request object. */ public Event getEvent() { return request.getEvent(); } /** * The default behavior of this method is to call * getMethod() on the wrapped request object. */ public String getMethod() { return request.getMethod(); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ActionRequestWrapper.java0000644000175000017500000001047711201125563030455 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import javax.portlet.ActionRequest; /** * The ActionRequestWrapper provides a convenient * implementation of the ActionRequest interface * that can be subclassed by developers wishing to adapt the request. * This class implements the Wrapper or Decorator pattern. * Methods default to calling through to the wrapped request object. * * @since 2.0 * @see ActionRequest */ public class ActionRequestWrapper extends PortletRequestWrapper implements ActionRequest { ActionRequest request; /** * Creates an ActionRequest adaptor * wrapping the given request object. * * @param request the action request to wrap * @throws java.lang.IllegalArgumentException if the request is null */ public ActionRequestWrapper(ActionRequest request) { super(request); this.request = request; } /** * The default behavior of this method is to call * getCharacterEncoding() on the wrapped request object. */ public String getCharacterEncoding() { return request.getCharacterEncoding(); } /** * The default behavior of this method is to call * getContentLength() on the wrapped request object. */ public int getContentLength() { return request.getContentLength(); } /** * The default behavior of this method is to call * getContentType() on the wrapped request object. */ public String getContentType() { return request.getContentType(); } /** * The default behavior of this method is to call * getPortletInputStream() on the wrapped request object. */ public InputStream getPortletInputStream() throws IOException { return request.getPortletInputStream(); } /** * The default behavior of this method is to call * getReader() on the wrapped request object. */ public BufferedReader getReader() throws UnsupportedEncodingException, IOException { return request.getReader(); } /** * The default behavior of this method is to call * setCharacterEncoding(String enc) * on the wrapped request object. */ public void setCharacterEncoding(String enc) throws UnsupportedEncodingException { request.setCharacterEncoding(enc); } /** * Return the wrapped request object. * * @return the wrapped request */ public ActionRequest getRequest() { return request; } /** * Sets the request object being wrapped. * * @param request the request to set * @throws java.lang.IllegalArgumentException if the request is null. */ public void setRequest(ActionRequest request) { if ( request == null) throw new java.lang.IllegalArgumentException("Request is null"); this.request = request; } /** * The default behavior of this method is to call * getMethod() on the wrapped request object. */ public String getMethod() { return request.getMethod(); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/RenderFilter.java0000644000175000017500000001257611201141010026676 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.io.IOException; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import javax.portlet.PortletException; /** * The RenderFilter is an object that performs filtering * tasks on either the render request to a portlet, or on the render response from * a portlet, or both. *

    * Filters perform filtering in the doFilter method. Every Filter has * access to a FilterConfig object from which it can obtain * its initialization parameters, a reference to the PortletContext * which it can use, for example, to load resources needed for filtering tasks. *

    * Filters are configured in the portlet deployment descriptor of a * portlet application. * * @since 2.0 */ public interface RenderFilter extends PortletFilter { /** * The doFilter method of the Filter is called by the * portlet container each time a render request/response pair is passed * through the chain due to a client request for a portlet method * at the end of the chain. *

    * The FilterChain passed in to this method allows * the Filter to pass on the render request and response to the next * component in the chain. *

    * The doFilter method of a filter will typically be implemented * following this or some subset of the following pattern: *

      *
    • The method examines the request information.
    • *
    • The method may wrap the request object passed in to * its doFilter method with a customized implementation * the request wrapper RenderRequestWrapper * in order to modify request data.
    • *
    • The method may wrap the response object passed in to its * doFilter method with a customized implementation * of the response wrapper RenderResponseWrapper * to modify response data.
    • *
    • The filter may invoke the next component in the filter chain. * The next component may be another filter, or if the filter * making the invocation is the last filter configured in the * deployment descriptor for this chain, the next component * is the target method of the portlet. The invocation of the * next component is effected by calling the doFilter * method on the FilterChain object, and passing in * the request and response with which it was called or passing * in wrapped versions it may have created. * The filter chain's implementation of the doFilter * method, provided by the portlet container, must locate the * next component in the filter chain and invoke its doFilter * method, passing in the appropriate request and response objects. * Alternatively, the filter chain can block the request by not * making the call to invoke the next component, leaving the filter * responsible for filling out the response object.
    • *
    • After invocation of the next filter in the chain, the filter * may examine the response data.
    • *
    • Alternatively, the filter may have thrown an exception to * indicate an error in processing. If the filter throws an * UnavailableException during its doFilter * processing, the portlet container must not attempt continued * processing down the filter chain. It may choose to retry the * whole chain at a later time if the exception is not marked permanent.
    • *
    • When the last filter in the chain has been invoked, the next * component accessed is the target method on the portlet at * the end of the chain.
    • *
    * * @param request the current render request * @param response the current render response * @param chain the remaining filter chain * @throws IOException if an IO error occurred in the filter processing * @throws PortletException if a portlet exception occurred in the filter processing */ public void doFilter(RenderRequest request, RenderResponse response, FilterChain chain) throws IOException, PortletException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/FilterChain.java0000644000175000017500000001034711201125563026512 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.io.IOException; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.EventRequest; import javax.portlet.EventResponse; import javax.portlet.PortletException; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import javax.portlet.ResourceRequest; import javax.portlet.ResourceResponse; /** * A FilterChain is an object provided by the portlet container * to the developer giving a view into the invocation chain of a * filtered request for a portlet. Filters use the FilterChain * to invoke the next filter in the chain, or if the calling filter is the * last filter in the chain, to invoke the portlet at the end of the chain. * * @since 2.0 */ public interface FilterChain { /** * Causes the next filter in the chain to be invoked, * or if the calling filter is the last filter in the chain, * causes the portlet at the end of the chain to be invoked. * * @param request the current action request. * @param response the current action response * * @throws IOException if an IO error occurred in the filter processing * @throws PortletException if a portlet exception occurred in the filter processing */ public void doFilter(ActionRequest request, ActionResponse response) throws IOException, PortletException; /** * Causes the next filter in the chain to be invoked, * or if the calling filter is the last filter in the chain, * causes the portlet at the end of the chain to be invoked. * * @param request the current event request. * @param response the current event response. * * @throws IOException if an IO error occured in the filter processing * @throws PortletException if a portlet exception occured in the filter processing */ public void doFilter(EventRequest request, EventResponse response) throws IOException, PortletException; /** * Causes the next filter in the chain to be invoked, * or if the calling filter is the last filter in the chain, * causes the portlet at the end of the chain to be invoked. * * @param request the current render request. * * @param response the current render response. * * @throws IOException if an IO error occurred in the filter processing * @throws PortletException if a portlet exception occurred in the filter processing */ public void doFilter(RenderRequest request, RenderResponse response) throws IOException, PortletException; /** * Causes the next filter in the chain to be invoked, * or if the calling filter is the last filter in the chain, * causes the portlet at the end of the chain to be invoked. * * @param request the current resource request. * @param response the current resource response. * * @throws IOException if an IO error occurred in the filter processing * @throws PortletException if a portlet exception occurred in the filter processing */ public void doFilter(ResourceRequest request, ResourceResponse response) throws IOException, PortletException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/EventResponseWrapper.java0000644000175000017500000001370211201125563030461 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.util.Map; import javax.portlet.EventRequest; import javax.portlet.EventResponse; import javax.portlet.PortletMode; import javax.portlet.PortletModeException; import javax.portlet.WindowState; import javax.portlet.WindowStateException; import javax.xml.namespace.QName; /** * The EventResponseWrapper provides a convenient * implementation of the EventResponse interface * that can be subclassed by developers wishing to adapt the response. * This class implements the Wrapper or Decorator pattern. * Methods default to calling through to the wrapped response object. * * @since 2.0 * @see EventResponse */ public class EventResponseWrapper extends PortletResponseWrapper implements EventResponse { EventResponse response; /** * Creates an EventResponse adaptor * wrapping the given response object. * * @param response the event response to wrap * @throws java.lang.IllegalArgumentException if the response is null */ public EventResponseWrapper(EventResponse response) { super(response); this.response = response; } /** * The default behavior of this method is to call * setEvent(name, value) on the wrapped response object. */ public void setEvent(QName name, java.io.Serializable value) { response.setEvent(name, value); } /** * The default behavior of this method is to call * setPortletMode(portletMode) on the wrapped response object. */ public void setPortletMode(PortletMode portletMode) throws PortletModeException { response.setPortletMode(portletMode); } /** * The default behavior of this method is to call * setRenderParameter(key, value) on the wrapped response object. */ public void setRenderParameter(String key, String value) { response.setRenderParameter(key, value); } /** * The default behavior of this method is to call * setRenderParameter(key, value) on the wrapped response object. */ public void setRenderParameter(String key, String[] values) { response.setRenderParameter(key, values); } /** * The default behavior of this method is to call * setRenderParameters(parameters) on the wrapped response object. */ public void setRenderParameters(Map parameters) { response.setRenderParameters(parameters); } /** * The default behavior of this method is to call * setWindowState(windowState) on the wrapped response object. */ public void setWindowState(WindowState windowState) throws WindowStateException { response.setWindowState(windowState); } /** * Return the wrapped response object. * * @return the wrapped response */ public EventResponse getResponse() { return response; } /** * Sets the response object being wrapped. * * @param response the response to set * @throws java.lang.IllegalArgumentException if the response is null. */ public void setResponse(EventResponse response) { if ( response == null) throw new java.lang.IllegalArgumentException("Response is null"); this.response = response; } /** * The default behavior of this method is to call * getPortletMode() on the wrapped response object. */ public PortletMode getPortletMode() { return response.getPortletMode(); } /** * The default behavior of this method is to call * getRenderParameterMap() on the wrapped response object. */ public Map getRenderParameterMap() { return response.getRenderParameterMap(); } /** * The default behavior of this method is to call * getWindowState() on the wrapped response object. */ public WindowState getWindowState() { return response.getWindowState(); } /** * The default behavior of this method is to call * setRenderParameters() on the wrapped response object. */ public void setRenderParameters(EventRequest request) { response.setRenderParameters(request); } /** * The default behavior of this method is to call * setEvent() on the wrapped response object. */ public void setEvent(String name, java.io.Serializable value) { response.setEvent(name, value); } /** * The default behavior of this method is to call * removePublicRenderParameter() on the wrapped response object. */ public void removePublicRenderParameter(String name) { response.removePublicRenderParameter(name); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ActionResponseWrapper.java0000644000175000017500000001422411201125563030615 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.io.IOException; import java.util.Map; import javax.portlet.ActionResponse; import javax.portlet.PortletMode; import javax.portlet.PortletModeException; import javax.portlet.WindowState; import javax.portlet.WindowStateException; import javax.xml.namespace.QName; /** * The ActionResponseWrapper provides a convenient * implementation of the ActionResponse interface * that can be subclassed by developers wishing to adapt the response. * This class implements the Wrapper or Decorator pattern. * Methods default to calling through to the wrapped response object. * * @since 2.0 * @see ActionResponse */ public class ActionResponseWrapper extends PortletResponseWrapper implements ActionResponse { ActionResponse response; /** * Creates an ActionResponse adaptor * wrapping the given response object. * * @param response the action response to wrap * @throws java.lang.IllegalArgumentException if the response is null */ public ActionResponseWrapper(ActionResponse response) { super(response); this.response = response; } /** * The default behavior of this method is to call * sendRedirect(location) on the wrapped response object. */ public void sendRedirect(String location) throws IOException { response.sendRedirect(location); } /** * The default behavior of this method is to call * sendRedirect(location, renderUrlParamName) on the wrapped response object. */ public void sendRedirect(String location, String renderUrlParamName) throws IOException { response.sendRedirect(location, renderUrlParamName); } /** * The default behavior of this method is to call * setEvent(name, value) on the wrapped response object. */ public void setEvent(QName name, java.io.Serializable value) { response.setEvent(name, value); } /** * The default behavior of this method is to call * setPortletMode(portletMode) on the wrapped response object. */ public void setPortletMode(PortletMode portletMode) throws PortletModeException { response.setPortletMode(portletMode); } /** * The default behavior of this method is to call * setRenderParameter(key, value) on the wrapped response object. */ public void setRenderParameter(String key, String value) { response.setRenderParameter(key, value); } /** * The default behavior of this method is to call * setRenderParameter(key, value) on the wrapped response object. */ public void setRenderParameter(String key, String[] values) { response.setRenderParameter(key, values); } /** * The default behavior of this method is to call * setRenderParameters(parameters) on the wrapped response object. */ public void setRenderParameters(Map parameters) { response.setRenderParameters(parameters); } /** * The default behavior of this method is to call * setWindowState(windowState) on the wrapped response object. */ public void setWindowState(WindowState windowState) throws WindowStateException { response.setWindowState(windowState); } /** * Return the wrapped response object. * * @return the wrapped response */ public ActionResponse getResponse() { return response; } /** * Sets the response object being wrapped. * * @param response the response to set * @throws java.lang.IllegalArgumentException if the response is null. */ public void setResponse(ActionResponse response) { if ( response == null) throw new java.lang.IllegalArgumentException("Response is null"); this.response = response; } /** * The default behavior of this method is to call * getPortletMode() on the wrapped response object. */ public PortletMode getPortletMode() { return response.getPortletMode(); } /** * The default behavior of this method is to call * getRenderParameterMap() on the wrapped response object. */ public Map getRenderParameterMap() { return response.getRenderParameterMap(); } /** * The default behavior of this method is to call * getWindowState() on the wrapped response object. */ public WindowState getWindowState() { return response.getWindowState(); } /** * The default behavior of this method is to call * setEvent() on the wrapped response object. */ public void setEvent(String name, java.io.Serializable value) { response.setEvent(name, value); } /** * The default behavior of this method is to call * removePublicRenderParameter() on the wrapped response object. */ public void removePublicRenderParameter(String name) { response.removePublicRenderParameter(name); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/PortletResponseWrapper.java0000644000175000017500000001070511201125563031031 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import javax.portlet.PortletResponse; import javax.servlet.http.Cookie; /** * The PortletResponseWrapper provides a convenient * implementation of the PortletResponse interface * and is extended by other response wrappers. * This class implements the Wrapper or Decorator pattern. * Methods default to calling through to the wrapped response object. * * @since 2.0 * @see PortletResponse */ public class PortletResponseWrapper implements PortletResponse { PortletResponse response; /** * Require having a response for constructing * the wrapper. * */ private PortletResponseWrapper() { } /** * Creates an ActionResponse adaptor * wrapping the given response object. * * @param response the action response to wrap * @throws java.lang.IllegalArgumentException if the response is null */ public PortletResponseWrapper(PortletResponse response) { if ( response == null) throw new java.lang.IllegalArgumentException("Response is null"); this.response = response; } /** * The default behavior of this method is to call * addProperty(key, value) on the wrapped response object. */ public void addProperty(String key, String value) { response.addProperty(key, value); } /** * The default behavior of this method is to call * encodeURL(path) on the wrapped response object. */ public String encodeURL(String path) { return response.encodeURL(path); } /** * The default behavior of this method is to call * getNamespace() on the wrapped response object. */ public String getNamespace() { return response.getNamespace(); } /** * The default behavior of this method is to call * setProperty(key, value) on the wrapped response object. */ public void setProperty(String key, String value) { response.setProperty(key, value); } /** * Return the wrapped response object. * * @return the wrapped response */ public PortletResponse getResponse() { return response; } /** * Sets the response object being wrapped. * * @param response the response to set * @throws java.lang.IllegalArgumentException if the response is null. */ public void setResponse(PortletResponse response) { if ( response == null) throw new java.lang.IllegalArgumentException("Response is null"); this.response = response; } /** * The default behavior of this method is to call * addProperty() on the wrapped response object. */ public void addProperty(String key, org.w3c.dom.Element element) { response.addProperty(key, element); } /** * The default behavior of this method is to call * createElement() on the wrapped response object. */ public org.w3c.dom.Element createElement(String tagName) { return response.createElement(tagName); } /** * The default behavior of this method is to call * addProperty() on the wrapped response object. */ public void addProperty(Cookie cookie) { response.addProperty(cookie); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ActionFilter.java0000644000175000017500000001260411201141010026664 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.io.IOException; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.PortletException; /** * The ActionFilter is an object that performs filtering * tasks on either the action request to a portlet, or on the action response from * a portlet, or both. *

    * Filters perform filtering in the doFilter method. Every Filter has * access to a FilterConfig object from which it can obtain * its initialization parameters, a reference to the PortletContext * which it can use, for example, to load resources needed for filtering tasks. *

    * Filters are configured in the portlet deployment descriptor of a * portlet application. * * @since 2.0 */ public interface ActionFilter extends PortletFilter { /** * The doFilter method of the Filter is called by the * portlet container each time a action request/response pair is passed * through the chain due to a client request for a portlet method * at the end of the chain. *

    * The FilterChain passed in to this method allows * the Filter to pass on the action request and response to the next * component in the chain. *

    * The doFilter method of a filter will typically be implemented * following this or some subset of the following pattern: *

      *
    • The method examines the request information.
    • *
    • The method may wrap the request object passed in to * its doFilter method with a customized implementation * the request wrapper ActionRequestWrapper * in order to modify request data.
    • *
    • The method may wrap the response object passed in to its * doFilter method with a customized implementation * of the response wrapper ActionResponseWrapper * to modify response data.
    • *
    • The filter may invoke the next component in the filter chain. * The next component may be another filter, or if the filter * making the invocation is the last filter configured in the * deployment descriptor for this chain, the next component * is the target method of the portlet. The invocation of the * next component is effected by calling the doFilter * method on the FilterChain object, and passing in * the request and response with which it was called or passing * in wrapped versions it may have created. * The filter chain's implementation of the doFilter * method, provided by the portlet container, must locate the * next component in the filter chain and invoke its doFilter * method, passing in the appropriate request and response objects. * Alternatively, the filter chain can block the request by not * making the call to invoke the next component, leaving the filter * responsible for filling out the response object.
    • *
    • After invocation of the next filter in the chain, the filter * may examine the response data.
    • *
    • Alternatively, the filter may have thrown an exception to * indicate an error in processing. If the filter throws an * UnavailableException during its doFilter * processing, the portlet container must not attempt continued * processing down the filter chain. It may choose to retry the * whole chain at a later time if the exception is not marked permanent.
    • *
    • When the last filter in the chain has been invoked, the next * component accessed is the target method on the portlet at * the end of the chain.
    • *
    * * @param request the current action request * @param response the current action response * @param chain the remaining filter chain * @throws IOException if an IO error occurred in the filter processing * @throws PortletException if a portlet exception occurred in the filter processing */ public void doFilter(ActionRequest request, ActionResponse response, FilterChain chain) throws IOException, PortletException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/FilterConfig.java0000644000175000017500000000524011201125563026671 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.util.Enumeration; import javax.portlet.PortletContext; /** * A filter configuration object used by a portlet container * to pass information to a filter during initialization. * * @since 2.0 */ public interface FilterConfig { /** * Returns the filter-name of this filter as defined in the * portlet deployment descriptor. * * @return the filter name */ public String getFilterName(); /** * Returns a reference to the PortletContext in which the caller is executing. * * @return the portlet context */ public PortletContext getPortletContext(); /** * Returns a String containing the value of the named * initialization parameter, or null if the parameter does not exist. *

    * Initialization parameters are defined in the portlet deployment descriptor. * * @param name the name of the initialization parameter to return * @return initialization parameter, or null if the parameter does not exist. */ public String getInitParameter(String name); /** * Returns the names of the filter's initialization parameters * as an Enumeration of String objects, or an empty Enumeration * if the filter has no initialization parameters. *

    * Initialization parameters are defined in the portlet deployment descriptor. * * @return the names of the filter's initialization parameters, * or an empty Enumeration if the filter has no initialization parameters. */ public Enumeration getInitParameterNames(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ResourceFilter.java0000644000175000017500000001262611201141010027242 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.io.IOException; import javax.portlet.ResourceRequest; import javax.portlet.ResourceResponse; import javax.portlet.PortletException; /** * The ResourceFilter is an object that performs filtering * tasks on either the resource request to a portlet, or on the resource response from * a portlet, or both. *

    * Filters perform filtering in the doFilter method. Every Filter has * access to a FilterConfig object from which it can obtain * its initialization parameters, a reference to the PortletContext * which it can use, for example, to load resources needed for filtering tasks. *

    * Filters are configured in the portlet deployment descriptor of a * portlet application. * * @since 2.0 */ public interface ResourceFilter extends PortletFilter { /** * The doFilter method of the Filter is called by the * portlet container each time a resource request/response pair is passed * through the chain due to a client request for a portlet method * at the end of the chain. *

    * The FilterChain passed in to this method allows * the Filter to pass on the resource request and response to the next * component in the chain. *

    * The doFilter method of a filter will typically be implemented * following this or some subset of the following pattern: *

      *
    • The method examines the request information.
    • *
    • The method may wrap the request object passed in to * its doFilter method with a customized implementation * the request wrapper ResourceRequestWrapper * in order to modify request data.
    • *
    • The method may wrap the response object passed in to its * doFilter method with a customized implementation * of the response wrapper ResourceResponseWrapper * to modify response data.
    • *
    • The filter may invoke the next component in the filter chain. * The next component may be another filter, or if the filter * making the invocation is the last filter configured in the * deployment descriptor for this chain, the next component * is the target method of the portlet. The invocation of the * next component is effected by calling the doFilter * method on the FilterChain object, and passing in * the request and response with which it was called or passing * in wrapped versions it may have created. * The filter chain's implementation of the doFilter * method, provided by the portlet container, must locate the * next component in the filter chain and invoke its doFilter * method, passing in the appropriate request and response objects. * Alternatively, the filter chain can block the request by not * making the call to invoke the next component, leaving the filter * responsible for filling out the response object.
    • *
    • After invocation of the next filter in the chain, the filter * may examine the response data.
    • *
    • Alternatively, the filter may have thrown an exception to * indicate an error in processing. If the filter throws an * UnavailableException during its doFilter * processing, the portlet container must not attempt continued * processing down the filter chain. It may choose to retry the * whole chain at a later time if the exception is not marked permanent.
    • *
    • When the last filter in the chain has been invoked, the next * component accessed is the target method on the portlet at * the end of the chain.
    • *
    * * @param request the current resource request * @param response the current resource response * @param chain the remaining filter chain * @throws IOException if an IO error occurred in the filter processing * @throws PortletException if a portlet exception occurred in the filter processing */ public void doFilter(ResourceRequest request, ResourceResponse response, FilterChain chain) throws IOException, PortletException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/PortletRequestWrapper.java0000644000175000017500000002741611201125563030672 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.security.Principal; import java.util.Enumeration; import java.util.Locale; import java.util.Map; import javax.portlet.PortalContext; import javax.portlet.PortletMode; import javax.portlet.PortletPreferences; import javax.portlet.PortletRequest; import javax.portlet.PortletSession; import javax.portlet.WindowState; import javax.servlet.http.Cookie; /** * The PortletRequestWrapper provides a convenient * implementation of the PortletRequest interface * and is extended by other request wrappers. * This class implements the Wrapper or Decorator pattern. * Methods default to calling through to the wrapped request object. * * @since 2.0 * @see PortletRequest */ public class PortletRequestWrapper implements PortletRequest { PortletRequest request; /** * Require having a request for constructing * the wrapper. * */ private PortletRequestWrapper() { } /** * Creates an PortletRequest adaptor * wrapping the given request object. * * @param request the portlet request to wrap * @throws java.lang.IllegalArgumentException if the request is null */ public PortletRequestWrapper(PortletRequest request) { if ( request == null) throw new java.lang.IllegalArgumentException("Request is null"); this.request = request; } /** * The default behavior of this method is to call * getAttribute(String name) on the wrapped request object. */ public Object getAttribute(String name) { return request.getAttribute(name); } /** * The default behavior of this method is to call * getAttributeNames() on the wrapped request object. */ public Enumeration getAttributeNames() { return request.getAttributeNames(); } /** * The default behavior of this method is to call * getAuthType() on the wrapped request object. */ public String getAuthType() { return request.getAuthType(); } /** * The default behavior of this method is to call * getContextPath() on the wrapped request object. */ public String getContextPath() { return request.getContextPath(); } /** * The default behavior of this method is to call * getLocale() on the wrapped request object. */ public Locale getLocale() { return request.getLocale(); } /** * The default behavior of this method is to call * getLocales() on the wrapped request object. */ public Enumeration getLocales() { return request.getLocales(); } /** * The default behavior of this method is to call * getParameter(String name) on the wrapped request object. */ public String getParameter(String name) { return request.getParameter(name); } /** * The default behavior of this method is to call * getParameterMap() on the wrapped request object. */ public Map getParameterMap() { return request.getParameterMap(); } /** * The default behavior of this method is to call * getParameterNames() on the wrapped request object. */ public Enumeration getParameterNames() { return request.getParameterNames(); } /** * The default behavior of this method is to call * getParameterValues(name) on the wrapped request object. */ public String[] getParameterValues(String name) { return request.getParameterValues(name); } /** * The default behavior of this method is to call * getPortalContext() on the wrapped request object. */ public PortalContext getPortalContext() { return request.getPortalContext(); } /** * The default behavior of this method is to call * getPortletMode() on the wrapped request object. */ public PortletMode getPortletMode() { return request.getPortletMode(); } /** * The default behavior of this method is to call * getPortletSession() on the wrapped request object. */ public PortletSession getPortletSession() { return request.getPortletSession(); } /** * The default behavior of this method is to call * getPortletSession(create) on the wrapped request object. */ public PortletSession getPortletSession(boolean create) { return request.getPortletSession(create); } /** * The default behavior of this method is to call * getPreferences() on the wrapped request object. */ public PortletPreferences getPreferences() { return request.getPreferences(); } /** * The default behavior of this method is to call * getProperteis(name) on the wrapped request object. */ public Enumeration getProperties(String name) { return request.getProperties(name); } /** * The default behavior of this method is to call * getProperty(name) on the wrapped request object. */ public String getProperty(String name) { return request.getProperty(name); } /** * The default behavior of this method is to call * getPropertyNames() on the wrapped request object. */ public Enumeration getPropertyNames() { return request.getPropertyNames(); } /** * The default behavior of this method is to call * getRemoteUser() on the wrapped request object. */ public String getRemoteUser() { return request.getRemoteUser(); } /** * The default behavior of this method is to call * getRequestedSessionId() on the wrapped request object. */ public String getRequestedSessionId() { return request.getRequestedSessionId(); } /** * The default behavior of this method is to call * getResponseContentType() on the wrapped request object. */ public String getResponseContentType() { return request.getResponseContentType(); } /** * The default behavior of this method is to call * getResponseContentTypes() on the wrapped request object. */ public Enumeration getResponseContentTypes() { return request.getResponseContentTypes(); } /** * The default behavior of this method is to call * getScheme() on the wrapped request object. */ public String getScheme() { return request.getScheme(); } /** * The default behavior of this method is to call * getServerName() on the wrapped request object. */ public String getServerName() { return request.getServerName(); } /** * The default behavior of this method is to call * getServerPort() on the wrapped request object. */ public int getServerPort() { return request.getServerPort(); } /** * The default behavior of this method is to call * getUserPrincipal() on the wrapped request object. */ public Principal getUserPrincipal() { return request.getUserPrincipal(); } /** * The default behavior of this method is to call * getWindowId() on the wrapped request object. */ public String getWindowID() { return request.getWindowID(); } /** * The default behavior of this method is to call * getWindowState() on the wrapped request object. */ public WindowState getWindowState() { return request.getWindowState(); } /** * The default behavior of this method is to call * isPortletModeAllowed(mode) on the wrapped request object. */ public boolean isPortletModeAllowed(PortletMode mode) { return request.isPortletModeAllowed(mode); } /** * The default behavior of this method is to call * isRequestedSessionIdValid() on the wrapped request object. */ public boolean isRequestedSessionIdValid() { return request.isRequestedSessionIdValid(); } /** * The default behavior of this method is to call * isSecure() on the wrapped request object. */ public boolean isSecure() { return request.isSecure(); } /** * The default behavior of this method is to call * isUserInRole(role) on the wrapped request object. */ public boolean isUserInRole(String role) { return request.isUserInRole(role); } /** * The default behavior of this method is to call * isWindowStateAllowed(state) on the wrapped request object. */ public boolean isWindowStateAllowed(WindowState state) { return request.isWindowStateAllowed(state); } /** * The default behavior of this method is to call * removeAttribute(name) on the wrapped request object. */ public void removeAttribute(String name) { request.removeAttribute(name); } /** * The default behavior of this method is to call * setAttribute(name, o) on the wrapped request object. */ public void setAttribute(String name, Object o) { request.setAttribute(name, o); } /** * Return the wrapped request object. * * @return the wrapped request */ public PortletRequest getRequest() { return request; } /** * Sets the request object being wrapped. * * @param request the request to set * @throws java.lang.IllegalArgumentException if the request is null. */ public void setRequest(PortletRequest request) { if ( request == null) throw new java.lang.IllegalArgumentException("Request is null"); this.request = request; } /** * The default behavior of this method is to call * getCookies() on the wrapped request object. */ public Cookie[] getCookies() { return request.getCookies(); } /** * The default behavior of this method is to call * getPrivateParameterMap() on the wrapped request object. */ public Map getPrivateParameterMap() { return request.getPrivateParameterMap(); } /** * The default behavior of this method is to call * getPublicParameterMap() on the wrapped request object. */ public Map getPublicParameterMap() { return request.getPublicParameterMap(); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ResourceResponseWrapper.java0000644000175000017500000001613711201125563031174 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Locale; import javax.portlet.CacheControl; import javax.portlet.PortletURL; import javax.portlet.ResourceResponse; import javax.portlet.ResourceURL; /** * The ResourceResponseWrapper provides a convenient * implementation of the ResourceResponse interface * that can be subclassed by developers wishing to adapt the response. * This class implements the Wrapper or Decorator pattern. * Methods default to calling through to the wrapped response object. * * @since 2.0 * @see ResourceResponse */ public class ResourceResponseWrapper extends PortletResponseWrapper implements ResourceResponse { ResourceResponse response; /** * Creates an ResourceResponse adaptor * wrapping the given response object. * * @param response the event response to wrap * @throws java.lang.IllegalArgumentException if the response is null */ public ResourceResponseWrapper(ResourceResponse response) { super(response); this.response = response; } /** * The default behavior of this method is to call * flushBuffer() on the wrapped response object. */ public void flushBuffer() throws IOException { response.flushBuffer(); } /** * The default behavior of this method is to call * getBufferSize() on the wrapped response object. */ public int getBufferSize() { return response.getBufferSize(); } /** * The default behavior of this method is to call * getCharacterEncoding() on the wrapped response object. */ public String getCharacterEncoding() { return response.getCharacterEncoding(); } /** * The default behavior of this method is to call * getContentType() on the wrapped response object. */ public String getContentType() { return response.getContentType(); } /** * The default behavior of this method is to call * getLocale() on the wrapped response object. */ public Locale getLocale() { return response.getLocale(); } /** * The default behavior of this method is to call * getPortletOutputStream() on the wrapped response object. */ public OutputStream getPortletOutputStream() throws IOException { return response.getPortletOutputStream(); } /** * The default behavior of this method is to call * getWriter() on the wrapped response object. */ public PrintWriter getWriter() throws IOException { return response.getWriter(); } /** * The default behavior of this method is to call * isCommitted() on the wrapped response object. */ public boolean isCommitted() { return response.isCommitted(); } /** * The default behavior of this method is to call * reset() on the wrapped response object. */ public void reset() { response.reset(); } /** * The default behavior of this method is to call * resetBuffer() on the wrapped response object. */ public void resetBuffer() { response.resetBuffer(); } /** * The default behavior of this method is to call * setBufferSize(size) on the wrapped response object. */ public void setBufferSize(int size) { response.setBufferSize(size); } /** * The default behavior of this method is to call * setContentType(type) on the wrapped response object. */ public void setContentType(String type) { response.setContentType(type); } /** * The default behavior of this method is to call * getCacheControl() on the wrapped response object. */ public CacheControl getCacheControl() { return response.getCacheControl(); } /** * The default behavior of this method is to call * setCharacterEncoding(String charset) on the wrapped response object. */ public void setCharacterEncoding(String charset) { response.setCharacterEncoding(charset); return; } /** * The default behavior of this method is to call * setLocale(Locale loc) on the wrapped response object. */ public void setLocale(Locale loc) { response.setLocale(loc); return; } /** * The default behavior of this method is to call * setContentLength() on the wrapped response object. */ public void setContentLength(int len) { response.setContentLength(len); } /** * Return the wrapped response object. * * @return the wrapped response */ public ResourceResponse getResponse() { return response; } /** * Sets the response object being wrapped. * * @param response the response to set * @throws java.lang.IllegalArgumentException if the response is null. */ public void setResponse(ResourceResponse response) { if ( response == null) throw new java.lang.IllegalArgumentException("Response is null"); this.response = response; } /** * The default behavior of this method is to call * createActionURL() on the wrapped response object. */ public PortletURL createActionURL() throws IllegalStateException { return response.createActionURL(); } /** * The default behavior of this method is to call * createRenderURL() on the wrapped response object. */ public PortletURL createRenderURL() throws IllegalStateException { return response.createRenderURL(); } /** * The default behavior of this method is to call * createResourceURL() on the wrapped response object. */ public ResourceURL createResourceURL() throws IllegalStateException { return response.createResourceURL(); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ResourceRequestWrapper.java0000644000175000017500000001237711201125563031030 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.util.Map; import javax.portlet.ResourceRequest; /** * The ResourceRequestWrapper provides a convenient * implementation of the ResourceRequest interface * that can be subclassed by developers wishing to adapt the request. * This class implements the Wrapper or Decorator pattern. * Methods default to calling through to the wrapped request object. * * @since 2.0 * @see ResourceRequest */ public class ResourceRequestWrapper extends PortletRequestWrapper implements ResourceRequest { ResourceRequest request; /** * Creates an ResourceRequest adaptor * wrapping the given request object. * * @param request the resource request to wrap * @throws java.lang.IllegalArgumentException if the request is null */ public ResourceRequestWrapper(ResourceRequest request) { super(request); this.request = request; } /** * The default behavior of this method is to call * getPortletInputStream() on the wrapped request object. */ public InputStream getPortletInputStream() throws IOException { return request.getPortletInputStream(); } /** * The default behavior of this method is to call * getReader() on the wrapped request object. */ public BufferedReader getReader() throws UnsupportedEncodingException, IOException { return request.getReader(); } /** * The default behavior of this method is to call * setCharacterEncoding(String enc) * on the wrapped request object. */ public void setCharacterEncoding(String enc) throws UnsupportedEncodingException { request.setCharacterEncoding(enc); } /** * Return the wrapped request object. * * @return the wrapped request */ public ResourceRequest getRequest() { return request; } /** * Sets the request object being wrapped. * * @param request the request to set * @throws java.lang.IllegalArgumentException if the request is null. */ public void setRequest(ResourceRequest request) { if ( request == null) throw new java.lang.IllegalArgumentException("Request is null"); this.request = request; } /** * The default behavior of this method is to call * getCharacterEncoding() on the wrapped request object. */ public String getCharacterEncoding() { return request.getCharacterEncoding(); } /** * The default behavior of this method is to call * getContentLength() on the wrapped request object. */ public int getContentLength() { return request.getContentLength(); } /** * The default behavior of this method is to call * getContentType() on the wrapped request object. */ public String getContentType() { return request.getContentType(); } /** * The default behavior of this method is to call * getETag() on the wrapped request object. */ public String getETag() { return request.getETag(); } /** * The default behavior of this method is to call * getMethod() on the wrapped request object. */ public String getMethod() { return request.getMethod(); } /** * The default behavior of this method is to call * getResourceID() on the wrapped request object. */ public String getResourceID() { return request.getResourceID(); } /** * The default behavior of this method is to call * getPrivateRenderParameterMap() on the wrapped request object. */ public Map getPrivateRenderParameterMap() { return request.getPrivateParameterMap(); } /** * The default behavior of this method is to call * getCacheability() on the wrapped response object. */ public String getCacheability() { return request.getCacheability(); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/RenderRequestWrapper.java0000644000175000017500000000523311201125563030451 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import javax.portlet.RenderRequest; /** * The RenderRequestWrapper provides a convenient * implementation of the RenderRequest interface * that can be subclassed by developers wishing to adapt the request. * This class implements the Wrapper or Decorator pattern. * Methods default to calling through to the wrapped request object. * * @since 2.0 * @see RenderRequest */ public class RenderRequestWrapper extends PortletRequestWrapper implements RenderRequest { RenderRequest request; /** * Creates an RenderRequest adaptor * wrapping the given request object. * * @param request the render request to wrap * @throws java.lang.IllegalArgumentException if the request is null */ public RenderRequestWrapper(RenderRequest request) { super(request); this.request = request; } /** * Return the wrapped request object. * * @return the wrapped request */ public RenderRequest getRequest() { return request; } /** * Sets the request object being wrapped. * * @param request the request to set * @throws java.lang.IllegalArgumentException if the request is null. */ public void setRequest(RenderRequest request) { if ( request == null) throw new java.lang.IllegalArgumentException("Request is null"); this.request = request; } /** * The default behavior of this method is to call * getETag() on the wrapped request object. */ public String getETag() { return request.getETag(); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/RenderResponseWrapper.java0000644000175000017500000001563211201125563030623 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Collection; import java.util.Locale; import javax.portlet.CacheControl; import javax.portlet.PortletMode; import javax.portlet.PortletURL; import javax.portlet.RenderResponse; import javax.portlet.ResourceURL; /** * The RenderResponseWrapper provides a convenient * implementation of the RenderResponse interface * that can be subclassed by developers wishing to adapt the response. * This class implements the Wrapper or Decorator pattern. * Methods default to calling through to the wrapped response object. * * @since 2.0 * @see RenderResponse */ public class RenderResponseWrapper extends PortletResponseWrapper implements RenderResponse { RenderResponse response; /** * Creates an RenderResponse adaptor * wrapping the given response object. * * @param response the event response to wrap * @throws java.lang.IllegalArgumentException if the response is null */ public RenderResponseWrapper(RenderResponse response) { super(response); this.response = response; } /** * The default behavior of this method is to call * flushBuffer() on the wrapped response object. */ public void flushBuffer() throws IOException { response.flushBuffer(); } /** * The default behavior of this method is to call * getBufferSize() on the wrapped response object. */ public int getBufferSize() { return response.getBufferSize(); } /** * The default behavior of this method is to call * getCharacterEncoding() on the wrapped response object. */ public String getCharacterEncoding() { return response.getCharacterEncoding(); } /** * The default behavior of this method is to call * getContentType() on the wrapped response object. */ public String getContentType() { return response.getContentType(); } /** * The default behavior of this method is to call * getLocale() on the wrapped response object. */ public Locale getLocale() { return response.getLocale(); } /** * The default behavior of this method is to call * getPortletOutputStream() on the wrapped response object. */ public OutputStream getPortletOutputStream() throws IOException { return response.getPortletOutputStream(); } /** * The default behavior of this method is to call * getWriter() on the wrapped response object. */ public PrintWriter getWriter() throws IOException { return response.getWriter(); } /** * The default behavior of this method is to call * isCommitted() on the wrapped response object. */ public boolean isCommitted() { return response.isCommitted(); } /** * The default behavior of this method is to call * reset() on the wrapped response object. */ public void reset() { response.reset(); } /** * The default behavior of this method is to call * resetBuffer() on the wrapped response object. */ public void resetBuffer() { response.resetBuffer(); } /** * The default behavior of this method is to call * setBufferSize(size) on the wrapped response object. */ public void setBufferSize(int size) { response.setBufferSize(size); } /** * The default behavior of this method is to call * setContentType(type) on the wrapped response object. */ public void setContentType(String type) { response.setContentType(type); } /** * The default behavior of this method is to call * setTitle(title) on the wrapped response object. */ public void setTitle(String title) { response.setTitle(title); } /** * The default behavior of this method is to call * getCacheControl() on the wrapped response object. */ public CacheControl getCacheControl() { return response.getCacheControl(); } /** * The default behavior of this method is to call * setNextPossiblePortletModes() on the wrapped response object. */ public void setNextPossiblePortletModes(Collection portletModes) { response.setNextPossiblePortletModes(portletModes); } /** * Return the wrapped response object. * * @return the wrapped response */ public RenderResponse getResponse() { return response; } /** * Sets the response object being wrapped. * * @param response the response to set * @throws java.lang.IllegalArgumentException if the response is null. */ public void setResponse(RenderResponse response) { if ( response == null) throw new java.lang.IllegalArgumentException("Response is null"); this.response = response; } /** * The default behavior of this method is to call * createActionURL() on the wrapped response object. */ public PortletURL createActionURL() throws IllegalStateException { return response.createActionURL(); } /** * The default behavior of this method is to call * createRenderURL() on the wrapped response object. */ public PortletURL createRenderURL() throws IllegalStateException { return response.createRenderURL(); } /** * The default behavior of this method is to call * createResourceURL() on the wrapped response object. */ public ResourceURL createResourceURL() throws IllegalStateException { return response.createResourceURL(); } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/PortletFilter.java0000644000175000017500000000571411201125563027123 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet.filter; import javax.portlet.PortletException; /** * The PortletFilter is the base interface for all portlet filters. * It provides the lifecycle methods init and destroy * for putting a portlet filter into and out of service. * * @since 2.0 */ public interface PortletFilter { /** * Called by the portlet container to indicate to a filter * that it is being placed into service. The portlet container * calls the init method exactly once after instantiating the filter. * The init method must complete successfully before the filter * is asked to do any filtering work. *

    * The portlet container cannot place the filter into service if the init method either *

      *
    • throws a PortletException
    • *
    • does not return within a time period defined by the portlet container
    • *
    * * @param filterConfig the filter configuration data defined * in the portlet deployment descriptor * @throws PortletException if an error occurs in the filter initialization */ public void init(FilterConfig filterConfig) throws PortletException; /** * Called by the portlet container to indicate to a filter that it is * being taken out of service. This method is only called once all threads * within the filter's doFilter method have exited or * after a timeout period has passed. *

    * After the portlet container calls this method, it will not call the * doFilter method again on this instance of the filter. *

    * This method gives the filter an opportunity to clean up any resources * that are being held (for example, memory, file handles, threads) and * make sure that any persistent state is synchronized with the * filter's current state in memory. */ public void destroy(); } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ResourceServingPortlet.java0000644000175000017500000000520411201125563027530 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The ResourceServingPortlet interface allows * serving resources through the portlet. *

    * The portlet container must call this method for links created by * the RenderResponse.createResourceURL() call. * If the portlet creates resource URLs with RenderResponse.createResourceURL() * it must implement this lifecycle method. * * @since 2.0 */ public interface ResourceServingPortlet { /** * Called by the portlet container to allow the portlet to generate * the resource content based on its current state. * The portal / portlet container must not render any output in addition * to the content returned by the portlet. The portal / portlet container * should expect that the portlet may return binary content for a * renderResource call. * * @param request * the resource request * @param response * the resource response * * @exception PortletException * if the portlet has problems fulfilling the * rendering request * @exception UnavailableException * if the portlet is unavailable to perform render at this time * @exception PortletSecurityException * if the portlet cannot fullfill this request because of security reasons * @exception java.io.IOException * if the streaming causes an I/O problem */ public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, java.io.IOException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletSessionUtil.java0000644000175000017500000000543311201125563026670 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The PortletSessionUtil class helps identify and decode * attributes in the PORTLET_SCOPE scope of the PortletSession * when accessed through the HttpSession an from within calls to methods * of the HttpSessionBindingListener interface. */ public class PortletSessionUtil { private static final String PORTLET_SCOPE_NAMESPACE = "javax.portlet.p."; /** * Returns the attribute name of an attribute in the * PORTLET_SCOPE. If the attribute is in the * APPLICATION_SCOPE it returns the attribute name unchanged. * * @param name a string specifying the name of the * encoded portlet attribute * * @return the decoded attribute name */ public static java.lang.String decodeAttributeName(java.lang.String name) { if (name.startsWith(PORTLET_SCOPE_NAMESPACE)) { int index = name.indexOf('?'); if (index>-1) { name = name.substring(index+1); } } return name; } /** * Returns the portlet attribute scope from an encoded portlet * attribute. *
    Possible return values are: *

      *
    • PortletSession.APPLICATION_SCOPE
    • *
    • PortletSession.PORTLET_SCOPE
    • *
    * * @param name a string specifying the name of the * encoded portlet attribute * * @return the decoded attribute scope * @see PortletSession */ public static int decodeScope(java.lang.String name) { int scope = PortletSession.APPLICATION_SCOPE; // APP if (name.startsWith(PORTLET_SCOPE_NAMESPACE)) { int index = name.indexOf('?'); if (index>-1) { scope = PortletSession.PORTLET_SCOPE; // PORTLET } } return scope; } } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletResponse.java0000644000175000017500000001674711201125563026217 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** * The PortletResponse defines the base interface to assist a * portlet in creating and sending a response to the client. The portlet * container uses specialized versions of this interface when invoking a * portlet. * The portlet container creates these objects and passes them as arguments to * the portlet's processAction, processEvent, serveResource and render methods. * * @see ActionResponse * @see RenderResponse * @see EventResponse * @see ResourceResponse */ public interface PortletResponse { /** * Adds a String property to an existing key to be returned to the portal. * If there are no property values already associated with the key, * a new key is created. *

    * This method allows response properties to have multiple values. *

    * Response properties can be viewed as header values set for the portal application. * If these header values are intended to be transmitted to the client they should be * set before the response is committed. * * @param key * the key of the property to be returned to the portal * @param value * the value of the property to be returned to the portal * * @exception java.lang.IllegalArgumentException * if key is null. */ public void addProperty(String key, String value); /** * Sets a String property to be returned to the portal. *

    * Response properties can be viewed as header values set for the portal application. * If these header values are intended to be transmitted to the client they should be * set before the response is committed. *

    * This method resets all properties previously added with the same key. * * @param key * the key of the property to be returned to the portal * @param value * the value of the property to be returned to the portal * * @exception java.lang.IllegalArgumentException * if key is null. */ public void setProperty(String key, String value); /** * Returns the encoded URL of the resource, like servlets, JSPs, images and * other static files, at the given path. *

    * Portlets should encode all resource URLs pointing to resources in the * portlet application via this method in order to ensure that they get * served via the portal application. *

    * Some portal/portlet-container implementation may require those URLs to * contain implementation specific data encoded in it. Because of that, * portlets should use this method to create such URLs. *

    * The encodeURL method may include the session ID and other * portal/portlet-container specific information into the URL. If encoding * is not needed, it returns the URL unchanged. *

    * Portlet developer should be aware that the returned URL might not be a well formed * URL but a special token at the time the portlet is generating its content. * Thus portlets should not add additional parameters on the resulting URL or * expect to be able to parse the URL. As a result, the outcome of the encodeURL * call may be different than calling encodeURL in the servlet world. * * @param path * the URI path to the resource. This must be either an absolute * URL (e.g. * http://my.co/myportal/mywebap/myfolder/myresource.gif) * or a full path URI (e.g. * /myportal/mywebap/myfolder/myresource.gif). * * @exception java.lang.IllegalArgumentException * if path doesn't have a leading slash or is not an absolute * URL * * @return the encoded resource URL as string, may not be a valid URL */ public String encodeURL(String path); /** * The value returned by this method should be prefixed or appended to * elements, such as JavaScript variables or function names, to ensure they * are unique in the context of the portal page. *

    * The namespace value must be constant for the lifetime of the portlet * window. * * @return the namespace */ public String getNamespace(); /** * Adds a HTTP Cookie property to the response.
    * The portlet should note that the cookie may not make * it to the client, but may be stored at the portal. *

    * This method allows response properties to have multiple cookies. *

    * * @param cookie the cookie to be added to the response * * @exception java.lang.IllegalArgumentException * if cookie is null. * @since 2.0 */ public void addProperty(javax.servlet.http.Cookie cookie); /** * Adds an XML DOM element property to the response. *

    * If a DOM element with the provided key already exists * the provided element will be stored in addition to the * existing element under the same key. *

    * If the element is null the key is removed from * the response. *

    * Response XML DOM element properties can be viewed as * additional response document sections * set for the portal application. * If these header values are intended to be transmitted to the client they should be * set before the response is committed. * * @param key * the key of the property to be returned to the portal * @param element * the XML DOM element to be added to the response * * @exception java.lang.IllegalArgumentException * if key is null. * @since 2.0 */ void addProperty(String key, org.w3c.dom.Element element); /** * Creates an element of the type specified to be used in the * {@link #addProperty(String,Element)} method. * * @param tagName name of the element type to instantiate * @return A new Element object with the nodeName attribute set to tagName, * and localName, prefix, and namespaceURI set to null. * @throws org.w3c.dom.DOMException * INVALID_CHARACTER_ERR: Raised if the specified name * contains an illegal character. */ org.w3c.dom.Element createElement(String tagName) throws org.w3c.dom.DOMException; } portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/WindowStateException.java0000644000175000017500000000566511201125563027173 0ustar drazzibdrazzib/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * This source code implements specifications defined by the Java * Community Process. In order to remain compliant with the specification * DO NOT add / change / or delete method signatures! */ package javax.portlet; /** ** The WindowStateException is thrown when a portlet ** tries to use a window state that is not supported by the current ** runtime environment or the portlet. **/ public class WindowStateException extends PortletException { private transient WindowState _state = null; private static final long serialVersionUID = 1L; /** * Constructs a new portlet state exception with the given text. The * portlet container may use the text write it to a log. * * @param text * the exception text * @param state * the state causing the exception */ public WindowStateException (String text, WindowState state) { super (text); _state = state; } /** * Constructs a new portlet state exception when the portlet needs to do * the following: *

      * throw an exception *
    • include a message about the "root cause" that interfered * with its normal operation *
    • include a description message *
    * * @param text * the exception text * @param cause * the root cause * @param state * the state causing the exception */ public WindowStateException (String text, Throwable cause, WindowState state) { super(text, cause); _state = state; } /** * Constructs a new portlet state exception when the portlet needs to throw an * exception. The exception message is based on the localized message * of the underlying exception. * * @param cause * the root cause * @param state * the state causing the exception */ public WindowStateException (Throwable cause, WindowState state) { super(cause); _state = state; } /** * Returns the portlet state causing this exception. * * @return the window state causing this exception */ public WindowState getState() { return _state; } }