You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by as...@apache.org on 2019/03/27 18:22:40 UTC

[portals-pluto] branch master updated: PLUTO-753 Improve performance of the ChatRoomDemo portlet by registering the PortletHub dependency

This is an automated email from the ASF dual-hosted git repository.

asfgriff pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/portals-pluto.git


The following commit(s) were added to refs/heads/master by this push:
     new fe81fe6  PLUTO-753 Improve performance of the ChatRoomDemo portlet by registering the PortletHub dependency
fe81fe6 is described below

commit fe81fe676fc10c1e5b69be0a2aab2b2091b45d01
Author: Neil Griffin <ne...@gmail.com>
AuthorDate: Wed Mar 27 14:22:21 2019 -0400

    PLUTO-753 Improve performance of the ChatRoomDemo portlet by registering the PortletHub dependency
---
 .../main/java/com/ibm/portal/samples/ChatRoom.java    |  8 ++++++++
 .../java/com/ibm/portal/samples/HelloWorldImage.java  | 19 -------------------
 2 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/ChatRoomDemo/src/main/java/com/ibm/portal/samples/ChatRoom.java b/ChatRoomDemo/src/main/java/com/ibm/portal/samples/ChatRoom.java
index 788efd1..f78ce54 100644
--- a/ChatRoomDemo/src/main/java/com/ibm/portal/samples/ChatRoom.java
+++ b/ChatRoomDemo/src/main/java/com/ibm/portal/samples/ChatRoom.java
@@ -30,6 +30,8 @@ import javax.portlet.PortletException;
 import javax.portlet.ResourceRequest;
 import javax.portlet.ResourceResponse;
 import javax.portlet.annotations.ActionMethod;
+import javax.portlet.annotations.Dependency;
+import javax.portlet.annotations.PortletConfiguration;
 import javax.portlet.annotations.RenderMethod;
 import javax.portlet.annotations.ServeResourceMethod;
 
@@ -39,6 +41,12 @@ import javax.portlet.annotations.ServeResourceMethod;
  * @author Scott Nicklous
  */
 @ApplicationScoped
+@PortletConfiguration(
+    portletName = "BeanPortletDemo",
+    dependencies = {
+        @Dependency(name="PortletHub", scope = "javax.portlet", version="3.0.0")
+    }
+)
 public class ChatRoom {
    
    @Inject private ChatHistory history;
diff --git a/ChatRoomDemo/src/main/java/com/ibm/portal/samples/HelloWorldImage.java b/ChatRoomDemo/src/main/java/com/ibm/portal/samples/HelloWorldImage.java
index 498dbb0..8041b9e 100644
--- a/ChatRoomDemo/src/main/java/com/ibm/portal/samples/HelloWorldImage.java
+++ b/ChatRoomDemo/src/main/java/com/ibm/portal/samples/HelloWorldImage.java
@@ -18,14 +18,9 @@
 
 package com.ibm.portal.samples;
 
-import java.io.IOException;
-
 import javax.inject.Inject;
-import javax.portlet.HeaderRequest;
-import javax.portlet.HeaderResponse;
 import javax.portlet.MimeResponse;
 import javax.portlet.PortletRequest;
-import javax.portlet.annotations.HeaderMethod;
 import javax.portlet.annotations.RenderMethod;
 import javax.portlet.annotations.ServeResourceMethod;
 
@@ -57,20 +52,6 @@ public class HelloWorldImage {
       "/resources/images/gorilla1.gif" };
    
    /**
-    * Header method to add dependency on the portlet hub. The markup for the image
-    * is loaded and added to the DOM through an Ajax call on the client. The client-side 
-    * code makes use of the portlet hub, so a header method is used to add a page-level
-    * resource dependency on the portlet hub.
-    * 
-    * With the portletNames attribute specified as '*', this header method will be 
-    * applied to all portlets in the portlet application.
-    */
-   @HeaderMethod(portletNames="*")
-   public void header(HeaderRequest req, HeaderResponse resp) throws IOException {
-      resp.addDependency("PortletHub", "javax.portlet", "3.0.0");
-   }
-
-   /**
     * Render method using automatic include. If a render method has multiple render methods,
     * the render methods are executed in the order of ascending ordinal number.
     */