Author: julien(a)jboss.com
Date: 2008-02-04 17:24:27 -0500 (Mon, 04 Feb 2008)
New Revision: 9749
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestPortalContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageUpdate.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ResourceControllerResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/AbstractMarkupRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ControllerResponseRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ControllerResponseRendererFactory.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ErrorResponseRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/FragmentRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/PageUpdateRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/PortletControllerContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/RedirectResponseRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ResourceRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/SimpleFragmentRenderer.java
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/FragmentRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderControllerResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RenderControllerResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/SimpleFragmentRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ViewRequestHandler.java
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ControllerResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorControllerResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageNavigationalState.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletController.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletRequestHandler.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletResourceRequestHandler.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectControllerResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RequestHandler.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/SimplePortalServlet.java
Log:
splitted the controller in 2 (controller and controller2 for now)
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -24,7 +24,12 @@
import org.jboss.portal.portlet.test.controller.ControllerResponse;
import org.jboss.portal.portlet.test.controller.PortletController;
-import org.jboss.portal.portlet.test.controller.PortletControllerContextImpl;
+import org.jboss.portal.portlet.test.controller2.PortletControllerContextImpl;
+import org.jboss.portal.portlet.test.controller.PageUpdate;
+import org.jboss.portal.portlet.test.controller.PageNavigationalState;
+import org.jboss.portal.portlet.test.controller2.ControllerResponseRendererFactory;
+import org.jboss.portal.portlet.test.controller2.ControllerResponseRenderer;
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -70,7 +75,26 @@
//
PortletController controller = new PortletController();
- ControllerResponse response = controller.process(context.getRequest());
- response.render(context);
+ if (context.getRequest() != null)
+ {
+ //
+ ControllerResponse response = controller.process(context.getRequest());
+
+ //
+ ControllerResponseRenderer renderer =
ControllerResponseRendererFactory.getRenderer(response);
+
+ //
+ renderer.render(context);
+ }
+ else
+ {
+ PageUpdate pageUpdate = new PageUpdate(new ResponseProperties(), new
PageNavigationalState());
+
+ //
+ ControllerResponseRenderer renderer =
ControllerResponseRendererFactory.getRenderer(pageUpdate);
+
+ //
+ renderer.render(context);
+ }
}
}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestPortalContext.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestPortalContext.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestPortalContext.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * 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.portlet.test;
+
+import org.jboss.portal.portlet.impl.spi.AbstractPortalContext;
+
+import java.util.Map;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class TestPortalContext extends AbstractPortalContext
+{
+ public TestPortalContext()
+ {
+
super(Collections.singletonMap("javax.portlet.markup.head.element.support",
"true"));
+ }
+}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ControllerResponse.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ControllerResponse.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ControllerResponse.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -35,7 +35,6 @@
* <p/>
* Typical usage should be : ControllerResponse response =
controller.invoker(ControllerRequest request);
*/
-public interface ControllerResponse
+public abstract class ControllerResponse
{
- void render(PortletControllerContext context) throws IOException;
}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorControllerResponse.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorControllerResponse.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorControllerResponse.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -23,38 +23,22 @@
package org.jboss.portal.portlet.test.controller;
-import org.apache.log4j.Logger;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import java.io.IOException;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
*/
-public class ErrorControllerResponse implements ControllerResponse
+public class ErrorControllerResponse extends ControllerResponse
{
- private ErrorResponse error;
- private static final Logger log = Logger.getLogger(ErrorControllerResponse.class);
+ /** . */
+ public ErrorResponse error;
+
+
public ErrorControllerResponse(ErrorResponse error)
{
this.error = error;
}
- public void render(PortletControllerContext context) throws IOException
- {
- //
- if (error.getCause() != null)
- {
- log.error("Portlet action threw an error: " + error.getMessage(),
error.getCause());
- }
- else
- {
- log.error("Portlet action threw an error: " + error.getMessage());
- }
-
- //
- context.getClientResponse().sendError(404, error.getMessage());
- }
}
Deleted:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/FragmentRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/FragmentRenderer.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/FragmentRenderer.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -1,38 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.controller;
-
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- */
-public interface FragmentRenderer
-{
- String renderPortlet(FragmentResponse fragment);
-
- String renderError(ErrorResponse error);
-}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageNavigationalState.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageNavigationalState.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageNavigationalState.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -25,7 +25,6 @@
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.test.WindowNavigationalState;
-import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.ParameterInfo;
import javax.xml.namespace.QName;
Deleted:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderControllerResponse.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderControllerResponse.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderControllerResponse.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -1,245 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.controller;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.util.MultiValuedPropertyMap;
-import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.common.xml.XMLTools;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
-import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
-import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
-import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
-import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.ResponseProperties;
-import org.jboss.portal.portlet.test.PortletURLRenderer;
-import org.jboss.portal.portlet.test.TestInstanceContext;
-import org.jboss.portal.portlet.test.TestRenderContext;
-import org.jboss.portal.portlet.test.WindowNavigationalState;
-import org.w3c.dom.Element;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- */
-public class PageRenderControllerResponse extends RenderControllerResponse
-{
- private FragmentRenderer fragmentRenderer = new SimpleFragmentRenderer();
- private List<FragmentResponse> fragments;
- private List<ErrorResponse> errors;
- private PageNavigationalState pageState;
-
- public PageRenderControllerResponse(ResponseProperties properties,
PageNavigationalState pageState)
- {
- super(properties);
- this.pageState = pageState;
- }
-
- public void setFragmentRenderer(FragmentRenderer fragmentRenderer)
- {
- this.fragmentRenderer = fragmentRenderer;
- }
-
- protected void renderContent(HttpServletResponse resp) throws IOException
- {
- //
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
- writer.print("<html>");
-
- // Render the head contributions
- writer.print("<head>");
- MultiValuedPropertyMap<Element> markupHeaders =
properties.getMarkupHeaders();
- List<Element> headElement =
markupHeaders.getValues("javax.portlet.markup.head.element");
- if (headElement != null)
- {
- for (Element headerValue : headElement)
- {
- try
- {
- String serializedElement = XMLTools.toString(headerValue);
- writer.print(serializedElement);
- }
- catch (Exception e)
- {
- // todo
- e.printStackTrace();
- }
- }
- }
- writer.print("</head>");
-
-
- writer.print("<body>");
- for (FragmentResponse fragment : fragments)
- {
- writer.print(fragmentRenderer.renderPortlet(fragment));
-
- }
-
- for (ErrorResponse error : errors)
- {
- writer.print(fragmentRenderer.renderError(error));
- }
-
- writer.print("</body></html>");
- }
-
- protected void prepareRendering(PortletControllerContext context)
- {
-
- // What we collect during the different renders
- // we don't reuse the render properties argument since we want to avoid that
- // a portlet rendition affects another rendition of a portlet on the same page
- ResponseProperties renderProperties = new ResponseProperties();
-
- //
- try
- {
- Collection<Portlet> portlets = context.getPortlets();
-
- int capacity = portlets.size();
- fragments = new ArrayList<FragmentResponse>(capacity);
- errors = new ArrayList<ErrorResponse>(capacity);
-
- for (Portlet portlet : portlets)
- {
- WindowNavigationalState windowNS =
pageState.getWindowNavigationalState(portlet.getContext().getId());
-
- //
- Mode mode = Mode.VIEW;
- WindowState windowState = WindowState.NORMAL;
- StateString portletNS = null;
-
- //
- if (windowNS != null)
- {
- if (windowNS.getMode() != null)
- {
- mode = windowNS.getMode();
- }
- if (windowNS.getWindowState() != null)
- {
- windowState = windowNS.getWindowState();
- }
- if (windowNS.getPortletNavigationalState() != null)
- {
- portletNS = windowNS.getPortletNavigationalState();
- }
- }
-
- //
- ParameterMap publicNS = pageState.getPublicNavigationalState(portlet);
-
- RenderInvocation render = createRenderInvocation(context, properties,
pageState, portlet, windowNS, mode, windowState, portletNS, publicNS);
-
- //
- try
- {
- PortletInvocationResponse response = context.invoke(render);
-
- if (response instanceof FragmentResponse)
- {
- FragmentResponse fragment = (FragmentResponse)response;
-
- //
- fragments.add(fragment);
-
- //
- ResponseProperties fragmentProperties = fragment.getProperties();
- if (fragmentProperties != null)
- {
- renderProperties.append(fragmentProperties);
- }
- }
- else if (response instanceof ErrorResponse)
- {
- ErrorResponse error = (ErrorResponse)response;
- errors.add(error);
- }
-
- }
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
- }
- }
- }
- catch (PortletInvokerException e)
- {
- // todo
- e.printStackTrace();
- }
-
- // Now we combine the render properties with the page properties
- properties.append(renderProperties);
- }
-
- protected RenderInvocation createRenderInvocation(
- PortletControllerContext context, ResponseProperties pageProperties,
PageNavigationalState pageNS, Portlet portlet,
- WindowNavigationalState windowNS, Mode mode, WindowState windowState, StateString
portletNS, ParameterMap publicNS)
- {
- HttpServletRequest req = context.getClientRequest();
- HttpServletResponse resp = context.getClientResponse();
-
- //
- PortletURLRenderer renderer = new PortletURLRenderer(pageNS, windowNS, portlet,
req, resp);
- //
- TestInstanceContext instanceContext = new TestInstanceContext(req,
portlet.getContext(), false);
-
- TestRenderContext renderContext = new TestRenderContext(renderer,
PortletController.MARKUP_INFO);
-
- //
- RenderInvocation render = new RenderInvocation(renderContext);
- render.setClientContext(new AbstractClientContext(req,
pageProperties.getCookies()));
- render.setServerContext(new AbstractServerContext(req, resp));
- render.setInstanceContext(instanceContext);
- render.setUserContext(new AbstractUserContext(req));
- render.setWindowContext(new AbstractWindowContext(portlet.getContext().getId()));
- render.setPortalContext(PortletController.getPortalContext());
- render.setSecurityContext(new AbstractSecurityContext(req));
- render.setTarget(instanceContext.getTarget());
- render.setMode(mode);
- render.setWindowState(windowState);
- render.setNavigationalState(portletNS);
- render.setPublicNavigationalState(publicNS);
- return render;
- }
-}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageUpdate.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageUpdate.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageUpdate.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.portlet.test.controller;
+
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageUpdate extends ControllerResponse
+{
+
+ /** . */
+ private ResponseProperties properties;
+
+ /** . */
+ private PageNavigationalState pageState;
+
+ public PageUpdate(ResponseProperties properties, PageNavigationalState pageState)
+ {
+ this.properties = properties;
+ this.pageState = pageState;
+ }
+
+ public ResponseProperties getProperties()
+ {
+ return properties;
+ }
+
+ public PageNavigationalState getPageState()
+ {
+ return pageState;
+ }
+}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletController.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletController.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletController.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -44,7 +44,7 @@
{
/** . */
- static final MarkupInfo MARKUP_INFO = new MarkupInfo(MediaType.HTML,
"UTF8");
+ public static final MarkupInfo MARKUP_INFO = new MarkupInfo(MediaType.HTML,
"UTF8");
/** . */
static final PortalContext portalContext;
@@ -61,12 +61,8 @@
{
RequestHandler handler;
- if (controllerRequest instanceof ViewRequest)
+ if (controllerRequest instanceof PortletRequest)
{
- handler = new ViewRequestHandler(this);
- }
- else if (controllerRequest instanceof PortletRequest)
- {
handler = new PortletRequestHandler(this);
}
else if (controllerRequest instanceof PortletResourceRequest)
@@ -81,13 +77,8 @@
return handler.handle(controllerRequest);
}
- static PortalContext getPortalContext()
+ public static class ControllerRequest
{
- return portalContext;
- }
-
- static class ControllerRequest
- {
/** . */
final PortletControllerContext controllerContext;
@@ -97,16 +88,8 @@
}
}
- static class ViewRequest extends ControllerRequest
+ public static class ContainerRequest extends ControllerRequest
{
- ViewRequest(PortletControllerContext controllerContext)
- {
- super(controllerContext);
- }
- }
-
- static class ContainerRequest extends ControllerRequest
- {
/** . */
final String portletId;
@@ -119,7 +102,7 @@
}
}
- static class PortletRequest extends ContainerRequest
+ public static class PortletRequest extends ContainerRequest
{
/** . */
final PageNavigationalState pageState;
@@ -141,7 +124,7 @@
}
}
- static abstract class PortletResourceRequest extends ContainerRequest
+ public static abstract class PortletResourceRequest extends ContainerRequest
{
/** . */
private static final Map<Class, CacheLevel> cacheability = new
HashMap<Class, CacheLevel>();
@@ -184,9 +167,9 @@
}
}
- static class FullScopedCacheablePortletResourceRequest extends PortletResourceRequest
+ public static class FullScopedCacheablePortletResourceRequest extends
PortletResourceRequest
{
- FullScopedCacheablePortletResourceRequest(
+ public FullScopedCacheablePortletResourceRequest(
PortletControllerContext controllerContext,
String portletId,
String resourceId,
@@ -197,12 +180,12 @@
}
}
- static class PortletScopedPortletResourceRequest extends
FullScopedCacheablePortletResourceRequest
+ public static class PortletScopedPortletResourceRequest extends
FullScopedCacheablePortletResourceRequest
{
/** . */
final WindowNavigationalState windowNavigationalState;
- PortletScopedPortletResourceRequest(
+ public PortletScopedPortletResourceRequest(
PortletControllerContext controllerContext,
String portletId,
String resourceId,
@@ -217,12 +200,12 @@
}
}
- static class PageScopedFullPortletResourceRequest extends
PortletScopedPortletResourceRequest
+ public static class PageScopedFullPortletResourceRequest extends
PortletScopedPortletResourceRequest
{
/** . */
private final PageNavigationalState pageState;
- PageScopedFullPortletResourceRequest(
+ public PageScopedFullPortletResourceRequest(
PortletControllerContext controllerContext,
String portletId,
String resourceId,
@@ -243,7 +226,7 @@
}
}
- static class PortletActionRequest extends PortletRequest
+ public static class PortletActionRequest extends PortletRequest
{
/** . */
final StateString interactionState;
@@ -267,7 +250,7 @@
}
}
- static class PortletRenderRequest extends PortletRequest
+ public static class PortletRenderRequest extends PortletRequest
{
/** . */
final Map<String, String[]> publicNavigationalStateChanges;
Deleted:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -1,282 +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.portlet.test.controller;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.cache.CacheLevel;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.test.controller.PageNavigationalState;
-import org.jboss.portal.portlet.test.StringCodec;
-import static org.jboss.portal.portlet.test.URLParameterConstants.*;
-import org.jboss.portal.portlet.test.WindowNavigationalState;
-import org.jboss.portal.portlet.test.event.EventControllerContext;
-import org.jboss.portal.portlet.test.event.EventControllerContextImpl;
-import org.jboss.portal.web.Body;
-import org.jboss.portal.web.IllegalRequestException;
-import org.jboss.portal.web.WebRequest;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletControllerContextImpl implements PortletControllerContext
-{
-
- /** . */
- public static final int NAV_SCOPE = 0;
-
- /** . */
- public static final int SESSION_SCOPE = 1;
-
- /** . */
- private final HttpServletRequest req;
-
- /** . */
- private final HttpServletResponse resp;
-
- /** . */
- private final ServletContext servletContext;
-
- /** . */
- private final PortletController.ControllerRequest request;
-
- /** . */
- private final PortletInvoker invoker;
-
- /** . */
- private final EventControllerContext eventControllerContext;
-
- public PortletControllerContextImpl(
- HttpServletRequest req,
- HttpServletResponse resp,
- ServletContext servletContext)
- throws IllegalRequestException, IOException, ClassNotFoundException
- {
- PortletInvoker invoker =
(PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
-
- // The nav state provided with the request
- PageNavigationalState pageState = null;
-
- // The request decoded if not null
- PortletController.ControllerRequest request = null;
-
- // Process
- String pathInfo = req.getPathInfo();
- if (pathInfo != null && pathInfo.startsWith("/") &&
pathInfo.length() > 1)
- {
- // Get the target portlet
- String targetId = StringCodec.decode(pathInfo.substring(1));
-
- // Helper
- WebRequest ri = new WebRequest(req);
-
- // Unmarshall portal navigational state if it is provided
- String context = req.getParameter(PAGE_STATE);
- if (context != null)
- {
- byte[] bytes = Tools.fromHexString(context);
- pageState = PageNavigationalState.unserialize(bytes);
- }
-
- //
- Mode mode = null;
- if (req.getParameter(MODE) != null)
- {
- mode = Mode.create(req.getParameter(MODE));
- }
-
- //
- WindowState windowState = null;
- if (req.getParameter(WINDOW_STATE) != null)
- {
- windowState = WindowState.create(req.getParameter(WINDOW_STATE));
- }
-
- //
- String navigationalStateString = req.getParameter(NAVIGATIONAL_STATE);
- StateString navigationalState = null;
- if (navigationalStateString != null)
- {
- navigationalState = ParametersStateString.create(navigationalStateString);
- }
-
- //
- WindowNavigationalState windowNavigationalState = new
WindowNavigationalState(navigationalState, mode, windowState);
-
- //
- String type = req.getParameter(LIFECYCLE_TYPE);
- if (RESOURCE_LIFECYCLE.equals(type))
- {
- StateString resourceState =
ParametersStateString.create(req.getParameter(RESOURCE_STATE));
- String resourceId = req.getParameter(RESOURCE_ID);
-
- //
- ParameterMap formParameters = null;
- if (ri.getBody() instanceof Body.Form)
- {
- formParameters = ((Body.Form)ri.getBody()).getParameters();
- }
-
- //
- CacheLevel resourceCacheLevel =
CacheLevel.valueOf(req.getParameter(RESOURCE_CACHEABILITY));
-
- //
- switch (resourceCacheLevel)
- {
- case FULL:
- request = new
PortletController.FullScopedCacheablePortletResourceRequest(
- this,
- targetId,
- resourceId,
- resourceState,
- formParameters);
- break;
- case PORTLET:
- request = new PortletController.PortletScopedPortletResourceRequest(
- this,
- targetId,
- resourceId,
- resourceState,
- formParameters,
- windowNavigationalState);
- break;
- case PAGE:
- request = new PortletController.PageScopedFullPortletResourceRequest(
- this,
- targetId,
- resourceId,
- resourceState,
- formParameters,
- pageState,
- windowNavigationalState);
- break;
- }
- }
- else
- {
- if (ACTION_LIFECYCLE.equals(type))
- {
- ParameterMap formParameters = null;
- if (ri.getBody() instanceof Body.Form)
- {
- formParameters = ((Body.Form)ri.getBody()).getParameters();
- }
-
- //
- StateString interactionState =
ParametersStateString.create(req.getParameter(INTERACTION_STATE));
-
- //
- request = new PortletController.PortletActionRequest(
- this,
- targetId,
- interactionState,
- formParameters,
- windowNavigationalState,
- pageState);
- }
- else
- {
- Map<String, String[]> publicNavigationalStateChanges =
(Map<String,
String[]>)IOTools.unserialize(Tools.fromHexString(req.getParameter(PUBLIC_NAVIGATIONAL_STATE_CHANGES)));
-
- //
- request = new PortletController.PortletRenderRequest(
- this,
- targetId,
- windowNavigationalState,
- publicNavigationalStateChanges,
- pageState);
- }
- }
- }
- else
- {
- request = new PortletController.ViewRequest(this);
- }
-
- //
- this.request = request;
- this.req = req;
- this.resp = resp;
- this.servletContext = servletContext;
- this.invoker = invoker;
- this.eventControllerContext = new EventControllerContextImpl(invoker);
- }
-
- public PortletController.ControllerRequest getRequest()
- {
- return request;
- }
-
- public ServletContext getServletContext()
- {
- return servletContext;
- }
-
- public HttpServletRequest getClientRequest()
- {
- return req;
- }
-
- public HttpServletResponse getClientResponse()
- {
- return resp;
- }
-
- public Portlet getPortlet(String portletId) throws PortletInvokerException
- {
- return invoker.getPortlet(PortletContext.createPortletContext(portletId));
- }
-
- public PortletInvocationResponse invoke(PortletInvocation invocation) throws
PortletInvokerException
- {
- return invoker.invoke(invocation);
- }
-
- public Collection<Portlet> getPortlets() throws PortletInvokerException
- {
- return invoker.getPortlets();
- }
-
- public EventControllerContext getEventControllerContext()
- {
- return eventControllerContext;
- }
-}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletRequestHandler.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletRequestHandler.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletRequestHandler.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -31,6 +31,7 @@
import org.jboss.portal.portlet.test.TestEventContext;
import org.jboss.portal.portlet.test.TestInstanceContext;
import org.jboss.portal.portlet.test.WindowNavigationalState;
+import org.jboss.portal.portlet.test.TestPortalContext;
import static org.jboss.portal.portlet.test.controller.PortletController.*;
import org.jboss.portal.portlet.test.event.Event;
import org.jboss.portal.portlet.test.event.EventControllerContext;
@@ -48,8 +49,9 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
*/
-public class PortletRequestHandler extends RequestHandler<PortletRequest>
+class PortletRequestHandler extends RequestHandler<PortletRequest>
{
+
public PortletRequestHandler(PortletController controller)
{
super(controller);
@@ -161,7 +163,8 @@
System.out.println("Not yet handled " + response);
}
- return new PageRenderControllerResponse(requestProperties, pageState);
+ //
+ return new PageUpdate(requestProperties, pageState);
}
PortletInvocationResponse invoke(PortletRequest portletRequest) throws
PortletInvokerException
@@ -232,7 +235,7 @@
actionInvocation.setInstanceContext(instanceContext);
actionInvocation.setUserContext(new AbstractUserContext(req));
actionInvocation.setWindowContext(new
AbstractWindowContext(portlet.getContext().getId()));
- actionInvocation.setPortalContext(getPortalContext());
+ actionInvocation.setPortalContext(new TestPortalContext());
actionInvocation.setSecurityContext(new AbstractSecurityContext(req));
actionInvocation.setRequestContext(new AbstractRequestContext(req));
actionInvocation.setTarget(instanceContext.getTarget());
@@ -287,7 +290,7 @@
eventInvocation.setInstanceContext(instanceContext);
eventInvocation.setUserContext(new AbstractUserContext(req));
eventInvocation.setWindowContext(new
AbstractWindowContext(portlet.getContext().getId()));
- eventInvocation.setPortalContext(getPortalContext());
+ eventInvocation.setPortalContext(new TestPortalContext());
eventInvocation.setSecurityContext(new AbstractSecurityContext(req));
eventInvocation.setTarget(instanceContext.getTarget());
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletResourceRequestHandler.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletResourceRequestHandler.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletResourceRequestHandler.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -45,6 +45,7 @@
import org.jboss.portal.portlet.test.ResourceTestContext;
import org.jboss.portal.portlet.test.TestInstanceContext;
import org.jboss.portal.portlet.test.WindowNavigationalState;
+import org.jboss.portal.portlet.test.TestPortalContext;
import static org.jboss.portal.portlet.test.controller.PortletController.*;
import javax.servlet.http.HttpServletRequest;
@@ -55,7 +56,7 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
*/
-public class PortletResourceRequestHandler extends
RequestHandler<PortletResourceRequest>
+class PortletResourceRequestHandler extends RequestHandler<PortletResourceRequest>
{
public PortletResourceRequestHandler(PortletController controller)
{
@@ -69,7 +70,7 @@
{
FragmentResponse fragment = (FragmentResponse)response;
- return new ResourceRenderControllerResponse(fragment.getProperties(),
fragment);
+ return new ResourceControllerResponse(fragment);
}
else
{
@@ -163,7 +164,7 @@
resourceInvocation.setInstanceContext(instanceContext);
resourceInvocation.setUserContext(new AbstractUserContext(req));
resourceInvocation.setWindowContext(new
AbstractWindowContext(portlet.getContext().getId()));
- resourceInvocation.setPortalContext(getPortalContext());
+ resourceInvocation.setPortalContext(new TestPortalContext());
resourceInvocation.setSecurityContext(new AbstractSecurityContext(req));
resourceInvocation.setRequestContext(new AbstractRequestContext(req));
resourceInvocation.setTarget(instanceContext.getTarget());
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectControllerResponse.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectControllerResponse.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectControllerResponse.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -25,23 +25,18 @@
import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
-import java.io.IOException;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
*/
-public class RedirectControllerResponse implements ControllerResponse
+public class RedirectControllerResponse extends ControllerResponse
{
- private HTTPRedirectionResponse redirection;
+ /** . */
+ public HTTPRedirectionResponse redirection;
+
public RedirectControllerResponse(HTTPRedirectionResponse redirection)
{
this.redirection = redirection;
}
-
- public void render(PortletControllerContext context) throws IOException
- {
- context.getClientResponse().sendRedirect(redirection.getLocation());
- }
}
Deleted:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RenderControllerResponse.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RenderControllerResponse.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RenderControllerResponse.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -1,91 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.controller;
-
-import org.jboss.portal.common.util.MultiValuedPropertyMap;
-import org.jboss.portal.portlet.invocation.response.ResponseProperties;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- */
-public abstract class RenderControllerResponse implements ControllerResponse
-{
- protected ResponseProperties properties = new ResponseProperties();
-
- protected RenderControllerResponse(ResponseProperties properties)
- {
- this.properties = properties;
- }
-
- public void render(PortletControllerContext context) throws IOException
- {
- prepareRendering(context);
- HttpServletResponse resp = context.getClientResponse();
-
- // Render the headers and cookies
- if (properties != null)
- {
- renderTransportHeaders(properties, resp);
- renderCookies(properties, resp);
- }
-
- renderContent(resp);
- }
-
- protected abstract void renderContent(HttpServletResponse resp)
- throws IOException;
-
- private void renderCookies(ResponseProperties pageProperties, HttpServletResponse
resp)
- {
- List<Cookie> cookies = pageProperties.getCookies();
- for (Cookie cookie : cookies)
- {
- resp.addCookie(cookie);
- }
- }
-
- private void renderTransportHeaders(ResponseProperties pageProperties,
HttpServletResponse resp)
- {
- MultiValuedPropertyMap<String> transportHeaders =
pageProperties.getTransportHeaders();
- for (String headerName : transportHeaders.keySet())
- {
- for (String headerValue : transportHeaders.getValues(headerName))
- {
- resp.addHeader(headerName, headerValue);
- }
- }
- }
-
- protected void prepareRendering(PortletControllerContext context)
- {
- // default behavior does nothing
- return;
- }
-}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RequestHandler.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RequestHandler.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RequestHandler.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -15,7 +15,7 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
*/
-public abstract class RequestHandler<T extends ControllerRequest>
+abstract class RequestHandler<T extends ControllerRequest>
{
protected PortletController controller;
Copied:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ResourceControllerResponse.java
(from rev 9748,
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ResourceRenderControllerResponse.java)
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ResourceControllerResponse.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ResourceControllerResponse.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.controller;
+
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class ResourceControllerResponse extends ControllerResponse
+{
+
+ /** . */
+ public FragmentResponse fragment;
+
+ public ResourceControllerResponse(FragmentResponse fragment)
+ {
+ this.fragment = fragment;
+ }
+}
\ No newline at end of file
Property changes on:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ResourceControllerResponse.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/SimpleFragmentRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/SimpleFragmentRenderer.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/SimpleFragmentRenderer.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -1,69 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.controller;
-
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- */
-public class SimpleFragmentRenderer implements FragmentRenderer
-{
- public String renderPortlet(FragmentResponse fragment)
- {
-
- if (fragment.getType() != FragmentResponse.TYPE_EMPTY)
- {
- String frag;
-
- //
- if (fragment.getType() == FragmentResponse.TYPE_BYTES)
- {
- frag = fragment.getBytes().toString();
- }
- else
- {
- frag = fragment.getChars().toString();
- }
-
- StringBuilder builder = new StringBuilder(frag.length() + 50);
- builder.append("<div
class=\"portlet\">").append(frag).append("</div>");
- return builder.toString();
- }
- else
- {
- return "<div/>";
- }
- }
-
- public String renderError(ErrorResponse error)
- {
- String html = error.toHTML();
- StringBuilder builder = new StringBuilder(html + 50);
- builder.append("<div
class='error'>").append(html).append("</div>");
- return builder.toString();
- }
-}
Deleted:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ViewRequestHandler.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ViewRequestHandler.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ViewRequestHandler.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -1,64 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.controller;
-
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.ResponseProperties;
-import static
org.jboss.portal.portlet.test.controller.PortletController.ControllerRequest;
-import static org.jboss.portal.portlet.test.controller.PortletController.ViewRequest;
-
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- */
-public class ViewRequestHandler extends RequestHandler<ViewRequest>
-{
- public ViewRequestHandler(PortletController controller)
- {
- super(controller);
- }
-
- ControllerResponse processResponse(ViewRequest request, PortletInvocationResponse
response) throws IOException, PortletInvokerException
- {
- return new PageRenderControllerResponse(new ResponseProperties(), new
PageNavigationalState());
- }
-
- PortletInvocationResponse invoke(ViewRequest controllerRequest) throws
PortletInvokerException
- {
- return null;
- }
-
- ViewRequest downcastRequest(ControllerRequest request)
- {
- if (!(request instanceof ViewRequest))
- {
- throw new IllegalArgumentException("Request " + request + "
cannot be handled by this handler");
- }
-
- return (ViewRequest)request;
- }
-}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/AbstractMarkupRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/AbstractMarkupRenderer.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/AbstractMarkupRenderer.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * 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.portlet.test.controller2;
+
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
+import org.jboss.portal.portlet.test.controller.PortletControllerContext;
+import org.jboss.portal.common.util.MultiValuedPropertyMap;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Cookie;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class AbstractMarkupRenderer implements ControllerResponseRenderer
+{
+
+ /** . */
+ protected ResponseProperties properties;
+
+ public AbstractMarkupRenderer(ResponseProperties properties)
+ {
+ this.properties = properties;
+ }
+
+ public void render(PortletControllerContext context) throws IOException
+ {
+ prepareRendering(context);
+ HttpServletResponse resp = context.getClientResponse();
+
+ // Render the headers and cookies
+ if (properties != null)
+ {
+ renderTransportHeaders(properties, resp);
+ renderCookies(properties, resp);
+ }
+
+ renderContent(resp);
+ }
+
+ protected abstract void renderContent(HttpServletResponse resp) throws IOException;
+
+ private void renderCookies(ResponseProperties pageProperties, HttpServletResponse
resp)
+ {
+ List<Cookie> cookies = pageProperties.getCookies();
+ for (Cookie cookie : cookies)
+ {
+ resp.addCookie(cookie);
+ }
+ }
+
+ private void renderTransportHeaders(ResponseProperties pageProperties,
HttpServletResponse resp)
+ {
+ MultiValuedPropertyMap<String> transportHeaders =
pageProperties.getTransportHeaders();
+ for (String headerName : transportHeaders.keySet())
+ {
+ for (String headerValue : transportHeaders.getValues(headerName))
+ {
+ resp.addHeader(headerName, headerValue);
+ }
+ }
+ }
+
+ protected void prepareRendering(PortletControllerContext context)
+ {
+ // default behavior does nothing
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ControllerResponseRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ControllerResponseRenderer.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ControllerResponseRenderer.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * 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.portlet.test.controller2;
+
+import org.jboss.portal.portlet.test.controller.PortletControllerContext;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface ControllerResponseRenderer
+{
+ void render(PortletControllerContext context) throws IOException;
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ControllerResponseRendererFactory.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ControllerResponseRendererFactory.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ControllerResponseRendererFactory.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.portlet.test.controller2;
+
+import org.jboss.portal.portlet.test.controller.ControllerResponse;
+import org.jboss.portal.portlet.test.controller.PageUpdate;
+import org.jboss.portal.portlet.test.controller.RedirectControllerResponse;
+import org.jboss.portal.portlet.test.controller.ErrorControllerResponse;
+import org.jboss.portal.portlet.test.controller.ResourceControllerResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerResponseRendererFactory
+{
+ public static ControllerResponseRenderer getRenderer(ControllerResponse response)
+ {
+ if (response instanceof PageUpdate)
+ {
+ return new PageUpdateRenderer((PageUpdate)response);
+ }
+ else if (response instanceof RedirectControllerResponse)
+ {
+ return new RedirectResponseRenderer((RedirectControllerResponse)response);
+ }
+ else if (response instanceof ErrorControllerResponse)
+ {
+ return new ErrorResponseRenderer((ErrorControllerResponse)response);
+ }
+ else if (response instanceof ResourceControllerResponse)
+ {
+ return new ResourceRenderer((ResourceControllerResponse)response);
+ }
+
+ //
+ return null;
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ErrorResponseRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ErrorResponseRenderer.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ErrorResponseRenderer.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -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.portlet.test.controller2;
+
+import org.jboss.portal.portlet.test.controller.ErrorControllerResponse;
+import org.jboss.portal.portlet.test.controller.PortletControllerContext;
+import org.apache.log4j.Logger;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ErrorResponseRenderer implements ControllerResponseRenderer
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(ErrorControllerResponse.class);
+
+ /** . */
+ private ErrorControllerResponse response;
+
+ public ErrorResponseRenderer(ErrorControllerResponse response)
+ {
+ this.response = response;
+ }
+
+ public void render(PortletControllerContext context) throws IOException
+ {
+ //
+ if (response.error.getCause() != null)
+ {
+ log.error("Portlet action threw an error: " +
response.error.getMessage(), response.error.getCause());
+ }
+ else
+ {
+ log.error("Portlet action threw an error: " +
response.error.getMessage());
+ }
+
+ //
+ context.getClientResponse().sendError(404, response.error.getMessage());
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/FragmentRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/FragmentRenderer.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/FragmentRenderer.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.controller2;
+
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9748 $
+ */
+public interface FragmentRenderer
+{
+ String renderPortlet(FragmentResponse fragment);
+
+ String renderError(ErrorResponse error);
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/PageUpdateRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/PageUpdateRenderer.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/PageUpdateRenderer.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,253 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.controller2;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.MultiValuedPropertyMap;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.xml.XMLTools;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
+import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
+import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
+import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
+import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
+import org.jboss.portal.portlet.test.PortletURLRenderer;
+import org.jboss.portal.portlet.test.TestInstanceContext;
+import org.jboss.portal.portlet.test.TestRenderContext;
+import org.jboss.portal.portlet.test.WindowNavigationalState;
+import org.jboss.portal.portlet.test.TestPortalContext;
+import org.jboss.portal.portlet.test.controller.PageNavigationalState;
+import org.jboss.portal.portlet.test.controller.PortletControllerContext;
+import org.jboss.portal.portlet.test.controller.PortletController;
+import org.jboss.portal.portlet.test.controller.PageUpdate;
+import org.w3c.dom.Element;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9748 $
+ */
+public class PageUpdateRenderer extends AbstractMarkupRenderer
+{
+
+ private FragmentRenderer fragmentRenderer = new SimpleFragmentRenderer();
+ private List<FragmentResponse> fragments;
+ private List<ErrorResponse> errors;
+ private PageNavigationalState pageState;
+
+ public PageUpdateRenderer(PageUpdate pageUpdate)
+ {
+ super(pageUpdate.getProperties());
+
+ //
+ this.pageState = pageUpdate.getPageState();
+ }
+
+ public void setFragmentRenderer(FragmentRenderer fragmentRenderer)
+ {
+ this.fragmentRenderer = fragmentRenderer;
+ }
+
+ protected void renderContent(HttpServletResponse resp) throws IOException
+ {
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ writer.print("<html>");
+
+ // Render the head contributions
+ writer.print("<head>");
+ MultiValuedPropertyMap<Element> markupHeaders =
properties.getMarkupHeaders();
+ List<Element> headElement =
markupHeaders.getValues("javax.portlet.markup.head.element");
+ if (headElement != null)
+ {
+ for (Element headerValue : headElement)
+ {
+ try
+ {
+ String serializedElement = XMLTools.toString(headerValue);
+ writer.print(serializedElement);
+ }
+ catch (Exception e)
+ {
+ // todo
+ e.printStackTrace();
+ }
+ }
+ }
+ writer.print("</head>");
+
+
+ writer.print("<body>");
+ for (FragmentResponse fragment : fragments)
+ {
+ writer.print(fragmentRenderer.renderPortlet(fragment));
+
+ }
+
+ for (ErrorResponse error : errors)
+ {
+ writer.print(fragmentRenderer.renderError(error));
+ }
+
+ writer.print("</body></html>");
+ }
+
+ protected void prepareRendering(PortletControllerContext context)
+ {
+
+ // What we collect during the different renders
+ // we don't reuse the render properties argument since we want to avoid that
+ // a portlet rendition affects another rendition of a portlet on the same page
+ ResponseProperties renderProperties = new ResponseProperties();
+
+ //
+ try
+ {
+ Collection<Portlet> portlets = context.getPortlets();
+
+ int capacity = portlets.size();
+ fragments = new ArrayList<FragmentResponse>(capacity);
+ errors = new ArrayList<ErrorResponse>(capacity);
+
+ for (Portlet portlet : portlets)
+ {
+ WindowNavigationalState windowNS =
pageState.getWindowNavigationalState(portlet.getContext().getId());
+
+ //
+ Mode mode = Mode.VIEW;
+ WindowState windowState = WindowState.NORMAL;
+ StateString portletNS = null;
+
+ //
+ if (windowNS != null)
+ {
+ if (windowNS.getMode() != null)
+ {
+ mode = windowNS.getMode();
+ }
+ if (windowNS.getWindowState() != null)
+ {
+ windowState = windowNS.getWindowState();
+ }
+ if (windowNS.getPortletNavigationalState() != null)
+ {
+ portletNS = windowNS.getPortletNavigationalState();
+ }
+ }
+
+ //
+ ParameterMap publicNS = pageState.getPublicNavigationalState(portlet);
+
+ RenderInvocation render = createRenderInvocation(context, properties,
pageState, portlet, windowNS, mode, windowState, portletNS, publicNS);
+
+ //
+ try
+ {
+ PortletInvocationResponse response = context.invoke(render);
+
+ if (response instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)response;
+
+ //
+ fragments.add(fragment);
+
+ //
+ ResponseProperties fragmentProperties = fragment.getProperties();
+ if (fragmentProperties != null)
+ {
+ renderProperties.append(fragmentProperties);
+ }
+ }
+ else if (response instanceof ErrorResponse)
+ {
+ ErrorResponse error = (ErrorResponse)response;
+ errors.add(error);
+ }
+
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ // todo
+ e.printStackTrace();
+ }
+
+ // Now we combine the render properties with the page properties
+ properties.append(renderProperties);
+ }
+
+ protected RenderInvocation createRenderInvocation(
+ PortletControllerContext context, ResponseProperties pageProperties,
PageNavigationalState pageNS, Portlet portlet,
+ WindowNavigationalState windowNS, Mode mode, WindowState windowState, StateString
portletNS, ParameterMap publicNS)
+ {
+ HttpServletRequest req = context.getClientRequest();
+ HttpServletResponse resp = context.getClientResponse();
+
+ //
+ PortletURLRenderer renderer = new PortletURLRenderer(pageNS, windowNS, portlet,
req, resp);
+ //
+ TestInstanceContext instanceContext = new TestInstanceContext(req,
portlet.getContext(), false);
+
+ TestRenderContext renderContext = new TestRenderContext(renderer,
PortletController.MARKUP_INFO);
+
+ //
+ RenderInvocation render = new RenderInvocation(renderContext);
+ render.setClientContext(new AbstractClientContext(req,
pageProperties.getCookies()));
+ render.setServerContext(new AbstractServerContext(req, resp));
+ render.setInstanceContext(instanceContext);
+ render.setUserContext(new AbstractUserContext(req));
+ render.setWindowContext(new AbstractWindowContext(portlet.getContext().getId()));
+ render.setPortalContext(new TestPortalContext());
+ render.setSecurityContext(new AbstractSecurityContext(req));
+ render.setTarget(instanceContext.getTarget());
+ render.setMode(mode);
+ render.setWindowState(windowState);
+ render.setNavigationalState(portletNS);
+ render.setPublicNavigationalState(publicNS);
+ return render;
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/PortletControllerContextImpl.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/PortletControllerContextImpl.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/PortletControllerContextImpl.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,280 @@
+/******************************************************************************
+ * 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.portlet.test.controller2;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.cache.CacheLevel;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.test.StringCodec;
+import static org.jboss.portal.portlet.test.URLParameterConstants.*;
+import org.jboss.portal.portlet.test.WindowNavigationalState;
+import org.jboss.portal.portlet.test.controller.PortletControllerContext;
+import org.jboss.portal.portlet.test.controller.PortletController;
+import org.jboss.portal.portlet.test.controller.PageNavigationalState;
+import org.jboss.portal.portlet.test.event.EventControllerContext;
+import org.jboss.portal.portlet.test.event.EventControllerContextImpl;
+import org.jboss.portal.web.Body;
+import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.portal.web.WebRequest;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletControllerContextImpl implements PortletControllerContext
+{
+
+ /** . */
+ public static final int NAV_SCOPE = 0;
+
+ /** . */
+ public static final int SESSION_SCOPE = 1;
+
+ /** . */
+ private final HttpServletRequest req;
+
+ /** . */
+ private final HttpServletResponse resp;
+
+ /** . */
+ private final ServletContext servletContext;
+
+ /** . */
+ private final PortletController.ControllerRequest request;
+
+ /** . */
+ private final PortletInvoker invoker;
+
+ /** . */
+ private final EventControllerContext eventControllerContext;
+
+ public PortletControllerContextImpl(
+ HttpServletRequest req,
+ HttpServletResponse resp,
+ ServletContext servletContext)
+ throws IllegalRequestException, IOException, ClassNotFoundException
+ {
+ PortletInvoker invoker =
(PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
+
+ // The nav state provided with the request
+ PageNavigationalState pageState = null;
+
+ // The request decoded if not null
+ PortletController.ControllerRequest request = null;
+
+ // Process
+ String pathInfo = req.getPathInfo();
+ if (pathInfo != null && pathInfo.startsWith("/") &&
pathInfo.length() > 1)
+ {
+ // Get the target portlet
+ String targetId = StringCodec.decode(pathInfo.substring(1));
+
+ // Helper
+ WebRequest ri = new WebRequest(req);
+
+ // Unmarshall portal navigational state if it is provided
+ String context = req.getParameter(PAGE_STATE);
+ if (context != null)
+ {
+ byte[] bytes = Tools.fromHexString(context);
+ pageState = PageNavigationalState.unserialize(bytes);
+ }
+
+ //
+ Mode mode = null;
+ if (req.getParameter(MODE) != null)
+ {
+ mode = Mode.create(req.getParameter(MODE));
+ }
+
+ //
+ WindowState windowState = null;
+ if (req.getParameter(WINDOW_STATE) != null)
+ {
+ windowState = WindowState.create(req.getParameter(WINDOW_STATE));
+ }
+
+ //
+ String navigationalStateString = req.getParameter(NAVIGATIONAL_STATE);
+ StateString navigationalState = null;
+ if (navigationalStateString != null)
+ {
+ navigationalState = ParametersStateString.create(navigationalStateString);
+ }
+
+ //
+ WindowNavigationalState windowNavigationalState = new
WindowNavigationalState(navigationalState, mode, windowState);
+
+ //
+ String type = req.getParameter(LIFECYCLE_TYPE);
+ if (RESOURCE_LIFECYCLE.equals(type))
+ {
+ StateString resourceState =
ParametersStateString.create(req.getParameter(RESOURCE_STATE));
+ String resourceId = req.getParameter(RESOURCE_ID);
+
+ //
+ ParameterMap formParameters = null;
+ if (ri.getBody() instanceof Body.Form)
+ {
+ formParameters = ((Body.Form)ri.getBody()).getParameters();
+ }
+
+ //
+ CacheLevel resourceCacheLevel =
CacheLevel.valueOf(req.getParameter(RESOURCE_CACHEABILITY));
+
+ //
+ switch (resourceCacheLevel)
+ {
+ case FULL:
+ request = new
PortletController.FullScopedCacheablePortletResourceRequest(
+ this,
+ targetId,
+ resourceId,
+ resourceState,
+ formParameters);
+ break;
+ case PORTLET:
+ request = new PortletController.PortletScopedPortletResourceRequest(
+ this,
+ targetId,
+ resourceId,
+ resourceState,
+ formParameters,
+ windowNavigationalState);
+ break;
+ case PAGE:
+ request = new PortletController.PageScopedFullPortletResourceRequest(
+ this,
+ targetId,
+ resourceId,
+ resourceState,
+ formParameters,
+ pageState,
+ windowNavigationalState);
+ break;
+ }
+ }
+ else
+ {
+ if (ACTION_LIFECYCLE.equals(type))
+ {
+ ParameterMap formParameters = null;
+ if (ri.getBody() instanceof Body.Form)
+ {
+ formParameters = ((Body.Form)ri.getBody()).getParameters();
+ }
+
+ //
+ StateString interactionState =
ParametersStateString.create(req.getParameter(INTERACTION_STATE));
+
+ //
+ request = new PortletController.PortletActionRequest(
+ this,
+ targetId,
+ interactionState,
+ formParameters,
+ windowNavigationalState,
+ pageState);
+ }
+ else
+ {
+ Map<String, String[]> publicNavigationalStateChanges =
(Map<String,
String[]>)IOTools.unserialize(Tools.fromHexString(req.getParameter(PUBLIC_NAVIGATIONAL_STATE_CHANGES)));
+
+ //
+ request = new PortletController.PortletRenderRequest(
+ this,
+ targetId,
+ windowNavigationalState,
+ publicNavigationalStateChanges,
+ pageState);
+ }
+ }
+ }
+
+ //
+ this.request = request;
+ this.req = req;
+ this.resp = resp;
+ this.servletContext = servletContext;
+ this.invoker = invoker;
+ this.eventControllerContext = new EventControllerContextImpl(invoker);
+ }
+
+ public PortletController.ControllerRequest getRequest()
+ {
+ return request;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
+ public HttpServletRequest getClientRequest()
+ {
+ return req;
+ }
+
+ public HttpServletResponse getClientResponse()
+ {
+ return resp;
+ }
+
+ public Portlet getPortlet(String portletId) throws PortletInvokerException
+ {
+ return invoker.getPortlet(PortletContext.createPortletContext(portletId));
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
PortletInvokerException
+ {
+ return invoker.invoke(invocation);
+ }
+
+ public Collection<Portlet> getPortlets() throws PortletInvokerException
+ {
+ return invoker.getPortlets();
+ }
+
+ public EventControllerContext getEventControllerContext()
+ {
+ return eventControllerContext;
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/RedirectResponseRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/RedirectResponseRenderer.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/RedirectResponseRenderer.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -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.portlet.test.controller2;
+
+import org.jboss.portal.portlet.test.controller.PortletControllerContext;
+import org.jboss.portal.portlet.test.controller.RedirectControllerResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RedirectResponseRenderer implements ControllerResponseRenderer
+{
+
+ /** . */
+ private RedirectControllerResponse response;
+
+ public RedirectResponseRenderer(RedirectControllerResponse response)
+ {
+ this.response = response;
+ }
+
+ public void render(PortletControllerContext context) throws IOException
+ {
+ context.getClientResponse().sendRedirect(response.redirection.getLocation());
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ResourceRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ResourceRenderer.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/ResourceRenderer.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,96 @@
+/******************************************************************************
+ * 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.portlet.test.controller2;
+
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.test.controller.ResourceControllerResponse;
+import org.jboss.portal.common.io.IOTools;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletOutputStream;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ResourceRenderer extends AbstractMarkupRenderer
+{
+
+ /** . */
+ private FragmentResponse fragment;
+
+ public ResourceRenderer(ResourceControllerResponse response)
+ {
+ super(response.fragment.getProperties());
+
+ //
+ this.fragment = response.fragment;
+ }
+
+ protected void renderContent(HttpServletResponse resp) throws IOException
+ {
+ //
+ if (fragment.getType() == FragmentResponse.TYPE_EMPTY)
+ {
+ resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
+ }
+ else
+ {
+ String contentType = fragment.getContentType();
+ if (contentType != null)
+ {
+ resp.setContentType(contentType);
+ }
+
+ //
+ if (fragment.getType() == FragmentResponse.TYPE_BYTES)
+ {
+ ServletOutputStream out = null;
+ try
+ {
+ out = resp.getOutputStream();
+ out.write(fragment.getBytes().toByteArray());
+ }
+ finally
+ {
+ IOTools.safeClose(out);
+ }
+ }
+ else
+ {
+ Writer writer = null;
+ try
+ {
+ writer = resp.getWriter();
+ writer.write(fragment.getChars().toString());
+ }
+ finally
+ {
+ writer.close();
+ }
+ }
+ }
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/SimpleFragmentRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/SimpleFragmentRenderer.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller2/SimpleFragmentRenderer.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.controller2;
+
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.test.controller2.FragmentRenderer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9748 $
+ */
+public class SimpleFragmentRenderer implements FragmentRenderer
+{
+ public String renderPortlet(FragmentResponse fragment)
+ {
+
+ if (fragment.getType() != FragmentResponse.TYPE_EMPTY)
+ {
+ String frag;
+
+ //
+ if (fragment.getType() == FragmentResponse.TYPE_BYTES)
+ {
+ frag = fragment.getBytes().toString();
+ }
+ else
+ {
+ frag = fragment.getChars().toString();
+ }
+
+ StringBuilder builder = new StringBuilder(frag.length() + 50);
+ builder.append("<div
class=\"portlet\">").append(frag).append("</div>");
+ return builder.toString();
+ }
+ else
+ {
+ return "<div/>";
+ }
+ }
+
+ public String renderError(ErrorResponse error)
+ {
+ String html = error.toHTML();
+ StringBuilder builder = new StringBuilder(html + 50);
+ builder.append("<div
class='error'>").append(html).append("</div>");
+ return builder.toString();
+ }
+}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/SimplePortalServlet.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/SimplePortalServlet.java 2008-02-04
19:06:09 UTC (rev 9748)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/SimplePortalServlet.java 2008-02-04
22:24:27 UTC (rev 9749)
@@ -24,7 +24,9 @@
import org.jboss.portal.portlet.test.controller.ControllerResponse;
import org.jboss.portal.portlet.test.controller.PortletController;
-import org.jboss.portal.portlet.test.controller.PortletControllerContextImpl;
+import org.jboss.portal.portlet.test.controller2.PortletControllerContextImpl;
+import org.jboss.portal.portlet.test.controller2.ControllerResponseRenderer;
+import org.jboss.portal.portlet.test.controller2.ControllerResponseRendererFactory;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -72,6 +74,11 @@
//
ControllerResponse response = controller.process(context.getRequest());
- response.render(context);
+
+ //
+ ControllerResponseRenderer renderer =
ControllerResponseRendererFactory.getRenderer(response);
+
+ //
+ renderer.render(context);
}
}
\ No newline at end of file