JBoss Portal SVN: r9018 - in branches/UIServer: uiserver/src/main/org/jboss/portal/presentation and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-18 19:37:38 -0500 (Sun, 18 Nov 2007)
New Revision: 9018
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/controller/
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/controller/UIController.java
Removed:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/controller/UIController.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/
Modified:
branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml
Log:
move the controller to the client package
Modified: branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml
===================================================================
--- branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml 2007-11-19 00:08:14 UTC (rev 9017)
+++ branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml 2007-11-19 00:37:38 UTC (rev 9018)
@@ -25,7 +25,7 @@
<server>
<mbean
- code="org.jboss.portal.presentation.controller.UIController"
+ code="org.jboss.portal.presentation.client.controller.UIController"
name="portal:service=Controller,type=Presentation"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Copied: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/controller (from rev 9013, branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller)
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/controller/UIController.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java 2007-11-18 20:00:55 UTC (rev 9013)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/controller/UIController.java 2007-11-19 00:37:38 UTC (rev 9018)
@@ -1,539 +0,0 @@
-/******************************************************************************
- * 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.controller;
-
-import java.io.PrintWriter;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.portal.presentation.client.PresentationContext;
-import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
-import org.jboss.portal.presentation.impl.PresentationContextImpl;
-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.protocol.ServerAction;
-import org.jboss.portal.presentation.protocol.ServerResponse;
-import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
-import org.jboss.portal.presentation.model.UIContext;
-import org.jboss.portal.presentation.model.UIObject;
-import org.jboss.portal.presentation.model.UIPage;
-import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.model.content.WindowContent;
-
-import org.jboss.portal.server.RequestController;
-import org.jboss.portal.server.ServerException;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerInvocationContext;
-
-
-/**
- * The UIServer is responsible for generating the output that is sent back to the client based on the Portal state of a particular Portal Request
- *
- * The UIServer provides various UI level services like Page Aggregation, Page Layout, Web 2.0 client interactions etc.
- *
- * Typically the Core component of the Portal delegates all UI specific functions to this component
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class UIController implements RequestController
-{
- /**
- *
- */
- private PresentationServer presentationServer = null;
-
-
- /**
- *
- *
- */
- public UIController()
- {
- }
-
-
- /**
- * handle is the entry point for handling an incoming Portal request. The request is handed over
- * from the Http Layer via the main Portal Servlet
- *
- */
- public void handle(ServerInvocation invocation) throws ServerException
- {
- try
- {
- HttpServletRequest request = invocation.getServerContext().getClientRequest();
-
- /**
- * TODO: decouple the implementation via factory pattern
- */
- PresentationContext presentationContext = new PresentationContextImpl(this.presentationServer,
- invocation);
- request.setAttribute("requestContext", presentationContext);
-
- /**
- * TODO: move this functionality to another component like a UIPresenter etc
- */
- ServerAction serverAction = this.getServerAction(presentationContext, invocation);
-
- ProcessorRequest processorRequest = new ProcessorRequest(serverAction);
- ProcessorResponse processorResponse = this.presentationServer.getProcessor().process(presentationContext,
- processorRequest);
-
- //Process the response from the Processor
- ServerResponse serverResponse = processorResponse.getResponse();
- this.handle(presentationContext, serverResponse, invocation);
- }
- catch(Exception e)
- {
- throw new ServerException(e);
- }
- }
-
- /**
- *
- * @param serverResponse
- * @throws ServerException
- */
- private void handle(PresentationContext presentationContext, ServerResponse serverResponse, ServerInvocation invocation) throws ServerException
- {
- try
- {
- HttpServletResponse response = invocation.getServerContext().getClientResponse();
- if(serverResponse instanceof ShowUIObjectResponse)
- {
- ShowUIObjectResponse show = (ShowUIObjectResponse)serverResponse;
- String targetId = show.getTargetId();
-
- //Load the objects in the UITree
- UIObject uiObject = presentationContext.getUIContext().getObject(targetId);
-
- if(uiObject instanceof UIPage)
- {
- UIPage page = (UIPage)uiObject;
- //Populate the state of the Windows in the Page that is being displayed
- //inside the UITree
- List<UIObject> windows = page.getChildren();
- if(windows != null)
- {
- for(int i=0; i<windows.size(); i++)
- {
- UIObject cour = windows.get(i);
-
- if(cour instanceof UIWindow)
- {
- UIWindow window = (UIWindow)cour;
- WindowContent windowContent = this.presentationServer.render(presentationContext, window);
-
- /**
- * TODO: decouple this from the model implementation by moving the functinality
- * to another component like a UIPresenter etc
- */
- ((org.jboss.portal.presentation.impl.model.UIWindowImpl)window).
- setContent(windowContent);
- }
- }
- }
- this.render(response.getWriter(), presentationContext.getUIContext(), targetId);
- }
- }
- }
- catch(Exception e)
- {
- throw new ServerException(e);
- }
- }
-
- /**
- *
- *
- */
- public void start()
- {
-
- }
-
- /**
- *
- *
- */
- public void stop()
- {
-
- }
- //-----------------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- *
- */
- public PresentationServer getPresentationServer()
- {
- return presentationServer;
- }
-
- /**
- *
- * @param presentationServer
- */
- public void setPresentationServer(PresentationServer presentationServer)
- {
- this.presentationServer = presentationServer;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- *
- */
- private ServerAction getServerAction(PresentationContext presentationContext, ServerInvocation invocation)
- {
- ServerAction serverAction = null;
-
- ServerInvocationContext invocationContext = invocation.getServerContext();
- HttpServletRequest request = invocationContext.getClientRequest();
-
- //Just use ViewUIObject command for now until URL interpretation/mapping
- //to ServiceAction is implemented
- serverAction = new ViewUIObjectAction("/default/default");
-
- /*if(targetPortalObject instanceof UIPage)
- {
- serverAction = new ViewUIObjectAction(targetPortalObject.getId());
- }
- else if(targetPortalObject instanceof UIWindow)
- {
- if(request.getMethod().equals("GET"))
- {
- GetActivation get = new GetActivation();
- get.setUrl(request.getRequestURL().toString());
- get.setContentType(invocationContext.getMediaType());
- get.setQueryParameters(invocationContext.getQueryParameterMap());
- get.setPortal(targetPortal);
- get.setTarget(targetPortalObject);
- serverAction = get;
- }
- else if(request.getMethod().equals("POST"))
- {
- PostActivation post = new PostActivation();
- post.setUrl(request.getRequestURL().toString());
- post.setContentType(invocationContext.getMediaType());
- post.setQueryParameters(invocationContext.getQueryParameterMap());
- post.setBodyParameters(invocationContext.getBodyParameterMap());
- post.setPortal(targetPortal);
- post.setTarget(targetPortalObject);
- serverAction = post;
- }
- }*/
-
- return serverAction;
- }
-
- /**
- *
- * @param portalRequestPath
- * @return
- */
- /*private UIPortal getTargetPortal(RequestContext requestContext,String portalRequestPath)
- {
- UIPortal targetPortal = null;
-
- //Parse the portalRequestPath and find the targetted Portal
- StringTokenizer st = new StringTokenizer(portalRequestPath, "/");
- StringBuffer buffer = new StringBuffer("/");
- while(st.hasMoreTokens())
- {
- String token = st.nextToken();
- buffer.append(token);
- String id = buffer.toString();
- ObjectState objectState = this.presentationServer.getModelLoader().loadState(id);
- if(objectState != null && objectState.getType() == UIPortal.class)
- {
- targetPortal = (UIPortal)requestContext.getUIContext().getObject(id);
- break;
- }
- buffer.append("/");
- }
-
- return targetPortal;
- }*/
-
- /**
- *
- * @param portalRequestPath
- * @return
- */
- /*private UIObject getTargetPortalObject(RequestContext requestContext,String portalRequestPath)
- {
- UIObject targetPortalObject = null;
-
- //Parse the portalRequestPath and find the targetted Portal Object (Page or Window)
- StringTokenizer st = new StringTokenizer(portalRequestPath, "/");
- StringBuffer buffer = new StringBuffer("/");
- while(st.hasMoreTokens())
- {
- String token = st.nextToken();
- buffer.append(token);
- String id = buffer.toString();
- ObjectState objectState = this.presentationServer.getModelLoader().loadState(id);
- if(objectState != null)
- {
- if(objectState.getType() == UIPage.class)
- {
- targetPortalObject = (UIPage)requestContext.getUIContext().getObject(id);
- }
- else if(objectState.getType() == UIWindow.class)
- {
- targetPortalObject = (UIWindow)requestContext.getUIContext().getObject(id);
- }
- }
- buffer.append("/");
- }
-
- return targetPortalObject;
- }*/
- //-----------------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- * TODO: this should be used only in classic UI case...eventually when Controller is abstracted, this will be moved to
- * the ClassicController implementation
- */
- private void render(PrintWriter clientConnection, UIContext uiContext, String targetId)
- {
- StringBuffer responseBuffer = new StringBuffer();
- UIObject uiObject = (UIObject)uiContext.getObject(targetId);
-
- //Display the page to the client
- if(uiObject instanceof UIPage)
- {
- UIPage page = (UIPage)uiObject;
- List<UIObject> windows = page.getChildren();
- for(int i=0; i<windows.size(); i++)
- {
- UIObject cour = windows.get(i);
- if(cour instanceof UIWindow)
- {
- org.jboss.portal.presentation.impl.model.UIWindowImpl window = (org.jboss.portal.presentation.impl.model.UIWindowImpl)cour;
- if(window.getContent() != null)
- {
- responseBuffer.append("<div>");
- responseBuffer.append("<div id=\"title\">"+window.getContent().getTitle()+"</div>");
- responseBuffer.append("<div id=\"content\">"+window.getContent().getMarkup()+"</div>");
- responseBuffer.append("</div><br/><br/>");
- }
- }
- }
- }
-
- //Create the final output...Also hardcoded without any preprocessing/postprocessing etc
- StringBuffer buffer = new StringBuffer();
- buffer.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>JBoss Portal UIServer</title><link rel=\"stylesheet\" id=\"dyna_css\" href=\"/portal-ajax/dyna/style.css\" type=\"text/css\"/><link rel=\"stylesheet\" type=\"text/css\" id=\"main_css\" href=\"/portal-core/themes/renaissance/portal_style.css\"/><link rel=\"shortcut icon\" href=\"/portal-core/themes/renaissance/images/favicon.ico\" /><link rel=\"icon\" type=\"image/gif\" href=\"/portal-core/themes/renaissance/images/animated_favicon1.gif\" /></head><body id=\"body\">\n");
- buffer.append(responseBuffer.toString());
- buffer.append("</body></html>\n");
-
-
- //Sending the results back to the Client
- clientConnection.write(buffer.toString());
- clientConnection.flush();
- }
-
- // ---------All these are just helper methods for the prototype-----------------------------------------------------------------------------------------------
- //----It containts mostly hard coded logic for the prototype-------------------------------------------------------------------------------------------------
- /**
- *
- */
- /*private Object[] getFlexibleGridLayoutManager(Page pageResult)
- {
-
- Page page = new Page();
- Container header = new Container("header");
- Container leftPanel = new Container("leftPanel");
- Container mainPanel = new Container("mainPanel");
- Window headerTabsWindow = new Window("header-tabs-window");
- Window menuWindow = new Window("menu-window");
- Window leftPanelWindow1 = new Window("left-panel-window1");
- Window leftPanelWindow2 = new Window("left-panel-window2");
- Window mainPanelWindow = new Window("main-panel-window");
- header.addComponent(headerTabsWindow);
- header.addComponent(menuWindow);
- leftPanel.addComponent(leftPanelWindow1);
- leftPanel.addComponent(leftPanelWindow2);
- mainPanel.addComponent(mainPanelWindow);
-
- //Setup the Grid for headerTabs container
- page.addContainer(header);
- FlexibleGrid headerGrid = this.getGrid("header", 1, 2);
- FlexibleGridConstraints[] headerTabConstraints = { this.getConstraints("header-tabs-window", "100", 0, 0, 10, 0, 0, 0),
- this.getConstraints("menu-window", "100", 0, 0, 0, 0, 0, 1) };
- headerGrid.setConstraints(headerTabConstraints);
-
- //Setup the Grid for left panel container
- page.addContainer(leftPanel);
- FlexibleGrid leftPanelGrid = this.getGrid("leftPanel", 2, 1);
- FlexibleGridConstraints[] leftPanelConstraints = { this.getConstraints("left-panel-window1", "75", 0, 0, 0, 0, 0, 0),
- this.getConstraints("left-panel-window2", "75", 0, 0, 0, 0, 1, 0) };
- leftPanelGrid.setConstraints(leftPanelConstraints);
-
- //Setup the Grid for main panel container
- page.addContainer(mainPanel);
- FlexibleGrid mainPanelGrid = this.getGrid("mainPanel", 1, 1);
- FlexibleGridConstraints[] mainPanelConstraints = { this.getConstraints("main-panel-window", "100", 0, 0, 0, 0, 0, 0) };
- mainPanelGrid.setConstraints(mainPanelConstraints);
-
- //Setup the FlexibleGrid Layout Manager with the different grids
- FlexibleGrid[] row1 = { headerGrid };
- FlexibleGrid[] row2 = { leftPanelGrid, mainPanelGrid };
- FlexibleGridLayoutManager layoutManager = new FlexibleGridLayoutManager();
- layoutManager.addRowOfGrids(row1);
- layoutManager.addRowOfGrids(row2);
-
- //Populate the grid windows with proper content
- List windows = pageResult.getWindows();
- int counter = 0;
- for(Iterator itr=windows.iterator();itr.hasNext();)
- {
- Window result = (Window)itr.next();
-
- switch(counter)
- {
- case 0:
- leftPanelWindow1.setContent(result.getContent());
- break;
-
- case 1:
- leftPanelWindow2.setContent(result.getContent());
- break;
-
- case 2:
- mainPanelWindow.setContent(result.getContent());
- break;
-
- case 3:
- menuWindow.setContent(result.getContent());
- break;
-
- case 4:
- headerTabsWindow.setContent(result.getContent());
- break;
- }
-
- counter++;
- }
-
- return new Object[]{page, layoutManager};
- }*/
-
-
- /**
- *
- * @param containerId
- * @param rows
- * @param columns
- * @return
- */
- /*private FlexibleGrid getGrid(String containerId,int rows, int columns)
- {
- FlexibleGrid grid = new FlexibleGrid(containerId);
- grid.setRows(rows);
- grid.setColumns(columns);
- return grid;
- }*/
-
- /**
- *
- * @param componentId
- * @param widthPercentage
- * @param top
- * @param bottom
- * @param left
- * @param right
- */
- /*private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
- {
- FlexibleGridConstraints constraints = new FlexibleGridConstraints();
- constraints.setComponentId(componentId);
- constraints.setWidthPercentage(widthPercentage);
- constraints.setRow(row);
- constraints.setColumn(column);
- constraints.setTop(top);
- constraints.setBottom(bottom);
- constraints.setLeft(left);
- constraints.setRight(right);
- return constraints;
- }*/
-
- /**
- *
- * @param pageResult
- * @return
- */
- /*private Object[] getRegionBasedLayoutManager(Page pageResult)
- {
- Page page = new Page();
- Container left = new Container("left");
- Container center = new Container("center");
- page.addContainer(left);
- page.addContainer(center);
-
- //Populate the grid windows with proper content
- List windows = pageResult.getWindows();
- int counter = 0;
- for(Iterator itr=windows.iterator();itr.hasNext();)
- {
- Window result = (Window)itr.next();
- Window uiWindow = new Window(result.getId());
- uiWindow.setContent(result.getContent());
- switch(counter)
- {
- case 0:
- left.addComponent(uiWindow);
- break;
-
- case 1:
- left.addComponent(uiWindow);
- break;
-
- case 2:
- center.addComponent(uiWindow);
- break;
-
- case 3:
- center.addComponent(uiWindow);
- break;
-
- case 4:
- left.addComponent(uiWindow);
- break;
- }
-
- counter++;
- }
-
- RegionLayoutManager layoutManager = new RegionLayoutManager();
- RegionConstraints leftConstraints = new RegionConstraints("left", RegionConstraints.LEFT);
- RegionConstraints centerConstraints = new RegionConstraints("center", RegionConstraints.CENTER);
- layoutManager.addRegionConstraints(leftConstraints);
- layoutManager.addRegionConstraints(centerConstraints);
-
- return new Object[]{page, layoutManager};
- }*/
-
-}
Copied: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/controller/UIController.java (from rev 9017, branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java)
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/controller/UIController.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/controller/UIController.java 2007-11-19 00:37:38 UTC (rev 9018)
@@ -0,0 +1,581 @@
+/******************************************************************************
+ * 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.client.controller;
+
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.portal.presentation.client.PresentationContext;
+import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
+import org.jboss.portal.presentation.impl.PresentationContextImpl;
+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.protocol.ServerAction;
+import org.jboss.portal.presentation.protocol.ServerResponse;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIPage;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.content.WindowContent;
+
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+
+/**
+ * The UIServer is responsible for generating the output that is sent back to the client based on the Portal state of a particular Portal Request
+ *
+ * The UIServer provides various UI level services like Page Aggregation, Page Layout, Web 2.0 client interactions etc.
+ *
+ * Typically the Core component of the Portal delegates all UI specific functions to this component
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIController implements RequestController
+{
+ /**
+ *
+ */
+ private PresentationServer presentationServer = null;
+
+
+ /**
+ *
+ *
+ */
+ public UIController()
+ {
+ }
+
+
+ /**
+ * handle is the entry point for handling an incoming Portal request. The request is handed over
+ * from the Http Layer via the main Portal Servlet
+ *
+ */
+ public void handle(ServerInvocation invocation) throws ServerException
+ {
+ try
+ {
+ HttpServletRequest request = invocation.getServerContext().getClientRequest();
+
+ /**
+ * TODO: decouple the implementation via factory pattern
+ */
+ PresentationContext presentationContext = new PresentationContextImpl(this.presentationServer,
+ invocation);
+ request.setAttribute("requestContext", presentationContext);
+
+ /**
+ * TODO: move this functionality to another component like a UIPresenter etc
+ */
+ ServerAction serverAction = this.getServerAction(presentationContext, invocation);
+
+ ProcessorRequest processorRequest = new ProcessorRequest(serverAction);
+ ProcessorResponse processorResponse = this.presentationServer.getProcessor().process(presentationContext,
+ processorRequest);
+
+ //Process the response from the Processor
+ ServerResponse serverResponse = processorResponse.getResponse();
+ this.handle(presentationContext, serverResponse, invocation);
+ }
+ catch(Exception e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ /**
+ *
+ * @param serverResponse
+ * @throws ServerException
+ */
+ private void handle(PresentationContext presentationContext, ServerResponse serverResponse, ServerInvocation invocation) throws ServerException
+ {
+ try
+ {
+ HttpServletResponse response = invocation.getServerContext().getClientResponse();
+ if(serverResponse instanceof ShowUIObjectResponse)
+ {
+ ShowUIObjectResponse show = (ShowUIObjectResponse)serverResponse;
+ String targetId = show.getTargetId();
+
+ //Load the objects in the UITree
+ UIObject uiObject = presentationContext.getUIContext().getObject(targetId);
+
+ if(uiObject instanceof UIPage)
+ {
+ UIPage page = (UIPage)uiObject;
+ //Populate the state of the Windows in the Page that is being displayed
+ //inside the UITree
+ List<UIObject> windows = page.getChildren();
+ if(windows != null)
+ {
+ for(int i=0; i<windows.size(); i++)
+ {
+ UIObject cour = windows.get(i);
+
+ if(cour instanceof UIWindow)
+ {
+ UIWindow window = (UIWindow)cour;
+ WindowContent windowContent = this.presentationServer.render(presentationContext, window);
+
+ /**
+ * TODO: decouple this from the model implementation by moving the functinality
+ * to another component like a UIPresenter etc
+ */
+ ((org.jboss.portal.presentation.impl.model.UIWindowImpl)window).
+ setContent(windowContent);
+ }
+ }
+ }
+ this.render(response.getWriter(), presentationContext.getUIContext(), targetId);
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ /**
+ *
+ *
+ */
+ public void start()
+ {
+
+ }
+
+ /**
+ *
+ *
+ */
+ public void stop()
+ {
+
+ }
+ //-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public PresentationServer getPresentationServer()
+ {
+ return presentationServer;
+ }
+
+ /**
+ *
+ * @param presentationServer
+ */
+ public void setPresentationServer(PresentationServer presentationServer)
+ {
+ this.presentationServer = presentationServer;
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ private ServerAction getServerAction(PresentationContext presentationContext, ServerInvocation invocation)
+ {
+ ServerInvocationContext invocationContext = invocation.getServerContext();
+ String requestPath = invocation.getServerContext().getPortalRequestPath();
+
+ //
+ if (requestPath.startsWith("/invoke/"))
+ {
+ UIObject target = presentationContext.getUIContext();
+
+ //
+ int from = "/invoke/".length();
+ while (true)
+ {
+ int pos = requestPath.indexOf('/', from);
+ if (pos == -1)
+ {
+ String name = requestPath.substring(from);
+ target = target.getChild(name);
+ break;
+ }
+ else
+ {
+ String name = requestPath.substring(from, pos);
+ target = target.getChild(name);
+ }
+ if (target == null)
+ {
+ break;
+ }
+ from = pos + 1;
+ }
+
+ //
+ if (target != null)
+ {
+ Map queryParameters = invocationContext.getQueryParameterMap();
+ Map bodyParameters = invocationContext.getBodyParameterMap();
+ if (bodyParameters != null)
+ {
+ return new PostActivation(target.getId(), queryParameters, bodyParameters);
+ }
+ else
+ {
+ return new GetActivation(target.getId(), queryParameters);
+ }
+ }
+ }
+
+ //Just use ViewUIObject command for now until URL interpretation/mapping
+ //to ServiceAction is implemented
+ return new ViewUIObjectAction("/default/default");
+
+ /*if(targetPortalObject instanceof UIPage)
+ {
+ serverAction = new ViewUIObjectAction(targetPortalObject.getId());
+ }
+ else if(targetPortalObject instanceof UIWindow)
+ {
+ if(request.getMethod().equals("GET"))
+ {
+ GetActivation get = new GetActivation();
+ get.setUrl(request.getRequestURL().toString());
+ get.setContentType(invocationContext.getMediaType());
+ get.setQueryParameters(invocationContext.getQueryParameterMap());
+ get.setPortal(targetPortal);
+ get.setTarget(targetPortalObject);
+ serverAction = get;
+ }
+ else if(request.getMethod().equals("POST"))
+ {
+ PostActivation post = new PostActivation();
+ post.setUrl(request.getRequestURL().toString());
+ post.setContentType(invocationContext.getMediaType());
+ post.setQueryParameters(invocationContext.getQueryParameterMap());
+ post.setBodyParameters(invocationContext.getBodyParameterMap());
+ post.setPortal(targetPortal);
+ post.setTarget(targetPortalObject);
+ serverAction = post;
+ }
+ }*/
+ }
+
+ /**
+ *
+ * @param portalRequestPath
+ * @return
+ */
+ /*private UIPortal getTargetPortal(RequestContext requestContext,String portalRequestPath)
+ {
+ UIPortal targetPortal = null;
+
+ //Parse the portalRequestPath and find the targetted Portal
+ StringTokenizer st = new StringTokenizer(portalRequestPath, "/");
+ StringBuffer buffer = new StringBuffer("/");
+ while(st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ buffer.append(token);
+ String id = buffer.toString();
+ ObjectState objectState = this.presentationServer.getModelLoader().loadState(id);
+ if(objectState != null && objectState.getType() == UIPortal.class)
+ {
+ targetPortal = (UIPortal)requestContext.getUIContext().getObject(id);
+ break;
+ }
+ buffer.append("/");
+ }
+
+ return targetPortal;
+ }*/
+
+ /**
+ *
+ * @param portalRequestPath
+ * @return
+ */
+ /*private UIObject getTargetPortalObject(RequestContext requestContext,String portalRequestPath)
+ {
+ UIObject targetPortalObject = null;
+
+ //Parse the portalRequestPath and find the targetted Portal Object (Page or Window)
+ StringTokenizer st = new StringTokenizer(portalRequestPath, "/");
+ StringBuffer buffer = new StringBuffer("/");
+ while(st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ buffer.append(token);
+ String id = buffer.toString();
+ ObjectState objectState = this.presentationServer.getModelLoader().loadState(id);
+ if(objectState != null)
+ {
+ if(objectState.getType() == UIPage.class)
+ {
+ targetPortalObject = (UIPage)requestContext.getUIContext().getObject(id);
+ }
+ else if(objectState.getType() == UIWindow.class)
+ {
+ targetPortalObject = (UIWindow)requestContext.getUIContext().getObject(id);
+ }
+ }
+ buffer.append("/");
+ }
+
+ return targetPortalObject;
+ }*/
+ //-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * TODO: this should be used only in classic UI case...eventually when Controller is abstracted, this will be moved to
+ * the ClassicController implementation
+ */
+ private void render(PrintWriter clientConnection, UIContext uiContext, String targetId)
+ {
+ StringBuffer responseBuffer = new StringBuffer();
+ UIObject uiObject = (UIObject)uiContext.getObject(targetId);
+
+ //Display the page to the client
+ if(uiObject instanceof UIPage)
+ {
+ UIPage page = (UIPage)uiObject;
+ List<UIObject> windows = page.getChildren();
+ for(int i=0; i<windows.size(); i++)
+ {
+ UIObject cour = windows.get(i);
+ if(cour instanceof UIWindow)
+ {
+ org.jboss.portal.presentation.impl.model.UIWindowImpl window = (org.jboss.portal.presentation.impl.model.UIWindowImpl)cour;
+ if(window.getContent() != null)
+ {
+ responseBuffer.append("<div>");
+ responseBuffer.append("<div id=\"title\">"+window.getContent().getTitle()+"</div>");
+ responseBuffer.append("<div id=\"content\">"+window.getContent().getMarkup()+"</div>");
+ responseBuffer.append("</div><br/><br/>");
+ }
+ }
+ }
+ }
+
+ //Create the final output...Also hardcoded without any preprocessing/postprocessing etc
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>JBoss Portal UIServer</title><link rel=\"stylesheet\" id=\"dyna_css\" href=\"/portal-ajax/dyna/style.css\" type=\"text/css\"/><link rel=\"stylesheet\" type=\"text/css\" id=\"main_css\" href=\"/portal-core/themes/renaissance/portal_style.css\"/><link rel=\"shortcut icon\" href=\"/portal-core/themes/renaissance/images/favicon.ico\" /><link rel=\"icon\" type=\"image/gif\" href=\"/portal-core/themes/renaissance/images/animated_favicon1.gif\" /></head><body id=\"body\">\n");
+ buffer.append(responseBuffer.toString());
+ buffer.append("</body></html>\n");
+
+
+ //Sending the results back to the Client
+ clientConnection.write(buffer.toString());
+ clientConnection.flush();
+ }
+
+ // ---------All these are just helper methods for the prototype-----------------------------------------------------------------------------------------------
+ //----It containts mostly hard coded logic for the prototype-------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ /*private Object[] getFlexibleGridLayoutManager(Page pageResult)
+ {
+
+ Page page = new Page();
+ Container header = new Container("header");
+ Container leftPanel = new Container("leftPanel");
+ Container mainPanel = new Container("mainPanel");
+ Window headerTabsWindow = new Window("header-tabs-window");
+ Window menuWindow = new Window("menu-window");
+ Window leftPanelWindow1 = new Window("left-panel-window1");
+ Window leftPanelWindow2 = new Window("left-panel-window2");
+ Window mainPanelWindow = new Window("main-panel-window");
+ header.addComponent(headerTabsWindow);
+ header.addComponent(menuWindow);
+ leftPanel.addComponent(leftPanelWindow1);
+ leftPanel.addComponent(leftPanelWindow2);
+ mainPanel.addComponent(mainPanelWindow);
+
+ //Setup the Grid for headerTabs container
+ page.addContainer(header);
+ FlexibleGrid headerGrid = this.getGrid("header", 1, 2);
+ FlexibleGridConstraints[] headerTabConstraints = { this.getConstraints("header-tabs-window", "100", 0, 0, 10, 0, 0, 0),
+ this.getConstraints("menu-window", "100", 0, 0, 0, 0, 0, 1) };
+ headerGrid.setConstraints(headerTabConstraints);
+
+ //Setup the Grid for left panel container
+ page.addContainer(leftPanel);
+ FlexibleGrid leftPanelGrid = this.getGrid("leftPanel", 2, 1);
+ FlexibleGridConstraints[] leftPanelConstraints = { this.getConstraints("left-panel-window1", "75", 0, 0, 0, 0, 0, 0),
+ this.getConstraints("left-panel-window2", "75", 0, 0, 0, 0, 1, 0) };
+ leftPanelGrid.setConstraints(leftPanelConstraints);
+
+ //Setup the Grid for main panel container
+ page.addContainer(mainPanel);
+ FlexibleGrid mainPanelGrid = this.getGrid("mainPanel", 1, 1);
+ FlexibleGridConstraints[] mainPanelConstraints = { this.getConstraints("main-panel-window", "100", 0, 0, 0, 0, 0, 0) };
+ mainPanelGrid.setConstraints(mainPanelConstraints);
+
+ //Setup the FlexibleGrid Layout Manager with the different grids
+ FlexibleGrid[] row1 = { headerGrid };
+ FlexibleGrid[] row2 = { leftPanelGrid, mainPanelGrid };
+ FlexibleGridLayoutManager layoutManager = new FlexibleGridLayoutManager();
+ layoutManager.addRowOfGrids(row1);
+ layoutManager.addRowOfGrids(row2);
+
+ //Populate the grid windows with proper content
+ List windows = pageResult.getWindows();
+ int counter = 0;
+ for(Iterator itr=windows.iterator();itr.hasNext();)
+ {
+ Window result = (Window)itr.next();
+
+ switch(counter)
+ {
+ case 0:
+ leftPanelWindow1.setContent(result.getContent());
+ break;
+
+ case 1:
+ leftPanelWindow2.setContent(result.getContent());
+ break;
+
+ case 2:
+ mainPanelWindow.setContent(result.getContent());
+ break;
+
+ case 3:
+ menuWindow.setContent(result.getContent());
+ break;
+
+ case 4:
+ headerTabsWindow.setContent(result.getContent());
+ break;
+ }
+
+ counter++;
+ }
+
+ return new Object[]{page, layoutManager};
+ }*/
+
+
+ /**
+ *
+ * @param containerId
+ * @param rows
+ * @param columns
+ * @return
+ */
+ /*private FlexibleGrid getGrid(String containerId,int rows, int columns)
+ {
+ FlexibleGrid grid = new FlexibleGrid(containerId);
+ grid.setRows(rows);
+ grid.setColumns(columns);
+ return grid;
+ }*/
+
+ /**
+ *
+ * @param componentId
+ * @param widthPercentage
+ * @param top
+ * @param bottom
+ * @param left
+ * @param right
+ */
+ /*private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
+ {
+ FlexibleGridConstraints constraints = new FlexibleGridConstraints();
+ constraints.setComponentId(componentId);
+ constraints.setWidthPercentage(widthPercentage);
+ constraints.setRow(row);
+ constraints.setColumn(column);
+ constraints.setTop(top);
+ constraints.setBottom(bottom);
+ constraints.setLeft(left);
+ constraints.setRight(right);
+ return constraints;
+ }*/
+
+ /**
+ *
+ * @param pageResult
+ * @return
+ */
+ /*private Object[] getRegionBasedLayoutManager(Page pageResult)
+ {
+ Page page = new Page();
+ Container left = new Container("left");
+ Container center = new Container("center");
+ page.addContainer(left);
+ page.addContainer(center);
+
+ //Populate the grid windows with proper content
+ List windows = pageResult.getWindows();
+ int counter = 0;
+ for(Iterator itr=windows.iterator();itr.hasNext();)
+ {
+ Window result = (Window)itr.next();
+ Window uiWindow = new Window(result.getId());
+ uiWindow.setContent(result.getContent());
+ switch(counter)
+ {
+ case 0:
+ left.addComponent(uiWindow);
+ break;
+
+ case 1:
+ left.addComponent(uiWindow);
+ break;
+
+ case 2:
+ center.addComponent(uiWindow);
+ break;
+
+ case 3:
+ center.addComponent(uiWindow);
+ break;
+
+ case 4:
+ left.addComponent(uiWindow);
+ break;
+ }
+
+ counter++;
+ }
+
+ RegionLayoutManager layoutManager = new RegionLayoutManager();
+ RegionConstraints leftConstraints = new RegionConstraints("left", RegionConstraints.LEFT);
+ RegionConstraints centerConstraints = new RegionConstraints("center", RegionConstraints.CENTER);
+ layoutManager.addRegionConstraints(leftConstraints);
+ layoutManager.addRegionConstraints(centerConstraints);
+
+ return new Object[]{page, layoutManager};
+ }*/
+
+}
16 years, 7 months
JBoss Portal SVN: r9017 - in branches/UIServer/core-uiserver/src: main/org/jboss/portal/core/presentation/server/content and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-18 19:08:14 -0500 (Sun, 18 Nov 2007)
New Revision: 9017
Added:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationActionContext.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortletInvocationContext.java
Modified:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java
branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml
Log:
basic support for portlet container
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-18 23:19:13 UTC (rev 9016)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-19 00:08:14 UTC (rev 9017)
@@ -33,6 +33,8 @@
import org.jboss.portal.presentation.protocol.ServerAction;
import org.jboss.portal.presentation.protocol.GetActivation;
import org.jboss.portal.presentation.protocol.LinkActivation;
+import org.jboss.portal.presentation.protocol.ErrorResponse;
+import org.jboss.portal.presentation.protocol.ServerResponse;
import org.jboss.portal.presentation.server.Processor;
import org.jboss.portal.presentation.server.ProcessorRequest;
import org.jboss.portal.presentation.server.ProcessorResponse;
@@ -42,10 +44,25 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.PortalObjectPath;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.portlet.WindowContextImpl;
+import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.CustomizationManager;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationActionContext;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationRenderContext;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationRequestContext;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationPortalContext;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationUserContext;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationSecurityContext;
import org.jboss.portal.portlet.impl.PortletRequestDecoder;
import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.RenderResponse;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
+import org.jboss.portal.identity.User;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -60,6 +77,9 @@
/** . */
private PortalObjectContainer portalObjectContainer;
+ /** . */
+ private CustomizationManager customizationManager;
+
public PortalObjectContainer getPortalObjectContainer()
{
return portalObjectContainer;
@@ -70,6 +90,16 @@
this.portalObjectContainer = portalObjectContainer;
}
+ public CustomizationManager getCustomizationManager()
+ {
+ return customizationManager;
+ }
+
+ public void setCustomizationManager(CustomizationManager customizationManager)
+ {
+ this.customizationManager = customizationManager;
+ }
+
/**
*
*/
@@ -77,7 +107,6 @@
{
try
{
- ProcessorResponse response = null;
//For now, just for prototype sake just use the existing Controller to produce the outcome
/*requestContext.getInvocation().setHandler(new RequestControllerDispatcher(this.requestController));
requestContext.getInvocation().invokeNext();
@@ -131,63 +160,96 @@
response = new ProcessorResponse(errorResponse);
}*/
ServerAction serverAction = request.getAction();
+
+ ServerResponse response = null;
+
if(serverAction instanceof ViewUIObjectAction)
{
ViewUIObjectAction viewAction = (ViewUIObjectAction)serverAction;
- ShowUIObjectResponse actionResponse = new ShowUIObjectResponse(viewAction.getTargetId());
- response = new ProcessorResponse(actionResponse);
+ response = new ShowUIObjectResponse(viewAction.getTargetId());
}
else if (serverAction instanceof LinkActivation)
{
LinkActivation getActivation = (LinkActivation)serverAction;
String id = getActivation.getTargetId();
PortalObjectId poid = PortalObjectId.parse(id, PortalObjectPath.CANONICAL_FORMAT);
- Window target = (Window)portalObjectContainer.getObject(poid);
+ Window window = (Window)portalObjectContainer.getObject(poid);
PortletRequestDecoder decoder = new PortletRequestDecoder();
decoder.decode(getActivation.getQueryParameters(), null);
// We assume that for now
- UIWindow window = (UIWindow)presentationContext.getUIContext().getObject(id);
+ UIWindow uiWindow = (UIWindow)presentationContext.getUIContext().getObject(id);
//
- switch(decoder.getType())
+ WindowState windowState = decoder.getWindowState();
+ Mode mode = decoder.getMode();
+ StateString contentState = decoder.getNavigationalState();
+
+ //
+ if (decoder.getType() == PortletRequestDecoder.ACTION_TYPE)
{
- case PortletRequestDecoder.ACTION_TYPE:
+ if (windowState == null)
+ {
+ windowState = WindowState.NORMAL;
+ }
+ if (mode == null)
+ {
+ mode = Mode.VIEW;
+ }
+ WindowNavigationalState wns = new WindowNavigationalState(windowState, mode, contentState);
+ PresentationActionContext actionContext = new PresentationActionContext(uiWindow, wns, presentationContext, decoder.getInteractionState(), decoder.getForm());
+ ActionInvocation action = new ActionInvocation(actionContext);
+ action.setRequestContext(new PresentationRequestContext(presentationContext));
+ action.setWindowContext(new WindowContextImpl(window));
+ action.setPortalContext(new PresentationPortalContext());
+ action.setUserContext(new PresentationUserContext());
+ action.setSecurityContext(new PresentationSecurityContext());
- System.out.println("TODO implement process action");
+ // We need the user id
+ User user = null; // Null for now
+ // Get instance
+ Instance instance = customizationManager.getInstance(window, user);
- break;
- case PortletRequestDecoder.NAV_TYPE:
- case PortletRequestDecoder.RENDER_TYPE:
+ //
+ PortletInvocationResponse pir = instance.invoke(action);
- //
- WindowState windowState = decoder.getWindowState();
- if (windowState != null)
- {
- window.setWindowState(windowState);
- }
+ //
+ if (pir instanceof RenderResponse)
+ {
+ RenderResponse render = (RenderResponse)pir;
+ windowState = render.getWindowState();
+ mode = render.getMode();
+ contentState = render.getNavigationalState();
+ }
+ else
+ {
+ System.out.println("TODO implement portlet invocation response handling for " + pir);
//
- Mode mode = decoder.getMode();
- if (mode != null)
- {
- window.setMode(mode);
- }
+ response = new ErrorResponse(500);
+ }
+ }
- // Update parameters
- StateString contentState = decoder.getNavigationalState();
- window.setContentState(contentState);
-
- //
- break;
+ // It means we went through a successful action or it is a render
+ if (response == null)
+ {
+ // Update navigational state
+ if (windowState != null)
+ {
+ uiWindow.setWindowState(windowState);
+ }
+ if (mode != null)
+ {
+ uiWindow.setMode(mode);
+ }
+ uiWindow.setContentState(contentState);
+ response = new ShowUIObjectResponse(window.getPage().getId().toString(PortalObjectPath.CANONICAL_FORMAT));
}
+ }
- //
- ShowUIObjectResponse actionResponse = new ShowUIObjectResponse(target.getPage().getId().toString(PortalObjectPath.CANONICAL_FORMAT));
- response = new ProcessorResponse(actionResponse);
- }
- return response;
+ //
+ return new ProcessorResponse(response);
}
catch(Exception e)
{
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-11-18 23:19:13 UTC (rev 9016)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-11-19 00:08:14 UTC (rev 9017)
@@ -102,7 +102,7 @@
public RenderInvocation createRenderInvocation(WindowNavigationalState navigationalState)
{
- RenderInvocation invocation = new RenderInvocation(new PresentationRenderContext(presentationContext, uiwindow, navigationalState));
+ RenderInvocation invocation = new RenderInvocation(new PresentationRenderContext(uiwindow, navigationalState, presentationContext));
invocation.setRequestContext(new PresentationRequestContext(presentationContext));
invocation.setWindowContext(new WindowContextImpl(window));
invocation.setPortalContext(new PresentationPortalContext());
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationActionContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationActionContext.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationActionContext.java 2007-11-19 00:08:14 UTC (rev 9017)
@@ -0,0 +1,104 @@
+/******************************************************************************
+ * 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.core.presentation.server.content.portlet;
+
+import org.jboss.portal.common.invocation.AbstractInvocationContext;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.portlet.spi.ActionContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.client.PresentationContext;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PresentationActionContext extends PresentationPortletInvocationContext implements ActionContext
+{
+
+ /** . */
+ private final StateString interactionState;
+
+ /** . */
+ private final PortletParameters form;
+
+ public PresentationActionContext(
+ UIWindow uiwindow,
+ WindowNavigationalState navigationalState,
+ PresentationContext presentationContext,
+ StateString interactionState,
+ PortletParameters form)
+ {
+ super(uiwindow, navigationalState, presentationContext);
+
+ //
+ this.interactionState = interactionState;
+ this.form = form;
+ }
+
+ public String getCharacterEncoding()
+ {
+ throw new NotYetImplemented();
+ }
+
+ public int getContentLength()
+ {
+ throw new NotYetImplemented();
+ }
+
+ public BufferedReader getReader() throws IOException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public InputStream getInputStream() throws IOException, IllegalStateException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public String getContentType()
+ {
+ throw new NotYetImplemented();
+ }
+
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public PortletParameters getForm()
+ {
+ return form;
+ }
+}
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortletInvocationContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortletInvocationContext.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortletInvocationContext.java 2007-11-19 00:08:14 UTC (rev 9017)
@@ -0,0 +1,109 @@
+/******************************************************************************
+ * 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.core.presentation.server.content.portlet;
+
+import org.jboss.portal.common.invocation.AbstractInvocationContext;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.impl.PortletRequestEncoder;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.client.PresentationContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PresentationPortletInvocationContext extends AbstractInvocationContext implements PortletInvocationContext
+{
+
+ /** . */
+ private static final MarkupInfo markupInfo = new MarkupInfo(MediaType.HTML, "UTF-8");
+
+ /** . */
+ private final UIWindow uiwindow;
+
+ /** . */
+ private final WindowNavigationalState navigationalState;
+
+ /** . */
+ private final PresentationContext presentationContext;
+
+ public PresentationPortletInvocationContext(
+ UIWindow uiwindow,
+ WindowNavigationalState navigationalState,
+ PresentationContext presentationContext)
+ {
+ this.uiwindow = uiwindow;
+ this.navigationalState = navigationalState;
+ this.presentationContext = presentationContext;
+
+ //
+ addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.PRINCIPAL_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState.getContentState();
+ }
+
+ public Mode getMode()
+ {
+ return navigationalState.getMode();
+ }
+
+ public WindowState getWindowState()
+ {
+ return navigationalState.getWindowState();
+ }
+
+ public MarkupInfo getMarkupInfo()
+ {
+ return markupInfo; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String encodeResourceURL(String url) throws IllegalArgumentException
+ {
+ return "todo";
+ }
+
+ public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+ {
+ PortletRequestEncoder encoder = new PortletRequestEncoder();
+ encoder.encode(portletURL);
+ GetActivation get = new GetActivation(uiwindow.getId(), encoder.getQueryParameters());
+ return presentationContext.render(get);
+ }
+}
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java 2007-11-18 23:19:13 UTC (rev 9016)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java 2007-11-19 00:08:14 UTC (rev 9017)
@@ -23,87 +23,18 @@
package org.jboss.portal.core.presentation.server.content.portlet;
import org.jboss.portal.portlet.spi.RenderContext;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.impl.PortletRequestEncoder;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.client.PresentationContext;
-import org.jboss.portal.presentation.protocol.GetActivation;
-import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.MediaType;
-import org.jboss.portal.common.invocation.AbstractInvocationContext;
-import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
-import java.util.HashMap;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class PresentationRenderContext extends AbstractInvocationContext implements RenderContext
+public class PresentationRenderContext extends PresentationPortletInvocationContext implements RenderContext
{
-
- /** . */
- private static final MarkupInfo markupInfo = new MarkupInfo(MediaType.HTML, "UTF-8");
-
- /** . */
- private final PresentationContext presentationContext;
-
- /** . */
- private final UIWindow uiwindow;
-
- /** . */
- private final WindowNavigationalState navigationalState;
-
-
- public PresentationRenderContext(PresentationContext presentationContext, UIWindow uiwindow, WindowNavigationalState navigationalState)
+ public PresentationRenderContext(UIWindow uiwindow, WindowNavigationalState navigationalState, PresentationContext presentationContext)
{
- this.presentationContext = presentationContext;
- this.uiwindow = uiwindow;
- this.navigationalState = navigationalState;
-
- //
- addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.PRINCIPAL_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
+ super(uiwindow, navigationalState, presentationContext);
}
-
- public StateString getNavigationalState()
- {
- return navigationalState.getContentState();
- }
-
- public Mode getMode()
- {
- return navigationalState.getMode();
- }
-
- public WindowState getWindowState()
- {
- return navigationalState.getWindowState();
- }
-
- public MarkupInfo getMarkupInfo()
- {
- return markupInfo;
- }
-
- public String encodeResourceURL(String url) throws IllegalArgumentException
- {
- return "todo";
- }
-
- public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
- {
- PortletRequestEncoder encoder = new PortletRequestEncoder();
- encoder.encode(portletURL);
- GetActivation get = new GetActivation(uiwindow.getId(), encoder.getQueryParameters());
- return presentationContext.render(get);
- }
}
Modified: branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml
===================================================================
--- branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml 2007-11-18 23:19:13 UTC (rev 9016)
+++ branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml 2007-11-19 00:08:14 UTC (rev 9017)
@@ -75,11 +75,11 @@
<depends>portal:service=InterceptorStackFactory,type=Command</depends>
<depends>portal:container=Instance</depends>
<depends>portal:service=PortalAuthorizationManagerFactory</depends>
- <depends>portal:service=CustomizationManager</depends>
<depends>portal:service=ContentProviderRegistry</depends>
<depends>portal:service=ResponseHandler,type=Selector</depends>
<depends>portal:service=ControlPolicy,type=Page</depends>
<depends optional-attribute-name="PortalObjectContainer" proxy-type="attribute">portal:container=PortalObject</depends>
+ <depends optional-attribute-name="CustomizationManager" proxy-type="attribute">portal:service=CustomizationManager</depends>
</mbean>
<mbean
code="org.jboss.portal.core.presentation.model.ModelLoaderImpl"
16 years, 7 months
JBoss Portal SVN: r9016 - in branches/UIServer: core-uiserver/src/main/org/jboss/portal/core/presentation/server/content and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-18 18:19:13 -0500 (Sun, 18 Nov 2007)
New Revision: 9016
Modified:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java
Log:
started portlet container integration
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-18 23:03:54 UTC (rev 9015)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-18 23:19:13 UTC (rev 9016)
@@ -43,6 +43,7 @@
import org.jboss.portal.core.model.portal.PortalObjectPath;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.portlet.impl.PortletRequestDecoder;
+import org.jboss.portal.portlet.StateString;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
@@ -138,7 +139,7 @@
}
else if (serverAction instanceof LinkActivation)
{
- GetActivation getActivation = (GetActivation)serverAction;
+ LinkActivation getActivation = (LinkActivation)serverAction;
String id = getActivation.getTargetId();
PortalObjectId poid = PortalObjectId.parse(id, PortalObjectPath.CANONICAL_FORMAT);
Window target = (Window)portalObjectContainer.getObject(poid);
@@ -152,7 +153,10 @@
switch(decoder.getType())
{
case PortletRequestDecoder.ACTION_TYPE:
- System.out.println("Todo call portlet action");
+
+ System.out.println("TODO implement process action");
+
+
break;
case PortletRequestDecoder.NAV_TYPE:
case PortletRequestDecoder.RENDER_TYPE:
@@ -172,7 +176,10 @@
}
// Update parameters
+ StateString contentState = decoder.getNavigationalState();
+ window.setContentState(contentState);
+ //
break;
}
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-11-18 23:03:54 UTC (rev 9015)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-11-18 23:19:13 UTC (rev 9016)
@@ -36,6 +36,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.StateString;
import org.jboss.portal.identity.User;
/**
@@ -81,14 +82,17 @@
windowState = WindowState.NORMAL;
}
+ StateString contentState = (StateString)uiwindow.getContentState();
+
//
- return new WindowNavigationalState(windowState, mode, null);
+ return new WindowNavigationalState(windowState, mode, contentState);
}
public void setNavigationalState(WindowNavigationalState navigationalState)
{
uiwindow.setWindowState(navigationalState.getWindowState());
uiwindow.setMode(navigationalState.getMode());
+ uiwindow.setContentState(navigationalState.getContentState());
}
public User getUser()
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-11-18 23:03:54 UTC (rev 9015)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-11-18 23:19:13 UTC (rev 9016)
@@ -35,19 +35,17 @@
*/
public class UIWindowImpl extends UIObjectImpl implements UIWindow
{
- /**
- *
- */
+
+ /** . */
private Mode mode = null;
- /**
- *
- */
+ /** . */
private WindowState windowState = null;
- /**
- *
- */
+ /** . */
+ private Object contentState = null;
+
+ /** . */
private WindowContent content = null;
public UIWindowImpl(UIContextImpl context, String id, ObjectState state)
@@ -95,6 +93,7 @@
public void setMode(Mode mode)
{
this.mode = mode;
+ this.content = null;
}
/**
@@ -103,8 +102,20 @@
public void setWindowState(WindowState windowState)
{
this.windowState = windowState;
- }
+ this.content = null;
+ }
+ public Object getContentState()
+ {
+ return contentState;
+ }
+
+ public void setContentState(Object contentState)
+ {
+ this.contentState = contentState;
+ this.content = null;
+ }
+
/**
*
* @param <T>
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java 2007-11-18 23:03:54 UTC (rev 9015)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java 2007-11-18 23:19:13 UTC (rev 9016)
@@ -54,4 +54,8 @@
* @param mode
*/
public void setMode(Mode mode);
+
+ public Object getContentState();
+
+ void setContentState(Object contentState);
}
16 years, 7 months
JBoss Portal SVN: r9015 - in branches/UIServer: core-uiserver/src/main/org/jboss/portal/core/presentation/server and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-18 18:03:54 -0500 (Sun, 18 Nov 2007)
New Revision: 9015
Modified:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java
branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/CreateUIObjectAction.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/GetActivation.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/LinkActivation.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/MoveUIObjectAction.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/PostActivation.java
Log:
started portlet container integration
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -88,27 +88,27 @@
{
ObjectState objectState = null;
- //Get the PortalObject corresponding to this objectId from the PortalObjectContainer
+ // Get the PortalObject corresponding to this objectId from the PortalObjectContainer
PortalObject portalObject = this.portalObjectContainer.getObject(PortalObjectId.parse(objectId,
PortalObjectPath.CANONICAL_FORMAT));
if(portalObject == null)
{
- //Object by this id was not found in the Portal
+ // Object by this id was not found in the Portal
return null;
}
- //Type
+ // Type
Class<? extends UIObject> type = this.getType(portalObject);
- //Name
+ // Name
String name = portalObject.getName();
- //Properties
+ // Properties
Map<String, String> properties = portalObject.getDeclaredProperties();
- //Parent Id
- String parentId = "";
+ // Parent Id
+ String parentId = null;
if(portalObject.getParent() != null)
{
parentId = portalObject.getParent().getId().toString();
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -31,9 +31,20 @@
import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
import org.jboss.portal.presentation.protocol.ServerAction;
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.LinkActivation;
import org.jboss.portal.presentation.server.Processor;
import org.jboss.portal.presentation.server.ProcessorRequest;
import org.jboss.portal.presentation.server.ProcessorResponse;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.PortalObjectPath;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.portlet.impl.PortletRequestDecoder;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -41,11 +52,23 @@
*/
public class MainProcessor implements Processor
{
- /**
- *
- */
+
+ /** . */
private static Logger log = Logger.getLogger(MainProcessor.class);
-
+
+ /** . */
+ private PortalObjectContainer portalObjectContainer;
+
+ public PortalObjectContainer getPortalObjectContainer()
+ {
+ return portalObjectContainer;
+ }
+
+ public void setPortalObjectContainer(PortalObjectContainer portalObjectContainer)
+ {
+ this.portalObjectContainer = portalObjectContainer;
+ }
+
/**
*
*/
@@ -112,7 +135,51 @@
ViewUIObjectAction viewAction = (ViewUIObjectAction)serverAction;
ShowUIObjectResponse actionResponse = new ShowUIObjectResponse(viewAction.getTargetId());
response = new ProcessorResponse(actionResponse);
- }
+ }
+ else if (serverAction instanceof LinkActivation)
+ {
+ GetActivation getActivation = (GetActivation)serverAction;
+ String id = getActivation.getTargetId();
+ PortalObjectId poid = PortalObjectId.parse(id, PortalObjectPath.CANONICAL_FORMAT);
+ Window target = (Window)portalObjectContainer.getObject(poid);
+ PortletRequestDecoder decoder = new PortletRequestDecoder();
+ decoder.decode(getActivation.getQueryParameters(), null);
+
+ // We assume that for now
+ UIWindow window = (UIWindow)presentationContext.getUIContext().getObject(id);
+
+ //
+ switch(decoder.getType())
+ {
+ case PortletRequestDecoder.ACTION_TYPE:
+ System.out.println("Todo call portlet action");
+ break;
+ case PortletRequestDecoder.NAV_TYPE:
+ case PortletRequestDecoder.RENDER_TYPE:
+
+ //
+ WindowState windowState = decoder.getWindowState();
+ if (windowState != null)
+ {
+ window.setWindowState(windowState);
+ }
+
+ //
+ Mode mode = decoder.getMode();
+ if (mode != null)
+ {
+ window.setMode(mode);
+ }
+
+ // Update parameters
+
+ break;
+ }
+
+ //
+ ShowUIObjectResponse actionResponse = new ShowUIObjectResponse(target.getPage().getId().toString(PortalObjectPath.CANONICAL_FORMAT));
+ response = new ProcessorResponse(actionResponse);
+ }
return response;
}
catch(Exception e)
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -98,7 +98,7 @@
public RenderInvocation createRenderInvocation(WindowNavigationalState navigationalState)
{
- RenderInvocation invocation = new RenderInvocation(new PresentationRenderContext(navigationalState));
+ RenderInvocation invocation = new RenderInvocation(new PresentationRenderContext(presentationContext, uiwindow, navigationalState));
invocation.setRequestContext(new PresentationRequestContext(presentationContext));
invocation.setWindowContext(new WindowContextImpl(window));
invocation.setPortalContext(new PresentationPortalContext());
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -25,16 +25,21 @@
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.impl.PortletRequestEncoder;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.client.PresentationContext;
+import org.jboss.portal.presentation.protocol.GetActivation;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.invocation.AbstractInvocationContext;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -43,13 +48,22 @@
{
/** . */
- private final WindowNavigationalState navigationalState;
+ private static final MarkupInfo markupInfo = new MarkupInfo(MediaType.HTML, "UTF-8");
/** . */
- private final MarkupInfo markupInfo = new MarkupInfo(MediaType.HTML, "UTF-8");
+ private final PresentationContext presentationContext;
- public PresentationRenderContext(WindowNavigationalState navigationalState)
+ /** . */
+ private final UIWindow uiwindow;
+
+ /** . */
+ private final WindowNavigationalState navigationalState;
+
+
+ public PresentationRenderContext(PresentationContext presentationContext, UIWindow uiwindow, WindowNavigationalState navigationalState)
{
+ this.presentationContext = presentationContext;
+ this.uiwindow = uiwindow;
this.navigationalState = navigationalState;
//
@@ -87,6 +101,9 @@
public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
{
- return "todo";
+ PortletRequestEncoder encoder = new PortletRequestEncoder();
+ encoder.encode(portletURL);
+ GetActivation get = new GetActivation(uiwindow.getId(), encoder.getQueryParameters());
+ return presentationContext.render(get);
}
}
Modified: branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml
===================================================================
--- branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml 2007-11-18 23:03:54 UTC (rev 9015)
@@ -69,7 +69,6 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends>portal:container=PortalObject</depends>
<depends>portal:service=PageService</depends>
<depends>portal:commandFactory=DefaultPortal</depends>
<depends>portal:urlFactory=Delegating</depends>
@@ -80,6 +79,7 @@
<depends>portal:service=ContentProviderRegistry</depends>
<depends>portal:service=ResponseHandler,type=Selector</depends>
<depends>portal:service=ControlPolicy,type=Page</depends>
+ <depends optional-attribute-name="PortalObjectContainer" proxy-type="attribute">portal:container=PortalObject</depends>
</mbean>
<mbean
code="org.jboss.portal.core.presentation.model.ModelLoaderImpl"
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-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -24,6 +24,7 @@
import java.io.PrintWriter;
import java.util.List;
+import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -37,6 +38,8 @@
import org.jboss.portal.presentation.protocol.ServerAction;
import org.jboss.portal.presentation.protocol.ServerResponse;
import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
import org.jboss.portal.presentation.model.UIContext;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIPage;
@@ -48,7 +51,6 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerInvocationContext;
-
/**
* The UIServer is responsible for generating the output that is sent back to the client based on the Portal state of a particular Portal Request
*
@@ -207,15 +209,57 @@
*/
private ServerAction getServerAction(PresentationContext presentationContext, ServerInvocation invocation)
{
- ServerAction serverAction = null;
-
ServerInvocationContext invocationContext = invocation.getServerContext();
- HttpServletRequest request = invocationContext.getClientRequest();
+ String requestPath = invocation.getServerContext().getPortalRequestPath();
+
+ //
+ if (requestPath.startsWith("/invoke/"))
+ {
+ UIObject target = presentationContext.getUIContext();
+
+ //
+ int from = "/invoke/".length();
+ while (true)
+ {
+ int pos = requestPath.indexOf('/', from);
+ if (pos == -1)
+ {
+ String name = requestPath.substring(from);
+ target = target.getChild(name);
+ break;
+ }
+ else
+ {
+ String name = requestPath.substring(from, pos);
+ target = target.getChild(name);
+ }
+ if (target == null)
+ {
+ break;
+ }
+ from = pos + 1;
+ }
+
+ //
+ if (target != null)
+ {
+ Map queryParameters = invocationContext.getQueryParameterMap();
+ Map bodyParameters = invocationContext.getBodyParameterMap();
+ if (bodyParameters != null)
+ {
+ return new PostActivation(target.getId(), queryParameters, bodyParameters);
+ }
+ else
+ {
+ return new GetActivation(target.getId(), queryParameters);
+ }
+ }
+ }
//Just use ViewUIObject command for now until URL interpretation/mapping
//to ServiceAction is implemented
- serverAction = new ViewUIObjectAction("/default/default");
-
+ return new ViewUIObjectAction("/default/default");
+
/*if(targetPortalObject instanceof UIPage)
{
serverAction = new ViewUIObjectAction(targetPortalObject.getId());
@@ -244,8 +288,6 @@
serverAction = post;
}
}*/
-
- return serverAction;
}
/**
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -26,10 +26,17 @@
import org.jboss.portal.presentation.client.PresentationContext;
import org.jboss.portal.presentation.protocol.ServerAction;
+import org.jboss.portal.presentation.protocol.LinkActivation;
+import org.jboss.portal.presentation.protocol.UIObjectAction;
import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIObject;
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.server.ServerURL;
+import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
import org.jboss.portal.web.ServletContextDispatcher;
/**
@@ -38,11 +45,11 @@
*/
public class PresentationContextImpl implements PresentationContext
{
- /**
- *
- */
+
+ /** . */
private ServerInvocation invocation = null;
+ /** . */
private PresentationServer presentationServer = null;
/**
@@ -93,6 +100,48 @@
*/
public String render(ServerAction action) throws IllegalArgumentException
{
- return "TODO";
+ if (action instanceof UIObjectAction)
+ {
+ UIObjectAction objectAction = (UIObjectAction)action;
+
+ String targetId = objectAction.getTargetId();
+
+ UIObject target = getUIContext().getObject(targetId);
+
+ //
+ if (objectAction instanceof LinkActivation)
+ {
+ StringBuffer portalRequestPath = new StringBuffer("/invoke");
+ createPath(target, portalRequestPath);
+ ServerURL url = new AbstractServerURL();
+ url.setPortalRequestPath(portalRequestPath.toString());
+ LinkActivation linkActivation = (LinkActivation)objectAction;
+ url.getParameterMap().putAll(linkActivation.getQueryParameters());
+ return invocation.getServerContext().renderURL(url, URLContext.newInstance(false, false), URLFormat.newInstance(false, true));
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
}
+
+ private static void createPath(UIObject object, StringBuffer buffer)
+ {
+ UIObject parent = object.getParent();
+
+ //
+ if (parent != null)
+ {
+ createPath(parent, buffer);
+
+ //
+ buffer.append('/').append(object.getName());
+ }
+ }
+
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -65,6 +65,9 @@
//
this.modelLoader = modelLoader;
+
+ // Put our self in the object cache
+ objects.put(getId(), this);
}
/**
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -132,8 +132,8 @@
*
*/
public UIObject getParent()
- {
- return context.getObject(parentId);
+ {
+ return parentId != null ? context.getObject(parentId) : null;
}
/**
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/CreateUIObjectAction.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/CreateUIObjectAction.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/CreateUIObjectAction.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.protocol;
+import org.jboss.portal.presentation.model.UIObject;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/GetActivation.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/GetActivation.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/GetActivation.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -22,11 +22,16 @@
******************************************************************************/
package org.jboss.portal.presentation.protocol;
+import java.util.Map;
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
public class GetActivation extends LinkActivation
{
-
+ public GetActivation(String targetId, Map queryParameters)
+ {
+ super(targetId, queryParameters);
+ }
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/LinkActivation.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/LinkActivation.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/LinkActivation.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -24,50 +24,25 @@
import java.util.Map;
-import org.jboss.portal.presentation.model.UIObject;
-
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
-public abstract class LinkActivation extends ServerAction
+public abstract class LinkActivation extends UIObjectAction
{
- /**
- *
- */
- protected String contentType = null;
-
- /**
- *
- */
- protected String url = null;
-
- /**
- *
- */
- protected Map queryParameters = null;
- /**
- * Target object where action needs to be performed
- */
- protected UIObject target = null;
+ /** julien: Not used for now . */
+ // protected String url = null;
- /**
- *
- * @return
- */
- public String getContentType()
- {
- return contentType;
- }
+ /** . */
+ protected Map queryParameters = null;
- /**
- *
- * @param contentType
- */
- public void setContentType(String contentType)
+ protected LinkActivation(String targetId, Map queryParameters)
{
- this.contentType = contentType;
+ super(targetId);
+
+ //
+ this.queryParameters = queryParameters;
}
/**
@@ -78,49 +53,4 @@
{
return queryParameters;
}
-
- /**
- *
- * @param queryParameters
- */
- public void setQueryParameters(Map queryParameters)
- {
- this.queryParameters = queryParameters;
- }
-
- /**
- *
- * @return
- */
- public String getURL()
- {
- return url;
- }
-
- /**
- *
- * @param URL
- */
- public void setURL(String URL)
- {
- this.url = URL;
- }
-
- /**
- *
- * @return
- */
- public UIObject getTarget()
- {
- return target;
- }
-
- /**
- *
- * @param target
- */
- public void setTarget(UIObject target)
- {
- this.target = target;
- }
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/MoveUIObjectAction.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/MoveUIObjectAction.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/MoveUIObjectAction.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.protocol;
+import org.jboss.portal.presentation.model.UIObject;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/PostActivation.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/PostActivation.java 2007-11-18 20:03:56 UTC (rev 9014)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/PostActivation.java 2007-11-18 23:03:54 UTC (rev 9015)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.protocol;
+import org.jboss.portal.presentation.model.UIObject;
+
import java.util.Map;
/**
@@ -30,8 +32,18 @@
*/
public class PostActivation extends LinkActivation
{
- private Map bodyParameters = null;
+ /** . */
+ private final Map bodyParameters;
+
+ public PostActivation(String targetId, Map queryParameters, Map bodyParameters)
+ {
+ super(targetId, queryParameters);
+
+ //
+ this.bodyParameters = bodyParameters;
+ }
+
/**
*
* @return
@@ -40,13 +52,4 @@
{
return bodyParameters;
}
-
- /**
- *
- * @param bodyParameters
- */
- public void setBodyParameters(Map bodyParameters)
- {
- this.bodyParameters = bodyParameters;
- }
}
16 years, 7 months
JBoss Portal SVN: r9013 - in branches/UIServer: uiserver/src/main/org/jboss/portal/presentation and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-18 15:00:55 -0500 (Sun, 18 Nov 2007)
New Revision: 9013
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java
Removed:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/entry/
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/entry/EntryPointImpl.java
Modified:
branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
branches/UIServer/uiserver/src/resources/presentation-war/WEB-INF/web.xml
Log:
- remove EntryPoint as it is possible to reuse the existing PortalServlet that will delegate to the UIController which implements RequestController provided by the ControllerFactory
Modified: branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml
===================================================================
--- branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml 2007-11-18 19:46:46 UTC (rev 9012)
+++ branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml 2007-11-18 20:00:55 UTC (rev 9013)
@@ -43,16 +43,6 @@
proxy-type="attribute">portal:service=Controller,type=Presentation</depends>
</mbean>
<mbean
- code="org.jboss.portal.presentation.impl.entry.EntryPointImpl"
- name="portal:service=EntryPoint"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends optional-attribute-name="InterceptorStackFactory" proxy-type="attribute">portal:service=InterceptorStackFactory,type=Server</depends>
- <depends optional-attribute-name="ControllerFactory" proxy-type="attribute">portal:service=ControllerFactory,type=Presentation</depends>
- <depends optional-attribute-name="PortalServer" proxy-type="attribute">portal:service=Server</depends>
- </mbean>
- <mbean
code="org.jboss.portal.core.presentation.server.PresentationServerImpl"
name="portal:service=PresentationServer"
xmbean-dd=""
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-18 19:46:46 UTC (rev 9012)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java 2007-11-18 20:00:55 UTC (rev 9013)
@@ -97,7 +97,7 @@
/**
* TODO: move this functionality to another component like a UIPresenter etc
*/
- ServerAction serverAction = this.getServerAction(presentationContext);
+ ServerAction serverAction = this.getServerAction(presentationContext, invocation);
ProcessorRequest processorRequest = new ProcessorRequest(serverAction);
ProcessorResponse processorResponse = this.presentationServer.getProcessor().process(presentationContext,
@@ -105,7 +105,7 @@
//Process the response from the Processor
ServerResponse serverResponse = processorResponse.getResponse();
- this.handle(presentationContext, serverResponse);
+ this.handle(presentationContext, serverResponse, invocation);
}
catch(Exception e)
{
@@ -118,11 +118,11 @@
* @param serverResponse
* @throws ServerException
*/
- private void handle(PresentationContext presentationContext, ServerResponse serverResponse) throws ServerException
+ private void handle(PresentationContext presentationContext, ServerResponse serverResponse, ServerInvocation invocation) throws ServerException
{
try
{
- HttpServletResponse response = presentationContext.getInvocation().getServerContext().getClientResponse();
+ HttpServletResponse response = invocation.getServerContext().getClientResponse();
if(serverResponse instanceof ShowUIObjectResponse)
{
ShowUIObjectResponse show = (ShowUIObjectResponse)serverResponse;
@@ -205,11 +205,10 @@
/**
*
*/
- private ServerAction getServerAction(PresentationContext presentationContext)
+ private ServerAction getServerAction(PresentationContext presentationContext, ServerInvocation invocation)
{
ServerAction serverAction = null;
- ServerInvocation invocation = presentationContext.getInvocation();
ServerInvocationContext invocationContext = invocation.getServerContext();
HttpServletRequest request = invocationContext.getClientRequest();
@@ -355,4 +354,186 @@
clientConnection.write(buffer.toString());
clientConnection.flush();
}
+
+ // ---------All these are just helper methods for the prototype-----------------------------------------------------------------------------------------------
+ //----It containts mostly hard coded logic for the prototype-------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ /*private Object[] getFlexibleGridLayoutManager(Page pageResult)
+ {
+
+ Page page = new Page();
+ Container header = new Container("header");
+ Container leftPanel = new Container("leftPanel");
+ Container mainPanel = new Container("mainPanel");
+ Window headerTabsWindow = new Window("header-tabs-window");
+ Window menuWindow = new Window("menu-window");
+ Window leftPanelWindow1 = new Window("left-panel-window1");
+ Window leftPanelWindow2 = new Window("left-panel-window2");
+ Window mainPanelWindow = new Window("main-panel-window");
+ header.addComponent(headerTabsWindow);
+ header.addComponent(menuWindow);
+ leftPanel.addComponent(leftPanelWindow1);
+ leftPanel.addComponent(leftPanelWindow2);
+ mainPanel.addComponent(mainPanelWindow);
+
+ //Setup the Grid for headerTabs container
+ page.addContainer(header);
+ FlexibleGrid headerGrid = this.getGrid("header", 1, 2);
+ FlexibleGridConstraints[] headerTabConstraints = { this.getConstraints("header-tabs-window", "100", 0, 0, 10, 0, 0, 0),
+ this.getConstraints("menu-window", "100", 0, 0, 0, 0, 0, 1) };
+ headerGrid.setConstraints(headerTabConstraints);
+
+ //Setup the Grid for left panel container
+ page.addContainer(leftPanel);
+ FlexibleGrid leftPanelGrid = this.getGrid("leftPanel", 2, 1);
+ FlexibleGridConstraints[] leftPanelConstraints = { this.getConstraints("left-panel-window1", "75", 0, 0, 0, 0, 0, 0),
+ this.getConstraints("left-panel-window2", "75", 0, 0, 0, 0, 1, 0) };
+ leftPanelGrid.setConstraints(leftPanelConstraints);
+
+ //Setup the Grid for main panel container
+ page.addContainer(mainPanel);
+ FlexibleGrid mainPanelGrid = this.getGrid("mainPanel", 1, 1);
+ FlexibleGridConstraints[] mainPanelConstraints = { this.getConstraints("main-panel-window", "100", 0, 0, 0, 0, 0, 0) };
+ mainPanelGrid.setConstraints(mainPanelConstraints);
+
+ //Setup the FlexibleGrid Layout Manager with the different grids
+ FlexibleGrid[] row1 = { headerGrid };
+ FlexibleGrid[] row2 = { leftPanelGrid, mainPanelGrid };
+ FlexibleGridLayoutManager layoutManager = new FlexibleGridLayoutManager();
+ layoutManager.addRowOfGrids(row1);
+ layoutManager.addRowOfGrids(row2);
+
+ //Populate the grid windows with proper content
+ List windows = pageResult.getWindows();
+ int counter = 0;
+ for(Iterator itr=windows.iterator();itr.hasNext();)
+ {
+ Window result = (Window)itr.next();
+
+ switch(counter)
+ {
+ case 0:
+ leftPanelWindow1.setContent(result.getContent());
+ break;
+
+ case 1:
+ leftPanelWindow2.setContent(result.getContent());
+ break;
+
+ case 2:
+ mainPanelWindow.setContent(result.getContent());
+ break;
+
+ case 3:
+ menuWindow.setContent(result.getContent());
+ break;
+
+ case 4:
+ headerTabsWindow.setContent(result.getContent());
+ break;
+ }
+
+ counter++;
+ }
+
+ return new Object[]{page, layoutManager};
+ }*/
+
+
+ /**
+ *
+ * @param containerId
+ * @param rows
+ * @param columns
+ * @return
+ */
+ /*private FlexibleGrid getGrid(String containerId,int rows, int columns)
+ {
+ FlexibleGrid grid = new FlexibleGrid(containerId);
+ grid.setRows(rows);
+ grid.setColumns(columns);
+ return grid;
+ }*/
+
+ /**
+ *
+ * @param componentId
+ * @param widthPercentage
+ * @param top
+ * @param bottom
+ * @param left
+ * @param right
+ */
+ /*private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
+ {
+ FlexibleGridConstraints constraints = new FlexibleGridConstraints();
+ constraints.setComponentId(componentId);
+ constraints.setWidthPercentage(widthPercentage);
+ constraints.setRow(row);
+ constraints.setColumn(column);
+ constraints.setTop(top);
+ constraints.setBottom(bottom);
+ constraints.setLeft(left);
+ constraints.setRight(right);
+ return constraints;
+ }*/
+
+ /**
+ *
+ * @param pageResult
+ * @return
+ */
+ /*private Object[] getRegionBasedLayoutManager(Page pageResult)
+ {
+ Page page = new Page();
+ Container left = new Container("left");
+ Container center = new Container("center");
+ page.addContainer(left);
+ page.addContainer(center);
+
+ //Populate the grid windows with proper content
+ List windows = pageResult.getWindows();
+ int counter = 0;
+ for(Iterator itr=windows.iterator();itr.hasNext();)
+ {
+ Window result = (Window)itr.next();
+ Window uiWindow = new Window(result.getId());
+ uiWindow.setContent(result.getContent());
+ switch(counter)
+ {
+ case 0:
+ left.addComponent(uiWindow);
+ break;
+
+ case 1:
+ left.addComponent(uiWindow);
+ break;
+
+ case 2:
+ center.addComponent(uiWindow);
+ break;
+
+ case 3:
+ center.addComponent(uiWindow);
+ break;
+
+ case 4:
+ left.addComponent(uiWindow);
+ break;
+ }
+
+ counter++;
+ }
+
+ RegionLayoutManager layoutManager = new RegionLayoutManager();
+ RegionConstraints leftConstraints = new RegionConstraints("left", RegionConstraints.LEFT);
+ RegionConstraints centerConstraints = new RegionConstraints("center", RegionConstraints.CENTER);
+ layoutManager.addRegionConstraints(leftConstraints);
+ layoutManager.addRegionConstraints(centerConstraints);
+
+ return new Object[]{page, layoutManager};
+ }*/
+
}
Copied: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java (from rev 9008, branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/entry/GWTClientFilter.java)
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java 2007-11-18 20:00:55 UTC (rev 9013)
@@ -0,0 +1,154 @@
+/******************************************************************************
+ * 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.ajax.entry;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * This filter is activated or deactivated depending on whether the Portal needs to runs in Ajax mode or Classic Html mode
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class GWTClientFilter implements Filter
+{
+ /**
+ *
+ */
+ public void init(FilterConfig arg0) throws ServletException
+ {
+ }
+
+ /**
+ *
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ *
+ */
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
+ {
+ HttpServletRequest request = (HttpServletRequest)servletRequest;
+ HttpServletResponse response = (HttpServletResponse)servletResponse;
+ String contextPath = request.getContextPath();
+
+ //Extract the resource that is being accessed
+ String resource = request.getRequestURI().replaceFirst(contextPath, "");
+ while(resource.startsWith("/"))
+ {
+ if(resource.length() > 1)
+ {
+ resource = resource.substring(1);
+ }
+ else
+ {
+ resource = "";
+ }
+ }
+
+ if(resource == null || resource.trim().length() == 0)
+ {
+ response.sendRedirect("index.html");
+ return;
+ }
+
+ //Now make sure the resource requested is a GWT resource
+ if( resource.equals("index.html") ||
+ resource.equals("portal.css") ||
+ resource.equals("mygwt-all.css") ||
+ resource.equals("mygwt-all-gray.css") ||
+ resource.equals("gwt.js") ||
+ resource.equals("prototype.js") ||
+ resource.contains(".cache.") ||
+ resource.contains(".nocache.") ||
+ resource.contains(".gwt.rpc") ||
+ resource.contains("images/default") ||
+ resource.contains("images/gray")
+ )
+ {
+ byte[] gwtResource = this.readContent(resource);
+ response.getOutputStream().write(gwtResource);
+ response.getOutputStream().flush();
+ return;
+ }
+ }
+
+ /**
+ *
+ * @param path
+ * @return
+ */
+ private byte[] readContent(String path)
+ {
+ byte[] content = null;
+
+ InputStream is = null;
+ ByteArrayOutputStream bos = null;
+ try
+ {
+ bos = new ByteArrayOutputStream();
+ is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
+ int bytesRead = 0;
+ byte[] data = new byte[1024];
+ while((bytesRead=is.read(data)) != -1)
+ {
+ byte[] cour = new byte[bytesRead];
+ System.arraycopy(data, 0, cour, 0, bytesRead);
+ bos.write(cour);
+ bos.flush();
+ }
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ if(is != null)
+ {
+ try{is.close();}catch(Exception e){}
+ }
+ if(bos != null)
+ {
+ content = bos.toByteArray();
+ try{bos.close();}catch(Exception e){}
+ }
+ }
+
+ return content;
+ }
+}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2007-11-18 19:46:46 UTC (rev 9012)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2007-11-18 20:00:55 UTC (rev 9013)
@@ -33,7 +33,6 @@
import org.jboss.portal.presentation.ajax.client.protocol.Page;
import org.jboss.portal.presentation.ajax.client.protocol.Window;
import org.jboss.portal.presentation.server.ProcessorResponse;
-import org.jboss.portal.presentation.entry.EntryPoint;
import com.google.gwt.user.client.rpc.SerializationException;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@@ -45,8 +44,7 @@
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
-public class PortalEntryPoint extends RemoteServiceServlet implements
-PortalRPC
+public class PortalEntryPoint extends RemoteServiceServlet implements PortalRPC
{
/** The logger. */
private Logger log = Logger.getLogger(getClass());
@@ -54,25 +52,25 @@
/**
*
*/
- private EntryPoint entryPoint = null;
+// private EntryPoint entryPoint = null;
/** Configure the as default servlet. */
public void init() throws ServletException
{
- try
- {
- MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
- this.entryPoint = (EntryPoint) MBeanProxy.get(EntryPoint.class, new ObjectName(
- this.getInitParameter("entryPointServiceName")),
- mbeanServer);
- }
- catch (Exception e)
- {
- this.entryPoint = null;
- String msg = "Portal Entry Point could not be created";
- log.error(msg, e);
- throw new UnavailableException(msg);
- }
+// try
+// {
+// MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+// this.entryPoint = (EntryPoint) MBeanProxy.get(EntryPoint.class, new ObjectName(
+// this.getInitParameter("entryPointServiceName")),
+// mbeanServer);
+// }
+// catch (Exception e)
+// {
+// this.entryPoint = null;
+// String msg = "Portal Entry Point could not be created";
+// log.error(msg, e);
+// throw new UnavailableException(msg);
+// }
}
/**
@@ -174,6 +172,7 @@
*/
private void callPortalServer() throws Exception
{
+/*
HttpServletRequest req = this.getThreadLocalRequest();
HttpServletResponse resp = this.getThreadLocalResponse();
String requestURI = req.getRequestURI();
@@ -218,5 +217,6 @@
InterceptorStackFactory stack = this.entryPoint.getInterceptorStackFactory();
invocation.invoke(stack.getInterceptorStack());
+*/
}
}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java 2007-11-18 19:46:46 UTC (rev 9012)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java 2007-11-18 20:00:55 UTC (rev 9013)
@@ -1,563 +0,0 @@
-/******************************************************************************
- * 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.classic.entry;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.UnavailableException;
-
-import org.apache.log4j.Logger;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.portal.common.http.QueryStringParser;
-import org.jboss.portal.common.invocation.InterceptorStackFactory;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.net.URLTools;
-import org.jboss.portal.common.util.Exceptions;
-import org.jboss.portal.server.PortalConstants;
-import org.jboss.portal.server.RequestController;
-import org.jboss.portal.server.RequestControllerDispatcher;
-import org.jboss.portal.server.RequestControllerFactory;
-import org.jboss.portal.server.Server;
-import org.jboss.portal.server.ServerException;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerInvocationContext;
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerResponse;
-import org.jboss.portal.server.impl.ServerInvocationContextImpl;
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.presentation.entry.EntryPoint;
-
-/**
- * The Portal Server Entry Point for classic html mode
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class PortalEntryPoint extends HttpServlet
-{
- /**
- *
- */
- private Logger log = Logger.getLogger(getClass());
-
- /** . */
- private static final int GET_METHOD = 0;
-
- /** . */
- private static final int POST_METHOD = 1;
-
- /** Describes a default servlet mapping. */
- private static final int DEFAULT_SERVLET_MAPPING = 0;
-
- /** Describes a root path mapping. */
- private static final int ROOT_PATH_MAPPING = 1;
-
- /** Describes a path mapping. */
- private static final int PATH_MAPPING = 2;
-
- /** Are we or not the default servlet ? */
- private boolean asDefaultServlet = false;
-
- /**
- *
- */
- private EntryPoint entryPoint = null;
-
- /** Configure the as default servlet. */
- public void init() throws ServletException
- {
- asDefaultServlet = getAsDefaultServletInitValue();
- try
- {
- MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
- this.entryPoint = (EntryPoint) MBeanProxy.get(EntryPoint.class, new ObjectName(
- this.getInitParameter("entryPointServiceName")),
- mbeanServer);
- }
- catch (Exception e)
- {
- this.entryPoint = null;
- String msg = "Portal Entry Point could not be created";
- log.error(msg, e);
- throw new UnavailableException(msg);
- }
- }
-
- /**
- *
- */
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- //
- String servletPath = req.getServletPath();
- String requestURI = req.getRequestURI();
- String contextPath = req.getContextPath();
-
- String resource = req.getRequestURI().replaceFirst(contextPath, "");
- while(resource.startsWith("/"))
- {
- if(resource.length() > 1)
- {
- resource = resource.substring(1);
- }
- else
- {
- resource = "";
- }
- }
-
- if(resource == null || resource.trim().length() == 0)
- {
- resp.sendRedirect("index.html");
- return;
- }
-
- int method;
- if ("GET".equals(req.getMethod()))
- {
- method = GET_METHOD;
- }
- else if ("POST".equals(req.getMethod()))
- {
- method = POST_METHOD;
- }
- else
- {
- throw new ServletException();
- }
-
- // Compute the media type in the content type
- String mediaType = this.entryPoint.retrieveMediaType(req.getContentType());
-
- // Only affect the charset encoding if the servlet container will decode the request
- if (method == POST_METHOD && PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED.equals(mediaType))
- {
- // Now we must ensure that we have either an equals or a trailing space after the media-type
- String characterEncoding = req.getCharacterEncoding();
- if (characterEncoding == null)
- {
- // Set out charset for the portal request
- req.setCharacterEncoding(PortalConstants.UTF_8.name());
- }
- else
- {
- Charset charset = Charset.forName(characterEncoding);
- if (!PortalConstants.UTF_8.equals(charset))
- {
- throw new ServletException("Unaccepted charset " + characterEncoding);
- }
- }
- }
-
- // Determine the mapping we have
- int mapping = DEFAULT_SERVLET_MAPPING;
- if (!asDefaultServlet)
- {
- if (servletPath.length() == 0)
- {
- mapping = ROOT_PATH_MAPPING;
- }
- else
- {
- mapping = PATH_MAPPING;
- }
- }
-
- // Determine the host for this request
- String portalHost = req.getServerName();
-
- // Determine the request path
- String portalRequestPath = null;
- String portalContextPath = null;
- switch (mapping)
- {
- case DEFAULT_SERVLET_MAPPING:
- portalRequestPath = requestURI.substring(contextPath.length());
- portalContextPath = requestURI.substring(0, contextPath.length());
- break;
- case ROOT_PATH_MAPPING:
- portalRequestPath = requestURI.substring(contextPath.length());
- portalContextPath = requestURI.substring(0, contextPath.length());
- break;
- case PATH_MAPPING:
- portalRequestPath = requestURI.substring(contextPath.length() + servletPath.length());
- portalContextPath = requestURI.substring(0, contextPath.length() + servletPath.length());
- break;
- }
-
- // Apply the url decoding
- portalRequestPath = URLTools.decodeXWWWFormURL(portalRequestPath);
- portalContextPath = URLTools.decodeXWWWFormURL(portalContextPath);
-
- //
- URLContext urlContext = URLContext.newInstance(req.isSecure(), req.getRemoteUser() != null);
-
- // ***************
- // ***************
- // ***************
- // ***************
-
- // Parse the query string to have the get parameters
- // The resulting map has its parameters decoded from the x-www-form-url encoding
- Map queryParameterMap = Collections.EMPTY_MAP;
- String queryString = req.getQueryString();
- if (queryString != null)
- {
- queryParameterMap = QueryStringParser.parseQueryString(queryString);
- }
-
- //
- Map bodyParameterMap = null;
- if (method == POST_METHOD && PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED.equals(mediaType))
- {
- bodyParameterMap = Collections.EMPTY_MAP;
- for (Iterator i = req.getParameterMap().entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
-
- // Get param name
- String paramName = (String)entry.getKey();
-
- // Values that are aggregated from the query string and the body
- String[] paramValues = (String[])entry.getValue();
-
- // Values decoded from the query string
- String[] queryValues = (String[])queryParameterMap.get(paramName);
- if (queryValues != null)
- {
- int bodyValuesLength = paramValues.length - queryValues.length;
- if (bodyValuesLength > 0)
- {
- String[] bodyValues = new String[bodyValuesLength];
- System.arraycopy(paramValues, queryValues.length, bodyValues, 0, bodyValuesLength);
- if (bodyParameterMap.isEmpty())
- {
- bodyParameterMap = new HashMap();
- }
- bodyParameterMap.put(paramName, bodyValues);
- }
- }
- else
- {
- if (bodyParameterMap.isEmpty())
- {
- bodyParameterMap = new HashMap();
- }
- bodyParameterMap.put(paramName, paramValues);
- }
- }
-
- // Make the map unmodifiable
- bodyParameterMap = bodyParameterMap.isEmpty() ? bodyParameterMap : Collections.unmodifiableMap(bodyParameterMap);
- }
-
- // ***************
- // ***************
- // ***************
- // ***************
-
- //
- Server server = this.entryPoint.getPortalServer();
-
- //
- ServerInvocationContext invocationCtx = new ServerInvocationContextImpl(
- req,
- resp,
- portalHost,
- portalRequestPath,
- portalContextPath,
- queryParameterMap,
- bodyParameterMap,
- urlContext,
- mediaType);
-
- //
- ServerRequest request = new ServerRequest(invocationCtx);
- request.setServer(server);
-
- //
- ServerResponse response = new ServerResponse(request, invocationCtx);
-
- //
- ServerInvocation invocation = new ServerInvocation(invocationCtx);
- invocation.setRequest(request);
- invocation.setResponse(response);
-
- //
- RequestControllerFactory controllerFactory = this.entryPoint.getControllerFactory();
- RequestController controller = controllerFactory.createRequestController(invocation);
- invocation.setHandler(new RequestControllerDispatcher(controller));
-
- //
- try
- {
- InterceptorStackFactory stack = this.entryPoint.getInterceptorStackFactory();
- invocation.invoke(stack.getInterceptorStack());
- }
- catch (ServerException e)
- {
- log.error("Server exception", e);
- Throwable nested = Exceptions.unwrap(e);
- throw new ServletException(nested);
- }
- catch (InvocationException e)
- {
- log.error("Invocation exception", e);
- Throwable nested = Exceptions.unwrap(e);
- throw new ServletException(nested);
- }
- catch (ServletException e)
- {
- throw e;
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- log.error("Unexpected exception", e);
- Throwable nested = Exceptions.unwrap(e);
- throw new ServletException(nested);
- }
- }
-
- /**
- * Return the value for the servlet mapping. This implementation get the
- * value from an init parameter of the servlet called <b>asDefaultServlet</b>
- */
- private boolean getAsDefaultServletInitValue()
- {
- ServletConfig config = getServletConfig();
- String value = config.getInitParameter("asDefaultServlet");
- if ("true".equalsIgnoreCase(value))
- {
- log.debug("Servlet loaded as default servlet mapping");
- return true;
- }
- else if ("false".equalsIgnoreCase(value))
- {
- log.debug("Servlet loaded as path mapping servlet");
- return false;
- }
- else
- {
- log.warn("Servlet mapping cannot be determined with init parameter value="
- + value);
- return false;
- }
- }
- // ---------All these are just helper methods for the prototype-----------------------------------------------------------------------------------------------
- //----It containts mostly hard coded logic for the prototype-------------------------------------------------------------------------------------------------
- /**
- *
- */
- /*private Object[] getFlexibleGridLayoutManager(Page pageResult)
- {
-
- Page page = new Page();
- Container header = new Container("header");
- Container leftPanel = new Container("leftPanel");
- Container mainPanel = new Container("mainPanel");
- Window headerTabsWindow = new Window("header-tabs-window");
- Window menuWindow = new Window("menu-window");
- Window leftPanelWindow1 = new Window("left-panel-window1");
- Window leftPanelWindow2 = new Window("left-panel-window2");
- Window mainPanelWindow = new Window("main-panel-window");
- header.addComponent(headerTabsWindow);
- header.addComponent(menuWindow);
- leftPanel.addComponent(leftPanelWindow1);
- leftPanel.addComponent(leftPanelWindow2);
- mainPanel.addComponent(mainPanelWindow);
-
- //Setup the Grid for headerTabs container
- page.addContainer(header);
- FlexibleGrid headerGrid = this.getGrid("header", 1, 2);
- FlexibleGridConstraints[] headerTabConstraints = { this.getConstraints("header-tabs-window", "100", 0, 0, 10, 0, 0, 0),
- this.getConstraints("menu-window", "100", 0, 0, 0, 0, 0, 1) };
- headerGrid.setConstraints(headerTabConstraints);
-
- //Setup the Grid for left panel container
- page.addContainer(leftPanel);
- FlexibleGrid leftPanelGrid = this.getGrid("leftPanel", 2, 1);
- FlexibleGridConstraints[] leftPanelConstraints = { this.getConstraints("left-panel-window1", "75", 0, 0, 0, 0, 0, 0),
- this.getConstraints("left-panel-window2", "75", 0, 0, 0, 0, 1, 0) };
- leftPanelGrid.setConstraints(leftPanelConstraints);
-
- //Setup the Grid for main panel container
- page.addContainer(mainPanel);
- FlexibleGrid mainPanelGrid = this.getGrid("mainPanel", 1, 1);
- FlexibleGridConstraints[] mainPanelConstraints = { this.getConstraints("main-panel-window", "100", 0, 0, 0, 0, 0, 0) };
- mainPanelGrid.setConstraints(mainPanelConstraints);
-
- //Setup the FlexibleGrid Layout Manager with the different grids
- FlexibleGrid[] row1 = { headerGrid };
- FlexibleGrid[] row2 = { leftPanelGrid, mainPanelGrid };
- FlexibleGridLayoutManager layoutManager = new FlexibleGridLayoutManager();
- layoutManager.addRowOfGrids(row1);
- layoutManager.addRowOfGrids(row2);
-
- //Populate the grid windows with proper content
- List windows = pageResult.getWindows();
- int counter = 0;
- for(Iterator itr=windows.iterator();itr.hasNext();)
- {
- Window result = (Window)itr.next();
-
- switch(counter)
- {
- case 0:
- leftPanelWindow1.setContent(result.getContent());
- break;
-
- case 1:
- leftPanelWindow2.setContent(result.getContent());
- break;
-
- case 2:
- mainPanelWindow.setContent(result.getContent());
- break;
-
- case 3:
- menuWindow.setContent(result.getContent());
- break;
-
- case 4:
- headerTabsWindow.setContent(result.getContent());
- break;
- }
-
- counter++;
- }
-
- return new Object[]{page, layoutManager};
- }*/
-
-
- /**
- *
- * @param containerId
- * @param rows
- * @param columns
- * @return
- */
- /*private FlexibleGrid getGrid(String containerId,int rows, int columns)
- {
- FlexibleGrid grid = new FlexibleGrid(containerId);
- grid.setRows(rows);
- grid.setColumns(columns);
- return grid;
- }*/
-
- /**
- *
- * @param componentId
- * @param widthPercentage
- * @param top
- * @param bottom
- * @param left
- * @param right
- */
- /*private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
- {
- FlexibleGridConstraints constraints = new FlexibleGridConstraints();
- constraints.setComponentId(componentId);
- constraints.setWidthPercentage(widthPercentage);
- constraints.setRow(row);
- constraints.setColumn(column);
- constraints.setTop(top);
- constraints.setBottom(bottom);
- constraints.setLeft(left);
- constraints.setRight(right);
- return constraints;
- }*/
-
- /**
- *
- * @param pageResult
- * @return
- */
- /*private Object[] getRegionBasedLayoutManager(Page pageResult)
- {
- Page page = new Page();
- Container left = new Container("left");
- Container center = new Container("center");
- page.addContainer(left);
- page.addContainer(center);
-
- //Populate the grid windows with proper content
- List windows = pageResult.getWindows();
- int counter = 0;
- for(Iterator itr=windows.iterator();itr.hasNext();)
- {
- Window result = (Window)itr.next();
- Window uiWindow = new Window(result.getId());
- uiWindow.setContent(result.getContent());
- switch(counter)
- {
- case 0:
- left.addComponent(uiWindow);
- break;
-
- case 1:
- left.addComponent(uiWindow);
- break;
-
- case 2:
- center.addComponent(uiWindow);
- break;
-
- case 3:
- center.addComponent(uiWindow);
- break;
-
- case 4:
- left.addComponent(uiWindow);
- break;
- }
-
- counter++;
- }
-
- RegionLayoutManager layoutManager = new RegionLayoutManager();
- RegionConstraints leftConstraints = new RegionConstraints("left", RegionConstraints.LEFT);
- RegionConstraints centerConstraints = new RegionConstraints("center", RegionConstraints.CENTER);
- layoutManager.addRegionConstraints(leftConstraints);
- layoutManager.addRegionConstraints(centerConstraints);
-
- return new Object[]{page, layoutManager};
- }*/
-}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/entry/EntryPointImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/entry/EntryPointImpl.java 2007-11-18 19:46:46 UTC (rev 9012)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/entry/EntryPointImpl.java 2007-11-18 20:00:55 UTC (rev 9013)
@@ -1,138 +0,0 @@
-/******************************************************************************
- * 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.entry;
-
-import org.jboss.portal.common.invocation.InterceptorStackFactory;
-import org.jboss.portal.server.RequestControllerFactory;
-import org.jboss.portal.server.Server;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.presentation.entry.EntryPoint;
-
-/**
- * Implementation of an Entry Point Utility
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class EntryPointImpl extends AbstractJBossService implements EntryPoint
-{
- /** The interceptor stack. */
- private InterceptorStackFactory interceptorStackFactory = null;
-
- /** The controller for this servlet. */
- private RequestControllerFactory controllerFactory = null;
-
- /**
- *
- */
- private Server portalServer = null;
-
-
- /**
- *
- * @return
- */
- public RequestControllerFactory getControllerFactory()
- {
- return controllerFactory;
- }
-
-
- /**
- *
- * @param controllerFactory
- */
- public void setControllerFactory(RequestControllerFactory controllerFactory)
- {
- this.controllerFactory = controllerFactory;
- }
-
-
- /**
- *
- * @return
- */
- public InterceptorStackFactory getInterceptorStackFactory()
- {
- return interceptorStackFactory;
- }
-
-
- /**
- *
- * @param interceptorStackFactory
- */
- public void setInterceptorStackFactory(
- InterceptorStackFactory interceptorStackFactory)
- {
- this.interceptorStackFactory = interceptorStackFactory;
- }
-
- /**
- *
- * @return
- */
- public Server getPortalServer()
- {
- return portalServer;
- }
-
-
- /**
- *
- * @param portalServer
- */
- public void setPortalServer(Server portalServer)
- {
- this.portalServer = portalServer;
- }
-
-
- /**
- *
- * @param contentType
- * @return
- */
- public String retrieveMediaType(String contentType)
- {
- String mediaType = contentType;
-
- //
- if (mediaType != null)
- {
- // Remove any parameters
- int index = mediaType.indexOf(';');
- if (index != -1)
- {
- mediaType = contentType.substring(0, index);
- }
-
- // Trim
- mediaType = mediaType.trim();
-
- // Media type matching is case insensitive, so we convert to lower case
- mediaType = mediaType.toLowerCase();
- }
- return mediaType;
- }
-}
Modified: branches/UIServer/uiserver/src/resources/presentation-war/WEB-INF/web.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/presentation-war/WEB-INF/web.xml 2007-11-18 19:46:46 UTC (rev 9012)
+++ branches/UIServer/uiserver/src/resources/presentation-war/WEB-INF/web.xml 2007-11-18 20:00:55 UTC (rev 9013)
@@ -40,38 +40,70 @@
<!-- The portal servlet is the main entrance point -->
<servlet>
- <servlet-name>PortalEntryPoint</servlet-name>
- <servlet-class>org.jboss.portal.presentation.impl.classic.entry.PortalEntryPoint</servlet-class>
+ <servlet-name>PortalServletWithPathMapping</servlet-name>
+ <servlet-class>org.jboss.portal.server.servlet.PortalServlet</servlet-class>
<init-param>
<param-name>asDefaultServlet</param-name>
<param-value>false</param-value>
<description>The servlet needs to know wether it is set as a default servlet or not</description>
</init-param>
<init-param>
- <param-name>entryPointServiceName</param-name>
- <param-value>portal:service=EntryPoint</param-value>
- <description>Entry Point Service</description>
+ <param-name>controllerFactoryName</param-name>
+ <param-value>portal:service=ControllerFactory,type=Presentation</param-value>
+ <description>The request controller factory for the portal servlet</description>
</init-param>
- <load-on-startup>0</load-on-startup>
- </servlet>
+ <load-on-startup>0</load-on-startup>
+ <security-role-ref>
+ <role-name>Authenticated</role-name>
+ <role-link>Authenticated</role-link>
+ </security-role-ref>
+ </servlet>
+
+ <!-- The portal servlet is the main entrance point -->
+ <servlet>
+ <servlet-name>PortalServletWithDefaultServletMapping</servlet-name>
+ <servlet-class>org.jboss.portal.server.servlet.PortalServlet</servlet-class>
+ <init-param>
+ <param-name>asDefaultServlet</param-name>
+ <param-value>true</param-value>
+ <description>The servlet needs to know wether it is set as a default servlet or not</description>
+ </init-param>
+ <init-param>
+ <param-name>controllerFactoryName</param-name>
+ <param-value>portal:service=ControllerFactory,type=Presentation</param-value>
+ <description>The request controller factory for the portal servlet</description>
+ </init-param>
+ <load-on-startup>0</load-on-startup>
+ <security-role-ref>
+ <role-name>Authenticated</role-name>
+ <role-link>Authenticated</role-link>
+ </security-role-ref>
+ </servlet>
+
+ <!-- Provide access to unauthenticated users -->
<servlet-mapping>
- <servlet-name>PortalEntryPoint</servlet-name>
+ <servlet-name>PortalServletWithPathMapping</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
+
+ <!-- Provide secure access to unauthenticated users -->
<servlet-mapping>
- <servlet-name>PortalEntryPoint</servlet-name>
+ <servlet-name>PortalServletWithPathMapping</servlet-name>
<url-pattern>/sec/*</url-pattern>
</servlet-mapping>
+
+ <!-- Provide access to authenticated users -->
<servlet-mapping>
- <servlet-name>PortalEntryPoint</servlet-name>
+ <servlet-name>PortalServletWithPathMapping</servlet-name>
<url-pattern>/auth/*</url-pattern>
</servlet-mapping>
+
+ <!-- Provide secure access to authenticated users -->
<servlet-mapping>
- <servlet-name>PortalEntryPoint</servlet-name>
+ <servlet-name>PortalServletWithPathMapping</servlet-name>
<url-pattern>/authsec/*</url-pattern>
</servlet-mapping>
-
-
+
<!-- Asynchronous service request processor -->
<servlet>
<servlet-name>AjaxPortalEntryPoint</servlet-name>
16 years, 7 months
JBoss Portal SVN: r9012 - in branches/UIServer/uiserver/src/main/org/jboss/portal/presentation: protocol and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-18 14:46:46 -0500 (Sun, 18 Nov 2007)
New Revision: 9012
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/LinkActivation.java
Log:
- remove target portal on LinkActivation
- use Java convention getURL/setURL instead of getUrl and setUrl
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java 2007-11-18 18:08:08 UTC (rev 9011)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java 2007-11-18 19:46:46 UTC (rev 9012)
@@ -92,7 +92,7 @@
* @throws IllegalArgumentException
*/
public String render(ServerAction action) throws IllegalArgumentException
- {
+ {
return "TODO";
}
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/LinkActivation.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/LinkActivation.java 2007-11-18 18:08:08 UTC (rev 9011)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/protocol/LinkActivation.java 2007-11-18 19:46:46 UTC (rev 9012)
@@ -24,7 +24,6 @@
import java.util.Map;
-import org.jboss.portal.presentation.model.UIPortal;
import org.jboss.portal.presentation.model.UIObject;
/**
@@ -47,13 +46,8 @@
*
*/
protected Map queryParameters = null;
-
+
/**
- * The Portal that the target object belongs to
- */
- protected UIPortal portal = null;
-
- /**
* Target object where action needs to be performed
*/
protected UIObject target = null;
@@ -98,42 +92,24 @@
*
* @return
*/
- public String getUrl()
+ public String getURL()
{
return url;
}
/**
*
- * @param url
+ * @param URL
*/
- public void setUrl(String url)
+ public void setURL(String URL)
{
- this.url = url;
+ this.url = URL;
}
/**
*
* @return
*/
- public UIPortal getPortal()
- {
- return portal;
- }
-
- /**
- *
- * @param portal
- */
- public void setPortal(UIPortal portal)
- {
- this.portal = portal;
- }
-
- /**
- *
- * @return
- */
public UIObject getTarget()
{
return target;
16 years, 7 months
JBoss Portal SVN: r9011 - in branches/UIServer: core-uiserver/src/main/org/jboss/portal/core/presentation/server/content and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-18 13:08:08 -0500 (Sun, 18 Nov 2007)
New Revision: 9011
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/PresentationContext.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java
Removed:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java
Modified:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRequestContext.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/Processor.java
Log:
renamed RequestContext to PresentationContext and moved into a new client package of org.jboss.portal.presentation
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-18 18:04:51 UTC (rev 9010)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -27,7 +27,7 @@
import org.jboss.portal.server.ServerException;
-import org.jboss.portal.presentation.RequestContext;
+import org.jboss.portal.presentation.client.PresentationContext;
import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
import org.jboss.portal.presentation.protocol.ServerAction;
@@ -49,7 +49,7 @@
/**
*
*/
- public ProcessorResponse process(RequestContext requestContext, ProcessorRequest request) throws ServerException
+ public ProcessorResponse process(PresentationContext presentationContext, ProcessorRequest request) throws ServerException
{
try
{
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-18 18:04:51 UTC (rev 9010)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -22,14 +22,13 @@
******************************************************************************/
package org.jboss.portal.core.presentation.server;
-import org.jboss.portal.presentation.RequestContext;
+import org.jboss.portal.presentation.client.PresentationContext;
import org.jboss.portal.presentation.server.Processor;
import org.jboss.portal.presentation.server.PresentationServer;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.model.state.ModelLoader;
import org.jboss.portal.core.controller.ControllerResponse;
-import org.jboss.portal.core.controller.Controller;
import org.jboss.portal.core.model.portal.command.response.MarkupResponse;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.PortalObjectPath;
@@ -150,7 +149,7 @@
this.portalObjectContainer = portalObjectContainer;
}
- public WindowContent render(RequestContext context, UIWindow uiwindow) throws Exception
+ public WindowContent render(PresentationContext context, UIWindow uiwindow) throws Exception
{
PortalObjectId windowId = PortalObjectId.parse(uiwindow.getId(), PortalObjectPath.CANONICAL_FORMAT);
Window window = (Window)portalObjectContainer.getObject(windowId);
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-11-18 18:04:51 UTC (rev 9010)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -32,7 +32,7 @@
import org.jboss.portal.core.presentation.server.content.portlet.PresentationUserContext;
import org.jboss.portal.core.presentation.server.content.portlet.PresentationSecurityContext;
import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.RequestContext;
+import org.jboss.portal.presentation.client.PresentationContext;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.invocation.RenderInvocation;
@@ -46,7 +46,7 @@
{
/** . */
- private final RequestContext requestContext;
+ private final PresentationContext presentationContext;
/** . */
private final UIWindow uiwindow;
@@ -54,9 +54,9 @@
/** . */
private final Window window;
- public PresentationContentRendererContext(RequestContext requestContext, UIWindow uiwindow, Window window)
+ public PresentationContentRendererContext(PresentationContext presentationContext, UIWindow uiwindow, Window window)
{
- this.requestContext = requestContext;
+ this.presentationContext = presentationContext;
this.uiwindow = uiwindow;
this.window = window;
}
@@ -99,7 +99,7 @@
public RenderInvocation createRenderInvocation(WindowNavigationalState navigationalState)
{
RenderInvocation invocation = new RenderInvocation(new PresentationRenderContext(navigationalState));
- invocation.setRequestContext(new PresentationRequestContext(requestContext));
+ invocation.setRequestContext(new PresentationRequestContext(presentationContext));
invocation.setWindowContext(new WindowContextImpl(window));
invocation.setPortalContext(new PresentationPortalContext());
invocation.setUserContext(new PresentationUserContext());
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRequestContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRequestContext.java 2007-11-18 18:04:51 UTC (rev 9010)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRequestContext.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -36,9 +36,9 @@
{
/** . */
- private final org.jboss.portal.presentation.RequestContext context;
+ private final org.jboss.portal.presentation.client.PresentationContext context;
- public PresentationRequestContext(org.jboss.portal.presentation.RequestContext context)
+ public PresentationRequestContext(org.jboss.portal.presentation.client.PresentationContext context)
{
this.context = context;
}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java 2007-11-18 18:04:51 UTC (rev 9010)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -1,58 +0,0 @@
-/******************************************************************************
- * 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;
-
-import org.jboss.portal.presentation.protocol.ServerAction;
-import org.jboss.portal.presentation.model.UIContext;
-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.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface RequestContext
-{
-
- /**
- * Create a string representation of the server action.
- *
- * @param action the server action to render
- * @return the rendition of the server action
- * @throws IllegalArgumentException if the action cannot be rendered
- */
- String render(ServerAction action) throws IllegalArgumentException;
-
- /**
- * Returns the root UI context provided by the portal.
- */
- UIContext getUIContext();
-
- /**
- *
- * @return
- */
- ServletContextDispatcher getDispatcher();
-}
Copied: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/PresentationContext.java (from rev 9010, branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java)
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/PresentationContext.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/client/PresentationContext.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * 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.client;
+
+import org.jboss.portal.presentation.protocol.ServerAction;
+import org.jboss.portal.presentation.model.UIContext;
+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.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PresentationContext
+{
+
+ /**
+ * Create a string representation of the server action.
+ *
+ * @param action the server action to render
+ * @return the rendition of the server action
+ * @throws IllegalArgumentException if the action cannot be rendered
+ */
+ String render(ServerAction action) throws IllegalArgumentException;
+
+ /**
+ * Returns the root UI context provided by the portal.
+ */
+ UIContext getUIContext();
+
+ /**
+ *
+ * @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-18 18:04:51 UTC (rev 9010)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -28,9 +28,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.jboss.portal.presentation.RequestContext;
+import org.jboss.portal.presentation.client.PresentationContext;
import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
-import org.jboss.portal.presentation.impl.RequestContextImpl;
+import org.jboss.portal.presentation.impl.PresentationContextImpl;
import org.jboss.portal.presentation.server.ProcessorRequest;
import org.jboss.portal.presentation.server.ProcessorResponse;
import org.jboss.portal.presentation.server.PresentationServer;
@@ -90,22 +90,22 @@
/**
* TODO: decouple the implementation via factory pattern
*/
- RequestContext requestContext = new RequestContextImpl(this.presentationServer,
+ PresentationContext presentationContext = new PresentationContextImpl(this.presentationServer,
invocation);
- request.setAttribute("requestContext", requestContext);
+ request.setAttribute("requestContext", presentationContext);
/**
* TODO: move this functionality to another component like a UIPresenter etc
*/
- ServerAction serverAction = this.getServerAction(requestContext);
+ ServerAction serverAction = this.getServerAction(presentationContext);
ProcessorRequest processorRequest = new ProcessorRequest(serverAction);
- ProcessorResponse processorResponse = this.presentationServer.getProcessor().process(requestContext,
+ ProcessorResponse processorResponse = this.presentationServer.getProcessor().process(presentationContext,
processorRequest);
//Process the response from the Processor
ServerResponse serverResponse = processorResponse.getResponse();
- this.handle(requestContext, serverResponse);
+ this.handle(presentationContext, serverResponse);
}
catch(Exception e)
{
@@ -118,18 +118,18 @@
* @param serverResponse
* @throws ServerException
*/
- private void handle(RequestContext requestContext, ServerResponse serverResponse) throws ServerException
+ private void handle(PresentationContext presentationContext, ServerResponse serverResponse) throws ServerException
{
try
{
- HttpServletResponse response = requestContext.getInvocation().getServerContext().getClientResponse();
+ HttpServletResponse response = presentationContext.getInvocation().getServerContext().getClientResponse();
if(serverResponse instanceof ShowUIObjectResponse)
{
ShowUIObjectResponse show = (ShowUIObjectResponse)serverResponse;
String targetId = show.getTargetId();
//Load the objects in the UITree
- UIObject uiObject = requestContext.getUIContext().getObject(targetId);
+ UIObject uiObject = presentationContext.getUIContext().getObject(targetId);
if(uiObject instanceof UIPage)
{
@@ -146,7 +146,7 @@
if(cour instanceof UIWindow)
{
UIWindow window = (UIWindow)cour;
- WindowContent windowContent = this.presentationServer.render(requestContext, window);
+ WindowContent windowContent = this.presentationServer.render(presentationContext, window);
/**
* TODO: decouple this from the model implementation by moving the functinality
@@ -157,7 +157,7 @@
}
}
}
- this.render(response.getWriter(), requestContext.getUIContext(), targetId);
+ this.render(response.getWriter(), presentationContext.getUIContext(), targetId);
}
}
}
@@ -205,11 +205,11 @@
/**
*
*/
- private ServerAction getServerAction(RequestContext requestContext)
+ private ServerAction getServerAction(PresentationContext presentationContext)
{
ServerAction serverAction = null;
- ServerInvocation invocation = requestContext.getInvocation();
+ ServerInvocation invocation = presentationContext.getInvocation();
ServerInvocationContext invocationContext = invocation.getServerContext();
HttpServletRequest request = invocationContext.getClientRequest();
Copied: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java (from rev 9010, branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java)
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -0,0 +1,98 @@
+/******************************************************************************
+ * 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.client.PresentationContext;
+import org.jboss.portal.presentation.protocol.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 PresentationContextImpl implements PresentationContext
+{
+ /**
+ *
+ */
+ private ServerInvocation invocation = null;
+
+ private PresentationServer presentationServer = null;
+
+ /**
+ *
+ * @param invocation
+ */
+ public PresentationContextImpl(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(this.presentationServer.getModelLoader());
+ session.setAttribute("uicontext", uiContext);
+ }
+
+ return uiContext;
+ }
+
+ /**
+ *
+ */
+ 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 "TODO";
+ }
+}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java 2007-11-18 18:04:51 UTC (rev 9010)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -1,98 +0,0 @@
-/******************************************************************************
- * 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.protocol.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(this.presentationServer.getModelLoader());
- session.setAttribute("uicontext", uiContext);
- }
-
- return uiContext;
- }
-
- /**
- *
- */
- 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 "TODO";
- }
-}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java 2007-11-18 18:04:51 UTC (rev 9010)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -23,12 +23,10 @@
package org.jboss.portal.presentation.impl.classic.entry;
import java.io.IOException;
-import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import javax.management.MBeanServer;
@@ -60,17 +58,7 @@
import org.jboss.portal.server.ServerResponse;
import org.jboss.portal.server.impl.ServerInvocationContextImpl;
import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.presentation.layout.LayoutManager;
-import org.jboss.portal.presentation.impl.classic.layout.FlexibleGrid;
-import org.jboss.portal.presentation.impl.classic.layout.FlexibleGridConstraints;
-import org.jboss.portal.presentation.impl.classic.layout.FlexibleGridLayoutManager;
-import org.jboss.portal.presentation.impl.classic.layout.RegionConstraints;
-import org.jboss.portal.presentation.impl.classic.layout.RegionLayoutManager;
-import org.jboss.portal.presentation.server.ProcessorResponse;
import org.jboss.portal.presentation.entry.EntryPoint;
-import org.jboss.portal.presentation.RequestContext;
-import org.jboss.portal.presentation.model.*;
-import org.jboss.portal.presentation.model.content.WindowContent;
/**
* The Portal Server Entry Point for classic html mode
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java 2007-11-18 18:04:51 UTC (rev 9010)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.server;
-import org.jboss.portal.presentation.RequestContext;
+import org.jboss.portal.presentation.client.PresentationContext;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.model.state.ModelLoader;
@@ -47,7 +47,7 @@
* @return the markup of the window
* @throws Exception for now a generic exception
*/
- WindowContent render(RequestContext context, UIWindow window) throws Exception;
+ WindowContent render(PresentationContext context, UIWindow window) throws Exception;
/**
*
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/Processor.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/Processor.java 2007-11-18 18:04:51 UTC (rev 9010)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/Processor.java 2007-11-18 18:08:08 UTC (rev 9011)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.server;
import org.jboss.portal.server.ServerException;
-import org.jboss.portal.presentation.RequestContext;
+import org.jboss.portal.presentation.client.PresentationContext;
/**
* UIServer calls the Processor to hand it
@@ -40,5 +40,5 @@
* @param request
* @throws ServerException
*/
- public ProcessorResponse process(RequestContext requestContext,ProcessorRequest request) throws ServerException;
+ public ProcessorResponse process(PresentationContext presentationContext,ProcessorRequest request) throws ServerException;
}
16 years, 7 months
JBoss Portal SVN: r9010 - in branches/UIServer: core-uiserver and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-18 13:04:51 -0500 (Sun, 18 Nov 2007)
New Revision: 9010
Added:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortalContext.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRequestContext.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationSecurityContext.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationUserContext.java
Modified:
branches/UIServer/core-uiserver/build.xml
branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml
branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java
Log:
- directly render content in the presentation server using the content integration framework (so it does not use the window render command stuff)
- remove server invocation from the presentation request context in order to not leak out this API
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-11-18 17:12:22 UTC (rev 9009)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-11-18 18:04:51 UTC (rev 9010)
@@ -39,14 +39,12 @@
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.CustomizationManager;
import org.jboss.portal.common.invocation.InterceptorStackFactory;
-import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.server.RequestController;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerException;
-import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.web.spi.ServletContainerContext;
+import org.apache.log4j.Logger;
import javax.servlet.ServletException;
import java.io.IOException;
@@ -56,10 +54,13 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class Controller extends AbstractJBossService implements RequestController, ControllerContextFactory
+public class Controller implements RequestController, ControllerContextFactory
{
/** . */
+ protected final Logger log = Logger.getLogger(getClass());
+
+ /** . */
protected PageService pageService;
/** . */
Modified: branches/UIServer/core-uiserver/build.xml
===================================================================
--- branches/UIServer/core-uiserver/build.xml 2007-11-18 17:12:22 UTC (rev 9009)
+++ branches/UIServer/core-uiserver/build.xml 2007-11-18 18:04:51 UTC (rev 9010)
@@ -99,7 +99,10 @@
<call target="configure-modules"/>
<path id="dependentmodule.classpath">
<path refid="jboss.portal-common.classpath"/>
+ <path refid="jboss.portlet-api.classpath"/>
+ <path refid="jboss.portal-portlet.classpath"/>
<path refid="jboss.portal-web.classpath"/>
+ <path refid="jboss.portal-identity.classpath"/>
<path refid="jboss.portal-jems.classpath"/>
<path refid="jboss.portal-test.classpath"/>
<path refid="jboss.portal-server.classpath"/>
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-18 17:12:22 UTC (rev 9009)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-18 18:04:51 UTC (rev 9010)
@@ -28,15 +28,19 @@
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.model.state.ModelLoader;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.Controller;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.ControllerContextFactory;
-import org.jboss.portal.core.controller.ControllerResponse;
-import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
import org.jboss.portal.core.model.portal.command.response.MarkupResponse;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.PortalObjectPath;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.content.WindowRendition;
+import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
+import org.jboss.portal.core.model.portal.content.ContentRenderer;
+import org.jboss.portal.core.model.portal.content.ContentRendererContext;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.presentation.server.content.PresentationContentRendererContext;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -45,19 +49,25 @@
public class PresentationServerImpl implements PresentationServer
{
-
- /** . */
- private ControllerContextFactory controllerContextFactory;
-
/**
*
*/
- private Processor processor = null;
+ private Processor processor;
/**
*
*/
- private ModelLoader modelLoader = null;
+ private ModelLoader modelLoader;
+
+ /**
+ *
+ */
+ private ContentRendererRegistry contentRendererRegistry;
+
+ /**
+ *
+ */
+ private PortalObjectContainer portalObjectContainer;
/**
*
@@ -119,53 +129,63 @@
{
this.processor = processor;
}
-
- /**
- *
- * @return
- */
- public ControllerContextFactory getControllerContextFactory()
+
+ public ContentRendererRegistry getContentRendererRegistry()
{
- return controllerContextFactory;
+ return contentRendererRegistry;
}
- /**
- *
- * @param controllerContextFactory
- */
- public void setControllerContextFactory(
- ControllerContextFactory controllerContextFactory)
+ public void setContentRendererRegistry(ContentRendererRegistry contentRendererRegistry)
{
- this.controllerContextFactory = controllerContextFactory;
+ this.contentRendererRegistry = contentRendererRegistry;
}
- public WindowContent render(RequestContext context, UIWindow window) throws Exception
+ public PortalObjectContainer getPortalObjectContainer()
{
- PortalObjectId windowId = PortalObjectId.parse(window.getId(), PortalObjectPath.CANONICAL_FORMAT);
- RenderWindowCommand rwc = new RenderWindowCommand(windowId);
- ControllerContext ctx = this.controllerContextFactory.getControllerContext(context.getInvocation());
- WindowRendition rendition = rwc.render(ctx);
- if (rendition != null)
+ return portalObjectContainer;
+ }
+
+ public void setPortalObjectContainer(PortalObjectContainer portalObjectContainer)
+ {
+ this.portalObjectContainer = portalObjectContainer;
+ }
+
+ public WindowContent render(RequestContext context, UIWindow uiwindow) throws Exception
+ {
+ PortalObjectId windowId = PortalObjectId.parse(uiwindow.getId(), PortalObjectPath.CANONICAL_FORMAT);
+ Window window = (Window)portalObjectContainer.getObject(windowId);
+ ContentType contentType = window.getContentType();
+ ContentRenderer renderer = contentRendererRegistry.getRenderer(contentType);
+
+ //
+ if (renderer != null)
{
+ ContentRendererContext rendererContext = new PresentationContentRendererContext(context, uiwindow, window);
+
+ //
+ WindowRendition rendition = renderer.renderWindow(rendererContext);
+
+ //
ControllerResponse response = rendition.getControllerResponse();
- // Null means we skip the window
- if (response != null)
+ //
+ if (response instanceof MarkupResponse)
{
- if (response instanceof MarkupResponse)
- {
- MarkupResponse markupResp = (MarkupResponse)response;
- return new WindowContent(-1, markupResp.getTitle(), markupResp.getContent());
- }
- else if (response != null)
- {
- // It may be an error, handle it
- }
+ MarkupResponse markupResp = (MarkupResponse)response;
+ return new WindowContent(-1, markupResp.getTitle(), markupResp.getContent());
}
+ else if (response != null)
+ {
+ return new WindowContent(-1, "", "<div>Response not yet handled " + response + "</div>");
+ }
+ else
+ {
+ return new WindowContent(-1, "", "<div>No response was provided</div>");
+ }
}
-
- return null;
-
- //return new WindowContent(-1, "MockTitle", "<div>Mock Content</div>");
+ else
+ {
+ return new WindowContent(-1, "", "<div>No renderer found for content type " + contentType + "</div>");
+ }
}
}
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-11-18 18:04:51 UTC (rev 9010)
@@ -0,0 +1,109 @@
+/******************************************************************************
+ * 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.core.presentation.server.content;
+
+import org.jboss.portal.core.model.portal.content.ContentRendererContext;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.portlet.WindowContextImpl;
+import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationRenderContext;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationRequestContext;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationPortalContext;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationUserContext;
+import org.jboss.portal.core.presentation.server.content.portlet.PresentationSecurityContext;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.RequestContext;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.identity.User;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PresentationContentRendererContext implements ContentRendererContext
+{
+
+ /** . */
+ private final RequestContext requestContext;
+
+ /** . */
+ private final UIWindow uiwindow;
+
+ /** . */
+ private final Window window;
+
+ public PresentationContentRendererContext(RequestContext requestContext, UIWindow uiwindow, Window window)
+ {
+ this.requestContext = requestContext;
+ this.uiwindow = uiwindow;
+ this.window = window;
+ }
+
+ public Window getWindow()
+ {
+ return window;
+ }
+
+ public WindowNavigationalState getNavigationalState()
+ {
+ Mode mode = uiwindow.getMode();
+ if (mode == null)
+ {
+ mode = Mode.VIEW;
+ }
+
+ //
+ WindowState windowState = uiwindow.getWindowState();
+ if (windowState == null)
+ {
+ windowState = WindowState.NORMAL;
+ }
+
+ //
+ return new WindowNavigationalState(windowState, mode, null);
+ }
+
+ public void setNavigationalState(WindowNavigationalState navigationalState)
+ {
+ uiwindow.setWindowState(navigationalState.getWindowState());
+ uiwindow.setMode(navigationalState.getMode());
+ }
+
+ public User getUser()
+ {
+ return null;
+ }
+
+ public RenderInvocation createRenderInvocation(WindowNavigationalState navigationalState)
+ {
+ RenderInvocation invocation = new RenderInvocation(new PresentationRenderContext(navigationalState));
+ invocation.setRequestContext(new PresentationRequestContext(requestContext));
+ invocation.setWindowContext(new WindowContextImpl(window));
+ invocation.setPortalContext(new PresentationPortalContext());
+ invocation.setUserContext(new PresentationUserContext());
+ invocation.setSecurityContext(new PresentationSecurityContext());
+ return invocation;
+ }
+}
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortalContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortalContext.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortalContext.java 2007-11-18 18:04:51 UTC (rev 9010)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * 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.core.presentation.server.content.portlet;
+
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+
+import java.util.Set;
+import java.util.Map;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PresentationPortalContext implements PortalContext
+{
+
+ /** . */
+ private final Set windowStates;
+
+ /** . */
+ private final Set modes;
+
+ /** . */
+ private final Map props;
+
+ public PresentationPortalContext()
+ {
+ windowStates = Collections.unmodifiableSet(new CollectionBuilder().add(WindowState.MAXIMIZED).add(WindowState.MINIMIZED).add(WindowState.NORMAL).toHashSet());
+ modes = Collections.unmodifiableSet(new CollectionBuilder().add(Mode.EDIT).add(Mode.HELP).add(Mode.VIEW).toHashSet());
+ props = Collections.EMPTY_MAP;
+ }
+
+ public String getInfo()
+ {
+ return "JBossPortal/1.0";
+ }
+
+ public Set getWindowStates()
+ {
+ return windowStates;
+ }
+
+ public Set getModes()
+ {
+ return modes;
+ }
+
+ public Map getProperties()
+ {
+ return props;
+ }
+}
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRenderContext.java 2007-11-18 18:04:51 UTC (rev 9010)
@@ -0,0 +1,92 @@
+/******************************************************************************
+ * 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.core.presentation.server.content.portlet;
+
+import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.invocation.AbstractInvocationContext;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PresentationRenderContext extends AbstractInvocationContext implements RenderContext
+{
+
+ /** . */
+ private final WindowNavigationalState navigationalState;
+
+ /** . */
+ private final MarkupInfo markupInfo = new MarkupInfo(MediaType.HTML, "UTF-8");
+
+ public PresentationRenderContext(WindowNavigationalState navigationalState)
+ {
+ this.navigationalState = navigationalState;
+
+ //
+ addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.PRINCIPAL_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState.getContentState();
+ }
+
+ public Mode getMode()
+ {
+ return navigationalState.getMode();
+ }
+
+ public WindowState getWindowState()
+ {
+ return navigationalState.getWindowState();
+ }
+
+ public MarkupInfo getMarkupInfo()
+ {
+ return markupInfo;
+ }
+
+ public String encodeResourceURL(String url) throws IllegalArgumentException
+ {
+ return "todo";
+ }
+
+ public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+ {
+ return "todo";
+ }
+}
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRequestContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRequestContext.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationRequestContext.java 2007-11-18 18:04:51 UTC (rev 9010)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.core.presentation.server.content.portlet;
+
+import org.jboss.portal.portlet.spi.RequestContext;
+import org.jboss.portal.web.spi.ServletContainerContext;
+import org.jboss.portal.web.RequestDispatchCallback;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PresentationRequestContext implements RequestContext
+{
+
+ /** . */
+ private final org.jboss.portal.presentation.RequestContext context;
+
+ public PresentationRequestContext(org.jboss.portal.presentation.RequestContext context)
+ {
+ this.context = context;
+ }
+
+ public String getScheme()
+ {
+ return "http";
+ }
+
+ public String getServerName()
+ {
+ return "localhost";
+ }
+
+ public int getServerPort()
+ {
+ return 8080;
+ }
+
+ public Object dispatch(ServletContainerContext servletContainerContext, ServletContext targetServletContext, RequestDispatchCallback callback, Object handback) throws Exception
+ {
+ return context.getDispatcher().include(targetServletContext, callback, handback);
+ }
+}
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationSecurityContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationSecurityContext.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationSecurityContext.java 2007-11-18 18:04:51 UTC (rev 9010)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * 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.core.presentation.server.content.portlet;
+
+import org.jboss.portal.portlet.spi.SecurityContext;
+
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PresentationSecurityContext implements SecurityContext
+{
+ public boolean isSecure()
+ {
+ return false;
+ }
+
+ public boolean isAuthenticated()
+ {
+ return false;
+ }
+
+ public String getAuthType()
+ {
+ return null;
+ }
+
+ public String getRemoteUser()
+ {
+ return null;
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return null;
+ }
+
+ public boolean isUserInRole(String roleName)
+ {
+ return false;
+ }
+}
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationUserContext.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationUserContext.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationUserContext.java 2007-11-18 18:04:51 UTC (rev 9010)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * 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.core.presentation.server.content.portlet;
+
+import org.jboss.portal.portlet.spi.UserContext;
+
+import java.util.Map;
+import java.util.Locale;
+import java.util.List;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PresentationUserContext implements UserContext
+{
+
+ public String getId()
+ {
+ return null;
+ }
+
+ public Map getInformations()
+ {
+ return null;
+ }
+
+ public Locale getLocale()
+ {
+ return Locale.ENGLISH;
+ }
+
+ public List getLocales()
+ {
+ return Collections.singletonList(Locale.ENGLISH);
+ }
+}
Modified: branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml
===================================================================
--- branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml 2007-11-18 17:12:22 UTC (rev 9009)
+++ branches/UIServer/core-uiserver/src/resources/presentation-sar/META-INF/jboss-service.xml 2007-11-18 18:04:51 UTC (rev 9010)
@@ -60,7 +60,8 @@
<xmbean/>
<depends optional-attribute-name="Processor" proxy-type="attribute">portal:service=Processor</depends>
<depends optional-attribute-name="ModelLoader" proxy-type="attribute">portal:container=ModelLoader</depends>
- <depends optional-attribute-name="ControllerContextFactory" proxy-type="attribute">portal:service=Controller</depends>
+ <depends optional-attribute-name="ContentRendererRegistry" proxy-type="attribute">portal:service=ContentProviderRegistry</depends>
+ <depends optional-attribute-name="PortalObjectContainer" proxy-type="attribute">portal:container=PortalObject</depends>
<depends>portal:service=PageService</depends>
<depends>portal:commandFactory=DefaultPortal</depends>
<depends>portal:urlFactory=Delegating</depends>
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-18 17:12:22 UTC (rev 9009)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java 2007-11-18 18:04:51 UTC (rev 9010)
@@ -49,16 +49,10 @@
* 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/impl/RequestContextImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java 2007-11-18 17:12:22 UTC (rev 9009)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/RequestContextImpl.java 2007-11-18 18:04:51 UTC (rev 9010)
@@ -79,14 +79,6 @@
/**
*
*/
- public ServerInvocation getInvocation()
- {
- return this.invocation;
- }
-
- /**
- *
- */
public ServletContextDispatcher getDispatcher()
{
return new ServletContextDispatcher(this.invocation.getServerContext().getClientRequest(),
@@ -101,6 +93,6 @@
*/
public String render(ServerAction action) throws IllegalArgumentException
{
- return null;
+ return "TODO";
}
}
16 years, 7 months
JBoss Portal SVN: r9009 - in branches/UIServer: core/src/main/org/jboss/portal/core/impl/model/content/generic and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-18 12:12:22 -0500 (Sun, 18 Nov 2007)
New Revision: 9009
Added:
branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/content/ContentRendererContext.java
Modified:
branches/UIServer/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java
branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/portlet/InternalPortletContentProvider.java
branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java
branches/UIServer/uiserver/build.xml
Log:
port the content renderer framework improvement from 2.6
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2007-11-18 15:13:49 UTC (rev 9008)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2007-11-18 17:12:22 UTC (rev 9009)
@@ -26,24 +26,21 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.core.aspects.portlet.AjaxInterceptor;
-import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.response.UnavailableResourceResponse;
import org.jboss.portal.core.controller.command.response.SecurityErrorResponse;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.content.spi.ContentProvider;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.content.WindowRendition;
+import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.command.response.MarkupResponse;
-import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
import org.jboss.portal.core.model.portal.content.ContentRenderer;
+import org.jboss.portal.core.model.portal.content.ContentRendererContext;
+import org.jboss.portal.core.model.portal.content.WindowRendition;
import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
-import org.jboss.portal.core.navstate.NavigationalStateKey;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
@@ -138,26 +135,34 @@
/**
* Returns the portlet instance to render view mode.
*
- * @param command
+ * @param rendererContext
* @return the portlet instance for the view mode
*/
- protected abstract Instance getPortletInstance(RenderWindowCommand command);
+ protected abstract Instance getPortletInstance(ContentRendererContext rendererContext);
- public WindowRendition renderWindow(RenderWindowCommand cmd)
+ public WindowRendition renderWindow(ContentRendererContext rendererContext)
{
- Window window = cmd.getWindow();
- Portal portal = cmd.getPortal();
- ControllerContext context = cmd.getControllerContext();
+ Window window = rendererContext.getWindow();
- PortalObjectId windowId = window.getId();
- NavigationalStateKey nsKey = new NavigationalStateKey(WindowNavigationalState.class, windowId);
- WindowNavigationalState windowNS = (WindowNavigationalState)context.getAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, nsKey);
+ // Get the parent portal
+ Portal portal = null;
+ for (PortalObject current = window;current != null;current = current.getParent())
+ {
+ if (current.getType() == PortalObject.TYPE_PORTAL)
+ {
+ portal = (Portal)current;
+ break;
+ }
+ }
//
+ WindowNavigationalState windowNS = rendererContext.getNavigationalState();
+
+ //
if (windowNS == null)
{
windowNS = new WindowNavigationalState(WindowState.NORMAL, Mode.VIEW, null);
- context.setAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, nsKey, windowNS);
+ rendererContext.setNavigationalState(windowNS);
}
//
@@ -166,7 +171,7 @@
WindowState windowState = windowNS.getWindowState();
// Obtain instance
- Instance instance = getPortletInstance(cmd);
+ Instance instance = getPortletInstance(rendererContext);
// No instance means we can't continue
if (instance == null)
@@ -186,13 +191,7 @@
}
// Create invocation
- RenderInvocation invocation = PortletInvocationFactory.createRender(
- context,
- mode,
- windowState,
- windowNS.getContentState(),
- window,
- portal);
+ RenderInvocation invocation = rendererContext.createRenderInvocation(new WindowNavigationalState(windowState, mode, windowNS.getContentState()));
//
List supportedWindowStates = Collections.EMPTY_LIST;
@@ -231,7 +230,7 @@
}
// Remove edit mode if the user is not logged it
- if (context.getServerInvocation().getServerContext().getClientRequest().getUserPrincipal() == null)
+ if (rendererContext.getUser() == null)
{
supportedModes.remove(Mode.EDIT);
}
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-11-18 15:13:49 UTC (rev 9008)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-11-18 17:12:22 UTC (rev 9009)
@@ -22,6 +22,9 @@
******************************************************************************/
package org.jboss.portal.core.impl.model.content.generic;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.core.impl.model.content.InternalContentProvider;
import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.model.content.spi.ContentProvider;
import org.jboss.portal.core.model.content.ContentType;
@@ -31,18 +34,12 @@
import org.jboss.portal.core.model.content.spi.portlet.ContentPortlet;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.command.response.MarkupResponse;
+import org.jboss.portal.core.model.portal.content.ContentRendererContext;
import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.impl.model.content.InternalContentProvider;
-import org.jboss.portal.core.navstate.NavigationalStateKey;
import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.common.invocation.AttributeResolver;
import java.util.Iterator;
import java.util.Map;
@@ -129,16 +126,14 @@
return new GenericContent(state);
}
- protected Instance getPortletInstance(RenderWindowCommand command)
+ protected Instance getPortletInstance(ContentRendererContext rendererContext)
{
String id = contentPortlet.getPortletName(Mode.VIEW);
//
if (id != null)
{
- ControllerContext context = command.getControllerContext();
- InstanceContainer container = context.getController().getInstanceContainer();
- return container.getDefinition(id);
+ return instanceContainer.getDefinition(id);
}
else
{
@@ -154,10 +149,9 @@
{
}
- public WindowRendition renderWindow(RenderWindowCommand cmd)
+ public WindowRendition renderWindow(ContentRendererContext rendererContext)
{
- ControllerContext context = cmd.getControllerContext();
- Window window = cmd.getWindow();
+ Window window = rendererContext.getWindow();
PortalObjectId windowId = window.getId();
// No content
@@ -168,11 +162,9 @@
}
//
- AttributeResolver nsResolver = context.getAttributeResolver(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE);
// Initialize the navigational state with the URI when needed
- NavigationalStateKey nsKey = new NavigationalStateKey(WindowNavigationalState.class, windowId);
- WindowNavigationalState navigationalState = (WindowNavigationalState)nsResolver.getAttribute(nsKey);
+ WindowNavigationalState navigationalState = rendererContext.getNavigationalState();
//
// boolean update = true;
@@ -203,11 +195,11 @@
state.setValue("uri", uri);
//
- WindowNavigationalState.setState(nsResolver, nsKey, state);
+ rendererContext.setNavigationalState(WindowNavigationalState.bilto(navigationalState, null, null, state));
}
//
- WindowRendition rendition = super.renderWindow(cmd);
+ WindowRendition rendition = super.renderWindow(rendererContext);
//
if (rendition != null && rendition.getControllerResponse() instanceof MarkupResponse && !getDecorateContent())
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/portlet/InternalPortletContentProvider.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/portlet/InternalPortletContentProvider.java 2007-11-18 15:13:49 UTC (rev 9008)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/impl/model/content/portlet/InternalPortletContentProvider.java 2007-11-18 17:12:22 UTC (rev 9009)
@@ -28,7 +28,6 @@
import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.portal.common.i18n.SimpleResourceBundleFactory;
import org.jboss.portal.common.util.EmptyResourceBundle;
-import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.impl.model.content.InternalContentProvider;
import org.jboss.portal.core.model.CustomizationManager;
import org.jboss.portal.core.model.content.Content;
@@ -40,7 +39,7 @@
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.content.ContentRendererContext;
import org.jboss.portal.identity.User;
/**
@@ -179,15 +178,13 @@
// ContentRenderer implementation ***********************************************************************************
- protected Instance getPortletInstance(RenderWindowCommand command)
+ protected Instance getPortletInstance(ContentRendererContext rendererContext)
{
- ControllerContext context = command.getControllerContext();
-
// The window
- Window window = command.getWindow();
+ Window window = rendererContext.getWindow();
// We need the user id
- User user = context.getUser();
+ User user = rendererContext.getUser();
// Get instance
return customizationManager.getInstance(window, user);
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2007-11-18 15:13:49 UTC (rev 9008)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2007-11-18 17:12:22 UTC (rev 9009)
@@ -25,21 +25,28 @@
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.portal.content.WindowRendition;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.control.page.PageControlContext;
+import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.model.portal.content.ContentRenderer;
import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
+import org.jboss.portal.core.model.portal.content.ContentRendererContext;
+import org.jboss.portal.core.navstate.NavigationalStateKey;
+import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class RenderWindowCommand extends WindowCommand
+public class RenderWindowCommand extends WindowCommand implements ContentRendererContext
{
/** . */
@@ -98,4 +105,34 @@
//
return null;
}
+
+ public WindowNavigationalState getNavigationalState()
+ {
+ AttributeResolver nsResolver = context.getAttributeResolver(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE);
+ NavigationalStateKey nsKey = new NavigationalStateKey(WindowNavigationalState.class, window.getId());
+ return (WindowNavigationalState)nsResolver.getAttribute(nsKey);
+ }
+
+ public void setNavigationalState(WindowNavigationalState navigationalState)
+ {
+ AttributeResolver nsResolver = context.getAttributeResolver(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE);
+ NavigationalStateKey nsKey = new NavigationalStateKey(WindowNavigationalState.class, window.getId());
+ nsResolver.setAttribute(nsKey, navigationalState);
+ }
+
+ public User getUser()
+ {
+ return context.getUser();
+ }
+
+ public RenderInvocation createRenderInvocation(WindowNavigationalState navigationalState)
+ {
+ return PortletInvocationFactory.createRender(
+ context,
+ navigationalState.getMode(),
+ navigationalState.getWindowState(),
+ navigationalState.getContentState(),
+ window,
+ portal);
+ }
}
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java 2007-11-18 15:13:49 UTC (rev 9008)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java 2007-11-18 17:12:22 UTC (rev 9009)
@@ -22,14 +22,11 @@
******************************************************************************/
package org.jboss.portal.core.model.portal.content;
-import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
-import org.jboss.portal.core.model.portal.content.WindowRendition;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public interface ContentRenderer
{
- WindowRendition renderWindow(RenderWindowCommand cmd);
+ WindowRendition renderWindow(ContentRendererContext rendererContext);
}
Copied: branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/content/ContentRendererContext.java (from rev 9006, branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/content/ContentRendererContext.java)
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/content/ContentRendererContext.java (rev 0)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/content/ContentRendererContext.java 2007-11-18 17:12:22 UTC (rev 9009)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * 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.core.model.portal.content;
+
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+
+/**
+ * Abstract the services provided to a content renderer for the render phase.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ContentRendererContext
+{
+
+ Window getWindow();
+
+ WindowNavigationalState getNavigationalState();
+
+ void setNavigationalState(WindowNavigationalState navigationalState);
+
+ User getUser();
+
+ RenderInvocation createRenderInvocation(WindowNavigationalState navigationalState);
+}
Modified: branches/UIServer/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java
===================================================================
--- branches/UIServer/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java 2007-11-18 15:13:49 UTC (rev 9008)
+++ branches/UIServer/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java 2007-11-18 17:12:22 UTC (rev 9009)
@@ -23,12 +23,12 @@
package org.jboss.portal.core.cms.content;
import org.jboss.portal.core.impl.model.content.generic.InternalGenericContentProvider;
-import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.content.WindowRendition;
import org.jboss.portal.core.model.content.spi.portlet.ContentPortlet;
import org.jboss.portal.core.cms.CMSObjectCommandFactory;
import org.jboss.portal.Mode;
+import org.jboss.portal.core.model.portal.content.ContentRendererContext;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -89,11 +89,11 @@
super.start();
}
- public WindowRendition renderWindow(RenderWindowCommand cmd)
+ public WindowRendition renderWindow(ContentRendererContext rendererContext)
{
try
{
- PortalObjectId windowId = cmd.getWindow().getId();
+ PortalObjectId windowId = rendererContext.getWindow().getId();
//
if (windowId.equals(targetWindowId))
@@ -102,7 +102,7 @@
}
//
- return super.renderWindow(cmd);
+ return super.renderWindow(rendererContext);
}
finally
{
Modified: branches/UIServer/uiserver/build.xml
===================================================================
--- branches/UIServer/uiserver/build.xml 2007-11-18 15:13:49 UTC (rev 9008)
+++ branches/UIServer/uiserver/build.xml 2007-11-18 17:12:22 UTC (rev 9009)
@@ -99,12 +99,11 @@
<!-- Configure modules -->
<call target="configure-modules"/>
<path id="dependentmodule.classpath">
- <path refid="jboss.portlet-api.classpath"/>
- <path refid="jboss.portal-jems.classpath"/>
- <path refid="jboss.portal-common.classpath"/>
- <path refid="jboss.portal-server.classpath"/>
- <path refid="jboss.portal-web.classpath"/>
- <path refid="jboss.portal-core-uiserver.classpath"/>
+ <path refid="jboss.portlet-api.classpath"/>
+ <path refid="jboss.portal-jems.classpath"/>
+ <path refid="jboss.portal-common.classpath"/>
+ <path refid="jboss.portal-server.classpath"/>
+ <path refid="jboss.portal-web.classpath"/>
</path>
<!--+=======================================+-->
16 years, 7 months