Author: sohil.shah(a)jboss.com
Date: 2007-11-16 13:53:28 -0500 (Fri, 16 Nov 2007)
New Revision: 8977
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorRequest.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorResponse.java
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml
Log:
integration
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
===================================================================
---
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-16
16:47:30 UTC (rev 8976)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-16
18:53:28 UTC (rev 8977)
@@ -89,14 +89,12 @@
ProcessorResponse response = null;
//For now, just for prototype sake just use the existing Controller to produce
the outcome
- request.getServerInvocation().setHandler(new
RequestControllerDispatcher(this.requestController));
- request.getServerInvocation().invokeNext();
+ requestContext.getInvocation().setHandler(new
RequestControllerDispatcher(this.requestController));
+ requestContext.getInvocation().invokeNext();
//Get access to the core Portal objects to be used after the execution of the
incoming Portal request
//by the Portal Controller
- ServerInvocation invocation = request.getServerInvocation();
- ServletContextDispatcher dispatcher = new
ServletContextDispatcher(invocation.getServerContext().getClientRequest(),
- invocation.getServerContext().getClientResponse(),
invocation.getRequest().getServer().getServletContainerContext());
+ ServerInvocation invocation = requestContext.getInvocation();
String task =
(String)invocation.getServerContext().getClientRequest().getAttribute("pfTask");
if(task.equals("aggregate"))
@@ -107,7 +105,7 @@
String contentType = markupInfo.getContentType() + "; charset=" +
markupInfo.getCharset();
//Generate the response to be sent back for processing by the Presentation
Framework
- response = new ProcessorResponse(dispatcher, null);
+ response = new ProcessorResponse(null);
}
else if(task.equals("stream"))
{
@@ -115,21 +113,21 @@
String contentType =
(String)invocation.getServerContext().getClientRequest().getAttribute("contentType");
InputStream in =
(InputStream)invocation.getServerContext().getClientRequest().getAttribute("inputStream");
StreamResponse streamResponse = new StreamResponse(contentType, in);
- response = new ProcessorResponse(dispatcher, streamResponse);
+ response = new ProcessorResponse(streamResponse);
}
else if(task.equals("redirect"))
{
//Handle sendRedirect back to the client
String url =
(String)invocation.getServerContext().getClientRequest().getAttribute("url");
RedirectResponse redirectResponse = new RedirectResponse(url);
- response = new ProcessorResponse(dispatcher, redirectResponse);
+ response = new ProcessorResponse(redirectResponse);
}
else if(task.equals("error"))
{
//Handle sendingErrror back to the client
Integer errorCode =
(Integer)invocation.getServerContext().getClientRequest().getAttribute("errorCode");
ErrorResponse errorResponse = new ErrorResponse(errorCode.intValue());
- response = new ProcessorResponse(dispatcher, errorResponse);
+ response = new ProcessorResponse(errorResponse);
}
return response;
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java 2007-11-16
16:47:30 UTC (rev 8976)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java 2007-11-16
18:53:28 UTC (rev 8977)
@@ -25,6 +25,8 @@
import org.jboss.portal.presentation.action.server.ServerAction;
import org.jboss.portal.presentation.model.UIContext;
import org.jboss.portal.presentation.model.state.ModelLoader;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.web.ServletContextDispatcher;
/**
* The contract that defines the services that the client provides to the server during a
server invocation.
@@ -48,5 +50,16 @@
* Returns the root UI context provided by the portal.
*/
UIContext getUIContext();
-
+
+ /**
+ *
+ * @return
+ */
+ ServerInvocation getInvocation();
+
+ /**
+ *
+ * @return
+ */
+ ServletContextDispatcher getDispatcher();
}
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java 2007-11-16
16:47:30 UTC (rev 8976)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java 2007-11-16
18:53:28 UTC (rev 8977)
@@ -27,12 +27,12 @@
import javax.servlet.http.HttpServletRequest;
import org.jboss.portal.presentation.RequestContext;
+import org.jboss.portal.presentation.impl.RequestContextImpl;
import org.jboss.portal.presentation.server.ProcessorRequest;
import org.jboss.portal.presentation.server.ProcessorResponse;
import org.jboss.portal.presentation.server.PresentationServer;
import org.jboss.portal.presentation.action.server.ServerAction;
import org.jboss.portal.presentation.action.server.ServerResponse;
-import org.jboss.portal.presentation.action.server.LinkActivation;
import org.jboss.portal.presentation.action.server.GetActivation;
import org.jboss.portal.presentation.action.server.PostActivation;
import org.jboss.portal.presentation.action.server.ViewUIObjectAction;
@@ -84,10 +84,14 @@
{
try
{
- //Make a request to the Processor
- RequestContext requestContext = null; //Just use null until proper
implementation is provided
+ /**
+ * TODO: decouple the implementation via factory pattern
+ */
+ RequestContext requestContext = new RequestContextImpl(this.presentationServer,
+ invocation);
+
ServerAction serverAction = this.getServerAction(requestContext,invocation);
- ProcessorRequest processorRequest = new ProcessorRequest(serverAction,
invocation);
+ ProcessorRequest processorRequest = new ProcessorRequest(serverAction);
ProcessorResponse processorResponse =
this.presentationServer.getProcessor().process(requestContext,
processorRequest);
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java 2007-11-16
18:53:28 UTC (rev 8977)
@@ -0,0 +1,107 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl;
+
+import javax.servlet.http.HttpSession;
+
+import org.jboss.portal.presentation.RequestContext;
+import org.jboss.portal.presentation.action.server.ServerAction;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.impl.model.UIContextImpl;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.web.ServletContextDispatcher;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class RequestContextImpl implements RequestContext
+{
+ /**
+ *
+ */
+ private ServerInvocation invocation = null;
+
+ private PresentationServer presentationServer = null;
+
+ /**
+ *
+ * @param invocation
+ */
+ public RequestContextImpl(PresentationServer presentationServer, ServerInvocation
invocation)
+ {
+ this.invocation = invocation;
+ this.presentationServer = presentationServer;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public UIContext getUIContext()
+ {
+ HttpSession session =
this.invocation.getServerContext().getClientRequest().getSession();
+
+ UIContext uiContext = (UIContext)session.getAttribute("uicontext");
+ if(uiContext == null)
+ {
+ /**
+ * TODO: decouple the implementation via factory pattern
+ */
+ uiContext = new UIContextImpl();
+
((UIContextImpl)uiContext).setModelLoader(this.presentationServer.getModelLoader());
+ session.setAttribute("uicontext", uiContext);
+ }
+
+ return uiContext;
+ }
+
+ /**
+ *
+ */
+ public ServerInvocation getInvocation()
+ {
+ return this.invocation;
+ }
+
+ /**
+ *
+ */
+ public ServletContextDispatcher getDispatcher()
+ {
+ return new
ServletContextDispatcher(this.invocation.getServerContext().getClientRequest(),
+ this.invocation.getServerContext().getClientResponse(),
this.invocation.getRequest().getServer().getServletContainerContext());
+ }
+
+ /**
+ *
+ * @param action
+ * @return
+ * @throws IllegalArgumentException
+ */
+ public String render(ServerAction action) throws IllegalArgumentException
+ {
+ return null;
+ }
+}
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorRequest.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorRequest.java 2007-11-16
16:47:30 UTC (rev 8976)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorRequest.java 2007-11-16
18:53:28 UTC (rev 8977)
@@ -24,7 +24,6 @@
import java.io.Serializable;
-import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.presentation.action.server.ServerAction;
@@ -41,21 +40,15 @@
/**
* The Portal action to be performed
*/
- private ServerAction action = null;
+ private ServerAction action = null;
/**
*
- */
- private ServerInvocation serverInvocation = null;
-
- /**
- *
*
*/
- public ProcessorRequest(ServerAction action, ServerInvocation serverInvocation)
+ public ProcessorRequest(ServerAction action)
{
- this.action = action;
- this.serverInvocation = serverInvocation;
+ this.action = action;
}
/**
@@ -74,25 +67,7 @@
public void setAction(ServerAction action)
{
this.action = action;
- }
-
- /**
- *
- * @return
- */
- public ServerInvocation getServerInvocation()
- {
- return serverInvocation;
- }
-
- /**
- *
- * @param serverInvocation
- */
- public void setServerInvocation(ServerInvocation serverInvocation)
- {
- this.serverInvocation = serverInvocation;
- }
+ }
/**
*
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorResponse.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorResponse.java 2007-11-16
16:47:30 UTC (rev 8976)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorResponse.java 2007-11-16
18:53:28 UTC (rev 8977)
@@ -24,7 +24,6 @@
import java.io.Serializable;
-import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.presentation.action.server.ServerResponse;
/**
@@ -32,13 +31,8 @@
*
*/
public class ProcessorResponse implements Serializable
-{
+{
/**
- *
- */
- private ServletContextDispatcher dispatcher = null;
-
- /**
* The ServerResponse generated by processing the ProcessorRequest by the Processor
*/
private ServerResponse response = null;
@@ -48,32 +42,13 @@
* @param dispatcher
* @param updatedPages
*/
- public ProcessorResponse(ServletContextDispatcher dispatcher, ServerResponse
response)
- {
- this.dispatcher = dispatcher;
+ public ProcessorResponse(ServerResponse response)
+ {
this.response = response;
- }
-
- /**
- *
- * @return
- */
- public ServletContextDispatcher getDispatcher()
- {
- return dispatcher;
- }
+ }
/**
*
- * @param dispatcher
- */
- public void setDispatcher(ServletContextDispatcher dispatcher)
- {
- this.dispatcher = dispatcher;
- }
-
- /**
- *
* @return
*/
public ServerResponse getResponse()
Modified: branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml
===================================================================
---
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml 2007-11-16
16:47:30 UTC (rev 8976)
+++
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml 2007-11-16
18:53:28 UTC (rev 8977)
@@ -27,7 +27,6 @@
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Add the GWT Client Filter to run the Portal in full Web 2.0 Ajax Mode. In
turn, to run in Classic Html Mode, turn this filter off -->
- <!--
<filter>
<filter-name>GWTClientFilter</filter-name>
<filter-class>org.jboss.portal.presentation.entry.GWTClientFilter</filter-class>
@@ -36,7 +35,6 @@
<filter-name>GWTClientFilter</filter-name>
<servlet-name>PortalEntryPoint</servlet-name>
</filter-mapping>
- -->
<!-- The portal servlet is the main entrance point -->
<servlet>