portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [33/35] portals-pluto git commit: Adapted V3 demo portlets to use annotated config. Fix a bug reading web DD
Date Mon, 18 Jan 2016 12:41:35 GMT
Adapted V3 demo portlets to use annotated config. Fix a bug reading web DD


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

Branch: refs/heads/V3Prototype
Commit: 43d2208eed1733f70484016a3879701bdf960064
Parents: abee379
Author: Scott Nicklous <msnicklous@apache.org>
Authored: Fri Jan 15 17:57:17 2016 +0100
Committer: Scott Nicklous <msnicklous@apache.org>
Committed: Fri Jan 15 17:57:17 2016 +0100

----------------------------------------------------------------------
 .../java/basic/portlet/ColorSelPortlet.java     | 48 +++++++++++------
 .../java/basic/portlet/ImageSelPortlet.java     |  4 +-
 .../java/basic/portlet/MessageBoxPortlet.java   | 26 ++++++---
 .../java/basic/portlet/ResourcePortlet.java     |  6 +--
 .../src/main/webapp/WEB-INF/portlet.xml         | 55 --------------------
 .../main/java/basic/portlet/AuthSCPortlet.java  |  2 +-
 .../java/basic/portlet/ColorSelPortlet.java     | 15 +++---
 .../main/java/basic/portlet/HeaderPortlet.java  |  4 ++
 .../java/basic/portlet/ImageSelPortlet.java     |  2 +-
 .../java/basic/portlet/MessageBoxPortlet.java   |  2 +-
 .../basic/portlet/PortletConfigPortlet.java     |  2 +-
 .../java/basic/portlet/RedirectPortlet.java     |  2 +
 .../java/basic/portlet/ResourcePortlet.java     |  2 +-
 .../main/java/basic/portlet/UrlTestPortlet.java |  2 +-
 .../src/main/webapp/WEB-INF/portlet.xml         | 29 -----------
 .../org/apache/pluto/container/HeaderData.java  |  5 +-
 .../container/impl/PortletRequestImpl.java      |  2 +-
 .../om/portlet/impl/ConfigurationProcessor.java | 16 ++++++
 .../impl/JSR362ConfigurationProcessor.java      |  7 ++-
 .../driver/url/PortletParameterFactory.java     |  5 +-
 20 files changed, 102 insertions(+), 134 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletHubDemo/src/main/java/basic/portlet/ColorSelPortlet.java
----------------------------------------------------------------------
diff --git a/PortletHubDemo/src/main/java/basic/portlet/ColorSelPortlet.java b/PortletHubDemo/src/main/java/basic/portlet/ColorSelPortlet.java
index e66e1cc..4e3445b 100644
--- a/PortletHubDemo/src/main/java/basic/portlet/ColorSelPortlet.java
+++ b/PortletHubDemo/src/main/java/basic/portlet/ColorSelPortlet.java
@@ -18,12 +18,17 @@
 
 package basic.portlet;
 
-import static basic.portlet.Constants.*;
+import static basic.portlet.Constants.DELIM;
+import static basic.portlet.Constants.PARAM_FG_BLUE;
+import static basic.portlet.Constants.PARAM_FG_COLOR;
+import static basic.portlet.Constants.PARAM_FG_GREEN;
+import static basic.portlet.Constants.PARAM_FG_RED;
+import static basic.portlet.Constants.PARAM_MSG_INPUT;
+import static basic.portlet.Constants.PARAM_SUBTYPE;
 
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Enumeration;
-import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -31,18 +36,24 @@ import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
 import javax.portlet.GenericPortlet;
 import javax.portlet.PortletException;
-import javax.portlet.PortletRequest;
+import javax.portlet.PortletParameters;
 import javax.portlet.PortletRequestDispatcher;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.portlet.ResourceRequest;
 import javax.portlet.ResourceResponse;
+import javax.portlet.annotations.ActionMethod;
+import javax.portlet.annotations.LocaleString;
+import javax.portlet.annotations.PortletConfiguration;
+import javax.portlet.annotations.PortletQName;
 import javax.xml.namespace.QName;
 
 
 /**
- * A management portlet that displays the current deep link configuration
+ * An example color selection portlet that uses the portlet hub.
  */
+@PortletConfiguration(portletName = "ColorSelPortlet", publicParams = "color", 
+                      title = @LocaleString("PH Color Selection Portlet"))
 public class ColorSelPortlet extends GenericPortlet {
 
    // Set up logging
@@ -73,12 +84,16 @@ public class ColorSelPortlet extends GenericPortlet {
          throws PortletException, IOException {
    }
 
+   @ActionMethod(portletName="ColorSelPortlet", publishingEvents= {
+         @PortletQName(namespaceURI="http://www.apache.org/portals/pluto/ResourcePortlet",
localPart="Message")
+   })
    public void processAction(ActionRequest req, ActionResponse resp)
          throws PortletException, IOException {
             
-      dumpParameters(req);
+      dumpParameters("Action", req.getActionParameters());
+      dumpParameters("Render", req.getRenderParameters());
       
-      String[] vals = req.getParameterValues(PARAM_FG_COLOR);
+      String[] vals = req.getActionParameters().getValues(PARAM_FG_COLOR);
       String r = "0";
       String g = "0";
       String b = "0";
@@ -94,17 +109,17 @@ public class ColorSelPortlet extends GenericPortlet {
       // make sure the private parameter are all on the URL for 
       // potential back button support
       if (vals != null) {
-         resp.setRenderParameter(PARAM_FG_COLOR, vals);
+         resp.getRenderParameters().setValues(PARAM_FG_COLOR, vals);
       }
       
-      String subType = req.getParameter(PARAM_SUBTYPE);
+      String subType = req.getActionParameters().getValue(PARAM_SUBTYPE);
       if (subType != null) {
-         resp.setRenderParameter(PARAM_SUBTYPE, subType);
+         resp.getRenderParameters().setValue(PARAM_SUBTYPE, subType);
       }
       
-      String text = req.getParameter(PARAM_MSG_INPUT);
+      String text = req.getActionParameters().getValue(PARAM_MSG_INPUT);
       if (text != null) {
-         resp.setRenderParameter(PARAM_MSG_INPUT, text);
+         resp.getRenderParameters().setValue(PARAM_MSG_INPUT, text);
       }
       
       String msg = text + DELIM + clr;
@@ -116,7 +131,7 @@ public class ColorSelPortlet extends GenericPortlet {
          resp.setEvent(qn, msg);
          logger.fine("Firing event with QName: " + qn.toString());
       } else {
-         logger.warning("No publishing event QName available. Check portlet deployment descriptor.");
+         logger.warning("No publishing event QName available. Check portlet configuration.");
       }
       
       StringBuilder sb = new StringBuilder("Color: ").append(Arrays.toString(vals));
@@ -125,14 +140,13 @@ public class ColorSelPortlet extends GenericPortlet {
       logger.fine(sb.toString());
    }
    
-   private void dumpParameters(PortletRequest req) {
+   private void dumpParameters(String type, PortletParameters parms) {
       if (logger.isLoggable(Level.FINEST)) {
          StringBuilder sb = new StringBuilder();
-         sb.append("Portlet request parameters:");
-         Map<String, String[]> parms = req.getParameterMap();
-         for (String name : parms.keySet()) {
+         sb.append("Portlet ").append(type).append(" parameters:");
+         for (String name : parms.getNames()) {
             sb.append("\nName: ").append(name);
-            sb.append(", Values: ").append(Arrays.toString(parms.get(name)));
+            sb.append(", Values: ").append(Arrays.toString(parms.getValues(name)));
          }
          logger.finest(sb.toString());
       }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletHubDemo/src/main/java/basic/portlet/ImageSelPortlet.java
----------------------------------------------------------------------
diff --git a/PortletHubDemo/src/main/java/basic/portlet/ImageSelPortlet.java b/PortletHubDemo/src/main/java/basic/portlet/ImageSelPortlet.java
index 2221e84..7256b41 100644
--- a/PortletHubDemo/src/main/java/basic/portlet/ImageSelPortlet.java
+++ b/PortletHubDemo/src/main/java/basic/portlet/ImageSelPortlet.java
@@ -80,9 +80,9 @@ public class ImageSelPortlet extends GenericPortlet {
 
 	      String pid = resp.getNamespace();
 	      Set<String> names = imgMap.keySet();
-	      String selType = req.getParameter(PARAM_SELTYPE);
+	      String selType = req.getRenderParameters().getValue(PARAM_SELTYPE);
 	      selType = (selType == null) ? PARAM_SELTYPE_RADIO : selType;
-	      String imgName = req.getParameter(PARAM_IMGNAME);
+	      String imgName = req.getRenderParameters().getValue(PARAM_IMGNAME);
 	      imgName = (imgName == null) ? "default" : imgName;
 
 	      if (selType.equals(PARAM_SELTYPE_RADIO)) {

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletHubDemo/src/main/java/basic/portlet/MessageBoxPortlet.java
----------------------------------------------------------------------
diff --git a/PortletHubDemo/src/main/java/basic/portlet/MessageBoxPortlet.java b/PortletHubDemo/src/main/java/basic/portlet/MessageBoxPortlet.java
index 13cb517..0eff878 100644
--- a/PortletHubDemo/src/main/java/basic/portlet/MessageBoxPortlet.java
+++ b/PortletHubDemo/src/main/java/basic/portlet/MessageBoxPortlet.java
@@ -18,7 +18,10 @@
 
 package basic.portlet;
 
-import static basic.portlet.Constants.*;
+import static basic.portlet.Constants.ATTRIB_MSGS;
+import static basic.portlet.Constants.DELIM;
+import static basic.portlet.Constants.PARAM_COLOR;
+import static basic.portlet.Constants.PARAM_NUM_MSGS;
 
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -37,10 +40,16 @@ import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.portlet.ResourceRequest;
 import javax.portlet.ResourceResponse;
+import javax.portlet.annotations.EventMethod;
+import javax.portlet.annotations.LocaleString;
+import javax.portlet.annotations.PortletConfiguration;
+import javax.portlet.annotations.PortletQName;
 
 /**
  * A demo portlet that displays messages sent via event
  */
+@PortletConfiguration(portletName = "MessageBoxPortlet", publicParams = "color", 
+                      title = @LocaleString("PH Message Box Portlet"))
 public class MessageBoxPortlet extends GenericPortlet {
 
    // Set up logging
@@ -68,7 +77,7 @@ public class MessageBoxPortlet extends GenericPortlet {
 
       // the only action for this portlet is to reset the stored messages
       
-      String actionName = req.getParameter("action");
+      String actionName = req.getActionParameters().getValue(ActionRequest.ACTION_NAME);
       logger.fine("MBP: Resetting messages. numMsgs = 0,  actionName = " + actionName);
 
       ArrayList<String> msgs = new ArrayList<String>();
@@ -79,15 +88,18 @@ public class MessageBoxPortlet extends GenericPortlet {
       sb.append("</p>");
       msgs.add(sb.toString());
 
-      resp.setRenderParameter(PARAM_NUM_MSGS, "0");
+      resp.getRenderParameters().setValue(PARAM_NUM_MSGS, "0");
       req.getPortletSession().setAttribute(ATTRIB_MSGS, msgs);
    }
    
-   @SuppressWarnings("unchecked")
+   @EventMethod(portletName="MessageBoxPortlet", processingEvents= {
+         @PortletQName(namespaceURI="http://www.apache.org/portals/pluto/ResourcePortlet",
localPart="Message")
+   })
    @Override
    public void processEvent(EventRequest req, EventResponse resp) 
          throws PortletException ,IOException {
       
+      @SuppressWarnings("unchecked")
       ArrayList<String> msgs = (ArrayList<String>) req.getPortletSession().getAttribute(ATTRIB_MSGS);
       if (msgs == null) {
          msgs = new ArrayList<String>();
@@ -96,7 +108,7 @@ public class MessageBoxPortlet extends GenericPortlet {
       String[] msg;
       int numMsgs = 0;
       try {
-         numMsgs = Integer.parseInt(req.getParameter(PARAM_NUM_MSGS));
+         numMsgs = Integer.parseInt(req.getRenderParameters().getValue(PARAM_NUM_MSGS));
       } catch (Exception e) {}
       
       if (numMsgs == 0) {
@@ -117,7 +129,7 @@ public class MessageBoxPortlet extends GenericPortlet {
          msg[1] = "#D00";
       }
       
-      String clr = req.getParameter(PARAM_COLOR);
+      String clr = req.getRenderParameters().getValue(PARAM_COLOR);
       clr = (clr == null) ? "#FFFFFF" : clr;
       
       StringBuffer sb = new StringBuffer();
@@ -130,7 +142,7 @@ public class MessageBoxPortlet extends GenericPortlet {
       
       logger.fine("Adding message: " + sb.toString());
 
-      resp.setRenderParameter(PARAM_NUM_MSGS, Integer.toString(msgs.size()));
+      resp.getRenderParameters().setValue(PARAM_NUM_MSGS, Integer.toString(msgs.size()));
       req.getPortletSession().setAttribute(ATTRIB_MSGS, msgs);
    };
    

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java
----------------------------------------------------------------------
diff --git a/PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java b/PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java
index eec1af5..52f8d78 100644
--- a/PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java
+++ b/PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java
@@ -107,13 +107,13 @@ public class ResourcePortlet extends GenericPortlet {
    public void serveResource(ResourceRequest req, ResourceResponse resp)
          throws PortletException, IOException {
 
-      String key = req.getParameter(PARAM_IMGNAME);
+      String key = req.getRenderParameters().getValue(PARAM_IMGNAME);
       String imgDir = DEFAULT_IMAGE;
       if ((key != null) && imgMap.containsKey(key)) {
          imgDir = imgMap.get(key);
       }
       
-      String bc = req.getParameter(PARAM_BORDER_COLOR);
+      String bc = req.getResourceParameters().getValue(PARAM_BORDER_COLOR);
       String imgStyle = "";
       if (bc != null) {
          imgStyle = " style='border:1px solid " + bc + ";' ";
@@ -125,7 +125,7 @@ public class ResourcePortlet extends GenericPortlet {
       resp.setContentType("text/html");
       PrintWriter writer = resp.getWriter();
       
-      String clr = req.getParameter(PARAM_COLOR);
+      String clr = req.getRenderParameters().getValue(PARAM_COLOR);
       clr = (clr == null) ? "#FFFFFF" : clr;
       
       // add action button if cacheability allows -

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletHubDemo/src/main/webapp/WEB-INF/portlet.xml
----------------------------------------------------------------------
diff --git a/PortletHubDemo/src/main/webapp/WEB-INF/portlet.xml b/PortletHubDemo/src/main/webapp/WEB-INF/portlet.xml
deleted file mode 100644
index a79f959..0000000
--- a/PortletHubDemo/src/main/webapp/WEB-INF/portlet.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<portlet-app xmlns="http://xmlns.jcp.org/xml/ns/portlet" 
-             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-             xmlns:rp="http://www.apache.org/portals/pluto/ResourcePortlet"
-             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/portlet http://xmlns.jcp.org/xml/ns/portlet/portlet-app_3_0.xsd"

-             version="3.0"
-    		id="ph.resource.portlet">
-
-   <portlet>
-      <portlet-name>MessageBoxPortlet</portlet-name>
-      <display-name>Message Box Portlet</display-name>
-      
-      <portlet-class>basic.portlet.MessageBoxPortlet</portlet-class>
-
-      <supports>
-         <mime-type>text/html</mime-type>
-         <portlet-mode>VIEW</portlet-mode>
-      </supports>
-
-      <supported-locale>en</supported-locale>        
-
-      <portlet-info>
-         <title>PH Message Box Portlet</title>
-      </portlet-info>
-
-      <supported-processing-event>
-         <qname>rp:Message</qname>
-      </supported-processing-event>
-
-      <supported-public-render-parameter>color</supported-public-render-parameter>
-   </portlet>
-
-   <portlet>
-      <portlet-name>PH-ColorSelPortlet</portlet-name>
-      <display-name>PH Color Selection Portlet</display-name>
-      
-      <portlet-class>basic.portlet.ColorSelPortlet</portlet-class>
-
-      <supports>
-         <mime-type>text/html</mime-type>
-         <portlet-mode>VIEW</portlet-mode>
-         <portlet-mode>HELP</portlet-mode>
-      </supports>
-
-      <supported-locale>en</supported-locale>        
-
-      <portlet-info>
-         <title>PH Color Selection Portlet</title>
-      </portlet-info>
-
-      <supported-publishing-event>
-         <qname>rp:Message</qname>
-      </supported-publishing-event>
-      <supported-public-render-parameter>color</supported-public-render-parameter>
-   </portlet>
- </portlet-app>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletV3Demo/src/main/java/basic/portlet/AuthSCPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/AuthSCPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/AuthSCPortlet.java
index 71fe067..744a867 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/AuthSCPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/AuthSCPortlet.java
@@ -40,7 +40,7 @@ import javax.portlet.ResourceResponse;
 
 
 /**
- * A portlet that allows render parameter names & values to be entered and set.
+ * A portlet that causes the resource request status code to be set.
  * 
  * @author Scott Nicklous
  */

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletV3Demo/src/main/java/basic/portlet/ColorSelPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/ColorSelPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/ColorSelPortlet.java
index 5f657bf..acf1a98 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/ColorSelPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/ColorSelPortlet.java
@@ -35,7 +35,7 @@ import javax.xml.namespace.QName;
 
 
 /**
- * A management portlet that displays the current deep link configuration
+ * A demo portlet for color selection.
  */
 public class ColorSelPortlet extends GenericPortlet {
 
@@ -63,11 +63,10 @@ public class ColorSelPortlet extends GenericPortlet {
          throws PortletException, IOException {
    }
 
-   @SuppressWarnings("deprecation")
    public void processAction(ActionRequest req, ActionResponse resp)
          throws PortletException, IOException {
             
-      String[] vals = req.getParameterValues(PARAM_FG_COLOR);
+      String[] vals = req.getActionParameters().getValues(PARAM_FG_COLOR);
       String r = "0";
       String g = "0";
       String b = "0";
@@ -83,17 +82,17 @@ public class ColorSelPortlet extends GenericPortlet {
       // make sure the private parameter are all on the URL for 
       // potential back button support
       if (vals != null) {
-         resp.setRenderParameter(PARAM_FG_COLOR, vals);
+         resp.getRenderParameters().setValues(PARAM_FG_COLOR, vals);
       }
       
-      String val = req.getParameter(PARAM_SUBTYPE);
+      String val = req.getActionParameters().getValue(PARAM_SUBTYPE);
       if (val != null) {
-         resp.setRenderParameter(PARAM_SUBTYPE, val);
+         resp.getRenderParameters().setValue(PARAM_SUBTYPE, val);
       }
       
-      val = req.getParameter(PARAM_MSG_INPUT);
+      val = req.getActionParameters().getValue(PARAM_MSG_INPUT);
       if (val != null) {
-         resp.setRenderParameter(PARAM_MSG_INPUT, val);
+         resp.getRenderParameters().setValue(PARAM_MSG_INPUT, val);
       }
       
       String msg = val + DELIM + clr;

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletV3Demo/src/main/java/basic/portlet/HeaderPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/HeaderPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/HeaderPortlet.java
index 1310b48..98466c0 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/HeaderPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/HeaderPortlet.java
@@ -38,6 +38,8 @@ import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.portlet.ResourceRequest;
 import javax.portlet.ResourceResponse;
+import javax.portlet.annotations.PortletConfiguration;
+import javax.portlet.annotations.LocaleString;
 import javax.servlet.http.Cookie;
 
 import org.w3c.dom.Element;
@@ -45,6 +47,8 @@ import org.w3c.dom.Element;
 /**
  * Portlet for testing the redirect funtionality, including the new getRedirectURL API.
  */
+@PortletConfiguration(portletName="V3HeaderPortlet", 
+                      title=@LocaleString("Header Phase Test Portlet"))
 public class HeaderPortlet extends GenericPortlet {
 
    private static final Logger  LOGGER  = Logger.getLogger(HeaderPortlet.class.getName());

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletV3Demo/src/main/java/basic/portlet/ImageSelPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/ImageSelPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/ImageSelPortlet.java
index 24095f0..3ea0fb7 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/ImageSelPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/ImageSelPortlet.java
@@ -41,7 +41,7 @@ import javax.portlet.ResourceResponse;
 
 
 /**
- * A management portlet that displays the current deep link configuraion
+ * A demo portlet for image selection.
  */
 public class ImageSelPortlet extends GenericPortlet {
 

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletV3Demo/src/main/java/basic/portlet/MessageBoxPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/MessageBoxPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/MessageBoxPortlet.java
index f397886..5a4ddd5 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/MessageBoxPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/MessageBoxPortlet.java
@@ -39,7 +39,7 @@ import javax.portlet.ResourceRequest;
 import javax.portlet.ResourceResponse;
 
 /**
- * A management portlet that displays the current deep link configuraion
+ * A portlet that recieves messages and displays them.
  */
 public class MessageBoxPortlet extends GenericPortlet {
 

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletV3Demo/src/main/java/basic/portlet/PortletConfigPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/PortletConfigPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/PortletConfigPortlet.java
index 4aaf5cd..a1e32e8 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/PortletConfigPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/PortletConfigPortlet.java
@@ -45,7 +45,7 @@ import javax.portlet.WindowState;
 import javax.xml.namespace.QName;
 
 /**
- * A management portlet that displays the current deep link configuraion
+ * A portlet for displaying config data
  */
 public class PortletConfigPortlet extends GenericPortlet {
 

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletV3Demo/src/main/java/basic/portlet/RedirectPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/RedirectPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/RedirectPortlet.java
index a983a6e..1b28843 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/RedirectPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/RedirectPortlet.java
@@ -35,6 +35,7 @@ import javax.portlet.RenderResponse;
 import javax.portlet.RenderURL;
 import javax.portlet.ResourceRequest;
 import javax.portlet.ResourceResponse;
+import javax.portlet.annotations.PortletConfiguration;
 
 import static javax.portlet.MimeResponse.Copy.*;
 import static basic.portlet.Constants.*;
@@ -42,6 +43,7 @@ import static basic.portlet.Constants.*;
 /**
  * Portlet for testing the redirect funtionality, including the new getRedirectURL API.
  */
+@PortletConfiguration(portletName="V3RedirectPortlet")
 public class RedirectPortlet extends GenericPortlet {
 
    private static final Logger  LOGGER  = Logger.getLogger(RedirectPortlet.class.getName());

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java b/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java
index 64829af..e4e2cd7 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java
@@ -42,7 +42,7 @@ import javax.portlet.ResourceResponse;
 
 
 /**
- * A management portlet that displays the current deep link configuraion
+ * A portlet for displaying an image and text using a resource URL.
  */
 public class ResourcePortlet extends GenericPortlet {
 

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletV3Demo/src/main/java/basic/portlet/UrlTestPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/UrlTestPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/UrlTestPortlet.java
index 8e62c51..e3d9901 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/UrlTestPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/UrlTestPortlet.java
@@ -53,7 +53,7 @@ import static javax.portlet.ResourceURL.*;
 
 
 /**
- * A purtlet hub portlet that allows parameter names & values to be entered and set.
+ * A portlet that creates various types of URL.
  * 
  * @author Scott Nicklous
  */

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml b/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
index a7aba59..2cce7d0 100644
--- a/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
@@ -95,41 +95,12 @@
 
    <portlet>
       <portlet-name>V3RedirectPortlet</portlet-name>
-      <display-name>Redirect Test Portlet</display-name>
-      
-      <portlet-class>basic.portlet.RedirectPortlet</portlet-class>
-
-      <supports>
-         <mime-type>text/html</mime-type>
-         <portlet-mode>VIEW</portlet-mode>
-      </supports>
-
-      <supported-locale>en</supported-locale>        
-
       <portlet-info>
          <title>Redirect Test Portlet</title>
       </portlet-info>
    </portlet>
 
    <portlet>
-      <portlet-name>V3HeaderPortlet</portlet-name>
-      <display-name>Header Phase Test Portlet</display-name>
-      
-      <portlet-class>basic.portlet.HeaderPortlet</portlet-class>
-
-      <supports>
-         <mime-type>text/html</mime-type>
-         <portlet-mode>VIEW</portlet-mode>
-      </supports>
-
-      <supported-locale>en</supported-locale>        
-
-      <portlet-info>
-         <title>Header Phase Test Portlet</title>
-      </portlet-info>
-   </portlet>
-
-   <portlet>
       <portlet-name>PortletConfigPortlet1</portlet-name>
       <display-name>Portlet Config Portlet #1</display-name>
       

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/pluto-container-api/src/main/java/org/apache/pluto/container/HeaderData.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/HeaderData.java
b/pluto-container-api/src/main/java/org/apache/pluto/container/HeaderData.java
index 86f08cc..36ea13e 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/HeaderData.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/HeaderData.java
@@ -64,6 +64,7 @@ public class HeaderData {
    /** Logger. */
    private static final Logger       LOG                = LoggerFactory.getLogger(HeaderData.class);
    private static final boolean      isDebug            = LOG.isDebugEnabled();
+   private static final boolean      isTrace            = LOG.isTraceEnabled();
 
    // for document processing
    private DocumentBuilder           docBuilder         = null;
@@ -345,11 +346,11 @@ public class HeaderData {
          }
       }
 
-      if (isDebug) {
+      if (isTrace) {
          StringBuilder sb = new StringBuilder();
          sb.append("returning tags: ");
          sb.append((tags.length() > 0) ? "\n" + tags : "");
-         LOG.debug(sb.toString());
+         LOG.trace(sb.toString());
       }
 
       return tags;

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
index fbb9226..ee05621 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
@@ -374,7 +374,7 @@ public abstract class PortletRequestImpl implements PortletRequest
     {
         if (LOG.isDebugEnabled())
         {
-            LOG.debug("Retreiving portlet session (create=" + create + ")");
+            LOG.debug("Retrieving portlet session (create=" + create + ")");
         }
         //
         // It is critical that we don't retrieve the portlet session until the

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
index 5c42c06..92c2803 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
@@ -8,7 +8,9 @@ import static org.apache.pluto.container.bean.processor.MethodDescription.METH_I
 import static org.apache.pluto.container.bean.processor.MethodDescription.METH_REN;
 import static org.apache.pluto.container.bean.processor.MethodDescription.METH_RES;
 
+import java.io.IOException;
 import java.io.InputStream;
+import java.io.StringReader;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -47,6 +49,9 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
 
 public abstract class ConfigurationProcessor {
    
@@ -245,7 +250,15 @@ public abstract class ConfigurationProcessor {
 
       // set up document
       DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
+      fact.setValidating(false);
+      
       final DocumentBuilder builder = fact.newDocumentBuilder();
+      builder.setEntityResolver(new EntityResolver() {
+         public InputSource resolveEntity(String arg0, String arg1) throws SAXException,
IOException {
+            return new InputSource(new StringReader(""));
+         }
+      });
+
       final Document document = builder.parse(in);
       final Element root = document.getDocumentElement();
 
@@ -261,13 +274,16 @@ public abstract class ConfigurationProcessor {
       NodeList nodes = (NodeList) GET_LIST.evaluate(root,
             XPathConstants.NODESET);
 
+      int mappings = 0;
       for (int jj = 0; jj < nodes.getLength(); jj++) {
          Node node = nodes.item(jj);
          String locstr = (String) GET_LOC.evaluate(node, XPathConstants.STRING);
          String encstr = (String) GET_ENC.evaluate(node, XPathConstants.STRING);
          Locale locale = deriveLocale(locstr);
          pad.addLocaleEncodingMapping(locale, encstr);
+         mappings++;
       }
+      LOG.debug("done parsing web DD, # mappings: " + mappings);
    }
    
    /**

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR362ConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR362ConfigurationProcessor.java
b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR362ConfigurationProcessor.java
index 9b97417..321b706 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR362ConfigurationProcessor.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR362ConfigurationProcessor.java
@@ -733,8 +733,13 @@ public class JSR362ConfigurationProcessor extends JSR286ConfigurationProcessor
{
                throw new IllegalArgumentException(warning);
             }
             pd = new PortletDefinitionImpl(pn, pad);
+            pd.setPortletClass(portlet.getPortletClass());
+         } else {
+            if ((clsName != null) && (clsName.length() > 0)) {
+               // The portlet class set in the portlet DD overrides the annotated class.
+               pd.setPortletClass(portlet.getPortletClass());
+            }
          }
-         pd.setPortletClass(portlet.getPortletClass());
 
          if (portlet.getResourceBundle() != null) {
             pd.setResourceBundle(portlet.getResourceBundle().getValue());

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/43d2208e/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortletParameterFactory.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortletParameterFactory.java
b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortletParameterFactory.java
index d4deaef..4776d13 100644
--- a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortletParameterFactory.java
+++ b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortletParameterFactory.java
@@ -43,7 +43,6 @@ import org.slf4j.LoggerFactory;
  */
 public class PortletParameterFactory {
    private static final Logger LOGGER = LoggerFactory.getLogger(PortletParameterFactory.class);
-   private final static boolean isDebug = LOGGER.isDebugEnabled();
    private final static boolean isTrace = LOGGER.isTraceEnabled();
    
    PortalURL url;
@@ -114,7 +113,7 @@ public class PortletParameterFactory {
          }
       }
 
-      if (isDebug) {
+      if (isTrace) {
          StringBuffer sb = new StringBuffer();
          sb.append("Dump private Parameter Map:");
          for (String k : parameters.keySet()) {
@@ -125,7 +124,7 @@ public class PortletParameterFactory {
                sep = ", ";
             }
          }
-         LOGGER.debug(sb.toString());
+         LOGGER.trace(sb.toString());
       }
       return parameters;
    }


Mime
View raw message