portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [50/50] [abbrv] portals-pluto git commit: Added another bean in async portlet demo to mark when the request has been completed so that the async runner can refrain fro doing work and causing exceptions after a timeout occurs. Toned down the logging somew
Date Thu, 14 Apr 2016 12:29:30 GMT
Added another bean in async portlet demo to mark when the request has been
completed so that the async runner can refrain fro doing work and causing
exceptions after a timeout occurs. Toned down the logging somewhat by
setting some log statements from log level debug to log level trace.


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

Branch: refs/heads/master
Commit: 713a70959e4969e80ef28a81afaf08970f93a035
Parents: 0e71c8a
Author: Scott Nicklous <msnicklous@apache.org>
Authored: Thu Apr 14 13:48:28 2016 +0200
Committer: Scott Nicklous <msnicklous@apache.org>
Committed: Thu Apr 14 13:48:28 2016 +0200

----------------------------------------------------------------------
 .../org/apache/portals/samples/APComplete.java  |  51 ++++++
 .../org/apache/portals/samples/APListener.java  |  10 +-
 .../samples/AsyncHackIncludedServlet.java       |  49 ------
 .../portals/samples/AsyncHackPortlet.java       | 166 -------------------
 .../apache/portals/samples/AsyncPortlet.java    |   6 +
 .../src/main/webapp/WEB-INF/jsp/asyncOutput.jsp |  16 +-
 .../bean/processor/PortletArtifactProducer.java |   5 +-
 .../processor/PortletSessionScopedBeanMap.java  |   4 +-
 .../container/impl/PortletPreferencesImpl.java  |  20 +--
 .../container/PortletAsyncContextImpl.java      |  20 +--
 .../container/PortletAsyncContextListener.java  |   5 +-
 .../container/PortletAsyncContextualRunner.java |  10 +-
 .../container/PortletRequestContextImpl.java    |   5 +-
 .../PortletResourceResponseContextImpl.java     |  10 +-
 .../PortletStateAwareResponseContextImpl.java   |   6 +-
 .../pluto/driver/PortalDriverServlet.java       |   4 +-
 16 files changed, 115 insertions(+), 272 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/APComplete.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/APComplete.java
b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/APComplete.java
new file mode 100644
index 0000000..fa66398
--- /dev/null
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/APComplete.java
@@ -0,0 +1,51 @@
+/*  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 org.apache.portals.samples;
+
+import javax.portlet.annotations.PortletRequestScoped;
+
+/**
+ * Requestscoped bean to mark if timout occurs.
+ * 
+ * @author Scott Nicklous
+ */
+@PortletRequestScoped
+public class APComplete {
+
+   private boolean complete = false;
+   
+   public APComplete() {
+   }
+
+   /**
+    * @return the complete
+    */
+   public boolean isComplete() {
+      return complete;
+   }
+
+   /**
+    * @param complete the complete to set
+    */
+   public void setComplete(boolean complete) {
+      this.complete = complete;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/APListener.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/APListener.java
b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/APListener.java
index 11847a9..2174846 100644
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/APListener.java
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/APListener.java
@@ -43,10 +43,9 @@ public class APListener implements PortletAsyncListener {
 
    private long                           start  = System.currentTimeMillis();
 
-   @Inject
-   private PortletRequestRandomNumberBean reqnum;
-   @Inject
-   private AsyncDialogBean                adb;
+   @Inject private PortletRequestRandomNumberBean reqnum;
+   @Inject private AsyncDialogBean                adb;
+   @Inject private APComplete                     completeBean;
 
    /*
     * (non-Javadoc)
@@ -59,8 +58,9 @@ public class APListener implements PortletAsyncListener {
 
       StringBuilder txt = new StringBuilder(128);
       txt.append("Listener: Completed. Execution time: ").append(delta).append(" milliseconds.");
-
       LOGGER.fine(txt.toString());
+      
+      completeBean.setComplete(true);
    }
 
    /*

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncHackIncludedServlet.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncHackIncludedServlet.java
b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncHackIncludedServlet.java
deleted file mode 100644
index 9c752c2..0000000
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncHackIncludedServlet.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*  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 org.apache.portals.samples;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.ServletException;
-import javax.servlet.annotation.WebServlet;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author Scott Nicklous
- *
- */
-@WebServlet(urlPatterns="/ais")
-public class AsyncHackIncludedServlet extends HttpServlet {
-   private static final long serialVersionUID = 1L;
-
-   public AsyncHackIncludedServlet() {
-   }
-
-   @Override
-   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
-      
-      PrintWriter writer = resp.getWriter();
-      writer.append("<p>Hello from dispatched servlet!</p>");
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncHackPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncHackPortlet.java
b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncHackPortlet.java
deleted file mode 100644
index 80eba8c..0000000
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncHackPortlet.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*  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 org.apache.portals.samples;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.logging.Logger;
-
-import javax.inject.Inject;
-import javax.portlet.PortletException;
-import javax.portlet.ResourceRequest;
-import javax.portlet.ResourceResponse;
-import javax.portlet.ResourceURL;
-import javax.portlet.annotations.Namespace;
-import javax.portlet.annotations.RenderMethod;
-import javax.portlet.annotations.ServeResourceMethod;
-import javax.portlet.annotations.URLFactory;
-import javax.servlet.AsyncContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Resource portlet for viewing path information.
- */
-public class AsyncHackPortlet {
-   private static final Logger LOGGER = Logger.getLogger(AsyncHackPortlet.class.getName());
-
-   public static final String RESPARAM_DISPLAY = "display";
-
-   private AsyncContext context;
-   private static final String jsp = "/WEB-INF/jsp/pathinfo.jsp";
-//   private static final String jsp = "/ais";
-
-   
-   private class AsyncHackRunnable implements Runnable {
-
-      @Override
-      public void run() {
-         try {
-            Thread.sleep(1000);
-         } catch (InterruptedException e) {}
-         LOGGER.fine("Slept, now dispatching.");
-         HttpServletRequest hreq = (HttpServletRequest) context.getRequest();
-         context.dispatch(hreq.getServletContext(), jsp);
-//       context.dispatch(jsp);
-      }
-      
-   }
-
-   // Injecting the namespace & URLFactory
-   @Inject
-   @Namespace
-   private String             pid;
-   @Inject
-   private URLFactory         uf;
-
-   @RenderMethod(portletNames = { "AsyncHackPortlet" }, ordinal = 100)
-   public String getImageInclude() {
-      LOGGER.fine("Rendering async hack portlet");
-
-      StringBuilder txt = new StringBuilder(128);
-      txt.append("<h3>Async Hack Portlet</h3>");
-
-      ResourceURL resurl = uf.createResourceURL();
-
-      txt.append("<div class='infobox' id='").append(pid).append("-putResourceHere'></div>\n");
-      txt.append("<script>\n");
-      txt.append("(function () {\n");
-      txt.append("   var xhr = new XMLHttpRequest();\n");
-      txt.append("   xhr.onreadystatechange=function() {\n");
-      txt.append("      if (xhr.readyState==4 && xhr.status==200) {\n");
-      txt.append("         document.getElementById('").append(pid)
-            .append("-putResourceHere').innerHTML=xhr.responseText;\n");
-      txt.append("      }\n");
-      txt.append("   };\n");
-      txt.append("   xhr.open(\"GET\",\"").append(resurl.toString()).append("\",true);\n");
-      txt.append("   xhr.send();\n");
-      txt.append("})();\n");
-      txt.append("</script>\n");
-
-      return txt.toString();
-   }
-
-   /**
-    * This resource method generates some output directly, then includes output from a JSP
as specified in the
-    * annotation.
-    * 
-    * @return The string for inclusion in the output.
-    * @throws IOException
-    * @throws PortletException 
-    */
-   @ServeResourceMethod(portletNames = { "AsyncHackPortlet" }, asyncSupported = true)
-   public void getPathInfo(ResourceRequest req, ResourceResponse resp) throws IOException,
PortletException {
-      LOGGER.fine("Doing async hack resource request");
-
-      @SuppressWarnings("unchecked")
-      ArrayList<String> pathInfo = (ArrayList<String>) req.getAttribute("pathInfo");
-      if (pathInfo == null) {
-         pathInfo = new ArrayList<String>();
-      }
-
-      HttpServletRequest hreq = (HttpServletRequest) req.getAttribute("javax.portlet.debug.ServletRequest");
-      HttpServletResponse hresp = (HttpServletResponse) req.getAttribute("javax.portlet.debug.ServletResponse");
-      PathDisplay pd;
-      if (hreq != null) {
-         pd = new PathDisplay(hreq, "Resource Method (Servlet)");
-         hreq.setAttribute("pathInfo", pathInfo);
-      } else {
-         pd = new PathDisplay(req, "Resource Method (Resource)");
-         req.setAttribute("pathInfo", pathInfo);
-      }
-      pathInfo.add(pd.toMarkup());
-
-      PrintWriter writer = resp.getWriter();
-      writer.append("<h5>Async Hack Resource Request</h5>");
-      
-      StringBuilder txt = new StringBuilder(128);
-      txt.append("Trying to start async. Servlet context: ").append(hreq.getServletContext().getContextPath());
-
-//      RequestDispatcher rd = null;
-//      rd = hreq.getRequestDispatcher(jsp);
-//      txt.append("Request dispatcher: ").append(rd);
-      LOGGER.fine(txt.toString());
-      txt.setLength(0);
-      
-      if (hreq != null && hresp != null) {
-         try {
-            
-            context = hreq.startAsync(hreq, hresp);
-            context.setTimeout(4000);
-            
-            txt.append("Async context: ").append((context == null) ? "null." : "not null.");
-            txt.append(" Now starting thread ... ");
-
-            AsyncHackRunnable ahr = new AsyncHackRunnable();
-            context.start(ahr);
-            
-            txt.append(" done. ");
-         } catch (Exception e) {
-            txt.append(" ... didn't work. Exception: ").append(e.toString());
-         }
-         
-         LOGGER.fine(txt.toString());
-         txt.setLength(0);
-      }
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortlet.java
b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortlet.java
index 2ae2fae..b0bac5d 100644
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortlet.java
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortlet.java
@@ -60,6 +60,7 @@ public class AsyncPortlet {
       private OutputType   type;
       
       @Inject private PortletRequestRandomNumberBean reqnum;
+      @Inject private APComplete complete;
 
       public void init(PortletAsyncContext ctx, int delay, OutputType type) {
          this.ctx = ctx;
@@ -77,6 +78,11 @@ public class AsyncPortlet {
       public void run() {
          try {
             Thread.sleep(delay);
+            
+            if (complete.isComplete()) {
+               LOGGER.warning("Request completed before work was finished. processing will
be aborted.");
+               return;
+            }
 
             ResourceRequest req = ctx.getResourceRequest();
             ResourceResponse resp = ctx.getResourceResponse();

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/asyncOutput.jsp
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/asyncOutput.jsp b/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/asyncOutput.jsp
index 2566242..4bb077b 100644
--- a/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/asyncOutput.jsp
+++ b/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/asyncOutput.jsp
@@ -6,9 +6,19 @@
 
 <portlet:defineObjects />
 
-<h5><%=request.getAttribute("title") %> for portlet: ${portletConfig.getPortletName()}</h5>
-<p>Dispatch type: <%=request.getDispatcherType() %>
-<c:catch var ="catchException">
+<h5><%=request.getAttribute("title") %> for portlet: 
+<c:catch var ="exp">
+   <!-- try to get portlet name using named bean from portlet artifact producer. -->
+   <!-- Works in the case of PortletRequestDispatcher include / forward. -->
+   ${portletConfig.getPortletName()} (using named bean)
+</c:catch>
+<c:if test = "${exp != null}">
+   <!-- Contextual context not available during async dispatch -->
+   <%=portletConfig.getPortletName() %> (using JSP expression)
+</c:if>
+</h5>
+<p>Dispatch type: <%=resourceRequest.getDispatcherType() %>
+<c:catch var ="exp">
    <span style='margin-left: 2em;'>Request #: ${reqnum.getRandomNumber()}</span>
 </c:catch>
 </p>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletArtifactProducer.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletArtifactProducer.java
b/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletArtifactProducer.java
index 8830f8e..8e8c8b4 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletArtifactProducer.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletArtifactProducer.java
@@ -66,7 +66,6 @@ import org.slf4j.LoggerFactory;
  */
 public class PortletArtifactProducer {
    private static final Logger LOG = LoggerFactory.getLogger(PortletArtifactProducer.class);
-   private static final boolean isDebug = LOG.isDebugEnabled();
    private static final boolean isTrace = LOG.isTraceEnabled();
    
    
@@ -570,14 +569,14 @@ public class PortletArtifactProducer {
     * @param pval
     */
    private static void trace(String anno, String sig, String pname, String pval) {
-      if (isDebug) {
+      if (isTrace) {
          StringBuilder txt = new StringBuilder(128);
          txt.append("Parameter injection trace.");
          txt.append(" Annotation: ").append(anno);
          txt.append(" Signature: ").append(sig);
          txt.append(" Param name: ").append(pname);
          txt.append(" Param value(s): ").append(pval);
-         LOG.debug(txt.toString());
+         LOG.trace(txt.toString());
       }
    }
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletSessionScopedBeanMap.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletSessionScopedBeanMap.java
b/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletSessionScopedBeanMap.java
index b4c3fb8..5f67f59 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletSessionScopedBeanMap.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletSessionScopedBeanMap.java
@@ -186,8 +186,8 @@ public class PortletSessionScopedBeanMap implements HttpSessionBindingListener,
     */
    @Override
    public void valueUnbound(HttpSessionBindingEvent evt) {
-      if (isDebug) {
-         LOG.debug("PortletSessionBeanHolder unbound from session. ID=" + evt.getName());
+      if (isTrace) {
+         LOG.trace("PortletSessionBeanHolder unbound from session. ID=" + evt.getName());
       }
       
       synchronized(beans) {

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletPreferencesImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletPreferencesImpl.java
b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletPreferencesImpl.java
index 65cf0c9..1865fc3 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletPreferencesImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletPreferencesImpl.java
@@ -93,8 +93,8 @@ public class PortletPreferencesImpl implements PortletPreferences {
         // Get the portlet preferences service from container.
         preferencesService = container.getContainerServices()
         		.getPortletPreferencesService();
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Using PortletPreferencesService: "
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("Using PortletPreferencesService: "
             		+ preferencesService.getClass().getName());
         }
         
@@ -106,8 +106,8 @@ public class PortletPreferencesImpl implements PortletPreferences {
                     preferences.put(p.getName(), p.clone());
                 }
             }
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Loaded default preferences: " + toString());
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Loaded default preferences: " + toString());
             }
             
             // Merge stored portlet preferences into preferences map.
@@ -120,8 +120,8 @@ public class PortletPreferencesImpl implements PortletPreferences {
             LOG.error("Error retrieving preferences.", ex);
             //TODO: Rethrow up the stack????
         }
-        if (LOG.isDebugEnabled()) {
-        	LOG.debug("Merged stored preferences: " + toString());
+        if (LOG.isTraceEnabled()) {
+        	LOG.trace("Merged stored preferences: " + toString());
         }
     }
     
@@ -221,15 +221,15 @@ public class PortletPreferencesImpl implements PortletPreferences {
         // Try to reset preference to the default values.
         PortletPreference p = defaultPreferences.get(key);
         if (p != null) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Resetting preference for key: " + key);
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Resetting preference for key: " + key);
             }
             preferences.put(key,p.clone());
         }       
         // Remove preference if default values are not defined (PLT.14.1).
         else {
-        	if (LOG.isDebugEnabled()) {
-        		LOG.debug("Resetting preference to null for key: " + key);
+        	if (LOG.isTraceEnabled()) {
+        		LOG.trace("Resetting preference to null for key: " + key);
         	}
         	preferences.remove(key);
         }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextImpl.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextImpl.java
index 1ab34e4..5925678 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextImpl.java
@@ -53,8 +53,6 @@ import org.slf4j.LoggerFactory;
  */
 public class PortletAsyncContextImpl implements PortletAsyncManager, AsyncContext, PortletAsyncContext
{
    private static final Logger LOG = LoggerFactory.getLogger(PortletAsyncContextImpl.class);
-   private static final boolean isDebug = LOG.isDebugEnabled();
-   @SuppressWarnings("unused")
    private static final boolean isTrace = LOG.isTraceEnabled();
    
    private AsyncContext                   actx;
@@ -121,13 +119,13 @@ public class PortletAsyncContextImpl implements PortletAsyncManager,
AsyncContex
          PortletArtifactProducer.setPrecursors(resreq, prctx.getResponse(), prctx.getPortletConfig());
       }
       
-      if (isDebug) {
+      if (isTrace) {
          StringBuilder txt = new StringBuilder();
          txt.append("Registered context.");
          txt.append(" complete: ").append(complete);
          txt.append(", isListener: ").append(isListener);
          txt.append(", doRegister: ").append(doDeregister);
-         LOG.debug(txt.toString());
+         LOG.trace(txt.toString());
       }
    }
 
@@ -144,13 +142,13 @@ public class PortletAsyncContextImpl implements PortletAsyncManager,
AsyncContex
          PortletArtifactProducer.remove();
       }
       
-      if (isDebug) {
+      if (isTrace) {
          StringBuilder txt = new StringBuilder();
          txt.append("Deregistered context.");
          txt.append(" complete: ").append(complete);
          txt.append(", isListener: ").append(isListener);
          txt.append(", doRegister: ").append(doDeregister);
-         LOG.debug(txt.toString());
+         LOG.trace(txt.toString());
       }
    }
 
@@ -166,10 +164,10 @@ public class PortletAsyncContextImpl implements PortletAsyncManager,
AsyncContex
       if (pendingRunner != null) {
          PortletAsyncContextualRunner runner = new PortletAsyncContextualRunner();
 
-         if (isDebug) {
+         if (isTrace) {
             StringBuilder txt = new StringBuilder();
             txt.append("Executing Portlet Runnable: " + pendingRunner.getClass().getCanonicalName());
-            LOG.debug(txt.toString());
+            LOG.trace(txt.toString());
          }
 
          runner.init(this, pendingRunner);
@@ -364,12 +362,12 @@ public class PortletAsyncContextImpl implements PortletAsyncManager,
AsyncContex
    }
    
    private Object createInstance(Class<?> cls) {
-      if (isDebug) {
+      if (isTrace) {
          StringBuilder txt = new StringBuilder();
          txt.append("Creating listener.");
          txt.append(" Bean manager: ").append(beanmgr);
          txt.append(", listener class: ").append(cls.getCanonicalName());
-         LOG.debug(txt.toString());
+         LOG.trace(txt.toString());
       }
       
       Object lis = null;
@@ -384,7 +382,7 @@ public class PortletAsyncContextImpl implements PortletAsyncManager, AsyncContex
       } 
       
       if (lis == null) {
-         LOG.debug("Instantiating class directly: " + cls.getCanonicalName());
+         LOG.trace("Instantiating class directly: " + cls.getCanonicalName());
          try {
             lis = cls.newInstance();
          } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextListener.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextListener.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextListener.java
index 4e85c36..f63ddd7 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextListener.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextListener.java
@@ -49,7 +49,6 @@ public class PortletAsyncContextListener implements AsyncListener {
    /** Logger. */
    private static final Logger LOG = LoggerFactory.getLogger(PortletAsyncContextListener.class);
    private static final boolean isDebug = LOG.isDebugEnabled();
-   @SuppressWarnings("unused")
    private static final boolean isTrace = LOG.isTraceEnabled();
    
    
@@ -104,7 +103,7 @@ public class PortletAsyncContextListener implements AsyncListener {
    }
    
    private void trace (String meth) {
-      if (isDebug) {
+      if (isTrace) {
          StringBuilder txt = new StringBuilder();
          txt.append("Firing ").append(meth).append(" event for ");
          txt.append(listeners.size()).append(" listeners.");
@@ -115,7 +114,7 @@ public class PortletAsyncContextListener implements AsyncListener {
          }
          txt.append(", # AsyncListeners: ").append(hcnt);
          txt.append(", # PortletAsyncListeners: ").append(pcnt);
-         LOG.debug(txt.toString());
+         LOG.trace(txt.toString());
       }
    }
 

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextualRunner.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextualRunner.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextualRunner.java
index c44c27f..efe1438 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextualRunner.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextualRunner.java
@@ -32,8 +32,6 @@ import org.slf4j.LoggerFactory;
  */
 public class PortletAsyncContextualRunner implements Runnable {
    private static final Logger LOG = LoggerFactory.getLogger(PortletAsyncContextualRunner.class);
-   private static final boolean isDebug = LOG.isDebugEnabled();
-   @SuppressWarnings("unused")
    private static final boolean isTrace = LOG.isTraceEnabled();
    
 
@@ -50,8 +48,8 @@ public class PortletAsyncContextualRunner implements Runnable {
 
    @Override
    public void run() {
-      if (isDebug) {
-         LOG.debug("Initializing contextual environment and launching runner in thread: "
+ Thread.currentThread().getId());
+      if (isTrace) {
+         LOG.trace("Initializing contextual environment and launching runner in thread: "
+ Thread.currentThread().getId());
       }
 
       try {
@@ -61,8 +59,8 @@ public class PortletAsyncContextualRunner implements Runnable {
          StringBuilder txt = new StringBuilder(128);
          txt.append("Exception running thread: ").append(e.toString());
       } finally {
-         if (isDebug) {
-            LOG.debug("Shutting down contextual environment for thread: " + Thread.currentThread().getId());
+         if (isTrace) {
+            LOG.trace("Shutting down contextual environment for thread: " + Thread.currentThread().getId());
          }
          pactx.deregisterContext(false);
       }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletRequestContextImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletRequestContextImpl.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletRequestContextImpl.java
index a059fef..b092d51 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletRequestContextImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletRequestContextImpl.java
@@ -56,7 +56,6 @@ import org.slf4j.LoggerFactory;
  */
 public class PortletRequestContextImpl implements PortletRequestContext {
    private static final Logger LOG = LoggerFactory.getLogger(PortletRequestContextImpl.class);
-   private static final boolean isDebug = LOG.isDebugEnabled();
    private static final boolean isTrace = LOG.isTraceEnabled();
    
 
@@ -259,11 +258,11 @@ public class PortletRequestContextImpl implements PortletRequestContext
{
    @Override
    public DispatcherType getDispatcherType() {
       DispatcherType type = getServletRequest().getDispatcherType();
-      if (isDebug) {
+      if (isTrace) {
          StringBuilder txt = new StringBuilder();
          txt.append("Dispatcher type: ").append(type);
          txt.append(", executing request body: ").append(executingRequestBody);
-         LOG.debug(txt.toString());
+         LOG.trace(txt.toString());
       }
       if (executingRequestBody && (type != DispatcherType.ASYNC)) {
          type = DispatcherType.REQUEST;

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceResponseContextImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceResponseContextImpl.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceResponseContextImpl.java
index a219142..366dace 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceResponseContextImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceResponseContextImpl.java
@@ -36,7 +36,7 @@ public class PortletResourceResponseContextImpl extends PortletMimeResponseConte
                 PortletResourceResponseContext
 {
    private static final Logger    LOGGER  = LoggerFactory.getLogger(PortletResourceResponseContextImpl.class);
-   private static final boolean   isDebug = LOGGER.isDebugEnabled();
+   private static final boolean   isTrace = LOGGER.isTraceEnabled();
     
     public PortletResourceResponseContextImpl(PortletContainer container, HttpServletRequest
containerRequest,
                                               HttpServletResponse containerResponse, PortletWindow
window)
@@ -47,11 +47,11 @@ public class PortletResourceResponseContextImpl extends PortletMimeResponseConte
 
     public void setCharacterEncoding(String charset)
     {
-        if (isDebug) {
+        if (isTrace) {
            StringBuilder txt = new StringBuilder("Setting character encoding.");
            txt.append(" charset: ").append(charset);
            txt.append(" isClosed: ").append(isClosed());
-           LOGGER.debug(txt.toString());
+           LOGGER.trace(txt.toString());
         }
         if (!isClosed())
         {
@@ -85,11 +85,11 @@ public class PortletResourceResponseContextImpl extends PortletMimeResponseConte
     }
 
    public void setStatus(int sc) {
-      if (isDebug) {
+      if (isTrace) {
          StringBuilder txt = new StringBuilder("Setting character encoding.");
          txt.append(" status code: ").append(sc);
          txt.append(" isClosed: ").append(isClosed());
-         LOGGER.debug(txt.toString());
+         LOGGER.trace(txt.toString());
       }
       if (!isClosed()) {
          getServletResponse().setStatus(sc);

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletStateAwareResponseContextImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletStateAwareResponseContextImpl.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletStateAwareResponseContextImpl.java
index 1a34d33..d8600bf 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletStateAwareResponseContextImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletStateAwareResponseContextImpl.java
@@ -21,9 +21,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import javax.portlet.Event;
 import javax.portlet.MutableRenderParameters;
 import javax.portlet.PortletMode;
@@ -38,9 +35,10 @@ import org.apache.pluto.container.PortletURLProvider;
 import org.apache.pluto.container.PortletWindow;
 import org.apache.pluto.container.driver.PlutoServices;
 import org.apache.pluto.container.impl.MutableRenderParametersImpl;
-import org.apache.pluto.container.impl.PortletURLImpl;
 import org.apache.pluto.driver.core.PortalRequestContext;
 import org.apache.pluto.driver.url.PortalURL;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Id$

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/713a7095/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
index 81ec5e9..e27701f 100644
--- a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
+++ b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
@@ -192,7 +192,7 @@ public class PortalDriverServlet extends HttpServlet {
             throw new ServletException(ex);
          }
          if (LOG.isDebugEnabled()) {
-            LOG.debug(reqType + " request processed.\n\n");
+            LOG.debug(reqType + " request processed.\n");
          }
 
       }
@@ -233,7 +233,7 @@ public class PortalDriverServlet extends HttpServlet {
          dispatcher.forward(request, response);
 
          if (LOG.isDebugEnabled()) {
-            LOG.debug("Render request processed.\n\n");
+            LOG.debug("Render request processed.\n");
          }
       }
    }


Mime
View raw message