portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [11/34] portals-pluto git commit: worked on startAsync implementaion
Date Fri, 08 Apr 2016 13:40:23 GMT
worked on startAsync implementaion


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

Branch: refs/heads/V3Prototype
Commit: ba9ee3bea3026ab99e3ec7e182d3a9cfebd9ffa0
Parents: 51caad7
Author: Scott Nicklous <msnicklous@apache.org>
Authored: Thu Mar 24 06:34:43 2016 +0100
Committer: Scott Nicklous <msnicklous@apache.org>
Committed: Thu Mar 24 06:34:43 2016 +0100

----------------------------------------------------------------------
 .../container/impl/ResourceRequestImpl.java     | 43 +++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ba9ee3be/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
b/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
index aafbbee..b73a29b 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
@@ -20,13 +20,20 @@ import java.util.Enumeration;
 import java.util.Map;
 
 import javax.portlet.CacheControl;
+import javax.portlet.PortletConfig;
 import javax.portlet.PortletRequest;
 import javax.portlet.ResourceParameters;
 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;
 
+import org.apache.pluto.container.PortletInvokerService;
+import org.apache.pluto.container.PortletRequestContext;
 import org.apache.pluto.container.PortletResourceRequestContext;
 import org.apache.pluto.container.PortletResourceResponseContext;
 import org.slf4j.Logger;
@@ -126,7 +133,23 @@ public class ResourceRequestImpl extends ClientDataRequestImpl implements
Resour
 
    @Override
    public AsyncContext startAsync(ResourceRequest request, ResourceResponse response) throws
IllegalStateException {
-      return null;
+      
+      HttpServletRequest hreq = getRequestContext().getServletRequest();
+      HttpServletResponse hresp = getRequestContext().getServletResponse();
+      ServletContext ctx = getRequestContext().getServletContext();
+      HttpSession sess = getSession();
+      PortletConfig cfg =getRequestContext().getPortletConfig(); 
+      
+      HttpServletRequest wreq = new HttpServletPortletRequestWrapper(hreq, ctx, sess, request,
false, false);
+      HttpServletResponse wresp = new HttpServletPortletResponseWrapper(hresp, request, response,
false);
+   
+      request.setAttribute(PortletInvokerService.PORTLET_CONFIG, cfg);
+      request.setAttribute(PortletInvokerService.PORTLET_REQUEST, request);
+      request.setAttribute(PortletInvokerService.PORTLET_RESPONSE, response);
+      
+      AsyncContext actx = hreq.startAsync(wreq, wresp);
+
+      return actx;
    }
 
    @Override
@@ -148,4 +171,22 @@ public class ResourceRequestImpl extends ClientDataRequestImpl implements
Resour
    public DispatcherType getDispatcherType() {
       return getRequestContext().getServletRequest().getDispatcherType();
    }
+
+   // For use within the wrapper. 
+   // PLT.10.4.3. Proxied session is created and passed if 
+   // javax.portlet.servletDefaultSessionScope == PORTLET_SCOPE
+   private HttpSession getSession() {
+      HttpSession sess = null;
+
+      PortletConfig portletConfig = getRequestContext().getPortletConfig();
+      Map<String, String[]> containerRuntimeOptions = portletConfig.getContainerRuntimeOptions();
+      String[] values = containerRuntimeOptions.get("javax.portlet.servletDefaultSessionScope");
+
+      if ((values != null) && (values.length > 0) && "PORTLET_SCOPE".equals(values[0]))
{
+         String portletWindowId = getRequestContext().getPortletWindow().getId().getStringId();
+         sess = ServletPortletSessionProxy.createProxy(getRequestContext().getServletRequest(),
portletWindowId);
+      }
+
+      return sess;
+   }
 }


Mime
View raw message