portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [36/50] [abbrv] portals-pluto git commit: basic async functionality works
Date Thu, 14 Apr 2016 12:29:16 GMT
basic async functionality works


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

Branch: refs/heads/master
Commit: c4a9c5387647a653ed0f3d258977948a6a2400bc
Parents: 3a6b398
Author: Scott Nicklous <msnicklous@apache.org>
Authored: Thu Mar 31 18:26:45 2016 +0200
Committer: Scott Nicklous <msnicklous@apache.org>
Committed: Thu Mar 31 18:26:45 2016 +0200

----------------------------------------------------------------------
 .../portals/samples/AsyncPortletResource.java   | 136 +++++---------
 .../src/main/resources/logging.properties       |   2 +-
 .../impl/PortletAsyncRequestWrapper.java        | 184 +++++++++++++++----
 .../PortletResourceRequestContextImpl.java      |  59 +++---
 4 files changed, 226 insertions(+), 155 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/c4a9c538/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortletResource.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortletResource.java
b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortletResource.java
index 65fea26..72b681b 100644
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortletResource.java
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortletResource.java
@@ -21,6 +21,7 @@ package org.apache.portals.samples;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.inject.Inject;
@@ -44,31 +45,30 @@ import org.apache.portals.samples.AsyncDialogBean.OutputType;
  * 
  */
 public class AsyncPortletResource {
-   private static final Logger LOGGER      = Logger.getLogger(AsyncPortletResource.class.getName());
-
+   private static final Logger LOGGER = Logger.getLogger(AsyncPortletResource.class.getName());
+   private static final boolean isDebug = LOGGER.isLoggable(Level.FINE);
+   private static final boolean isTrace = LOGGER.isLoggable(Level.FINEST);
+   
    private final static String JSP         = "/WEB-INF/jsp/asyncOutput.jsp";
    private final static String ATTRIB_REPS = "reps";
    private final static String ATTRIB_AUTO = "auto";
-   private final static String ATTRIB_TITLE = "title";
+   public  final static String ATTRIB_TITLE = "title";
 
    private class AsyncRunnable implements Runnable {
 
       private final AsyncContext ctx;
       private final int          delay;
       private final OutputType   type;
-      private final boolean      done;
 
-      public AsyncRunnable(AsyncContext ctx, int delay, OutputType type, boolean done) {
+      public AsyncRunnable(AsyncContext ctx, int delay, OutputType type) {
          this.ctx = ctx;
          this.delay = delay;
          this.type = type;
-         this.done = done;
          
          StringBuilder txt = new StringBuilder(128);
          txt.append("Constructing runnable.");
          txt.append(" delay: ").append(delay);
          txt.append(", type: ").append(type);
-         txt.append(", done: ").append(done);
          LOGGER.fine(txt.toString());
       }
 
@@ -81,34 +81,7 @@ public class AsyncPortletResource {
             HttpServletResponse hresp = (HttpServletResponse) ctx.getResponse();
             RequestDispatcher rd;
             
-            {
-               List<String> attrNames = Collections.list(hreq.getAttributeNames());
-               StringBuilder txt = new StringBuilder(128);
-               txt.append("Runnable:");
-               txt.append("\nAttribute names: ").append(attrNames);
-               txt.append("\nasync_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.async.request_uri"));
-               txt.append("\nasync_context_path:      ").append((String) hreq.getAttribute("javax.servlet.async.context_path"));
-               txt.append("\nasync_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.async.servlet_path"));
-               txt.append("\nasync_path_info:      ").append((String) hreq.getAttribute("javax.servlet.async.path_info"));
-               txt.append("\nasync_query_string:      ").append((String) hreq.getAttribute("javax.servlet.async.query_string"));
-               txt.append("\nforward_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.forward.request_uri"));
-               txt.append("\nforward_context_path:      ").append((String) hreq.getAttribute("javax.servlet.forward.context_path"));
-               txt.append("\nforward_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.forward.servlet_path"));
-               txt.append("\nforward_path_info:      ").append((String) hreq.getAttribute("javax.servlet.forward.path_info"));
-               txt.append("\nforward_query_string:      ").append((String) hreq.getAttribute("javax.servlet.forward.query_string"));
-               txt.append("\ninclude_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.include.request_uri"));
-               txt.append("\ninclude_context_path:      ").append((String) hreq.getAttribute("javax.servlet.include.context_path"));
-               txt.append("\ninclude_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.include.servlet_path"));
-               txt.append("\ninclude_path_info:      ").append((String) hreq.getAttribute("javax.servlet.include.path_info"));
-               txt.append("\ninclude_query_string:      ").append((String) hreq.getAttribute("javax.servlet.include.query_string"));
-               txt.append("\nmethod_request_uri:      ").append(hreq.getRequestURI());
-               txt.append("\nmethod_context_path:      ").append(hreq.getContextPath());
-               txt.append("\nmethod_servlet_path:      ").append(hreq.getServletPath());
-               txt.append("\nmethod_path_info:      ").append(hreq.getPathInfo());
-               txt.append("\nmethod_query_string:      ").append(hreq.getQueryString());
-               LOGGER.fine(txt.toString());
-            }
-
+            AsyncPortletResource.trace(hreq, "Runnable: ");
             
             PortletConfig config = (PortletConfig) hreq.getAttribute("javax.portlet.config");
             String portletName = "Could not get PortletConfig";
@@ -124,11 +97,7 @@ public class AsyncPortletResource {
                txt.append("<p>dispatcher type: ").append(hreq.getDispatcherType().toString());
                txt.append("</p>");
                hresp.getWriter().write(txt.toString());
-               if (done) {
-                  ctx.complete();
-               } else {
-                  hresp.flushBuffer();
-               }
+               ctx.complete();
                break;
             case AUTO:
                StringBuilder str = new StringBuilder(128);
@@ -145,26 +114,19 @@ public class AsyncPortletResource {
                ctx.dispatch(hreq.getServletContext(), JSP);
                break;
             case FWD:
-               LOGGER.fine("Doing request dispatcher forward to JSP.");
+               LOGGER.fine("Doing request dispatcher forward to JSP: " + JSP);
                hreq.setAttribute(ATTRIB_TITLE, "Thread forwarding to JSP");
                rd = hreq.getRequestDispatcher(JSP);
                rd.forward(hreq, hresp);
-               if (done) {
-                  ctx.complete();
-               } else {
-                  hresp.flushBuffer();
-               }
+               LOGGER.fine("After request dispatcher forward to JSP.");
+               ctx.complete();
                break;
             case INC:
-               LOGGER.fine("Doing request dispatcher include of JSP.");
+               LOGGER.fine("Including JSP: " + JSP);
                hreq.setAttribute(ATTRIB_TITLE, "Thread including JSP");
                rd = hreq.getRequestDispatcher(JSP);
                rd.include(hreq, hresp);
-               if (done) {
-                  ctx.complete();
-               } else {
-                  hresp.flushBuffer();
-               }
+               ctx.complete();
                break;
             }
 
@@ -188,13 +150,9 @@ public class AsyncPortletResource {
       req.removeAttribute(ATTRIB_AUTO);
 
       Integer reps = (Integer) req.getAttribute(ATTRIB_REPS);
-      boolean done = false;
       if (reps == null) {
          reps = adb.getReps();
       }
-      if (reps <= 0) {
-         done = true;
-      }
       
       StringBuilder txt = new StringBuilder(128);
       txt.append("Resource method.");
@@ -204,12 +162,11 @@ public class AsyncPortletResource {
       txt.append(", total reps: ").append(adb.getReps());
       txt.append(", auto: ").append(adb.isAutoDispatch());
       txt.append(", auto-dispatch: ").append(auto);
-      txt.append(", done: ").append(done);
       LOGGER.fine(txt.toString());
       
       AsyncContext ctx = null;
 
-      if (!done) {
+      if (reps > 0) {
          reps--;
          req.setAttribute(ATTRIB_REPS, reps);
          
@@ -225,6 +182,7 @@ public class AsyncPortletResource {
          
          if (ctx == null) {
             // last iteration of auto-dispatch
+            LOGGER.fine("Retrieving async context for the last run.");
             try {
                ctx = req.getAsyncContext();
             } catch (Exception e) {
@@ -237,35 +195,7 @@ public class AsyncPortletResource {
          }
 
          HttpServletRequest hreq = (HttpServletRequest) req.getAttribute("javax.portlet.debug.ServletRequest");
-         
-         {
-            List<String> attrNames = Collections.list(hreq.getAttributeNames());
-            StringBuilder txt2 = new StringBuilder(128);
-            txt2.append("During content generation:");
-            txt2.append("\nAttribute names: ").append(attrNames);
-            txt2.append("\nasync_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.async.request_uri"));
-            txt2.append("\nasync_context_path:      ").append((String) hreq.getAttribute("javax.servlet.async.context_path"));
-            txt2.append("\nasync_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.async.servlet_path"));
-            txt2.append("\nasync_path_info:      ").append((String) hreq.getAttribute("javax.servlet.async.path_info"));
-            txt2.append("\nasync_query_string:      ").append((String) hreq.getAttribute("javax.servlet.async.query_string"));
-            txt2.append("\nforward_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.forward.request_uri"));
-            txt2.append("\nforward_context_path:      ").append((String) hreq.getAttribute("javax.servlet.forward.context_path"));
-            txt2.append("\nforward_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.forward.servlet_path"));
-            txt2.append("\nforward_path_info:      ").append((String) hreq.getAttribute("javax.servlet.forward.path_info"));
-            txt2.append("\nforward_query_string:      ").append((String) hreq.getAttribute("javax.servlet.forward.query_string"));
-            txt2.append("\ninclude_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.include.request_uri"));
-            txt2.append("\ninclude_context_path:      ").append((String) hreq.getAttribute("javax.servlet.include.context_path"));
-            txt2.append("\ninclude_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.include.servlet_path"));
-            txt2.append("\ninclude_path_info:      ").append((String) hreq.getAttribute("javax.servlet.include.path_info"));
-            txt2.append("\ninclude_query_string:      ").append((String) hreq.getAttribute("javax.servlet.include.query_string"));
-            txt2.append("\nmethod_request_uri:      ").append(hreq.getRequestURI());
-            txt2.append("\nmethod_context_path:      ").append(hreq.getContextPath());
-            txt2.append("\nmethod_servlet_path:      ").append(hreq.getServletPath());
-            txt2.append("\nmethod_path_info:      ").append(hreq.getPathInfo());
-            txt2.append("\nmethod_query_string:      ").append(hreq.getQueryString());
-            LOGGER.fine(txt2.toString());
-         }
-
+         trace(hreq, "Resource method: ");
          
          // HttpServletRequest hreq = (HttpServletRequest) ctx.getRequest();
          PortletConfig config = (PortletConfig) req.getAttribute("javax.portlet.config");
@@ -323,9 +253,39 @@ public class AsyncPortletResource {
             type = OutputType.AUTO;
          }
 
-         AsyncRunnable ar = new AsyncRunnable(ctx, adb.getDelay(), type, (reps<=0));
+         AsyncRunnable ar = new AsyncRunnable(ctx, adb.getDelay(), type);
          ctx.start(ar);
       }
+   }
+   
+   public static void trace(HttpServletRequest hreq, String src) {
+      if (isTrace) {
+         List<String> attrNames = Collections.list(hreq.getAttributeNames());
+         StringBuilder txt = new StringBuilder(128);
+         txt.append(src);
+         txt.append("\nAttribute names: ").append(attrNames);
+         txt.append("\nasync_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.async.request_uri"));
+         txt.append("\nasync_context_path:      ").append((String) hreq.getAttribute("javax.servlet.async.context_path"));
+         txt.append("\nasync_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.async.servlet_path"));
+         txt.append("\nasync_path_info:      ").append((String) hreq.getAttribute("javax.servlet.async.path_info"));
+         txt.append("\nasync_query_string:      ").append((String) hreq.getAttribute("javax.servlet.async.query_string"));
+         txt.append("\nforward_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.forward.request_uri"));
+         txt.append("\nforward_context_path:      ").append((String) hreq.getAttribute("javax.servlet.forward.context_path"));
+         txt.append("\nforward_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.forward.servlet_path"));
+         txt.append("\nforward_path_info:      ").append((String) hreq.getAttribute("javax.servlet.forward.path_info"));
+         txt.append("\nforward_query_string:      ").append((String) hreq.getAttribute("javax.servlet.forward.query_string"));
+         txt.append("\ninclude_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.include.request_uri"));
+         txt.append("\ninclude_context_path:      ").append((String) hreq.getAttribute("javax.servlet.include.context_path"));
+         txt.append("\ninclude_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.include.servlet_path"));
+         txt.append("\ninclude_path_info:      ").append((String) hreq.getAttribute("javax.servlet.include.path_info"));
+         txt.append("\ninclude_query_string:      ").append((String) hreq.getAttribute("javax.servlet.include.query_string"));
+         txt.append("\nmethod_request_uri:      ").append(hreq.getRequestURI());
+         txt.append("\nmethod_context_path:      ").append(hreq.getContextPath());
+         txt.append("\nmethod_servlet_path:      ").append(hreq.getServletPath());
+         txt.append("\nmethod_path_info:      ").append(hreq.getPathInfo());
+         txt.append("\nmethod_query_string:      ").append(hreq.getQueryString());
+         LOGGER.fine(txt.toString());
+      }
 
    }
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/c4a9c538/PortletV3AnnotatedDemo/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/resources/logging.properties b/PortletV3AnnotatedDemo/src/main/resources/logging.properties
index 9a479f9..ef8a5c4 100644
--- a/PortletV3AnnotatedDemo/src/main/resources/logging.properties
+++ b/PortletV3AnnotatedDemo/src/main/resources/logging.properties
@@ -34,4 +34,4 @@ org.apache.juli.FileHandler.directory = ${catalina.base}/logs
 org.apache.juli.FileHandler.prefix = PortletV3AnnotatedDemo.
 
 org.apache.pluto.level=FINE
-org.apache.portals.samples.level=FINEST
+org.apache.portals.samples.level=FINER

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/c4a9c538/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAsyncRequestWrapper.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAsyncRequestWrapper.java
b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAsyncRequestWrapper.java
index f2f6c2b..aec96ef 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAsyncRequestWrapper.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAsyncRequestWrapper.java
@@ -19,63 +19,173 @@
 
 package org.apache.pluto.container.impl;
 
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Enumeration;
 
-import javax.portlet.PortletRequest;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
 import javax.servlet.AsyncContext;
-import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletContext;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpSession;
+
+import org.apache.pluto.container.NamespaceMapper;
+import org.apache.pluto.container.PortletRequestContext;
+import org.apache.pluto.container.PortletResourceRequestContext;
+import org.apache.pluto.container.PortletWindowID;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author Scott Nicklous
  *
  */
-public class PortletAsyncRequestWrapper extends HttpServletRequestWrapper {
+public class PortletAsyncRequestWrapper extends HttpServletPortletRequestWrapper {
+   
+   /** Logger. */
+   private static final Logger LOG = LoggerFactory.getLogger(PortletAsyncRequestWrapper.class);
+   @SuppressWarnings("unused")
+   private static final boolean isDebug = LOG.isDebugEnabled();
+   private static final boolean isTrace = LOG.isTraceEnabled();
    
-   private final PortletRequest preq;
+   
+   private final ResourceRequest preq;
+   private final PortletResourceRequestContext reqctx;
+   private final NamespaceMapper mapper;
+   private final PortletWindowID winId;
 
-   public PortletAsyncRequestWrapper(HttpServletRequest hreq, PortletRequest preq) {
-      super(hreq);
+   public PortletAsyncRequestWrapper(HttpServletRequest hreq, ResourceRequest preq, PortletResourceRequestContext
reqctx) {
+      super(hreq, reqctx.getServletContext(), null, preq, true, false);
       this.preq = preq;
+      this.reqctx = reqctx;
+      this.mapper = reqctx.getContainer().getContainerServices().getNamespaceMapper();
+      this.winId = reqctx.getPortletWindow().getId();
    }
    
    
    
    @Override
    public Object getAttribute(String name) {
-      return preq.getAttribute(name);
+      boolean encoded = true;
+      Object val = getRequest().getAttribute(mapper.encode(winId, name));
+      if (val == null) {
+         val = getRequest().getAttribute(name);
+         encoded = false;
+      }
+      if (isTrace) {
+         StringBuilder txt = new StringBuilder();
+         txt.append("Getting: ");
+         txt.append(name).append(", value: ").append((val == null) ? "null" : val.toString());
+         txt.append(", encoded: ").append(encoded);
+         LOG.debug(txt.toString());
+      }
+      return val;
    }
    
    @Override
    public Enumeration<String> getAttributeNames() {
-      return preq.getAttributeNames();
+      Enumeration<String> enames = getRequest().getAttributeNames();
+      ArrayList<String> snames = new ArrayList<String>();
+      for (String name : Collections.list(enames)) {
+         String dn = mapper.decode(winId, name);
+         if (dn != null) {
+            snames.add(dn);
+         } else {
+            snames.add(name);
+         }
+      }
+      return Collections.enumeration(snames);
    }
    
    @Override
    public void setAttribute(String name, Object o) {
-      preq.setAttribute(name, o);
+      boolean encoded = false;
+      Object val = getRequest().getAttribute(mapper.encode(winId, name));
+      if (val != null) {
+         getRequest().setAttribute(mapper.encode(winId, name), o);
+         encoded = true;
+      } else {
+         getRequest().setAttribute(name, o);
+      }
+
+      if (isTrace) {
+         StringBuilder txt = new StringBuilder();
+         txt.append("Setting: ");
+         txt.append(name).append(", value: ").append((o == null) ? "null" : o.toString());
+         txt.append(", encoded: ").append(encoded);
+         LOG.debug(txt.toString());
+      }
    }
    
    @Override
    public void removeAttribute(String name) {
-      preq.removeAttribute(name);
+      boolean encoded = false;
+      Object val = getRequest().getAttribute(mapper.encode(winId, name));
+      if (val != null) {
+         getRequest().removeAttribute(mapper.encode(winId, name));
+         encoded = true;
+      } else {
+         getRequest().removeAttribute(name);
+      }
+
+      if (isTrace) {
+         StringBuilder txt = new StringBuilder();
+         txt.append("Removing: ");
+         txt.append(name);
+         txt.append(", encoded: ").append(encoded);
+         LOG.debug(txt.toString());
+      }
    }
    
    @Override
-   public RequestDispatcher getRequestDispatcher(String path) {
-      RequestDispatcher rd = super.getRequestDispatcher(path);
-      if (rd != null) {
-         return new PortletRequestDispatcherImpl(rd, false);
+   public String getServletPath() {
+      String path = ((HttpServletRequest)getRequest()).getServletPath();
+      if (isTrace) {
+         StringBuilder txt = new StringBuilder();
+         txt.append("Servlet path: ");
+         txt.append(path);
+         LOG.debug(txt.toString());
       }
-      return null;
+      return path;
    }
    
+   @Override
+   public String getPathInfo() {
+      String info = ((HttpServletRequest)getRequest()).getPathInfo();
+      if (isTrace) {
+         StringBuilder txt = new StringBuilder();
+         txt.append("Path info: ");
+         txt.append(info);
+         LOG.debug(txt.toString());
+      }
+      return info;
+   }
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+//    @Override
+//    public RequestDispatcher getRequestDispatcher(String path) {
+//       RequestDispatcher rd = super.getRequestDispatcher(path);
+//       if (rd != null) {
+//          PortletRequestDispatcherImpl prd =  new PortletRequestDispatcherImpl(rd, false);
+//          prd.setPortletRequest(preq);
+//          prd.setPortletResponse(reqctx.getResponse());
+//          return prd;
+//       }
+//       return null;
+//    }
+   
    
    
    
@@ -101,25 +211,25 @@ public class PortletAsyncRequestWrapper extends HttpServletRequestWrapper
{
 //    
 // 
 // 
-//    @Override
-//    public AsyncContext startAsync() throws IllegalStateException {
-//       return getRequest().startAsync();
-//    }
-// 
-//    @Override
-//    public AsyncContext startAsync(ServletRequest request, ServletResponse response) throws
IllegalStateException {
-//       return getRequest().startAsync(request, response);
-//    }
-// 
-//    @Override
-//    public boolean isAsyncStarted() {
-//       return getRequest().isAsyncStarted();
-//    }
-// 
-//    @Override
-//    public boolean isAsyncSupported() {
-//       return getRequest().isAsyncSupported();
-//    }
-// 
+   @Override
+   public AsyncContext startAsync() throws IllegalStateException {
+      return getRequest().startAsync();
+   }
+
+   @Override
+   public AsyncContext startAsync(ServletRequest request, ServletResponse response) throws
IllegalStateException {
+      return getRequest().startAsync(request, response);
+   }
+
+   @Override
+   public boolean isAsyncStarted() {
+      return getRequest().isAsyncStarted();
+   }
+
+   @Override
+   public boolean isAsyncSupported() {
+      return getRequest().isAsyncSupported();
+   }
+
 
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/c4a9c538/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceRequestContextImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceRequestContextImpl.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceRequestContextImpl.java
index a441c29..35909c0 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceRequestContextImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceRequestContextImpl.java
@@ -26,7 +26,6 @@ import javax.portlet.ResourceRequest;
 import javax.portlet.ResourceResponse;
 import javax.servlet.AsyncContext;
 import javax.servlet.DispatcherType;
-import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
@@ -35,7 +34,6 @@ import org.apache.pluto.container.PortletContainer;
 import org.apache.pluto.container.PortletInvokerService;
 import org.apache.pluto.container.PortletResourceRequestContext;
 import org.apache.pluto.container.PortletWindow;
-import org.apache.pluto.container.impl.HttpServletPortletRequestWrapper;
 import org.apache.pluto.container.impl.HttpServletPortletResponseWrapper;
 import org.apache.pluto.container.impl.PortletAsyncRequestWrapper;
 import org.apache.pluto.container.impl.ResourceParametersImpl;
@@ -53,6 +51,7 @@ public class PortletResourceRequestContextImpl extends PortletRequestContextImpl
    
    /** Logger. */
    private static final Logger LOG = LoggerFactory.getLogger(PortletResourceRequestContextImpl.class);
+   @SuppressWarnings("unused")
    private static final boolean isDebug = LOG.isDebugEnabled();
    private static final boolean isTrace = LOG.isTraceEnabled();
    
@@ -130,11 +129,11 @@ public class PortletResourceRequestContextImpl extends PortletRequestContextImpl
        
        HttpServletRequest hreq = getServletRequest();
        HttpServletResponse hresp = getServletResponse();
-       ServletContext ctx = getServletContext();
-       HttpSession sess = getSession();
+//       ServletContext ctx = getServletContext();
+//       HttpSession sess = getSession();
        PortletConfig cfg = getPortletConfig(); 
        
-       if (isDebug) {
+       if (isTrace) {
           List<String> attrNames = Collections.list(hreq.getAttributeNames());
           StringBuilder txt = new StringBuilder(128);
           txt.append("Start async before:");
@@ -171,7 +170,8 @@ public class PortletResourceRequestContextImpl extends PortletRequestContextImpl
 
        // Wrap http req & response. 
        
-       HttpServletRequest wreq = new PortletAsyncRequestWrapper(hreq, request);
+       HttpServletRequest wreq = new PortletAsyncRequestWrapper(hreq, request, this);
+//       HttpServletRequest wreq = new HttpServletPortletRequestWrapper(hreq, ctx, sess,
request, true, false);
        HttpServletResponse wresp = new HttpServletPortletResponseWrapper(hresp, request,
response, false);
 
        // get the original container req & resp to pass to listener for resource releasing
@@ -192,31 +192,31 @@ public class PortletResourceRequestContextImpl extends PortletRequestContextImpl
        }
 
        
-       if (isDebug) {
+       if (isTrace) {
           List<String> attrNames = Collections.list(hreq.getAttributeNames());
           StringBuilder txt = new StringBuilder(128);
-          txt.append("Start async after:");
+          txt.append("Start async after (wreq):");
           txt.append("\nAttribute names: ").append(attrNames);
-          txt.append("\nasync_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.async.request_uri"));
-          txt.append("\nasync_context_path:      ").append((String) hreq.getAttribute("javax.servlet.async.context_path"));
-          txt.append("\nasync_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.async.servlet_path"));
-          txt.append("\nasync_path_info:      ").append((String) hreq.getAttribute("javax.servlet.async.path_info"));
-          txt.append("\nasync_query_string:      ").append((String) hreq.getAttribute("javax.servlet.async.query_string"));
-          txt.append("\nforward_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.forward.request_uri"));
-          txt.append("\nforward_context_path:      ").append((String) hreq.getAttribute("javax.servlet.forward.context_path"));
-          txt.append("\nforward_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.forward.servlet_path"));
-          txt.append("\nforward_path_info:      ").append((String) hreq.getAttribute("javax.servlet.forward.path_info"));
-          txt.append("\nforward_query_string:      ").append((String) hreq.getAttribute("javax.servlet.forward.query_string"));
-          txt.append("\ninclude_request_uri:      ").append((String) hreq.getAttribute("javax.servlet.include.request_uri"));
-          txt.append("\ninclude_context_path:      ").append((String) hreq.getAttribute("javax.servlet.include.context_path"));
-          txt.append("\ninclude_servlet_path:      ").append((String) hreq.getAttribute("javax.servlet.include.servlet_path"));
-          txt.append("\ninclude_path_info:      ").append((String) hreq.getAttribute("javax.servlet.include.path_info"));
-          txt.append("\ninclude_query_string:      ").append((String) hreq.getAttribute("javax.servlet.include.query_string"));
-          txt.append("\nmethod_request_uri:      ").append(hreq.getRequestURI());
-          txt.append("\nmethod_context_path:      ").append(hreq.getContextPath());
-          txt.append("\nmethod_servlet_path:      ").append(hreq.getServletPath());
-          txt.append("\nmethod_path_info:      ").append(hreq.getPathInfo());
-          txt.append("\nmethod_query_string:      ").append(hreq.getQueryString());
+          txt.append("\nasync_request_uri:      ").append((String) wreq.getAttribute("javax.servlet.async.request_uri"));
+          txt.append("\nasync_context_path:      ").append((String) wreq.getAttribute("javax.servlet.async.context_path"));
+          txt.append("\nasync_servlet_path:      ").append((String) wreq.getAttribute("javax.servlet.async.servlet_path"));
+          txt.append("\nasync_path_info:      ").append((String) wreq.getAttribute("javax.servlet.async.path_info"));
+          txt.append("\nasync_query_string:      ").append((String) wreq.getAttribute("javax.servlet.async.query_string"));
+          txt.append("\nforward_request_uri:      ").append((String) wreq.getAttribute("javax.servlet.forward.request_uri"));
+          txt.append("\nforward_context_path:      ").append((String) wreq.getAttribute("javax.servlet.forward.context_path"));
+          txt.append("\nforward_servlet_path:      ").append((String) wreq.getAttribute("javax.servlet.forward.servlet_path"));
+          txt.append("\nforward_path_info:      ").append((String) wreq.getAttribute("javax.servlet.forward.path_info"));
+          txt.append("\nforward_query_string:      ").append((String) wreq.getAttribute("javax.servlet.forward.query_string"));
+          txt.append("\ninclude_request_uri:      ").append((String) wreq.getAttribute("javax.servlet.include.request_uri"));
+          txt.append("\ninclude_context_path:      ").append((String) wreq.getAttribute("javax.servlet.include.context_path"));
+          txt.append("\ninclude_servlet_path:      ").append((String) wreq.getAttribute("javax.servlet.include.servlet_path"));
+          txt.append("\ninclude_path_info:      ").append((String) wreq.getAttribute("javax.servlet.include.path_info"));
+          txt.append("\ninclude_query_string:      ").append((String) wreq.getAttribute("javax.servlet.include.query_string"));
+          txt.append("\nmethod_request_uri:      ").append(wreq.getRequestURI());
+          txt.append("\nmethod_context_path:      ").append(wreq.getContextPath());
+          txt.append("\nmethod_servlet_path:      ").append(wreq.getServletPath());
+          txt.append("\nmethod_path_info:      ").append(wreq.getPathInfo());
+          txt.append("\nmethod_query_string:      ").append(wreq.getQueryString());
           LOG.debug(txt.toString());
        }
 
@@ -246,7 +246,8 @@ public class PortletResourceRequestContextImpl extends PortletRequestContextImpl
     // For use within the wrapper. 
     // PLT.10.4.3. Proxied session is created and passed if 
     // javax.portlet.servletDefaultSessionScope == PORTLET_SCOPE
-    private HttpSession getSession() {
+    @SuppressWarnings("unused")
+   private HttpSession getSession() {
        HttpSession sess = null;
 
        PortletConfig portletConfig = getPortletConfig();


Mime
View raw message