You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2007/10/25 15:38:13 UTC
svn commit: r588233 [1/5] - in /myfaces/portlet-bridge/trunk: ./ api/
api/src/ api/src/main/ api/src/main/java/ api/src/main/java/javax/
api/src/main/java/javax/portlet/ api/src/main/java/javax/portlet/faces/
api/src/main/java/javax/portlet/faces/compo...
Author: mmarinschek
Date: Thu Oct 25 06:38:05 2007
New Revision: 588233
URL: http://svn.apache.org/viewvc?rev=588233&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-1664 (MYFACES-1664): JSR-301 Implementation, initial commit
Added:
myfaces/portlet-bridge/trunk/LICENSE.txt
myfaces/portlet-bridge/trunk/NOTICE.txt
myfaces/portlet-bridge/trunk/api/
myfaces/portlet-bridge/trunk/api/pom.xml
myfaces/portlet-bridge/trunk/api/src/
myfaces/portlet-bridge/trunk/api/src/main/
myfaces/portlet-bridge/trunk/api/src/main/java/
myfaces/portlet-bridge/trunk/api/src/main/java/javax/
myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/
myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/
myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/Bridge.java
myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/BridgeDefaultViewNotSpecifiedException.java
myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/BridgeException.java
myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/
myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainer.java
myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java
myfaces/portlet-bridge/trunk/api/src/main/resources/
myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/
myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/LICENSE.txt
myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/NOTICE.txt
myfaces/portlet-bridge/trunk/impl/
myfaces/portlet-bridge/trunk/impl/pom.xml
myfaces/portlet-bridge/trunk/impl/src/
myfaces/portlet-bridge/trunk/impl/src/main/
myfaces/portlet-bridge/trunk/impl/src/main/java/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/context/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/context/FacesContextFactoryImpl.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletFacesContextImpl.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/el/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/el/PortletELContextImpl.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/el/PortletELResolver.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/HTTPUtils.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/QueryString.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/SimpleStringBuffer.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/TextUtils.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/URLUtils.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/config/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/config/WebConfigurationProcessor.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/LocalesIterator.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletAbstractMap.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletApplicationMap.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletInitParameterMap.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestHeaderMap.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestHeaderValuesMap.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestHeaders.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestMap.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterMap.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterValuesMap.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletSessionMap.java
myfaces/portlet-bridge/trunk/impl/src/main/resources/
myfaces/portlet-bridge/trunk/impl/src/main/resources/META-INF/
myfaces/portlet-bridge/trunk/impl/src/main/resources/META-INF/LICENSE.txt
myfaces/portlet-bridge/trunk/impl/src/main/resources/META-INF/NOTICE.txt
myfaces/portlet-bridge/trunk/impl/src/main/resources/META-INF/faces-config.xml
myfaces/portlet-bridge/trunk/impl/src/main/resources/META-INF/services/
myfaces/portlet-bridge/trunk/impl/src/main/resources/META-INF/services/javax.faces.context.FacesContextFactory
myfaces/portlet-bridge/trunk/impl/src/main/resources/META-INF/services/javax.portlet.faces.Bridge
myfaces/portlet-bridge/trunk/pom.xml
Added: myfaces/portlet-bridge/trunk/LICENSE.txt
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/LICENSE.txt?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/LICENSE.txt (added)
+++ myfaces/portlet-bridge/trunk/LICENSE.txt Thu Oct 25 06:38:05 2007
@@ -0,0 +1,202 @@
+
+ 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.
Added: myfaces/portlet-bridge/trunk/NOTICE.txt
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/NOTICE.txt?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/NOTICE.txt (added)
+++ myfaces/portlet-bridge/trunk/NOTICE.txt Thu Oct 25 06:38:05 2007
@@ -0,0 +1,14 @@
+Apache MyFaces Portlet Bridge
+Copyright [2007] The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software are Copyright (c) 2007, Oracle
+Corporation, <http://www.oracle.com/> and are licensed to
+the Apache Software Foundation under the "Software Grant
+and Corporate Contribution License Agreement"
+
+See the LICENSE.txt file for information on all licenses
+associated with this software.
+
Added: myfaces/portlet-bridge/trunk/api/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/api/pom.xml?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/api/pom.xml (added)
+++ myfaces/portlet-bridge/trunk/api/pom.xml Thu Oct 25 06:38:05 2007
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2006 The Apache Software Foundation.
+
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <!-- TODO: Is this the correct group id? -->
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ <artifactId>jsf-portlet-bridge</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>Portlet Bridge for JavaServer Faces API</name>
+ <description>Public API for the Portlet Bridge for JavaServer Faces.</description>
+
+ <artifactId>jsf-portlet-bridge-api</artifactId>
+ <packaging>jar</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <!-- Allows building of jdev projects (jdev:jdev target) -->
+ <!-- TODO: This is an artifical dependancy on Trinidad, should it be removed? -->
+ <plugin>
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <artifactId>maven-jdev-plugin</artifactId>
+ <version>1.0.1</version>
+ </plugin>
+
+ <!-- Build and sign jars (http://maven.apache.org/plugins/maven-jar-plugin/)-->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ </archive>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+
+ <!-- Generate JavaDocs (http://maven.apache.org/plugins/maven-javadoc-plugin/) -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <showPackage>false</showPackage>
+ <showProtected>true</showProtected>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
Added: myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/Bridge.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/Bridge.java?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/Bridge.java (added)
+++ myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/Bridge.java Thu Oct 25 06:38:05 2007
@@ -0,0 +1,220 @@
+/*
+ * 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.
+ */
+package javax.portlet.faces;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.UnavailableException;
+
+/**
+ * The <CODE>Bridge</CODE> interface is used by a portlet to execute a JSF artifact. Its lifecycle
+ * follows the pattern used by other web components such as portlets or servlets, namely:
+ * <ul>
+ * <li><code>init</code>: one time (per portlet) initialization. Usually invoked during portlet
+ * <code>init</code> but may also occur lazily. Context is passed to the Bridge at initialization
+ * via <code>PortletContext</code> attributes. See method description for details. </li>
+ * <li><code>doFacesRequest</code>: called for each portlet request that is to be handled by
+ * Faces. Must only be called after the bridge has been initialized. </li>
+ * <li><code>destroy</code>: called to destroy this bridge instance. Usually invoked during
+ * portlet <code>destroy</code> but may also occur earlier if the portlet decides to reclaim
+ * resources. </li>
+ * </ul>
+ * <P>
+ * Portlet developers are encouraged to allow deployers an ability to configure the particular
+ * Bridge implementation it uses within a given deployment. This ensures a best fit solution for a
+ * given application server, portlet container, and/or Faces environment. The specifics for this
+ * configuation are undefined. Each portlet can define a preferred mechanism. Subclasses of
+ * {@link GenericFacesPortlet} automatically inherit this behavior as it recognizes a defined
+ * portlet initialization parameter.
+ * <p>
+ * Implementations of this <code>Bridge</code> interface are required to have a <code>code</code>
+ * constructor.
+ */
+
+public interface Bridge
+{
+
+ // Base Bridge attribute/context parameter prefix
+ public static final String BRIDGE_PACKAGE_PREFIX = "javax.portlet.faces.";
+
+ // Following are the names of context init parameters that control
+ // Bridge behavior. These are specified in the web.xml
+
+ public static final String MAX_MANAGED_REQUEST_SCOPES = BRIDGE_PACKAGE_PREFIX
+ + "MAX_MANAGED_REQUEST_SCOPES";
+
+ public static final String LIFECYCLE_ID = "javax.faces.LIFECYCLE_ID";
+
+ // Attribute signifying whether this render is a postback or not.
+ public static final String IS_POSTBACK_ATTRIBUTE = BRIDGE_PACKAGE_PREFIX + "isPostback";
+
+ // Special session attribute name to hold the application_scope in the
+ // portlet_scope of the session so these are accessible as well.
+ public static final String APPLICATION_SCOPE_MAP = "javax.portlet.faces.ApplicationScopeMap";
+
+ // Following are the names of context attributes that a portlet can set prior
+ // to calling the bridge's init() method to control Bridge behavior.
+
+ // These attributes are scoped to a specific portlet in the context
+ // hence to acquire one must include the portlet name within attribute name:
+ // BRIDGE_PACKAGE_PREFIX + context.getPortletName() + attributeName
+
+ // if "true" indicates the bridge will preserve all the action params in its
+ // request scope and restore them as parameters in the subsequent renders
+ public static final String PRESERVE_ACTION_PARAMS = "preserveActionParams";
+
+ // allows a portlet to control render delgation. A value of "ALWAYS_DELEGATE" indicates
+ // the bridge doesn't render itself, it merely delegates. A value of "NEVER_DELEGATE"
+ // indicates the bridge never delegates, rather it always overrides and renders.
+ // A value of "DEFAULT" indicates the bridge will delegate first and only render
+ // if the delegatee throws an exception/throwable.
+ public static final String RENDER_POLICY = "renderPolicy";
+
+ // Parameter that can be added to an ActionURL to signify it is a direct link
+ // and hence shouldn't be encoded by encodeActionURL as an actionURL
+ public static final String DIRECT_LINK = BRIDGE_PACKAGE_PREFIX + "DirectLink";
+
+ // Session attribute pushed by bridge into session scope to give one access
+ // to Application scope
+ public static final String SESSION_APPLICATION_SCOPE_MAP = BRIDGE_PACKAGE_PREFIX
+ + "ApplicationScopeMap";
+
+ // Request attribute pushed by bridge in renderView to indicate it can
+ // handle a filter putting the AFTER_VIEW_CONTENT in a buffer on the request.
+ // Allows rendering order to be preserved in jsps
+ public static final String RENDER_CONTENT_AFTER_VIEW = BRIDGE_PACKAGE_PREFIX
+ + "RenderContentAfterView";
+
+ // Request attribute set by servlet filter in request/responseWrapper to
+ // place the AFTER_VIEW_CONTENT in a buffer on the request.
+ // Allows filter to transfer such content back to the bridge/renderView so
+ // if can output in correct order. Should only be done if
+ // RENDER_CONTENT_AFTER_VIEW request attribute is true.
+ public static final String AFTER_VIEW_CONTENT = BRIDGE_PACKAGE_PREFIX
+ + "AfterViewContent";
+
+ // Following are names of request attributes a portlet must set before
+ // calling the Bridge to process a request
+ public static final String DEFAULT_VIEWID = BRIDGE_PACKAGE_PREFIX
+ + "defaultViewId";
+
+ // Following are the names of request attributes the Bridge must set before
+ // acquiring its first FacesContext/FacesContextFactory in each request
+ public static final String PORTLET_LIFECYCLE_PHASE = BRIDGE_PACKAGE_PREFIX + "phase";
+
+ public static final String PORTLET_ISNAMESPACED_PROPERTY = "X-JAVAX-PORTLET-IS-NAMESPACED";
+
+ // The possible JSR168 portlet lifecycle phazses
+
+ public static enum PortletPhase
+ {
+ ActionPhase, RenderPhase, ;
+ }
+
+ public static enum BridgeRenderPolicy
+ {
+ DEFAULT, ALWAYS_DELEGATE, NEVER_DELEGATE, ;
+ }
+
+ /**
+ * Called by the portlet. It indicates that the bridge is being placed into service.
+ * <p>
+ * The portlet calls the <code>init</code> method exactly once before invoking other lifecycle
+ * methods. Usually, done immediately after instantiating the bridge. The <code>init</code>
+ * method must complete successfully before the bridge can receive any requests.
+ * <p>
+ * The portlet cannot place the bridge into service if the <code>init</code> method Throws a
+ * <code>BridgeException</code>.
+ * <p>
+ * Initialization context is passed to bridge via <code>PortletContext</code> attributes. The
+ * following attributes are defined:
+ * <ul>
+ * <li><code>javax.portlet.faces.encodeRedirectURL</code>: instructs the bridge to call
+ * <code>ExternalContext.encodeActionURL()</code> before processing the redirect request. This
+ * exists because some (newer) versions of JSF 1.2 call <code>encodeActionURL</code> before
+ * calling <code>redirect</code> while others do not. This flag adjusts the behavior of the
+ * bridge in accordance with the JSF 1.2 implementation it runs with.
+ * <li><code>javax.portlet.faces.numManagedActionScopes</code>: defines the maximum number of
+ * actionScopes this bridge preserves at any given time. Value is an integer. ActionScopes are
+ * managed on a per Bridge class portlet context wide basis. As a typical portlet application uses
+ * the same bridge implementation for all its Faces based portlets, this means that all
+ * actionScopes are managed in a single bucket.<br>
+ * For convenience this interface defines the <code>NUM_MANAGED_ACTIONSCOPES</code> constant.
+ * <li><code>javax.faces.lifecycleID</code>: defines the Faces <code>Lifecycle</code> id
+ * that bridge uses when acquiring the <code>Faces.Lifecycle</code> via which it executes the
+ * request. As a context wide attribute, all bridge instances in this portlet application will use
+ * this lifecyle.
+ * <li><code>javax.portlet.faces.[portlet name].preserveActionParams</code>: instructs the
+ * bridge to preserve action parameters in the action scope and represent them in subsequent
+ * renders. Should be used only when binding to a Faces implementation that relies on accessing
+ * such parameters during its render phase. As this is a portlet/bridge instance specific
+ * attribute, the <code>PortletContext</code>attribute name is qualified by the portlet
+ * instance name. This allows different portlets within the same portlet application to have
+ * different settings.<br>
+ * For convenience this interfaces defines a number of constants that simplifies constructing
+ * and/or recognizing this name.
+ * </ul>
+ *
+ * @param config
+ * a <code>PortletConfig</code> 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 BridgeException;
+
+ /**
+ * Called by the portlet when it wants the bridge to process an action request.
+ *
+ * @param request
+ * the request object.
+ * @param response
+ * the response object.
+ * @throws BridgeDefaultViewNotSpecifiedException
+ * thrown if the request indicates to the Bridge that is should use the default ViewId
+ * and the portlet hasn't supplied one.
+ * @throws BridgeException
+ * all other internal exceptions are converted to a BridgeException.
+ */
+ public void doFacesRequest(ActionRequest request, ActionResponse response)
+ throws BridgeDefaultViewNotSpecifiedException,
+ BridgeException;
+
+ /**
+ * Called by the portlet when it wants the bridge to process a render request.
+ *
+ * @param request
+ * the request object.
+ * @param response
+ * the response object.
+ * @throws BridgeDefaultViewNotSpecifiedException
+ * thrown if the request indicates to the Bridge that is should use the default ViewId
+ * and the portlet hasn't supplied one.
+ * @throws BridgeException
+ * all other internal exceptions are converted to a BridgeException.
+ */
+ public void doFacesRequest(RenderRequest request, RenderResponse response)
+ throws BridgeDefaultViewNotSpecifiedException,
+ BridgeException;
+
+ /**
+ * Called by the portlet to take the bridge out of service. Once out of service, the bridge must
+ * be reinitialized before processing any further requests.
+ */
+ public void destroy();
+
+}
Added: myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/BridgeDefaultViewNotSpecifiedException.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/BridgeDefaultViewNotSpecifiedException.java?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/BridgeDefaultViewNotSpecifiedException.java (added)
+++ myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/BridgeDefaultViewNotSpecifiedException.java Thu Oct 25 06:38:05 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+package javax.portlet.faces;
+
+public class BridgeDefaultViewNotSpecifiedException extends BridgeException
+{
+ //TODO: This should be regenerated each time this is modified. Can this be added to maven?
+ private static final long serialVersionUID = 540438273186022660L;
+
+ public BridgeDefaultViewNotSpecifiedException()
+ {
+ super();
+ }
+
+ public BridgeDefaultViewNotSpecifiedException(String message)
+ {
+ super(message);
+ }
+
+ public BridgeDefaultViewNotSpecifiedException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public BridgeDefaultViewNotSpecifiedException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added: myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/BridgeException.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/BridgeException.java?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/BridgeException.java (added)
+++ myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/BridgeException.java Thu Oct 25 06:38:05 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+package javax.portlet.faces;
+
+import javax.faces.FacesException;
+
+public class BridgeException extends FacesException
+{
+ //TODO: This should be regenerated each time this is modified. Can this be added to maven?
+ private static final long serialVersionUID = 6758659847475864393L;
+
+ public BridgeException()
+ {
+ super();
+ }
+
+ public BridgeException(String message)
+ {
+ super(message);
+ }
+
+ public BridgeException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public BridgeException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added: myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java (added)
+++ myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java Thu Oct 25 06:38:05 2007
@@ -0,0 +1,384 @@
+/*
+ * 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.
+ */
+package javax.portlet.faces;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletRequest;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+/**
+ * The <code>GenericFacesPortlet</code> is provided to simplify development of a portlet that in
+ * whole or part relies on the Faces bridge to process requests. If all requests are to be handled
+ * by the bridge, <code>GenericFacesPortlet</code> is a turnkey implementation. Developers do not
+ * need to subclass it. However, if there are some situations where the portlet doesn't require
+ * bridge services then <code>GenericFacesPortlet</code> can be subclassed and overriden.
+ * <p>
+ * Since <code>GenericFacesPortlet</code> subclasses <code>GenericPortlet</code> care is taken
+ * to all subclasses to override naturally. For example, though <code>doDispatch()</code> is
+ * overriden, requests are only dispatched to the bridge from here if the <code>PortletMode</code>
+ * isn't <code>VIEW</code>, <code>EDIT</code>, or <code>HELP</code>.
+ * <p>
+ * The <code>GenericFacesPortlet</code> recognizes the following portlet init parameters:
+ * <ul>
+ * <li><code>javax.portlet.faces.defaultViewId.[<i>mode</i>]</code>: specifies on a per mode
+ * basis the default viewId the Bridge executes when not already encoded in the incoming request. A
+ * value must be defined for each <code>PortletMode</code> the <code>Bridge</code> is expected
+ * to process. </li>
+ * </ul>
+ * The <code>GenericFacesPortlet</code> recognizes the following <code>
+ * PortletContext</code>
+ * init parameters:
+ * <ul>
+ * <li><code>javax.portlet.faces.BridgeImplClass</code>: specifies the <code>Bridge</code>implementation
+ * class used by this portlet. This init parameter must be specified or else an exception is thrown.
+ * </li>
+ * </ul>
+ */
+public class GenericFacesPortlet extends GenericPortlet
+{
+ public static final String BRIDGE_CLASS = Bridge.BRIDGE_PACKAGE_PREFIX
+ + "BridgeImplClass";
+ public static final String BRIDGE_SERVICE_CLASSPATH = "/META-INF/services/javax.portlet.faces.Bridge";
+
+ private Class mFacesBridgeClass = null;
+ private Bridge mFacesBridge = null;
+
+ /**
+ * Initialize generic faces portlet from portlet.xml
+ */
+ @Override
+ public void init(PortletConfig portletConfig) throws PortletException
+ {
+ super.init(portletConfig);
+
+ // Make sure the bridge impl class is defined -- if not then search for it
+ // using same search rules as Faces
+ String bridgeClassName = getBridgeClassName();
+
+ if (bridgeClassName != null)
+ {
+ try
+ {
+ mFacesBridgeClass = Thread.currentThread().getContextClassLoader().loadClass(bridgeClassName);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // Do nothing and fall through to null check
+ }
+ }
+
+ if (mFacesBridgeClass == null)
+ {
+ throw new PortletException("Configuration Error: Initial Parameter '" + BRIDGE_CLASS
+ + "' is not defined for portlet: " + getPortletName());
+ }
+
+ // Context level attribute for whether to encode redirect URL
+ String renderPolicy = getPortletConfig().getInitParameter(
+ Bridge.BRIDGE_PACKAGE_PREFIX
+ + Bridge.RENDER_POLICY);
+ if (renderPolicy != null)
+ {
+ getPortletContext().setAttribute(
+ Bridge.BRIDGE_PACKAGE_PREFIX + getPortletName() + "."
+ + Bridge.RENDER_POLICY,
+ Bridge.BridgeRenderPolicy.valueOf(renderPolicy));
+ }
+ String preserveActionParams = getPortletConfig()
+ .getInitParameter(
+ Bridge.BRIDGE_PACKAGE_PREFIX
+ + Bridge.PRESERVE_ACTION_PARAMS);
+ if (preserveActionParams != null)
+ {
+ getPortletContext().setAttribute(
+ Bridge.BRIDGE_PACKAGE_PREFIX + getPortletName() + "."
+ + Bridge.PRESERVE_ACTION_PARAMS,
+ Boolean.valueOf(preserveActionParams));
+ }
+
+ // Don't instanciate/initialize the bridge yet. Do it on first use
+ }
+
+ /**
+ * Release resources
+ */
+ @Override
+ public void destroy()
+ {
+ if (mFacesBridge != null)
+ {
+ mFacesBridge.destroy();
+ mFacesBridge = null;
+ mFacesBridgeClass = null;
+ }
+ }
+
+ /**
+ * If mode is VIEW, EDIT, or HELP -- defer to the doView, doEdit, doHelp so subclasses can
+ * override. Otherwise handle mode here if there is a defaultViewId mapping for it.
+ */
+ @Override
+ public void doDispatch(RenderRequest request, RenderResponse response) throws PortletException,
+ IOException
+ {
+ // Defer to helper methods for standard modes so subclasses can override
+ PortletMode mode = request.getPortletMode();
+ if (mode == PortletMode.EDIT || mode == PortletMode.HELP || mode == PortletMode.VIEW)
+ {
+ super.doDispatch(request, response);
+ }
+ else
+ {
+ doDispatchInternal(request, response, request.getPortletMode());
+ }
+ }
+
+ @Override
+ protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException,
+ java.io.IOException
+ {
+ doDispatchInternal(request, response, request.getPortletMode());
+
+ }
+
+ @Override
+ protected void doHelp(RenderRequest request, RenderResponse response) throws PortletException,
+ java.io.IOException
+ {
+ doDispatchInternal(request, response, request.getPortletMode());
+
+ }
+
+ @Override
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException,
+ java.io.IOException
+ {
+ doDispatchInternal(request, response, request.getPortletMode());
+
+ }
+
+ @Override
+ public void processAction(ActionRequest request, ActionResponse response)
+ throws PortletException,
+ IOException
+ {
+ doBridgeDispatch(request, response, getDefaultViewId(request, request.getPortletMode()));
+ }
+
+ /**
+ * Returns the className of the bridge implementation this portlet uses. Subclasses override to
+ * alter the default behavior. Default implementation first checks for a portlet context init
+ * parameter: javax.portlet.faces.BridgeImplClass. If it doesn't exist then it looks for the
+ * resource file "/META-INF/services/javax.portlet.faces.Bridge" using the current threads
+ * classloader and extracts the classname from the first line in that file.
+ *
+ * @return the class name of the Bridge class the GenericFacesPortlet uses. null if it can't be
+ * determined.
+ */
+ public String getBridgeClassName()
+ {
+ String bridgeClassName = getPortletConfig().getPortletContext().getInitParameter(BRIDGE_CLASS);
+
+ if (bridgeClassName == null)
+ {
+ bridgeClassName = getFromServicesPath(getPortletConfig().getPortletContext(),
+ BRIDGE_SERVICE_CLASSPATH);
+ }
+ return bridgeClassName;
+ }
+
+ /**
+ * Returns the defaultViewId to be used for this request. The defaultViewId is depends on the
+ * PortletMode.
+ *
+ * @param request
+ * the request object.
+ * @param mode
+ * the mode which to return the defaultViewId for.
+ * @return the defaultViewId for this mode
+ */
+ public String getDefaultViewId(PortletRequest request, PortletMode mode)
+ {
+ return getPortletConfig().getInitParameter(Bridge.DEFAULT_VIEWID + "." + mode.toString());
+ }
+
+ private void doDispatchInternal(RenderRequest request, RenderResponse response, PortletMode mode)
+ throws PortletException,
+ IOException
+ {
+ // Only process if there is a default page defined for this mode
+ String modeDefaultViewId = getDefaultViewId(request, mode);
+
+ if (!(modeDefaultViewId == null))
+ {
+ WindowState state = request.getWindowState();
+ if (!state.equals(WindowState.MINIMIZED))
+ {
+ doBridgeDispatch(request, response, modeDefaultViewId);
+ }
+ }
+ else
+ {
+ super.doDispatch(request, response);
+ }
+ }
+
+ private void doBridgeDispatch(RenderRequest request, RenderResponse response, String defaultViewId)
+ throws PortletException
+ {
+ // initial Bridge if not already active
+ initBridge();
+ // Push information for Bridge into request attributes
+ setBridgeRequestContext(request, defaultViewId);
+ try
+ {
+ mFacesBridge.doFacesRequest(request, response);
+ }
+ catch (BridgeException e)
+ {
+ throw new PortletException(
+ "doBridgeDispatch failed: error from Bridge in executing the request",
+ e);
+ }
+
+ }
+
+ private void doBridgeDispatch(ActionRequest request, ActionResponse response, String defaultViewId)
+ throws PortletException
+ {
+ // initial Bridge if not already active
+ initBridge();
+ // Push information for Bridge into request attributes
+ setBridgeRequestContext(request, defaultViewId);
+ try
+ {
+ mFacesBridge.doFacesRequest(request, response);
+ }
+ catch (BridgeException e)
+ {
+ throw new PortletException(
+ "doBridgeDispatch failed: error from Bridge in executing the request",
+ e);
+ }
+
+ }
+
+ private void initBridge() throws PortletException
+ {
+ if (mFacesBridge == null)
+ {
+ try
+ {
+ mFacesBridge = (Bridge) mFacesBridgeClass.newInstance();
+ mFacesBridge.init(getPortletConfig());
+ }
+ catch (Exception e)
+ {
+ throw new PortletException("doBridgeDisptach: error instantiating the bridge class", e);
+ }
+ }
+ }
+
+ private void setBridgeRequestContext(PortletRequest request, String defaultViewId)
+ {
+ // Make the defaultViewId available to the Bridge
+ request.setAttribute(Bridge.DEFAULT_VIEWID, defaultViewId);
+ }
+
+ private String getFromServicesPath(PortletContext context, String resourceName)
+ {
+ // Check for a services definition
+ String result = null;
+ BufferedReader reader = null;
+ InputStream stream = null;
+ try
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null)
+ {
+ return null;
+ }
+
+ stream = cl.getResourceAsStream(resourceName);
+ if (stream != null)
+ {
+ // Deal with systems whose native encoding is possibly
+ // different from the way that the services entry was created
+ try
+ {
+ reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ reader = new BufferedReader(new InputStreamReader(stream));
+ }
+ result = reader.readLine();
+ if (result != null)
+ {
+ result = result.trim();
+ }
+ reader.close();
+ reader = null;
+ stream = null;
+ }
+ }
+ catch (IOException e)
+ {
+ }
+ catch (SecurityException e)
+ {
+ }
+ finally
+ {
+ if (reader != null)
+ {
+ try
+ {
+ reader.close();
+ stream = null;
+ }
+ catch (Throwable t)
+ {
+ ;
+ }
+ reader = null;
+ }
+ if (stream != null)
+ {
+ try
+ {
+ stream.close();
+ }
+ catch (Throwable t)
+ {
+ ;
+ }
+ stream = null;
+ }
+ }
+ return result;
+ }
+
+}
Added: myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainer.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainer.java?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainer.java (added)
+++ myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainer.java Thu Oct 25 06:38:05 2007
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package javax.portlet.faces.component;
+
+import javax.faces.component.NamingContainer;
+
+/**
+ * <p>
+ * <strong>PortletNamingContainer</strong> is an interface that must be implemented by any
+ * UIViewRoot that wants to be used in a Portlet Bridge environment. It indicates that this the
+ * component (usually a UIViewRoot) that implements this <code>NamingContainer</code> incorporates
+ * the consumer provided portlet namespaceId into the id returned from
+ * <code>getContainerClientId</code>. This is merely a marker interface
+ */
+public interface PortletNamingContainer extends NamingContainer
+{
+
+}
Added: myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java (added)
+++ myfaces/portlet-bridge/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java Thu Oct 25 06:38:05 2007
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+package javax.portlet.faces.component;
+
+import java.io.Serializable;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+
+/**
+ * Bridge ViewRoot that implements NamingContainer which uses the ExternalContext.encodeNamespace to
+ * introduce the consumer namespace into tree components.
+ */
+public class PortletNamingContainerUIViewRoot extends UIViewRoot implements PortletNamingContainer,
+ Serializable
+{
+
+ //TODO: This should be regenerated each time this is modified. Can this be added to maven?
+ private static final long serialVersionUID = -4524288011655837711L;
+ private static final String SEPARATOR = (new Character(NamingContainer.SEPARATOR_CHAR))
+ .toString();
+
+ public PortletNamingContainerUIViewRoot()
+ {
+ super();
+ }
+
+ public PortletNamingContainerUIViewRoot(UIViewRoot viewRootToReplace)
+ {
+ super();
+ setViewId(viewRootToReplace.getViewId());
+ setLocale(viewRootToReplace.getLocale());
+ setRenderKitId(viewRootToReplace.getRenderKitId());
+ }
+
+ // Implement the method that satisfies NamingContainer
+
+ public static String getContainerClientId(FacesContext context, String additionalId)
+ {
+ ExternalContext ec = context.getExternalContext();
+ String namespace = ec.encodeNamespace(SEPARATOR);
+
+ /*
+ * In servlet world encodeNamespace does nothing -- so if we get back what we sent in then do
+ * not perturn the NamingContainer Id
+ */
+ if (namespace.length() > 1)
+ {
+ if (additionalId != null)
+ {
+ return namespace + additionalId;
+ }
+ else
+ {
+ return namespace;
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ // Implement the method that satisfies NamingContainer
+
+ @Override
+ public String getContainerClientId(FacesContext context)
+ {
+ return PortletNamingContainerUIViewRoot
+ .getContainerClientId(
+ context,
+ super
+ .getContainerClientId(context));
+ }
+
+}
Added: myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/LICENSE.txt
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/LICENSE.txt?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/LICENSE.txt (added)
+++ myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/LICENSE.txt Thu Oct 25 06:38:05 2007
@@ -0,0 +1,202 @@
+
+ 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.
Added: myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/NOTICE.txt
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/NOTICE.txt?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/NOTICE.txt (added)
+++ myfaces/portlet-bridge/trunk/api/src/main/resources/META-INF/NOTICE.txt Thu Oct 25 06:38:05 2007
@@ -0,0 +1,14 @@
+Apache MyFaces Portlet Bridge
+Copyright [2007] The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software are Copyright (c) 2007, Oracle
+Corporation, <http://www.oracle.com/> and are licensed to
+the Apache Software Foundation under the "Software Grant
+and Corporate Contribution License Agreement"
+
+See the LICENSE.txt file for information on all licenses
+associated with this software.
+
Added: myfaces/portlet-bridge/trunk/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/impl/pom.xml?rev=588233&view=auto
==============================================================================
--- myfaces/portlet-bridge/trunk/impl/pom.xml (added)
+++ myfaces/portlet-bridge/trunk/impl/pom.xml Thu Oct 25 06:38:05 2007
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2006 The Apache Software Foundation.
+
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <!-- TODO: Is this the correct group id? -->
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ <artifactId>jsf-portlet-bridge</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>Portlet Bridge for JavaServer Faces Impl</name>
+ <description>Implementation of the Portlet Bridge for JavaServer Faces.</description>
+
+ <artifactId>jsf-portlet-bridge-impl</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ <artifactId>jsf-portlet-bridge-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <!-- Allows building of jdev projects (jdev:jdev target) -->
+ <!-- TODO: This is an artifical dependancy on Trinidad, should it be removed? -->
+ <plugin>
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <artifactId>maven-jdev-plugin</artifactId>
+ <version>1.0.1</version>
+ </plugin>
+
+ <!-- Build and sign jars (http://maven.apache.org/plugins/maven-jar-plugin/)-->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ </archive>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+
+ <!-- Generate JavaDocs (http://maven.apache.org/plugins/maven-javadoc-plugin/) -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <showPackage>false</showPackage>
+ <showProtected>true</showProtected>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>