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 ms...@apache.org on 2014/11/25 13:50:15 UTC

[10/19] portals-pluto git commit: Basic ajax action path working

Basic ajax action path working


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

Branch: refs/heads/PortletHub
Commit: a4a6812b4bb425139b734041c8242f4a533ca882
Parents: 80b632d
Author: Scott Nicklous <ms...@apache.org>
Authored: Sun Nov 23 14:54:52 2014 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Sun Nov 23 14:54:52 2014 +0100

----------------------------------------------------------------------
 PortletHubDemo/pom.xml                          | 179 ++++++++++---------
 .../java/basic/portlet/MessageBoxPortlet.java   |  27 +--
 .../src/main/resources/logging.properties       |  37 ++++
 3 files changed, 142 insertions(+), 101 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a4a6812b/PortletHubDemo/pom.xml
----------------------------------------------------------------------
diff --git a/PortletHubDemo/pom.xml b/PortletHubDemo/pom.xml
index 9f5efb4..a8a2d4e 100644
--- a/PortletHubDemo/pom.xml
+++ b/PortletHubDemo/pom.xml
@@ -1,82 +1,82 @@
 <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">
-	<modelVersion>4.0.0</modelVersion>
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.portals.pluto</groupId>
         <artifactId>pluto</artifactId>
         <version>2.1.0-SNAPSHOT</version>
     </parent>
 
-	<artifactId>PortletHubDemo</artifactId>
-	<packaging>war</packaging>
+   <artifactId>PortletHubDemo</artifactId>
+   <packaging>war</packaging>
 
-	<dependencies>
-		<dependency>
-			<groupId>javax.portlet</groupId>
-			<artifactId>portlet-api</artifactId>
-			<version>2.0</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>servlet-api</artifactId>
-			<scope>provided</scope>
-		</dependency>
+   <dependencies>
+      <dependency>
+         <groupId>javax.portlet</groupId>
+         <artifactId>portlet-api</artifactId>
+         <version>2.0</version>
+         <scope>provided</scope>
+      </dependency>
+      <dependency>
+         <groupId>javax.servlet</groupId>
+         <artifactId>servlet-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
 
-		<!-- for eclipse JSP tooling purposes -->
-		<dependency>
-			<groupId>javax.servlet.jsp</groupId>
-			<artifactId>jsp-api</artifactId>
-			<version>2.1</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>jstl</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.portals.pluto</groupId>
-			<artifactId>pluto-taglib</artifactId>
-			<version>2.1.0-M3</version>
-			<scope>provided</scope>
-		</dependency>
-	</dependencies>
+      <!-- for eclipse JSP tooling purposes -->
+      <dependency>
+         <groupId>javax.servlet.jsp</groupId>
+         <artifactId>jsp-api</artifactId>
+         <version>2.1</version>
+         <scope>provided</scope>
+      </dependency>
+      <dependency>
+         <groupId>javax.servlet</groupId>
+         <artifactId>jstl</artifactId>
+         <scope>provided</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.portals.pluto</groupId>
+         <artifactId>pluto-taglib</artifactId>
+         <version>2.1.0-M3</version>
+         <scope>provided</scope>
+      </dependency>
+   </dependencies>
 
-	<build>
-		<finalName>PortletHubDemo</finalName>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<configuration>
-					<source>1.6</source>
-					<target>1.6</target>
-				</configuration>
-			</plugin>
-			<plugin>
-				<artifactId>maven-war-plugin</artifactId>
-				<configuration>
-					<archiveClasses>true</archiveClasses>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
+   <build>
+      <finalName>PortletHubDemo</finalName>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-compiler-plugin</artifactId>
+            <configuration>
+               <source>1.6</source>
+               <target>1.6</target>
+            </configuration>
+         </plugin>
+         <plugin>
+            <artifactId>maven-war-plugin</artifactId>
+            <configuration>
+               <archiveClasses>false</archiveClasses>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
 
-	<profiles>
-		<profile>
-			<id>pluto</id>
+   <profiles>
+      <profile>
+         <id>pluto</id>
          <activation>
            <property>
              <name>!alwaysActivate</name>
            </property>
          </activation>
     
-			<dependencies>
+         <dependencies>
                 <dependency>
                     <groupId>javax.servlet</groupId>
                     <artifactId>jstl</artifactId>
-                    <scope>compile</scope>
+                    <scope>provided</scope>
                     <exclusions>
                         <exclusion>
                             <groupId>javax.servlet</groupId>
@@ -87,40 +87,41 @@
                 <dependency>
                     <groupId>taglibs</groupId>
                     <artifactId>standard</artifactId>
-                    <scope>compile</scope>
+                    <scope>provided</scope>
                 </dependency>
-			</dependencies>
-			
-			<build>
-				<plugins>
+         </dependencies>
+         
+         <build>
+            <plugins>
                <plugin>
                  <artifactId>maven-war-plugin</artifactId>
                  <configuration>
+                   <archiveClasses>false</archiveClasses>
                    <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
                  </configuration>
                </plugin>
                <!-- bind 'pluto:assemble' goal to 'generate-resources' lifecycle -->
-					<plugin>
-						<groupId>org.apache.portals.pluto</groupId>
-						<artifactId>maven-pluto-plugin</artifactId>
-						<version>${project.version}</version>
-						<dependencies>
-							<dependency>
-								<groupId>org.apache.portals.pluto</groupId>
-								<artifactId>pluto-util</artifactId>
-								<version>${project.version}</version>
-								<scope>runtime</scope>
-							</dependency>
-						</dependencies>
-						<executions>
-							<execution>
-								<phase>generate-resources</phase>
-								<goals>
-									<goal>assemble</goal>
-								</goals>
-							</execution>
-						</executions>
-					</plugin>
+               <plugin>
+                  <groupId>org.apache.portals.pluto</groupId>
+                  <artifactId>maven-pluto-plugin</artifactId>
+                  <version>${project.version}</version>
+                  <dependencies>
+                     <dependency>
+                        <groupId>org.apache.portals.pluto</groupId>
+                        <artifactId>pluto-util</artifactId>
+                        <version>${project.version}</version>
+                        <scope>runtime</scope>
+                     </dependency>
+                  </dependencies>
+                  <executions>
+                     <execution>
+                        <phase>generate-resources</phase>
+                        <goals>
+                           <goal>assemble</goal>
+                        </goals>
+                     </execution>
+                  </executions>
+               </plugin>
                <!-- workaround for war processing of m-r-r-plugin causing the generated NOTICE and LICENSE file to be put under WEB-INF/classes/META-INF -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
@@ -137,9 +138,9 @@
                        </execution>
                    </executions>
                </plugin>
-				</plugins>
-			</build>
-		</profile>
-	</profiles>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
 
 </project>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a4a6812b/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 a0976e8..8f8e648 100644
--- a/PortletHubDemo/src/main/java/basic/portlet/MessageBoxPortlet.java
+++ b/PortletHubDemo/src/main/java/basic/portlet/MessageBoxPortlet.java
@@ -123,19 +123,18 @@ public class MessageBoxPortlet extends GenericPortlet {
       // the only action for this portlet is to reset the stored messages
       
       String actionName = req.getParameter("action");
-      if ("clear".equals(actionName)) {
-         
-         ArrayList<String> msgs = new ArrayList<String>();
-         StringBuffer sb = new StringBuffer();
-         sb.append("<p style='margin:0px 5px 0px 5px; color:#00D;"
-               + " background-color:#AAF;'>");
-         sb.append("Reset - No messages.");
-         sb.append("</p>");
-         msgs.add(sb.toString());
+      logger.fine("MBP: Resetting messages. numMsgs = 0,  actionName = " + actionName);
 
-         resp.setRenderParameter(PARAM_NUM_MSGS, "0");
-         req.getPortletSession().setAttribute(ATTRIB_MSGS, msgs);
-      }
+      ArrayList<String> msgs = new ArrayList<String>();
+      StringBuffer sb = new StringBuffer();
+      sb.append("<p style='margin:2px 5px 2px 5px; color:#00D;"
+            + " background-color:#AAF;'>");
+      sb.append("Reset - No messages.");
+      sb.append("</p>");
+      msgs.add(sb.toString());
+
+      resp.setRenderParameter(PARAM_NUM_MSGS, "0");
+      req.getPortletSession().setAttribute(ATTRIB_MSGS, msgs);
    }
    
    @SuppressWarnings("unchecked")
@@ -157,6 +156,8 @@ public class MessageBoxPortlet extends GenericPortlet {
       if (numMsgs == 0) {
          msgs.clear();
       }
+      
+      logger.fine("MBP: Processing message event. Current # messages = " + msgs.size());
 
       try {
          // Both pieces of info are transported in a delimted string rather than 
@@ -180,6 +181,8 @@ public class MessageBoxPortlet extends GenericPortlet {
       sb.append("</p>");
       
       msgs.add(sb.toString());
+      
+      logger.fine("Adding message: " + sb.toString());
 
       resp.setRenderParameter(PARAM_NUM_MSGS, Integer.toString(msgs.size()));
       req.getPortletSession().setAttribute(ATTRIB_MSGS, msgs);

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a4a6812b/PortletHubDemo/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/PortletHubDemo/src/main/resources/logging.properties b/PortletHubDemo/src/main/resources/logging.properties
new file mode 100644
index 0000000..d40d7c5
--- /dev/null
+++ b/PortletHubDemo/src/main/resources/logging.properties
@@ -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.
+
+handlers = org.apache.juli.FileHandler
+
+############################################################
+#
+# JDK 1.4+ logging handler specific properties for Pluto portal
+# using Tomcat's custom implementation of LogManager.
+# Logging level can be set to any one of:
+# SEVERE, WARN, INFO, CONFIG, FINE, FINEST or ALL. 
+# See the Tomcat documentation for more details.
+# 
+############################################################
+
+org.apache.juli.FileHandler.level = FINE
+org.apache.juli.FileHandler.directory = ${catalina.base}/logs
+#Log file will be named pluto.<yyyy-mm-dd>.log
+org.apache.juli.FileHandler.prefix = PortletHubDemo.
+
+org.apache.pluto.level=FINEST
+basic.portlet.level=FINEST