portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [1/4] portals-pluto git commit: Added new methods to HeaderResponse to support dynamic dependency configuration: addDependency(String name, String scope, String version) and addDependency(String name, String scope, String version, Element markup). Made a
Date Thu, 19 May 2016 15:13:34 GMT
Repository: portals-pluto
Updated Branches:
  refs/heads/master 53a830b41 -> c3557adcf


Added new methods to HeaderResponse to support dynamic dependency
configuration:
addDependency(String name, String scope, String version) and
addDependency(String name, String scope, String version, Element markup).
Made associated changes to HeaderReponseWrapper and to test fixtures.
Fixed typos and unclear text in javadocs.


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/29b2d9ae
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/29b2d9ae
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/29b2d9ae

Branch: refs/heads/master
Commit: 29b2d9ae5a698bf75ff91b698550907d8ff13a02
Parents: 53a830b
Author: Scott Nicklous <msnicklous@apache.org>
Authored: Tue May 17 14:36:23 2016 +0200
Committer: Scott Nicklous <msnicklous@apache.org>
Committed: Tue May 17 14:36:23 2016 +0200

----------------------------------------------------------------------
 .../container/impl/HeaderResponseImpl.java      |   9 ++
 .../fixtures/mocks/MockHeaderResponse.java      |  12 ++-
 .../main/java/javax/portlet/HeaderRequest.java  |  14 ++-
 .../main/java/javax/portlet/HeaderResponse.java | 102 ++++++++++++++++++-
 .../java/javax/portlet/PortletAsyncContext.java |   2 -
 .../java/javax/portlet/ResourceRequest.java     |   4 +-
 .../portlet/filter/HeaderResponseWrapper.java   |  18 +++-
 portlet-api/src/main/javadoc/overview.html      |  31 ++++--
 8 files changed, 170 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29b2d9ae/pluto-container/src/main/java/org/apache/pluto/container/impl/HeaderResponseImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/HeaderResponseImpl.java
b/pluto-container/src/main/java/org/apache/pluto/container/impl/HeaderResponseImpl.java
index 1c86620..c8149fe 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/HeaderResponseImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/HeaderResponseImpl.java
@@ -24,6 +24,7 @@ import javax.portlet.PortletMode;
 
 import org.apache.pluto.container.PortletHeaderResponseContext;
 import org.apache.pluto.container.util.ArgumentUtility;
+import org.w3c.dom.Element;
 
 
 /**
@@ -122,4 +123,12 @@ public class HeaderResponseImpl extends MimeResponseImpl implements HeaderRespon
     {
        ((PortletHeaderResponseContext) responseContext).setTitle(title);
     }
+
+   @Override
+   public void addDependency(String name, String scope, String version) {
+   }
+
+   @Override
+   public void addDependency(String name, String scope, String version, Element markup) {
+   }
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29b2d9ae/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockHeaderResponse.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockHeaderResponse.java
b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockHeaderResponse.java
index e2d1201..caf7df2 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockHeaderResponse.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockHeaderResponse.java
@@ -21,18 +21,24 @@ package org.apache.pluto.container.bean.processor.fixtures.mocks;
 
 import javax.portlet.HeaderResponse;
 
+import org.w3c.dom.Element;
+
 /**
  * @author Scott Nicklous
  *
  */
 public class MockHeaderResponse extends MockMimeResponse implements HeaderResponse {
 
-   /* (non-Javadoc)
-    * @see javax.portlet.HeaderResponse#setTitle(java.lang.String)
-    */
    @Override
    public void setTitle(String arg0) {
+   }
+
+   @Override
+   public void addDependency(String name, String scope, String version) {
+   }
 
+   @Override
+   public void addDependency(String name, String scope, String version, Element markup) {
    }
 
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29b2d9ae/portlet-api/src/main/java/javax/portlet/HeaderRequest.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/HeaderRequest.java b/portlet-api/src/main/java/javax/portlet/HeaderRequest.java
index 75352a3..ba283fb 100644
--- a/portlet-api/src/main/java/javax/portlet/HeaderRequest.java
+++ b/portlet-api/src/main/java/javax/portlet/HeaderRequest.java
@@ -21,9 +21,21 @@ package javax.portlet;
 
 /**
  * <div class="changed_added_3_0">
- * Tag interface designating a header request object
+ * Tag interface designating a header request object.
+ * <p>
+ * The portlet programming interface provides a mechanism to assist portlets when 
+ * the aggregated portal markup is an HTML or similar document that requires markup
+ * for the document <code>HEAD</code> section to be written and HTTP headers
to be 
+ * set before the render markup for each individual portlet is aggregated.
+ * This mechanism is represented in the portlet API by the {@link HeaderPortlet}, 
+ * {@link HeaderRequest}, and {@link HeaderResponse} interfaces.
+ * <p>  
+ * The <CODE>HeaderRequest</CODE> provides the portlet with information about
+ * the request.
  * </div>
  *
+ *@see HeaderResponse
+ *@see HeaderPortlet
  */
 public interface HeaderRequest extends RenderRequest {
 

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29b2d9ae/portlet-api/src/main/java/javax/portlet/HeaderResponse.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/HeaderResponse.java b/portlet-api/src/main/java/javax/portlet/HeaderResponse.java
index 36ee7f0..886c0ba 100644
--- a/portlet-api/src/main/java/javax/portlet/HeaderResponse.java
+++ b/portlet-api/src/main/java/javax/portlet/HeaderResponse.java
@@ -24,10 +24,18 @@
 
 package javax.portlet;
 
+import org.w3c.dom.Element;
+
 /**
  * <div class="changed_added_3_0">
- * The
- * <CODE>HeaderResponse</CODE> defines an object to assist a portlet in
+ * The portlet programming interface provides a mechanism to assist portlets when 
+ * the aggregated portal markup is an HTML or similar document that requires markup
+ * for the document <code>HEAD</code> section to be written and HTTP headers
to be 
+ * set before the render markup for each individual portlet is aggregated.
+ * This mechanism is represented in the portlet API by the {@link HeaderPortlet}, 
+ * {@link HeaderRequest}, and {@link HeaderResponse} interfaces.
+ * <p>  
+ * The <CODE>HeaderResponse</CODE> defines an object to assist a portlet in
  * sending a response to the portal. It extends the
  * <CODE>MimeResponse</CODE> interface to provide specific header
  * response functionality to portlets.
@@ -81,4 +89,94 @@ public interface HeaderResponse extends MimeResponse {
      */
     public void setContentType(String type);
 
+    /**
+     * Data written to the <code>HeaderResponse</code> writer is added
+     * to the aggregated portal document <code>HEAD</code> section.
+     * <p>
+     * {@inheritDoc}
+     */
+    public java.io.PrintWriter getWriter() throws java.io.IOException;
+
+    /**
+     * Data written to the <code>HeaderResponse</code> output stream is added
+     * to the aggregated portal document <code>HEAD</code> section.
+     * <p>
+     * {@inheritDoc}
+     */
+    public java.io.OutputStream getPortletOutputStream() throws java.io.IOException;
+    
+    /**
+     * Adds a dependency on a page-level resource that is managed by the portal.
+     * <p>
+     * When a portlet is aggregated onto a page, it may designate resources such as 
+     * JavaScript files or style sheets
+     * that it needs to have on the page in order to operate correctly.
+     * These resources typically should be added to the aggregated document <code>head</code>
+     * section. 
+     * Such resources are known as portlet dependencies.
+     * <p>
+     * The portal implementation is responsible for adding the portlet dependencies to
+     * the page during aggregation.
+     * The resources declared as dependencies are typically such that they should be added

+     * to the page only a single time, but may be used by multiple portlets.
+     * <p>
+     * Portlet dependencies may be configured statically either through annotations or 
+     * through the portlet deployment descriptor.
+     * The resources to satisfy such dependencies will be made available on all pages on
which
+     * the portlet is rendered.
+     * <p>
+     * The dependency added dynamically through this method is added to the
+     * statically declared dependencies for the portlet for the current rendering cycle 
+     * only.
+     * <p>
+     * This method should only be used to add portlet dependencies that can potentially be

+     * required by or shared with other portlets as well.
+     * Strictly private dependencies, such as JavaScript code needed by this portlet only,
+     * should be added to to document head section using the  
+     * <code>PortletResponse#addProperty(String, Element)</code> method or by
using either the
+     * <code>PrintWriter</code> or <code>OutputStream</code> object
obtained 
+     * through the <code>HeaderResponse</code>.
+     * <p>
+     * The manner in which the portal maps the specified name, scope, and version to 
+     * specific resources is left to the portal implementation.
+     * 
+     * @param name      the resource name
+     * @param scope     the resource scope
+     * @param version   the resource version
+     * 
+     * @see PortletResponse#addProperty(String, org.w3c.dom.Element)
+     * @see #getWriter()
+     * @see #getPortletOutputStream()
+     */
+    public void addDependency(String name, String scope, String version);
+    
+    /**
+     * Adds a dependency on a page-level resource that is managed by the portal
+     * and adds a resource for addition to the page for the dependency.
+     * <p>
+     * See {@link #addDependency(String, String, String)} for a discussion of
+     * dependencies.
+     * <p>
+     * The specified markup element representing the resource must be suitable for inclusion
+     * in the aggregated portal document <code>HEAD</code> section.
+     * It will generally be either a <code>LINK</code> or <code>SCRIPT</code>
tag.
+     * <p>
+     * This method does not directly place markup into the aggregated page document. 
+     * The aggregating portal will use the identifying information name, scope, and version
+     * along with identifying information for other available page resources to determine
+     * which resources will be added to the page.
+     * <p>
+     * For example, if a portlet provides a resource with a version of 2.0.0 but another

+     * portlet on the same page provides a resource with the same name and scope but 
+     * a version of 2.1.0, the aggregating portal may choose to include the later
+     * version of the resource on the page. 
+     * 
+     * @param name      the resource name
+     * @param scope     the resource scope
+     * @param version   the resource version
+     * @param markup    the markup for adding the resource to the page
+     */
+    public void addDependency(String name, String scope, String version, Element markup);
+
+    
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29b2d9ae/portlet-api/src/main/java/javax/portlet/PortletAsyncContext.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/PortletAsyncContext.java b/portlet-api/src/main/java/javax/portlet/PortletAsyncContext.java
index 13f75ad..6dc1c2f 100644
--- a/portlet-api/src/main/java/javax/portlet/PortletAsyncContext.java
+++ b/portlet-api/src/main/java/javax/portlet/PortletAsyncContext.java
@@ -19,8 +19,6 @@
 
 package javax.portlet;
 
-import javax.servlet.ServletContext;
-
 
 /**
  * <div class="changed_added_3_0">

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29b2d9ae/portlet-api/src/main/java/javax/portlet/ResourceRequest.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/ResourceRequest.java b/portlet-api/src/main/java/javax/portlet/ResourceRequest.java
index bfbbf80..123cf96 100644
--- a/portlet-api/src/main/java/javax/portlet/ResourceRequest.java
+++ b/portlet-api/src/main/java/javax/portlet/ResourceRequest.java
@@ -380,8 +380,8 @@ public interface ResourceRequest extends ClientDataRequest {
     * 
     * @return   <code>true</code> if asynchronous mode has been started
     * @since    3.0
-    * @see      #startAsync()
-    * @see      #startAsync(ResourceRequest, ResourceResponse)
+    * @see      #startPortletAsync()
+    * @see      #startPortletAsync(ResourceRequest, ResourceResponse)
     */
 
    public boolean isAsyncStarted();

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29b2d9ae/portlet-api/src/main/java/javax/portlet/filter/HeaderResponseWrapper.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/filter/HeaderResponseWrapper.java b/portlet-api/src/main/java/javax/portlet/filter/HeaderResponseWrapper.java
index c7251b7..66c0b1f 100644
--- a/portlet-api/src/main/java/javax/portlet/filter/HeaderResponseWrapper.java
+++ b/portlet-api/src/main/java/javax/portlet/filter/HeaderResponseWrapper.java
@@ -20,6 +20,8 @@ package javax.portlet.filter;
 
 import javax.portlet.HeaderResponse;
 
+import org.w3c.dom.Element;
+
 /**
  * <div class="changed_added_3_0"> The <code>HeaderResponseWrapper</code>
  * provides a convenient implementation of the <code>HeaderResponse</code>
@@ -57,13 +59,19 @@ public class HeaderResponseWrapper extends MimeResponseWrapper implements
Header
       super.setResponse(response);
    }
 
-   /*
-    * (non-Javadoc)
-    * 
-    * @see javax.portlet.HeaderResponse#setTitle(java.lang.String)
-    */
+   @Override
    public void setTitle(String title) {
       ((HeaderResponse)response).setTitle(title);
    }
 
+   @Override
+   public void addDependency(String name, String scope, String version) {
+      ((HeaderResponse)response).addDependency(name, scope, version);
+   }
+
+   @Override
+   public void addDependency(String name, String scope, String version, Element markup) {
+      ((HeaderResponse)response).addDependency(name, scope, version, markup);
+   }
+
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29b2d9ae/portlet-api/src/main/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/javadoc/overview.html b/portlet-api/src/main/javadoc/overview.html
index 851b116..55569ee 100644
--- a/portlet-api/src/main/javadoc/overview.html
+++ b/portlet-api/src/main/javadoc/overview.html
@@ -21,6 +21,23 @@
     <div class="indexContainer-not">
     <ul>
     <li>
+    20160517:
+    Renamed methods to
+    {@link javax.portlet.ResourceRequest#startPortletAsync() ResourceRequest#startPortletAsync()},

+    {@link javax.portlet.ResourceRequest#startPortletAsync(ResourceRequest, ResourceResponse)
ResourceRequest#startPortletAsync(ResourceRequest, ResourceResponse)}, and 
+    {@link javax.portlet.ResourceRequest#getPortletAsyncContext() ResourceRequest#getPortletAsyncContext()}
+    from <code>startAsync()</code>, <code>startAsync(ResourceRequest, ResourceResponse)</code>
+    and <code>getAsyncContext()</code>, respectively.
+    Added new methods 
+    {@link javax.portlet.HeaderResponse#addDependency(String, String, String)} and 
+    {@link javax.portlet.HeaderResponse#addDependency(String, String, String, Element)}
+    to dynamically add page resource dependencies in fulfillment of issue
+    <a href="https://java.net/jira/browse/PORTLETSPEC3-40">PORTLETSPEC3-40 Add new
javax.portlet.ResourceComparator annotation in order to identify duplicate resources</a>.
+    Added
+    {@link javax.portlet.annotations.Dependency#scope() Dependency#scope()} method
+    to support three-part resource identifier with name, scope, and version fields.
+    </li>
+    <li>
     20160418:
     Added new method to implement 
     <a href="https://java.net/jira/browse/PORTLETSPEC3-63">PORTLETSPEC3-63 Make user
agent available to Portlets</a>:
@@ -44,9 +61,9 @@
     {@link javax.portlet.PortletAsyncListener PortletAsyncListener}, and
     {@link javax.portlet.PortletAsyncEvent PortletAsyncEvent}.
     Modified 
-    {@link javax.portlet.ResourceRequest#startAsync() ResourceRequest#startAsync()}, 
-    {@link javax.portlet.ResourceRequest#startAsync(ResourceRequest, ResourceResponse) ResourceRequest#startAsync(ResourceRequest,
ResourceResponse)}, and 
-    {@link javax.portlet.ResourceRequest#getAsyncContext() ResourceRequest#getAsyncContext()}
+    {@link javax.portlet.ResourceRequest#startPortletAsync() ResourceRequest#startPortletAsync()},

+    {@link javax.portlet.ResourceRequest#startPortletAsync(ResourceRequest, ResourceResponse)
ResourceRequest#startPortletAsync(ResourceRequest, ResourceResponse)}, and 
+    {@link javax.portlet.ResourceRequest#getPortletAsyncContext() ResourceRequest#getPortletAsyncContext()}
     along with the corresponding wrapper class accordingly.
     </li>
     <li>
@@ -55,11 +72,11 @@
     <a href="https://java.net/jira/browse/PORTLETSPEC3-68">PORTLETSPEC3-68 Add Async
Support</a>:
     {@link javax.portlet.annotations.PortletConfiguration#asyncSupported() PortletConfiguration#asyncSupported()},

     {@link javax.portlet.annotations.ServeResourceMethod#asyncSupported() ServeResourceMethod#asyncSupported()},

-    {@link javax.portlet.ResourceRequest#startAsync() ResourceRequest#startAsync()}, 
-    {@link javax.portlet.ResourceRequest#startAsync(ResourceRequest, ResourceResponse) ResourceRequest#startAsync(ResourceRequest,
ResourceResponse)}, 
+    {@link javax.portlet.ResourceRequest#startPortletAsync() ResourceRequest#startPortletAsync()},

+    {@link javax.portlet.ResourceRequest#startPortletAsync(ResourceRequest, ResourceResponse)
ResourceRequest#startPortletAsync(ResourceRequest, ResourceResponse)}, 
     {@link javax.portlet.ResourceRequest#isAsyncStarted() ResourceRequest#isAsyncStarted()},

     {@link javax.portlet.ResourceRequest#isAsyncSupported() ResourceRequest#isAsyncSupported()},

-    {@link javax.portlet.ResourceRequest#getAsyncContext() ResourceRequest#getAsyncContext()},
and 
+    {@link javax.portlet.ResourceRequest#getPortletAsyncContext() ResourceRequest#getPortletAsyncContext()},
and 
     {@link javax.portlet.ResourceRequest#getDispatcherType() ResourceRequest#getDispatcherType()}.
     Added appropriate documentation to 
     {@link javax.portlet.filter.ResourceFilter ResourceFilter}.
@@ -120,7 +137,7 @@
     Added wrappers according to 
     <a href="https://java.net/jira/browse/PORTLETSPEC3-62">PORTLETSPEC3-62</a>,
     (see {@link javax.portlet.filter filter package}).
-    Update following annotations for consistency with spec & RI:
+    Update following annotations for consistency with spec {@literal &} RI:
     {@link javax.portlet.annotations.DestroyMethod DestroyMethod},
     {@link javax.portlet.annotations.EventMethod EventMethod},
     {@link javax.portlet.annotations.HeaderMethod HeaderMethod},


Mime
View raw message