JBoss Portal SVN: r10002 - branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2008-02-17 11:10:54 -0500 (Sun, 17 Feb 2008)
New Revision: 10002
Modified:
branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/PortalConstants.java
Log:
updated version number for portal...now is 2.6.5
Modified: branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/PortalConstants.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/PortalConstants.java 2008-02-16 19:09:16 UTC (rev 10001)
+++ branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/PortalConstants.java 2008-02-17 16:10:54 UTC (rev 10002)
@@ -36,7 +36,7 @@
{
/** Current version. */
- public static final Version VERSION = new Version("JBoss Portal", 2, 6, 3, new Version.Qualifier(Version.Qualifier.Prefix.SNAPSHOT), "Ninja");
+ public static final Version VERSION = new Version("JBoss Portal", 2, 6, 5, new Version.Qualifier(Version.Qualifier.Prefix.SNAPSHOT), "Ninja");
/** The default portal name. */
public static final String DEFAULT_PORTAL_NAME = "default";
16 years, 7 months
JBoss Portal SVN: r10001 - in modules/portlet/trunk: controller/src/main/java/org/jboss/portal/portlet/controller/event and 9 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-16 14:09:16 -0500 (Sat, 16 Feb 2008)
New Revision: 10001
Added:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestFactory.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterMapFactory.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterNames.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletEventRequest.java
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletController.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletControllerContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletResourceRequestHandler.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/RequestHandler.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/Event.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/state/PageNavigationalStateImpl.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/ContainerRequest.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/ControllerRequest.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/FullScopedCacheablePortletResourceRequest.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PageScopedFullPortletResourceRequest.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletActionRequest.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletRenderRequest.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletRequest.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletResourceRequest.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletScopedPortletResourceRequest.java
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/URLParameterConstants.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractMarkupRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorResponseRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.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/PortletURLRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectResponseRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/Renderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/controller/StateControllerContextTestCase.java
Log:
- extract default common request parameter encoding/decoding for reuse
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletController.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletController.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletController.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -46,7 +46,7 @@
*/
public class PortletController
{
- public ControllerResponse process(ControllerRequest controllerRequest) throws IOException, PortletInvokerException
+ public ControllerResponse process(PortletControllerContext controllerContext, ControllerRequest controllerRequest) throws IOException, PortletInvokerException
{
RequestHandler handler;
@@ -63,6 +63,6 @@
throw new PortletInvokerException("Unknown request type: " + controllerRequest.getClass().getName());
}
- return handler.handle(controllerRequest);
+ return handler.handle(controllerContext, controllerRequest);
}
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletControllerContext.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletControllerContext.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletControllerContext.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -48,21 +48,28 @@
public interface PortletControllerContext
{
- ServletContext getServletContext();
+ /**
+ * Returns the portet info for a specified window.
+ *
+ * @param windowId the window id
+ * @return the portlet info or null if none can be found
+ */
+ PortletInfo getPortletInfo(String windowId);
- HttpServletRequest getClientRequest();
-
- HttpServletResponse getClientResponse();
-
- PortletInfo getPortletInfo(String windowId) throws PortletInvokerException;
-
+ /**
+ * Create a portlet invocation context for the specified window id.
+ *
+ * @param windowId the window id
+ * @param pageState
+ * @return
+ */
PortletInvocationContext createPortletInvocationContext(String windowId, PageNavigationalState pageState);
- PortletInvocationResponse invoke(String windowId, ActionInvocation actionInvocation) throws PortletInvokerException;
+ PortletInvocationResponse invoke( ActionInvocation actionInvocation) throws PortletInvokerException;
- PortletInvocationResponse invoke(String windowId, List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException;
+ PortletInvocationResponse invoke(List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException;
- PortletInvocationResponse invoke(String windowId, ResourceInvocation resourceInvocation) throws PortletInvokerException;
+ PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws PortletInvokerException;
EventControllerContext getEventControllerContext();
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -30,7 +30,6 @@
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
-import org.jboss.portal.portlet.controller.request.ControllerRequest;
import org.jboss.portal.portlet.controller.request.PortletActionRequest;
import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
import org.jboss.portal.portlet.controller.request.PortletRequest;
@@ -63,23 +62,11 @@
public PortletRequestHandler(PortletController controller)
{
- super(controller);
+ super(PortletRequest.class, controller);
}
- protected PortletRequest downcastRequest(ControllerRequest request)
+ ControllerResponse processResponse(PortletControllerContext context, PortletRequest portletRequest, PortletInvocationResponse response) throws IOException, PortletInvokerException
{
- if (!(request instanceof PortletRequest))
- {
- throw new IllegalArgumentException("Request " + request + " cannot be handled by this handler");
- }
-
- return (PortletRequest)request;
- }
-
- ControllerResponse processResponse(PortletRequest portletRequest, PortletInvocationResponse response) throws IOException, PortletInvokerException
- {
- PortletControllerContext context = portletRequest.getControllerContext();
-
StateControllerContext stateContext = context.getStateControllerContext();
// The page navigational state we will operate on during the request
@@ -175,11 +162,8 @@
}
}
- PortletInvocationResponse invoke(PortletRequest portletRequest) throws PortletInvokerException
+ PortletInvocationResponse invoke(PortletControllerContext context, PortletRequest portletRequest) throws PortletInvokerException
{
- PortletControllerContext context = portletRequest.getControllerContext();
-
- //
if (portletRequest instanceof PortletRenderRequest)
{
PortletRenderRequest portletRenderRequest = (PortletRenderRequest)portletRequest;
@@ -229,7 +213,7 @@
actionInvocation.setForm(portletActionRequest.getBodyParameters() != null ? ParameterMap.clone(portletActionRequest.getBodyParameters()) : null);
//
- return context.invoke(portletRequest.getWindowId(), actionInvocation);
+ return context.invoke(actionInvocation);
}
}
@@ -261,7 +245,7 @@
eventInvocation.setPayload(event.getPayload());
//
- return context.invoke(event.getWindowId(), requestCookies, eventInvocation);
+ return context.invoke(requestCookies, eventInvocation);
}
private void updateNavigationalState(
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletResourceRequestHandler.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletResourceRequestHandler.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletResourceRequestHandler.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -32,7 +32,6 @@
import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.portlet.invocation.ResourceInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.controller.request.ControllerRequest;
import org.jboss.portal.portlet.controller.request.PageScopedFullPortletResourceRequest;
import org.jboss.portal.portlet.controller.request.PortletResourceRequest;
import org.jboss.portal.portlet.controller.request.PortletScopedPortletResourceRequest;
@@ -48,17 +47,18 @@
*/
class PortletResourceRequestHandler extends RequestHandler<PortletResourceRequest>
{
+
public PortletResourceRequestHandler(PortletController controller)
{
- super(controller);
+ super(PortletResourceRequest.class, controller);
}
- ControllerResponse processResponse(PortletResourceRequest request, PortletInvocationResponse response) throws IOException, PortletInvokerException
+ ControllerResponse processResponse(PortletControllerContext controllerContext, PortletResourceRequest request, PortletInvocationResponse response) throws IOException, PortletInvokerException
{
return new ResourceResponse(response);
}
- PortletInvocationResponse invoke(PortletResourceRequest portletResourceRequest) throws PortletInvokerException
+ PortletInvocationResponse invoke(PortletControllerContext context, PortletResourceRequest portletResourceRequest) throws PortletInvokerException
{
//
@@ -69,8 +69,6 @@
StateString portletNS = null;
CacheLevel cacheability;
- PortletControllerContext context = portletResourceRequest.getControllerContext();
-
//
if (portletResourceRequest instanceof PortletScopedPortletResourceRequest)
{
@@ -129,21 +127,11 @@
//
try
{
- return context.invoke(portletResourceRequest.getWindowId(), resourceInvocation);
+ return context.invoke(resourceInvocation);
}
catch (PortletInvokerException e)
{
return null;
}
}
-
- PortletResourceRequest downcastRequest(ControllerRequest request)
- {
- if (!(request instanceof PortletResourceRequest))
- {
- throw new IllegalArgumentException("Request " + request + " cannot be handled by this handler");
- }
-
- return (PortletResourceRequest)request;
- }
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/RequestHandler.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/RequestHandler.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/RequestHandler.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -37,26 +37,36 @@
*/
abstract class RequestHandler<T extends ControllerRequest>
{
+ /** . */
+ protected static final Logger log = Logger.getLogger(RequestHandler.class);
+
+ /** . */
protected PortletController controller;
- protected static final Logger log = Logger.getLogger(RequestHandler.class);
+ /** . */
+ protected final Class<T> t;
- public RequestHandler(PortletController controller)
+ protected RequestHandler(Class<T> t, PortletController controller)
{
+ this.t = t;
this.controller = controller;
}
- public ControllerResponse handle(ControllerRequest request) throws PortletInvokerException, IOException
+ public ControllerResponse handle(PortletControllerContext controllerContext, ControllerRequest request) throws PortletInvokerException, IOException
{
- T req = downcastRequest(request);
- PortletInvocationResponse response = invoke(req);
+ if (!t.isInstance(request))
+ {
+ throw new IllegalArgumentException("Request " + request + " cannot be handled by this handler");
+ }
- return processResponse(req, response);
+ //
+ T req = t.cast(request);
+ PortletInvocationResponse response = invoke(controllerContext, req);
+
+ return processResponse(controllerContext, req, response);
}
- abstract ControllerResponse processResponse(T request, PortletInvocationResponse response) throws IOException, PortletInvokerException;
+ abstract ControllerResponse processResponse(PortletControllerContext controllerContext, T request, PortletInvocationResponse response) throws IOException, PortletInvokerException;
- abstract PortletInvocationResponse invoke(T controllerRequest) throws PortletInvokerException;
-
- abstract T downcastRequest(ControllerRequest request);
+ abstract PortletInvocationResponse invoke(PortletControllerContext controllerContext, T controllerRequest) throws PortletInvokerException;
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/Event.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/Event.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/Event.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -26,7 +26,7 @@
import java.io.Serializable;
/**
- * An event associated with a portlet.
+ * An event associated with a portlet window.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
Added: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestFactory.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestFactory.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestFactory.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -0,0 +1,191 @@
+/******************************************************************************
+ * 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.controller.impl.request;
+
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.portlet.controller.request.ControllerRequest;
+import org.jboss.portal.portlet.controller.request.FullScopedCacheablePortletResourceRequest;
+import org.jboss.portal.portlet.controller.request.PortletScopedPortletResourceRequest;
+import org.jboss.portal.portlet.controller.request.PageScopedFullPortletResourceRequest;
+import org.jboss.portal.portlet.controller.request.PortletActionRequest;
+import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.cache.CacheLevel;
+import org.jboss.portal.common.util.Base64;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.io.Serialization;
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.Body;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerRequestFactory
+{
+
+ /** . */
+ private final StateControllerContext stateControllerContext;
+
+ /** . */
+ private final PageNavigationalStateSerialization serialization;
+
+ public ControllerRequestFactory(StateControllerContext stateControllerContext)
+ {
+ this.stateControllerContext = stateControllerContext;
+ this.serialization = new PageNavigationalStateSerialization(stateControllerContext);
+ }
+
+ public ControllerRequest createRequest(WebRequest req)
+ {
+
+ // The nav state provided with the request
+ // Unmarshall portal navigational state if it is provided
+ PageNavigationalState pageState = null;
+ String context = req.getParameter(ControllerRequestParameterNames.PAGE_STATE);
+ if (context != null)
+ {
+ byte[] bytes = Base64.decode(context, true);
+ pageState = IOTools.unserialize(serialization, SerializationFilter.COMPRESSOR, bytes);
+ }
+
+ // Get the window id
+ String windowId = req.getParameter(ControllerRequestParameterNames.WINDOW_ID);
+
+ //
+ Mode mode = null;
+ if (req.getParameter(ControllerRequestParameterNames.MODE) != null)
+ {
+ mode = Mode.create(req.getParameter(ControllerRequestParameterNames.MODE));
+ }
+
+ //
+ WindowState windowState = null;
+ if (req.getParameter(ControllerRequestParameterNames.WINDOW_STATE) != null)
+ {
+ windowState = WindowState.create(req.getParameter(ControllerRequestParameterNames.WINDOW_STATE));
+ }
+
+ //
+ String navigationalStateString = req.getParameter(ControllerRequestParameterNames.NAVIGATIONAL_STATE);
+ StateString navigationalState = null;
+ if (navigationalStateString != null)
+ {
+ navigationalState = ParametersStateString.create(navigationalStateString);
+ }
+
+ //
+ WindowNavigationalState windowNavigationalState = new WindowNavigationalState(navigationalState, mode, windowState);
+
+ //
+ String phase = req.getParameter(ControllerRequestParameterNames.LIFECYCLE_PHASE);
+ if (ControllerRequestParameterNames.RESOURCE_PHASE.equals(phase))
+ {
+ StateString resourceState = ParametersStateString.create(req.getParameter(ControllerRequestParameterNames.RESOURCE_STATE));
+ String resourceId = req.getParameter(ControllerRequestParameterNames.RESOURCE_ID);
+
+ //
+ ParameterMap formParameters = null;
+ if (req.getBody() instanceof Body.Form)
+ {
+ formParameters = ((Body.Form)req.getBody()).getParameters();
+ }
+
+ //
+ CacheLevel resourceCacheLevel = CacheLevel.valueOf(req.getParameter(ControllerRequestParameterNames.RESOURCE_CACHEABILITY));
+
+ //
+ switch (resourceCacheLevel)
+ {
+ case FULL:
+ return new FullScopedCacheablePortletResourceRequest(
+ windowId,
+ resourceId,
+ resourceState,
+ formParameters);
+ case PORTLET:
+ return new PortletScopedPortletResourceRequest(
+ windowId,
+ resourceId,
+ resourceState,
+ formParameters,
+ windowNavigationalState);
+ case PAGE:
+ return new PageScopedFullPortletResourceRequest(
+ windowId,
+ resourceId,
+ resourceState,
+ formParameters,
+ pageState,
+ windowNavigationalState);
+ default:
+ throw new AssertionError();
+ }
+ }
+ else
+ {
+ if (ControllerRequestParameterNames.ACTION_PHASE.equals(phase))
+ {
+ ParameterMap formParameters = null;
+ if (req.getBody() instanceof Body.Form)
+ {
+ formParameters = ((Body.Form)req.getBody()).getParameters();
+ }
+
+ //
+ StateString interactionState = ParametersStateString.create(req.getParameter(ControllerRequestParameterNames.INTERACTION_STATE));
+
+ //
+ return new PortletActionRequest(
+ windowId,
+ interactionState,
+ formParameters,
+ windowNavigationalState,
+ pageState);
+ }
+ else
+ {
+ byte[] bytes = Base64.decode(req.getParameter(ControllerRequestParameterNames.PUBLIC_NAVIGATIONAL_STATE_CHANGES), true);
+ Map<String, String[]> publicNavigationalStateChanges = IOTools.unserialize(Serialization.PARAMETER_MAP, SerializationFilter.COMPRESSOR, bytes);
+
+ //
+ return new PortletRenderRequest(
+ windowId,
+ windowNavigationalState,
+ publicNavigationalStateChanges,
+ pageState);
+ }
+ }
+ }
+
+}
Added: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterMapFactory.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterMapFactory.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterMapFactory.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -0,0 +1,202 @@
+/******************************************************************************
+ * 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.controller.impl.request;
+
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.ResourceURL;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.cache.CacheLevel;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.io.Serialization;
+import org.jboss.portal.common.util.Base64;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerRequestParameterMapFactory
+{
+
+ /** . */
+ private final StateControllerContext stateControllerContext;
+
+ /** . */
+ private final PageNavigationalStateSerialization serialization;
+
+ public ControllerRequestParameterMapFactory(StateControllerContext stateControllerContext)
+ {
+ this.stateControllerContext = stateControllerContext;
+ this.serialization = new PageNavigationalStateSerialization(stateControllerContext);
+ }
+
+ public Map<String, String> blah(PageNavigationalState pageNS, String windowId, ContainerURL containerURL)
+ {
+ Map<String, String> parameters = new HashMap<String, String>();
+
+ //
+ parameters.put(ControllerRequestParameterNames.WINDOW_ID, windowId);
+
+ //
+ String type;
+ if (containerURL instanceof ActionURL)
+ {
+ type = ControllerRequestParameterNames.ACTION_PHASE;
+ }
+ else if (containerURL instanceof RenderURL)
+ {
+ type = ControllerRequestParameterNames.RENDER_PHASE;
+ }
+ else if (containerURL instanceof ResourceURL)
+ {
+ type = ControllerRequestParameterNames.RESOURCE_PHASE;
+ }
+ else
+ {
+ throw new Error();
+ }
+ parameters.put(ControllerRequestParameterNames.LIFECYCLE_PHASE, type);
+
+
+ //
+ String pageState = null;
+ if (pageNS != null)
+ {
+ byte[] bytes = IOTools.serialize(serialization, SerializationFilter.COMPRESSOR, pageNS);
+ pageState = Base64.encodeBytes(bytes, true);
+ }
+
+ //
+ if (containerURL instanceof PortletURL)
+ {
+ PortletURL portletURL = (PortletURL)containerURL;
+
+ if (portletURL.getMode() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.MODE, portletURL.getMode().toString());
+ }
+
+ //
+ if (portletURL.getWindowState() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.WINDOW_STATE, portletURL.getWindowState().toString());
+ }
+
+ //
+ if (pageState != null)
+ {
+ parameters.put(ControllerRequestParameterNames.PAGE_STATE, pageState);
+ }
+
+ //
+ if (containerURL instanceof ActionURL)
+ {
+ ActionURL actionURL = (ActionURL)containerURL;
+
+ //
+ if (actionURL.getNavigationalState() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, actionURL.getNavigationalState().getStringValue());
+ }
+
+ //
+ StateString interactionState = actionURL.getInteractionState();
+ parameters.put(ControllerRequestParameterNames.INTERACTION_STATE, interactionState.getStringValue());
+ }
+ else
+ {
+ RenderURL renderURL = (RenderURL)containerURL;
+
+ //
+ Map<String, String[]> changes = renderURL.getPublicNavigationalStateChanges();
+ byte[] bytes = IOTools.serialize(Serialization.PARAMETER_MAP, SerializationFilter.COMPRESSOR, changes);
+ String ns = Base64.encodeBytes(bytes, true);
+ parameters.put(ControllerRequestParameterNames.PUBLIC_NAVIGATIONAL_STATE_CHANGES, ns);
+
+ //
+ StateString navigationalState = renderURL.getNavigationalState();
+ if (navigationalState != null)
+ {
+ parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, navigationalState.getStringValue());
+ }
+ }
+ }
+ else
+ {
+ ResourceURL resourceURL = (ResourceURL)containerURL;
+
+ //
+ StateString resourceState = resourceURL.getResourceState();
+ parameters.put(ControllerRequestParameterNames.RESOURCE_STATE, resourceState.getStringValue());
+
+ //
+ String resourceId = resourceURL.getResourceId();
+ if (resourceId != null)
+ {
+ parameters.put(ControllerRequestParameterNames.RESOURCE_ID, resourceId);
+ }
+
+ //
+ CacheLevel cacheability = resourceURL.getCacheability();
+ parameters.put(ControllerRequestParameterNames.RESOURCE_CACHEABILITY, cacheability.name());
+
+ //
+ if (cacheability != CacheLevel.FULL)
+ {
+ if (resourceURL.getNavigationalState() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, resourceURL.getNavigationalState().getStringValue());
+ }
+
+ //
+ if (resourceURL.getMode() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.MODE, resourceURL.getMode().toString());
+ }
+
+ //
+ if (resourceURL.getWindowState() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.WINDOW_STATE, resourceURL.getWindowState().toString());
+ }
+
+ if (cacheability == CacheLevel.PAGE && pageState != null)
+ {
+ parameters.put(ControllerRequestParameterNames.PAGE_STATE, pageState);
+ }
+ }
+ }
+
+ //
+ return parameters;
+ }
+}
Added: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterNames.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterNames.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterNames.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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.controller.impl.request;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerRequestParameterNames
+{
+ /**
+ * The life cycle type of the invocation. The values accepted are <code>ACTION_LIFECYCLE</code>,
+ * <code>RENDER_LIFECYCLE</code> and <code>RESOURCE_LIFECYCLE</code>.
+ */
+ public static final String LIFECYCLE_PHASE = "lifecycle";
+ /** The window id. */
+ public static final String WINDOW_ID = "windowid";
+ /** The portlet mode. */
+ public static final String MODE = "mode";
+ /** The window state. */
+ public static final String WINDOW_STATE = "windowstate";
+ /** The portlet navigational state for any type of lifecycle. */
+ public static final String NAVIGATIONAL_STATE = "navigationalstate";
+ /** The portlet resource state for lifecycle of type <code>RENDER_LIFECYCLE</code>. */
+ public static final String RESOURCE_STATE = "resourcestate";
+ /** The portlet interaction state for lifecycle of type <code>ACTION_LIFECYCLE</code>. */
+ public static final String INTERACTION_STATE = "interactionstate";
+ /** The page state for any kind of lifecycle. */
+ public static final String PAGE_STATE = "pagestate";
+ /** The public navigational state changes of a portlet for lifecycle of type <code>RENDER_LIFECYCLE</code>. */
+ public static final String PUBLIC_NAVIGATIONAL_STATE_CHANGES = "publicnavigationalstatechanges";
+ /** The resource id for lifecycle of type <code>RESOURCE_LIFECYCLE</code>. */
+ public static final String RESOURCE_ID = "resourceid";
+ /** The resource cacheability for lifecycle of type <code>RENDER_LIFECYCLE</code>. */
+ public static final String RESOURCE_CACHEABILITY = "resourcecacheability";
+ /** Denotes an action lifecycle operation. */
+ public static final String ACTION_PHASE = "action";
+ /** Denotes a render lifecycle operation. */
+ public static final String RENDER_PHASE = "render";
+ /** Denotes a resource lifecycle operation. */
+ public static final String RESOURCE_PHASE = "resource";
+}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/state/PageNavigationalStateImpl.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/state/PageNavigationalStateImpl.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/state/PageNavigationalStateImpl.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.controller.impl.state;
import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.info.ParameterInfo;
@@ -83,10 +82,12 @@
public ParameterMap getPublicNavigationalState(String windowId)
{
- ParameterMap publicNavigationalState = null;
- try
+ PortletInfo info = context.portletControllerContext.getPortletInfo(windowId);
+
+ //
+ if (info != null)
{
- PortletInfo info = context.portletControllerContext.getPortletInfo(windowId);
+ ParameterMap publicNavigationalState = new ParameterMap();
for (ParameterInfo parameterInfo : info.getNavigation().getPublicParameters())
{
String[] parameterValue = page.get(parameterInfo.getName());
@@ -96,24 +97,17 @@
{
String parameterId = parameterInfo.getId();
- // Lazy create
- if (publicNavigationalState == null)
- {
- publicNavigationalState = new ParameterMap();
- }
-
// We clone the value here so we keep the internal state not potentially changed
publicNavigationalState.put(parameterId, parameterValue.clone());
}
}
+
+ //
+ return publicNavigationalState;
}
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
- }
//
- return publicNavigationalState;
+ return null;
}
public Set<QName> getPublicNames()
@@ -146,10 +140,11 @@
}
//
- try
- {
- PortletInfo info = context.portletControllerContext.getPortletInfo(windowId);
+ PortletInfo info = context.portletControllerContext.getPortletInfo(windowId);
+ //
+ if (info != null)
+ {
NavigationInfo navigationInfo = info.getNavigation();
for (Map.Entry<String, String[]> entry : update.entrySet())
{
@@ -174,10 +169,6 @@
}
}
}
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
- }
}
public void setPublicNavigationalState(QName name, String[] value)
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/ContainerRequest.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/ContainerRequest.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/ContainerRequest.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.controller.request;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -34,9 +32,9 @@
/** . */
private final String windowId;
- ContainerRequest(PortletControllerContext controllerContext, String windowId)
+ ContainerRequest(String windowId)
{
- super(controllerContext);
+ super();
//
this.windowId = windowId;
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/ControllerRequest.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/ControllerRequest.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/ControllerRequest.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.controller.request;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -31,16 +31,17 @@
public class ControllerRequest
{
- /** . */
- private final PortletControllerContext controllerContext;
-
- ControllerRequest(PortletControllerContext controllerContext)
+ ControllerRequest()
{
- this.controllerContext = controllerContext;
}
- public PortletControllerContext getControllerContext()
+ /**
+ * Returns the page state or null if that kind of request cannot have one.
+ *
+ * @return the page state
+ */
+ public PageNavigationalState getPageState()
{
- return controllerContext;
+ return null;
}
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/FullScopedCacheablePortletResourceRequest.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/FullScopedCacheablePortletResourceRequest.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/FullScopedCacheablePortletResourceRequest.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -24,7 +24,6 @@
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -34,12 +33,11 @@
{
public FullScopedCacheablePortletResourceRequest(
- PortletControllerContext controllerContext,
String windowId,
String resourceId,
StateString resourceState,
ParameterMap bodyParameters)
{
- super(controllerContext, windowId, resourceId, resourceState, bodyParameters);
+ super(windowId, resourceId, resourceState, bodyParameters);
}
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PageScopedFullPortletResourceRequest.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PageScopedFullPortletResourceRequest.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PageScopedFullPortletResourceRequest.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -39,7 +39,6 @@
private final PageNavigationalState pageState;
public PageScopedFullPortletResourceRequest(
- PortletControllerContext controllerContext,
String windowId,
String resourceId,
StateString resourceState,
@@ -47,7 +46,7 @@
PageNavigationalState pageState,
WindowNavigationalState windowNavigationalState)
{
- super(controllerContext, windowId, resourceId, resourceState, bodyParameters, windowNavigationalState);
+ super(windowId, resourceId, resourceState, bodyParameters, windowNavigationalState);
//
this.pageState = pageState;
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletActionRequest.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletActionRequest.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletActionRequest.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -24,7 +24,6 @@
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
@@ -42,14 +41,13 @@
private final ParameterMap bodyParameters;
public PortletActionRequest(
- PortletControllerContext controllerContext,
String windowId,
StateString interactionState,
ParameterMap bodyParameters,
WindowNavigationalState windowNavigationalState,
PageNavigationalState pageState)
{
- super(controllerContext, windowId, windowNavigationalState, pageState);
+ super(windowId, windowNavigationalState, pageState);
//
this.interactionState = interactionState;
Added: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletEventRequest.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletEventRequest.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletEventRequest.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -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.controller.request;
+
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+/**
+ * An event request. The purpose of this type of request is to allow
+ * the portal to fire events to a portlet.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletEventRequest extends PortletRequest
+{
+
+ /** . */
+ private final QName name;
+
+ /** . */
+ private final Serializable payload;
+
+ public PortletEventRequest(
+ String windowId,
+ WindowNavigationalState windowNavigationalState,
+ PageNavigationalState pageState,
+ QName name,
+ Serializable payload)
+ {
+ super(windowId, windowNavigationalState, pageState);
+
+ //
+ this.name = name;
+ this.payload = payload;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public Serializable getPayload()
+ {
+ return payload;
+ }
+}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletRenderRequest.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletRenderRequest.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletRenderRequest.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -39,13 +39,12 @@
private final Map<String, String[]> publicNavigationalStateChanges;
public PortletRenderRequest(
- PortletControllerContext controllerContext,
String windowId,
WindowNavigationalState windowNavigationalState,
Map<String, String[]> publicNavigationalStateChanges,
PageNavigationalState pageState)
{
- super(controllerContext, windowId, windowNavigationalState, pageState);
+ super(windowId, windowNavigationalState, pageState);
//
this.publicNavigationalStateChanges = publicNavigationalStateChanges;
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletRequest.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletRequest.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletRequest.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -40,12 +40,11 @@
private final WindowNavigationalState windowNavigationalState;
PortletRequest(
- PortletControllerContext controllerContext,
String windowId,
WindowNavigationalState windowNavigationalState,
PageNavigationalState pageState)
{
- super(controllerContext, windowId);
+ super(windowId);
//
this.windowNavigationalState = windowNavigationalState;
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletResourceRequest.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletResourceRequest.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletResourceRequest.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -25,7 +25,6 @@
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.cache.CacheLevel;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
import java.util.HashMap;
import java.util.Map;
@@ -57,14 +56,13 @@
private final ParameterMap bodyParameters;
PortletResourceRequest(
- PortletControllerContext controllerContext,
String windowId,
String resourceId,
StateString resourceState,
ParameterMap bodyParameters
)
{
- super(controllerContext, windowId);
+ super(windowId);
//
this.resourceId = resourceId;
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletScopedPortletResourceRequest.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletScopedPortletResourceRequest.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/request/PortletScopedPortletResourceRequest.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -38,14 +38,13 @@
private final WindowNavigationalState windowNavigationalState;
public PortletScopedPortletResourceRequest(
- PortletControllerContext controllerContext,
String windowId,
String resourceId,
StateString resourceState,
ParameterMap bodyParameters,
WindowNavigationalState windowNavigationalState)
{
- super(controllerContext, windowId, resourceId, resourceState, bodyParameters);
+ super(windowId, resourceId, resourceState, bodyParameters);
//
this.windowNavigationalState = windowNavigationalState;
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-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -23,12 +23,15 @@
package org.jboss.portal.portlet.test;
import org.jboss.portal.portlet.controller.PortletController;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
+import org.jboss.portal.portlet.controller.request.ControllerRequest;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.invocation.response.ResponseProperties;
import org.jboss.portal.portlet.test.controller.ControllerResponseRendererFactory;
import org.jboss.portal.portlet.test.controller.PageRenderer;
import org.jboss.portal.portlet.test.controller.PortletControllerContextImpl;
import org.jboss.portal.portlet.test.controller.Renderer;
+import org.jboss.portal.web.WebRequest;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -74,10 +77,17 @@
//
PortletController controller = new PortletController();
- if (context.getRequest() != null)
+ String type = req.getParameter(URLParameterConstants.TYPE);
+
+ //
+ if (URLParameterConstants.PORTLET_TYPE.equals(type))
{
+ WebRequest wr = new WebRequest(req);
+ ControllerRequestFactory factory = new ControllerRequestFactory(context.getStateControllerContext());
+ ControllerRequest request = factory.createRequest(wr);
+
//
- ControllerResponse response = controller.process(context.getRequest());
+ ControllerResponse response = controller.process(context, request);
//
Renderer renderer = ControllerResponseRendererFactory.getRenderer(response);
@@ -87,6 +97,7 @@
}
else
{
+
PageRenderer renderer = new PageRenderer(new ResponseProperties(), context.getStateControllerContext().createPageState(false));
//
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/URLParameterConstants.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/URLParameterConstants.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/URLParameterConstants.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -44,49 +44,4 @@
*/
public static final String PORTLET_TYPE = "portlet";
- /**
- * The life cycle type of the invocation. The values accepted are <code>ACTION_LIFECYCLE</code>,
- * <code>RENDER_LIFECYCLE</code> and <code>RESOURCE_LIFECYCLE</code>.
- */
- public static final String LIFECYCLE_PHASE = "lifecycle";
-
- /** The window id. */
- public static final String WINDOW_ID = "windowid";
-
- /** The portlet mode. */
- public static final String MODE = "mode";
-
- /** The window state. */
- public static final String WINDOW_STATE = "windowstate";
-
- /** The portlet navigational state for any type of lifecycle. */
- public static final String NAVIGATIONAL_STATE = "navigationalstate";
-
- /** The portlet resource state for lifecycle of type <code>RENDER_LIFECYCLE</code>. */
- public static final String RESOURCE_STATE = "resourcestate";
-
- /** The portlet interaction state for lifecycle of type <code>ACTION_LIFECYCLE</code>. */
- public static final String INTERACTION_STATE = "interactionstate";
-
- /** The page state for any kind of lifecycle. */
- public static final String PAGE_STATE = "pagestate";
-
- /** The public navigational state changes of a portlet for lifecycle of type <code>RENDER_LIFECYCLE</code>. */
- public static final String PUBLIC_NAVIGATIONAL_STATE_CHANGES = "publicnavigationalstatechanges";
-
- /** The resource id for lifecycle of type <code>RESOURCE_LIFECYCLE</code>. */
- public static final String RESOURCE_ID = "resourceid";
-
- /** The resource cacheability for lifecycle of type <code>RENDER_LIFECYCLE</code>. */
- public static final String RESOURCE_CACHEABILITY = "resourcecacheability";
-
- /** Denotes an action lifecycle operation. */
- public static final String ACTION_PHASE = "action";
-
- /** Denotes a render lifecycle operation. */
- public static final String RENDER_PHASE = "render";
-
- /** Denotes a resource lifecycle operation. */
- public static final String RESOURCE_PHASE = "resource";
-
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractMarkupRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractMarkupRenderer.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractMarkupRenderer.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -47,7 +47,7 @@
this.properties = properties;
}
- public void render(PortletControllerContext context) throws IOException
+ public void render(PortletControllerContextImpl context) throws IOException
{
prepareRendering(context);
HttpServletResponse resp = context.getClientResponse();
@@ -85,7 +85,7 @@
}
}
- protected void prepareRendering(PortletControllerContext context)
+ protected void prepareRendering(PortletControllerContextImpl context)
{
// default behavior does nothing
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -23,33 +23,12 @@
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.io.Serialization;
-import org.jboss.portal.common.io.SerializationFilter;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.util.MediaType;
-import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.common.util.Base64;
-import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.portlet.controller.PortletControllerContext;
-import org.jboss.portal.portlet.controller.event.EventControllerContext;
-import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
-import org.jboss.portal.portlet.controller.request.ControllerRequest;
-import org.jboss.portal.portlet.controller.request.FullScopedCacheablePortletResourceRequest;
-import org.jboss.portal.portlet.controller.request.PageScopedFullPortletResourceRequest;
-import org.jboss.portal.portlet.controller.request.PortletActionRequest;
-import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
-import org.jboss.portal.portlet.controller.request.PortletScopedPortletResourceRequest;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.state.StateControllerContext;
-import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
-import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
@@ -63,18 +42,14 @@
import org.jboss.portal.portlet.invocation.ResourceInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import static org.jboss.portal.portlet.test.URLParameterConstants.*;
-import org.jboss.portal.web.Body;
import org.jboss.portal.web.IllegalRequestException;
-import org.jboss.portal.web.WebRequest;
+import org.apache.log4j.Logger;
-import javax.servlet.ServletContext;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
-import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -84,6 +59,9 @@
{
/** . */
+ private static Logger log = Logger.getLogger(AbstractPortletControllerContext.class);
+
+ /** . */
public static final MarkupInfo MARKUP_INFO = new MarkupInfo(MediaType.HTML, "UTF8");
/** . */
@@ -98,189 +76,14 @@
/** . */
private final HttpServletResponse resp;
- /** . */
- private final ServletContext servletContext;
-
- /** . */
- private final ControllerRequest request;
-
- /** . */
- private final StateControllerContextImpl stateControllerContext;
-
- /** . */
- private final PageNavigationalState pageState;
-
- public AbstractPortletControllerContext(
- HttpServletRequest req,
- HttpServletResponse resp,
- ServletContext servletContext)
+ public AbstractPortletControllerContext(HttpServletRequest req, HttpServletResponse resp
+ )
throws IllegalRequestException, IOException
{
- StateControllerContextImpl tmp = new StateControllerContextImpl(this);
-
- //
- PageNavigationalStateSerialization serialization = new PageNavigationalStateSerialization(tmp);
-
- // The nav state provided with the request
- // Unmarshall portal navigational state if it is provided
- PageNavigationalState pageState = null;
- String context = req.getParameter(PAGE_STATE);
- if (context != null)
- {
- byte[] bytes = Base64.decode(context, true);
- pageState = IOTools.unserialize(serialization, SerializationFilter.COMPRESSOR, bytes);
- }
-
- // The type of invocation
- String type = req.getParameter(TYPE);
-
- // Process only portlet type
- // The request decoded if not null
- ControllerRequest request = null;
- if (PORTLET_TYPE.equals(type))
- {
- // Get the window id
- String windowId = req.getParameter(WINDOW_ID);
-
- // Helper
- WebRequest ri = new WebRequest(req);
-
- //
- 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 phase = req.getParameter(LIFECYCLE_PHASE);
- if (RESOURCE_PHASE.equals(phase))
- {
- 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 FullScopedCacheablePortletResourceRequest(
- this,
- windowId,
- resourceId,
- resourceState,
- formParameters);
- break;
- case PORTLET:
- request = new PortletScopedPortletResourceRequest(
- this,
- windowId,
- resourceId,
- resourceState,
- formParameters,
- windowNavigationalState);
- break;
- case PAGE:
- request = new PageScopedFullPortletResourceRequest(
- this,
- windowId,
- resourceId,
- resourceState,
- formParameters,
- pageState,
- windowNavigationalState);
- break;
- }
- }
- else
- {
- if (ACTION_PHASE.equals(phase))
- {
- 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 PortletActionRequest(
- this,
- windowId,
- interactionState,
- formParameters,
- windowNavigationalState,
- pageState);
- }
- else
- {
- byte[] bytes = Base64.decode(req.getParameter(PUBLIC_NAVIGATIONAL_STATE_CHANGES), true);
- Map<String, String[]> publicNavigationalStateChanges = IOTools.unserialize(Serialization.PARAMETER_MAP, SerializationFilter.COMPRESSOR, bytes);
-
- //
- request = new PortletRenderRequest(
- this,
- windowId,
- windowNavigationalState,
- publicNavigationalStateChanges,
- pageState);
- }
- }
- }
-
- //
- this.request = request;
this.req = req;
this.resp = resp;
- this.servletContext = servletContext;
- this.stateControllerContext = tmp;
- this.pageState = pageState;
}
- public PageNavigationalState getPageState()
- {
- return pageState;
- }
-
- public ControllerRequest getRequest()
- {
- return request;
- }
-
- public ServletContext getServletContext()
- {
- return servletContext;
- }
-
public HttpServletRequest getClientRequest()
{
return req;
@@ -291,24 +94,30 @@
return resp;
}
- public PortletInfo getPortletInfo(String windowId) throws PortletInvokerException
+ public PortletInfo getPortletInfo(String windowId)
{
- return getPortlet(windowId).getInfo();
+ try
+ {
+ return getPortlet(windowId).getInfo();
+ }
+ catch (PortletInvokerException e)
+ {
+ log.error("Could not access portlet invoker for locating window " + windowId, e);
+
+ //
+ return null;
+ }
}
protected abstract Portlet getPortlet(String windowId) throws PortletInvokerException;
protected abstract PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException;
- public abstract EventControllerContext getEventControllerContext();
-
- public StateControllerContext getStateControllerContext()
+ public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws PortletInvokerException
{
- return stateControllerContext;
- }
- public PortletInvocationResponse invoke(String windowId, ActionInvocation actionInvocation) throws PortletInvokerException
- {
+ TestPortletInvocationContext context = (TestPortletInvocationContext)actionInvocation.getContext();
+ String windowId = context.getWindowId();
Portlet portlet = getPortlet(windowId);
@@ -324,11 +133,14 @@
actionInvocation.setRequestContext(new AbstractRequestContext(req));
actionInvocation.setTarget(instanceContext.getTarget());
- return invoke(actionInvocation);
+ return invoke((PortletInvocation)actionInvocation);
}
- public PortletInvocationResponse invoke(String windowId, List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
+ public PortletInvocationResponse invoke(List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
{
+ TestPortletInvocationContext context = (TestPortletInvocationContext)eventInvocation.getContext();
+ String windowId = context.getWindowId();
+
Portlet portlet = getPortlet(windowId);
TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
@@ -345,8 +157,11 @@
return invoke(eventInvocation);
}
- public PortletInvocationResponse invoke(String windowId, ResourceInvocation resourceInvocation) throws PortletInvokerException
+ public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws PortletInvokerException
{
+ TestPortletInvocationContext context = (TestPortletInvocationContext)resourceInvocation.getContext();
+ String windowId = context.getWindowId();
+
Portlet portlet = getPortlet(windowId);
TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
@@ -361,12 +176,12 @@
resourceInvocation.setRequestContext(new AbstractRequestContext(req));
resourceInvocation.setTarget(instanceContext.getTarget());
- return invoke(resourceInvocation);
+ //
+ return invoke((PortletInvocation)resourceInvocation);
}
public PortletInvocationContext createPortletInvocationContext(String windowId, PageNavigationalState pageState)
{
- return new TestPortletInvocationContext(stateControllerContext, req, resp, windowId, pageState, MARKUP_INFO);
+ return new TestPortletInvocationContext(getStateControllerContext(), req, resp, windowId, pageState, MARKUP_INFO);
}
-
}
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorResponseRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorResponseRenderer.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorResponseRenderer.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -24,7 +24,6 @@
package org.jboss.portal.portlet.test.controller;
import org.apache.log4j.Logger;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import java.io.IOException;
@@ -47,7 +46,7 @@
this.response = response;
}
- public void render(PortletControllerContext context) throws IOException
+ public void render(PortletControllerContextImpl context) throws IOException
{
if (response.getCause() != null)
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -125,7 +125,7 @@
writer.print("</body></html>");
}
- protected void prepareRendering(PortletControllerContext context)
+ protected void prepareRendering(PortletControllerContextImpl context)
{
// What we collect during the different renders
@@ -216,7 +216,7 @@
}
protected RenderInvocation createRenderInvocation(
- PortletControllerContext context, ResponseProperties pageProperties, PageNavigationalState pageNS, Portlet portlet,
+ PortletControllerContextImpl context, ResponseProperties pageProperties, PageNavigationalState pageNS, Portlet portlet,
WindowNavigationalState windowNS, Mode mode, WindowState windowState, StateString portletNS, ParameterMap publicNS)
{
HttpServletRequest req = context.getClientRequest();
Modified: 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-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -23,61 +23,23 @@
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.MarkupInfo;
-import org.jboss.portal.common.util.MediaType;
-import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.ContainerURL;
-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.controller.PortletControllerContext;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.impl.event.EventControllerContextImpl;
import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
-import org.jboss.portal.portlet.controller.request.ControllerRequest;
-import org.jboss.portal.portlet.controller.request.FullScopedCacheablePortletResourceRequest;
-import org.jboss.portal.portlet.controller.request.PageScopedFullPortletResourceRequest;
-import org.jboss.portal.portlet.controller.request.PortletActionRequest;
-import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
-import org.jboss.portal.portlet.controller.request.PortletScopedPortletResourceRequest;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.StateControllerContext;
-import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
-import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
-import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
-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.info.PortletInfo;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.ResourceInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.portlet.test.StringCodec;
-import static org.jboss.portal.portlet.test.URLParameterConstants.*;
-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.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
-import java.util.List;
-import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -92,14 +54,18 @@
/** . */
private final EventControllerContext eventControllerContext;
+ /** . */
+ private final StateControllerContext stateControllerContext;
+
public PortletControllerContextImpl(HttpServletRequest req, HttpServletResponse resp, ServletContext servletContext)
throws IllegalRequestException, IOException, ClassNotFoundException
{
- super(req, resp, servletContext);
+ super(req, resp);
//
this.invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
this.eventControllerContext = new EventControllerContextImpl(invoker);
+ this.stateControllerContext = new StateControllerContextImpl(this);
}
protected Portlet getPortlet(String windowId) throws PortletInvokerException
@@ -107,6 +73,11 @@
return invoker.getPortlet(PortletContext.createPortletContext(windowId));
}
+ public StateControllerContext getStateControllerContext()
+ {
+ return stateControllerContext;
+ }
+
protected PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
{
return invoker.invoke(invocation);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -24,26 +24,20 @@
package org.jboss.portal.portlet.test.controller;
import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.common.io.Serialization;
import org.jboss.portal.common.io.SerializationFilter;
import org.jboss.portal.common.text.CharBuffer;
import org.jboss.portal.common.text.FastURLEncoder;
import org.jboss.portal.common.util.Base64;
-import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.ResourceURL;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.cache.CacheLevel;
-import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterNames;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterMapFactory;
import static org.jboss.portal.portlet.test.URLParameterConstants.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.util.HashMap;
import java.util.Map;
import java.util.Collections;
@@ -55,7 +49,7 @@
{
/** . */
- final StateControllerContextImpl stateContext;
+ final StateControllerContext stateContext;
/** . */
final PageNavigationalStateSerialization serialization;
@@ -70,7 +64,7 @@
final PageNavigationalState pageNS;
public PortletURLRenderer(
- StateControllerContextImpl stateContext,
+ StateControllerContext stateContext,
PageNavigationalState pageNS,
HttpServletRequest clientReq,
HttpServletResponse clientResp)
@@ -130,7 +124,7 @@
Map<String, String> parameters;
if (pageState != null)
{
- parameters = Collections.singletonMap(PAGE_STATE, pageState);
+ parameters = Collections.singletonMap(ControllerRequestParameterNames.PAGE_STATE, pageState);
}
else
{
@@ -143,144 +137,15 @@
public String renderURL(String windowId, ContainerURL containerURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
{
- Map<String, String> parameters = new HashMap<String, String>();
+ ControllerRequestParameterMapFactory factory = new ControllerRequestParameterMapFactory(stateContext);
//
- parameters.put(TYPE, PORTLET_TYPE);
+ Map<String, String> parameters = factory.blah(pageNS, windowId, containerURL);
//
- parameters.put(WINDOW_ID, windowId);
+ parameters.put(TYPE, PORTLET_TYPE);
//
- String type;
- if (containerURL instanceof ActionURL)
- {
- type = ACTION_PHASE;
- }
- else if (containerURL instanceof RenderURL)
- {
- type = RENDER_PHASE;
- }
- else if (containerURL instanceof ResourceURL)
- {
- type = RESOURCE_PHASE;
- }
- else
- {
- throw new Error();
- }
- parameters.put(LIFECYCLE_PHASE, type);
-
- //
- String pageState = null;
- if (pageNS != null)
- {
- byte[] bytes = IOTools.serialize(serialization, SerializationFilter.COMPRESSOR, pageNS);
- pageState = Base64.encodeBytes(bytes, true);
- }
-
- //
- if (containerURL instanceof PortletURL)
- {
- PortletURL portletURL = (PortletURL)containerURL;
-
- if (portletURL.getMode() != null)
- {
- parameters.put(MODE, portletURL.getMode().toString());
- }
-
- //
- if (portletURL.getWindowState() != null)
- {
- parameters.put(WINDOW_STATE, portletURL.getWindowState().toString());
- }
-
- //
- if (pageState != null)
- {
- parameters.put(PAGE_STATE, pageState);
- }
-
- //
- if (containerURL instanceof ActionURL)
- {
- ActionURL actionURL = (ActionURL)containerURL;
-
- //
- if (actionURL.getNavigationalState() != null)
- {
- parameters.put(NAVIGATIONAL_STATE, actionURL.getNavigationalState().getStringValue());
- }
-
- //
- StateString interactionState = actionURL.getInteractionState();
- parameters.put(INTERACTION_STATE, interactionState.getStringValue());
- }
- else
- {
- RenderURL renderURL = (RenderURL)containerURL;
-
- //
- Map<String, String[]> changes = renderURL.getPublicNavigationalStateChanges();
- byte[] bytes = IOTools.serialize(Serialization.PARAMETER_MAP, SerializationFilter.COMPRESSOR, changes);
- String ns = Base64.encodeBytes(bytes, true);
- parameters.put(PUBLIC_NAVIGATIONAL_STATE_CHANGES, ns);
-
- //
- StateString navigationalState = renderURL.getNavigationalState();
- if (navigationalState != null)
- {
- parameters.put(NAVIGATIONAL_STATE, navigationalState.getStringValue());
- }
- }
- }
- else
- {
- ResourceURL resourceURL = (ResourceURL)containerURL;
-
- //
- StateString resourceState = resourceURL.getResourceState();
- parameters.put(RESOURCE_STATE, resourceState.getStringValue());
-
- //
- String resourceId = resourceURL.getResourceId();
- if (resourceId != null)
- {
- parameters.put(RESOURCE_ID, resourceId);
- }
-
- //
- CacheLevel cacheability = resourceURL.getCacheability();
- parameters.put(RESOURCE_CACHEABILITY, cacheability.name());
-
- //
- if (cacheability != CacheLevel.FULL)
- {
- if (resourceURL.getNavigationalState() != null)
- {
- parameters.put(NAVIGATIONAL_STATE, resourceURL.getNavigationalState().getStringValue());
- }
-
- //
- if (resourceURL.getMode() != null)
- {
- parameters.put(MODE, resourceURL.getMode().toString());
- }
-
- //
- if (resourceURL.getWindowState() != null)
- {
- parameters.put(WINDOW_STATE, resourceURL.getWindowState().toString());
- }
-
- if (cacheability == CacheLevel.PAGE && pageState != null)
- {
- parameters.put(PAGE_STATE, pageState);
- }
- }
- }
-
- //
return renderURL(parameters, wantSecure, wantAuthenticated, relative);
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectResponseRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectResponseRenderer.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectResponseRenderer.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.test.controller;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import java.io.IOException;
@@ -43,7 +42,7 @@
this.response = response;
}
- public void render(PortletControllerContext context) throws IOException
+ public void render(PortletControllerContextImpl context) throws IOException
{
context.getClientResponse().sendRedirect(response.getLocation());
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/Renderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/Renderer.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/Renderer.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -33,5 +33,5 @@
*/
public interface Renderer
{
- void render(PortletControllerContext context) throws IOException;
+ void render(PortletControllerContextImpl context) throws IOException;
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -29,6 +29,7 @@
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -43,7 +44,7 @@
{
/** . */
- private final StateControllerContextImpl stateContext;
+ private final StateControllerContext stateContext;
/** . */
private final PortletURLRenderer urlRenderer;
@@ -61,7 +62,7 @@
private final HttpServletResponse clientResponse;
public TestPortletInvocationContext(
- StateControllerContextImpl stateContext,
+ StateControllerContext stateContext,
HttpServletRequest clientRequest,
HttpServletResponse clientResponse,
String windowId,
@@ -86,6 +87,11 @@
addResolver(PortletInvocation.REQUEST_SCOPE, new MapAttributeResolver());
}
+ public String getWindowId()
+ {
+ return windowId;
+ }
+
public HttpServletRequest getClientRequest() throws IllegalStateException
{
return clientRequest;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.test.jsp;
import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
+import org.jboss.portal.portlet.test.URLParameterConstants;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -30,13 +31,20 @@
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.controller.request.PortletActionRequest;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
+import org.jboss.portal.portlet.controller.request.ControllerRequest;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterNames;
import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
import org.jboss.portal.portlet.controller.response.ResourceResponse;
import org.jboss.portal.portlet.controller.response.PortletResponse;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.util.Base64;
+import org.jboss.portal.web.WebRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -96,14 +104,22 @@
// Now we can create a populated context
PagePortletControllerContext context = new PagePortletControllerContext(req, resp, invoker, getServletContext(), prepareResponse);
- //
+ // The type of invocation
+ String type = req.getParameter(URLParameterConstants.TYPE);
+
+ // Process only portlet type
+ // The request decoded if not null
PageNavigationalState pageState = null;
- if (context.getRequest() != null)
+ if (URLParameterConstants.PORTLET_TYPE.equals(type))
{
+ WebRequest wr = new WebRequest(req);
+ ControllerRequestFactory factory = new ControllerRequestFactory(context.getStateControllerContext());
+ ControllerRequest request = factory.createRequest(wr);
+
ControllerResponse controllerResponse;
try
{
- controllerResponse = new PortletController().process(context.getRequest());
+ controllerResponse = new PortletController().process(context, request);
}
catch (PortletInvokerException e)
{
@@ -116,7 +132,7 @@
PageUpdateResponse pageUpdate = (PageUpdateResponse)controllerResponse;
// We perform a send redirect on actions
- if (context.getRequest() instanceof PortletActionRequest)
+ if (request instanceof PortletActionRequest)
{
//
PortletURLRenderer renderer = new PortletURLRenderer(
@@ -231,7 +247,16 @@
}
else
{
- pageState = context.getPageState();
+ PageNavigationalStateSerialization serialization = new PageNavigationalStateSerialization(context.getStateControllerContext());
+ // The nav state provided with the request
+ // Unmarshall portal navigational state if it is provided
+ pageState = null;
+ String blah = req.getParameter(ControllerRequestParameterNames.PAGE_STATE);
+ if (blah != null)
+ {
+ byte[] bytes = Base64.decode(blah, true);
+ pageState = IOTools.unserialize(serialization, SerializationFilter.COMPRESSOR, bytes);
+ }
}
//
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -27,6 +27,8 @@
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.test.controller.AbstractPortletControllerContext;
@@ -51,6 +53,9 @@
private final EventControllerContext eventControllerContext;
/** . */
+ private final StateControllerContext stateControllerContext;
+
+ /** . */
private final PortalPrepareResponse prepareResponse;
/** . */
@@ -67,7 +72,7 @@
PortalPrepareResponse prepareResponse)
throws IllegalRequestException, IOException, ServletException, PortletInvokerException
{
- super(req, resp, servletContext);
+ super(req, resp);
//
Map<Key, Portlet> portlets = new HashMap<Key, Portlet>();
@@ -84,6 +89,7 @@
this.invoker = invoker;
this.portlets = portlets;
this.prepareResponse = prepareResponse;
+ this.stateControllerContext = new StateControllerContextImpl(this);
this.eventControllerContext = new PageEventControllerContext(this, prepareResponse);
}
@@ -110,6 +116,11 @@
return eventControllerContext;
}
+ public StateControllerContext getStateControllerContext()
+ {
+ return stateControllerContext;
+ }
+
private static class Key
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -94,7 +94,7 @@
}
PortletURLRenderer renderer = new PortletURLRenderer(
- (StateControllerContextImpl)context.getStateControllerContext(),
+ context.getStateControllerContext(),
renderResponse.getPageState(),
context.getClientRequest(),
context.getClientResponse());
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/controller/StateControllerContextTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/controller/StateControllerContextTestCase.java 2008-02-16 06:20:27 UTC (rev 10000)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/controller/StateControllerContextTestCase.java 2008-02-16 19:09:16 UTC (rev 10001)
@@ -40,12 +40,10 @@
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.common.io.SerializationFilter;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import static org.jboss.unit.api.Assert.*;
-import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Cookie;
@@ -114,11 +112,6 @@
private static final PortletControllerContext dummyContext = new PortletControllerContext()
{
- public ServletContext getServletContext()
- {
- throw new NotYetImplemented();
- }
-
public HttpServletRequest getClientRequest()
{
throw new NotYetImplemented();
@@ -129,7 +122,7 @@
throw new NotYetImplemented();
}
- public PortletInfo getPortletInfo(String windowId) throws PortletInvokerException
+ public PortletInfo getPortletInfo(String windowId)
{
throw new NotYetImplemented();
}
@@ -139,17 +132,17 @@
throw new NotYetImplemented();
}
- public PortletInvocationResponse invoke(String windowId, ActionInvocation actionInvocation) throws PortletInvokerException
+ public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws PortletInvokerException
{
throw new NotYetImplemented();
}
- public PortletInvocationResponse invoke(String windowId, List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
+ public PortletInvocationResponse invoke(List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
{
throw new NotYetImplemented();
}
- public PortletInvocationResponse invoke(String windowId, ResourceInvocation resourceInvocation) throws PortletInvokerException
+ public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws PortletInvokerException
{
throw new NotYetImplemented();
}
16 years, 7 months
JBoss Portal SVN: r10000 - in docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en: images/tutorials/jsp_portlet and 1 other directories.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-16 01:20:27 -0500 (Sat, 16 Feb 2008)
New Revision: 10000
Added:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/tutorials/jsf_portlet/jsf_ant_deploy.png
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/tutorials/jsf_portlet/jsf_ant_explode.png
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/tutorials/jsp_portlet/jsp_ant_explode.png
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml
Log:
5.2.3. An example Sun JSF Reference Implementation (RI) Portlet
* adding images of ant deploy and ant explode
* fixing my images that had a black line
* revising 5.2.3 to be consistent with 5.2.1. Deploying your first Portlet
and 5.2.2. An example JSP Portlet
Added: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/tutorials/jsf_portlet/jsf_ant_deploy.png
===================================================================
(Binary files differ)
Property changes on: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/tutorials/jsf_portlet/jsf_ant_deploy.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/tutorials/jsf_portlet/jsf_ant_explode.png
===================================================================
(Binary files differ)
Property changes on: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/tutorials/jsf_portlet/jsf_ant_explode.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/tutorials/jsp_portlet/jsp_ant_explode.png
===================================================================
(Binary files differ)
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml 2008-02-16 05:05:05 UTC (rev 9999)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml 2008-02-16 06:20:27 UTC (rev 10000)
@@ -1155,34 +1155,114 @@
</para>
</sect3>
<sect3>
- <title>Building and deploying your portlet</title>
- <para>If you have downloaded the sample, you can execute the build.xml with ant or inside your IDE.
- Executing <literal>ant</literal> will compile all source files and produce a
- <literal>helloworldjspportlet.war</literal> file in a way similar to what we saw in
- <xref linkend="first_portlet_build"/>.
+ <title>Building your JSF Portlet</title>
+ <para>
+ The <filename>HelloWorldJSFSunRIPortlet.zip</filename> file contains a pre-compiled <filename>helloworldjsfsunriportlet.war</filename> file; however, to manually build the <filename>helloworldjsfsunriportlet.war</filename> file:
+ </para>
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ Change into the <filename>HHelloWorldJSFSunRIPortlet</filename> directory, and remove the existing <filename>helloworldjsfsunriportlet.war</filename> file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If required, edit the <filename>HelloWorldJSFSunRIPortlet/src/main/org/jboss/portlet/hello/bean/User.java</filename> file, and the XML descriptors in the <filename>HelloWorldJSFSunRIPortlet/src/resources/helloworldjsfsunriportlet-war/WEB-INF/</filename> directory.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Change into <filename>HelloWorldJSFSunRIPortlet/</filename> directory, and run the <command>ant deploy</command> command. On Linux, the output will be similar to the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/tutorials/jsf_portlet/jsf_ant_deploy.png" valign="middle"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ Note: the directory names will be different for your system.
+ </para>
+ <para>
+ Expanding the <filename>helloworldjsfsunriportlet.war</filename> file allows you to deploy the portlet as an expanded directory, which makes development easier. As well, it gives you access to the XML descriptors, resource files, JSF, and JSP pages. To expand the <filename>helloworldjsfsunriportlet.war</filename> file:
+ </para>
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ If you do not have the <filename>HelloWorldJSFSunRIPortlet/helloworldjsfsunriportlet.war</filename> file, change into the <filename>HelloWorldJSFSunRIPortlet/</filename> directory, and run the <command>ant deploy</command> command. This creates the <filename>helloworldjsfsunriportlet.war</filename> file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ To expand the war file, change into the <filename>HelloWorldJSFSunRIPortlet/</filename> directory, and run the <command>ant explode</command> command. On Linux, the output will be similar to the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/tutorials/jsf_portlet/jsf_ant_explode.png" valign="middle"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ Note: the directory names will be different for your system.
+ </para>
+ <para>
+ The expanded war file and the XML descriptors are located in the <filename>HelloWorldJSFSunRIPortlet/output/lib/exploded/helloworldjsfsunriportlet.war</filename> directory.
</para>
- <!--
- <para>
- The <literal>explode</literal> target will produce the following:
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/exploded.gif" valign="middle"/>
- </imageobject>
+ </sect3>
+ <sect3>
+ <title>Deploying your JSF Portlet</title>
+ <para>
+ If you did not expand the <filename>helloworldjsfsunriportlet.war</filename> file, copy the <filename>HelloWorldJSFSunRIPortlet/helloworldjsfsunriportlet.war</filename> file into the correct JBoss AS or JBoss EAP <filename>deploy/</filename> directory. If you expanded the <filename>helloworldjsfsunriportlet.war</filename> file, copy the <filename>HelloWorldJSFSunRIPortlet/output/lib/exploded/helloworldjsfsunriportlet.war/</filename> directory into the correct JBoss AS or JBoss EAP <filename>deploy/</filename> directory. For example, if you are using JBoss AS, copy the war file or the expanded directory into the <filename>$JBOSS_HOME/server/default/deploy/</filename> directory.
+ </para>
+ <para>
+ Performing this step on a running instance of JBoss AS or JBoss EAP, and JBoss Portal, will trigger a hot-deploy of the portlet:
+ </para>
+ <para>
+<screen><![CDATA[
+INFO [TomcatDeployer] deploy, ctxPath=/helloworldjsfsunriportlet, warUrl=.../tmp/deploy/tmp9138helloworldjsfsunriportlet-exp.war/]]>
+</screen>
+ </para>
+ <para>
+ To see the HelloWorldJSFPortlet, navigate to <ulink url="http://localhost:8080/portal/">http://localhost:8080/portal/</ulink>, or, if the default JBoss Portal page is already open, refresh the page. The HelloWorldJSFPortlet is added to the bottom of the default JBoss Portal page:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/tutorials/jsf_portlet/output.png" valign="middle"/>
+ </imageobject>
</mediaobject>
</para>
- -->
- <para>
- Deploying the portlet is as easy as copying/moving the <literal>helloworldjspportlet.war</literal> file
- to the server <literal>deploy</literal> directory. We can then see our portlet on the Portal default
- page (<ulink url="http://localhost:8080/portal/">http://localhost:8080/portal/</ulink>):
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/output.png" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- </sect3>
- </sect2>
+ <para>
+ To re-deploy the portlet, for example, if you have made changes to any of the XML descriptors, touch the <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldjsfsunriportlet.war/WEB-INF/web.xml</filename> file. On Linux, run the following command to re-deploy the HelloWorldPortlet:
+ </para>
+ <para>
+<screen>
+touch $JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldjsfsunriportlet.war/WEB-INF/web.xml
+</screen>
+ </para>
+ <para>
+ Re-deploying the HelloWorldJSFPortlet will produce output to the JBoss AS or JBoss EAP console, similar to the following:
+ </para>
+ <para>
+<screen><![CDATA[
+INFO [TomcatDeployer] undeploy, ctxPath=/helloworldjsfsunriportlet,
+warUrl=.../deploy/helloworldjsfsunriportlet.war/
+INFO [TomcatDeployer] deploy, ctxPath=/helloworldjsfsunriportlet,
+warUrl=.../deploy/helloworldjsfsunriportlet.war/]]>
+</screen>
+ </para>
+ </sect3>
+</sect2>
<!--<sect2 id="sunri_42x_301">
<title>Portal and JSF RI: A basic demonstration using common components</title>
<sect3>
16 years, 7 months
JBoss Portal SVN: r9999 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-16 00:05:05 -0500 (Sat, 16 Feb 2008)
New Revision: 9999
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml
Log:
minor corrections/revisions
5.2.3. An example Sun JSF Reference Implementation (RI) Portlet
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml 2008-02-16 04:01:16 UTC (rev 9998)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml 2008-02-16 05:05:05 UTC (rev 9999)
@@ -974,7 +974,7 @@
</mediaobject>
</para>
<para>
- To re-deploy the portlet, for example, if you have made changes to any of the XML descriptors, touch the $JBOSS_HOME/server/configuration/deploy/helloworldjspportlet.war/WEB-INF/web.xml file. On Linux, run the following command to re-deploy the HelloWorldJSPPortlet:
+ To re-deploy the portlet, for example, if you have made changes to any of the XML descriptors, touch the <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldjspportlet.war/WEB-INF/web.xml</filename> file. On Linux, run the following command to re-deploy the HelloWorldJSPPortlet:
</para>
<para>
<screen>
@@ -999,13 +999,13 @@
<sect3>
<title>Introduction</title>
<para>
- This section describes how to deploy a JSF portlet in JBoss Portal, using the Apache MyFaces JSF implementation on JBoss AS or JBoss EAP. Before proceeding, download the <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">HelloWorldJSFSunRIPortlet</ulink> from <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>.
+ This section describes how to deploy a JSF portlet in JBoss Portal, using the Apache MyFaces JSF implementation in JBoss AS or JBoss EAP. Before proceeding, download the <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">HelloWorldJSFSunRIPortlet</ulink> from <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>.
</para>
</sect3>
<sect3>
<title>Package Structure</title>
<para>
- JBoss Portal requires certain descriptors to be included in a portlet WAR file. Some of these descriptors are defined by the JSR-168 Portlet Specification, and others are specific to JBoss Portal. Like a typical JSF application, the HelloWorldJSFSunRIPortlet package contains a <filename>faces-config.xml</filename> file, that defines managed-beans, converters, validators, navigation rules, and so on. The following is an example of the directory structure of the HelloWorldJSFSunRIPortlet portlet:
+ JBoss Portal requires certain descriptors to be included in a portlet WAR file. Some of these descriptors are defined by the JSR-168 Portlet Specification, and others are specific to JBoss Portal. Like a typical JSF application, the HelloWorldJSFSunRIPortlet package contains a <filename>faces-config.xml</filename> file that defines managed-beans, converters, validators, navigation rules, and so on. The following is an example of the directory structure of the HelloWorldJSFSunRIPortlet portlet:
</para>
<para>
<mediaobject>
@@ -1015,7 +1015,7 @@
</mediaobject>
</para>
<para>
- To create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the helloworldjsfsunriportlet.war file.
+ To create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the <filename>helloworldjsfsunriportlet.war</filename> file.
</para>
<para>
<note>
@@ -1030,18 +1030,8 @@
<sect3>
<title>Application Descriptors</title>
<para>
- For brevity, only the <filename>portlet.xml</filename>, <filename>faces-config.xml</filename>, and <filename>web.xml</filename> descriptors are defined. For more information on other discriptors, refer to <xref linkend="first_portlet_descriptors"/> and <xref linkend="descriptors_portlet"/>.
+ For brevity, only the <filename>portlet.xml</filename>, <filename>faces-config.xml</filename>, and <filename>web.xml</filename> descriptors are described here. For more information about application descriptors, refer to <xref linkend="first_portlet_descriptors"/> and <xref linkend="descriptors_portlet"/>.
</para>
- <para>
- The following is an example of the directory structure of the HelloWorldJSFSunRIPortlet portlet:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/package_sunri.png" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
<para>
The following is an example of the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/portlet.xml</filename> file. This file must adhere to its definition in the JSR-168 Portlet Specification. You may define more than one portlet application in this file:
</para>
@@ -1078,7 +1068,7 @@
</screen></term>
<listitem>
<para>
- This specifies that the <computeroutput>com.sun.faces.portlet.FacesPortlet</computeroutput> handles all requests and responses from users. This class is part of the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/lib/jsf-portlet.jar</filename> file.
+ This specifies that the <computeroutput>com.sun.faces.portlet.FacesPortlet</computeroutput> handles all requests and responses from the users. This class is part of the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/lib/jsf-portlet.jar</filename> file.
</para>
</listitem>
</varlistentry>
@@ -1090,7 +1080,7 @@
</screen></term>
<listitem>
<para>
- You must initializes the portlet with a default view page to render, similar to the default JBoss Portal page.
+ You must initialize the portlet with a default page to render, similar to what is done with the default JBoss Portal page.
</para>
</listitem>
</varlistentry>
@@ -1122,10 +1112,10 @@
</screen>
</para>
<para>
- Without the <filename>faces-config.xml</filename>, the application would work the same outside of the portlet, as it would inside a portlet container. In this exampel, a basic user bean, <computeroutput><managed-bean-name>user</managed-bean-name></computeroutput>, and a navigation <computeroutput><navigation-rule></computeroutput> rule are defined, which handle submitting the original form in the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/jsp/index.jsp</filename> file.
+ Without the <filename>faces-config.xml</filename> file, the application would work the same outside of the portlet, as it would inside a portlet container. In this example, a basic user bean, <computeroutput><managed-bean-name>user</managed-bean-name></computeroutput>, and a navigation rule are defined, which handle submitting the original form in the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/jsp/index.jsp</filename> file.
</para>
<para>
- The following is an example of the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/web.xml</filename> file:
+ The following is an example of the <computeroutput>Faces Servlet</computeroutput> section from the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/web.xml</filename> file:
</para>
<para>
<screen><![CDATA[
@@ -1153,13 +1143,13 @@
</screen>
</para>
<para>
- For the Sun JSF RI, this definition is mandatory to associate <filename>.jsf</filename> extensions with the faces servlet.
+ For the Sun JSF RI, this definition is mandatory to associate files with <filename>.jsf</filename> extensions with the Apache MyFaces servlet.
</para>
<para>
<warning>
<title>Classes for the JSF-Portlet bridge are not included</title>
<para>
- The classes for the JSF-Portlet bridge are not included with the JSF implementation (unlike Apache MyFaces), JBoss AS, or JBoss EAP. This library must be available in your application package. Navigate to the <ulink url="https://jsfportletbridge.dev.java.net/servlets/ProjectDocumentList">JSF-Portlet bridge webpage</ulink> to download the JSF-Portlet bridge library.
+ Unlike Apache MyFaces, the classes for the JSF-Portlet bridge are not included with the JSF implementation, JBoss AS, or JBoss EAP. This library must be available in your application package. Navigate to the <ulink url="https://jsfportletbridge.dev.java.net/servlets/ProjectDocumentList">JSF-Portlet bridge webpage</ulink> to download the JSF-Portlet bridge library.
</para>
</warning>
</para>
16 years, 7 months
JBoss Portal SVN: r9998 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-15 23:01:16 -0500 (Fri, 15 Feb 2008)
New Revision: 9998
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml
Log:
5.2.3.3. Application Descriptors
revising, replacing itemizedlist with variable
trying to make it more consistent with
5.2.1.4. Application Descriptors
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml 2008-02-16 02:54:58 UTC (rev 9997)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml 2008-02-16 04:01:16 UTC (rev 9998)
@@ -1093,12 +1093,15 @@
You must initializes the portlet with a default view page to render, similar to the default JBoss Portal page.
</para>
</listitem>
-</variabelist>
+</varlistentry>
+</variablelist>
</para>
-
- <listitem>
- <para><literal>faces-config.xml</literal>
-<programlisting><![CDATA[<?xml version="1.0"?>
+<para>
+ The following is an example <filename>HelloWorldJSFSunRIPortlet/WEB-INF/faces-config.xml</filename> file:
+</para>
+<para>
+<screen><![CDATA[
+<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
@@ -1115,16 +1118,18 @@
<to-view-id>/WEB-INF/jsp/result.jsp</to-view-id>
</navigation-case>
</navigation-rule>
-</faces-config>]]></programlisting>
- There is nothing special about the <literal>faces-config.xml</literal> file included here. This
- application would work just as well outside of a portlet as it would inside a portlet container.
- In the above lines, we define a basic <literal>User</literal> Bean and a navigation rule to
- handle the submittal of the original form on <literal>index.jsp</literal>.
- </para>
- </listitem>
- <listitem>
- <para><literal>web.xml</literal>
-<programlisting><![CDATA[<?xml version="1.0"?>
+</faces-config>]]>
+</screen>
+</para>
+<para>
+ Without the <filename>faces-config.xml</filename>, the application would work the same outside of the portlet, as it would inside a portlet container. In this exampel, a basic user bean, <computeroutput><managed-bean-name>user</managed-bean-name></computeroutput>, and a navigation <computeroutput><navigation-rule></computeroutput> rule are defined, which handle submitting the original form in the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/jsp/index.jsp</filename> file.
+</para>
+<para>
+ The following is an example of the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/web.xml</filename> file:
+</para>
+<para>
+<screen><![CDATA[
+<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
@@ -1144,18 +1149,20 @@
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
-</web-app>]]></programlisting>
- For the Sun RI, this definition is mandatory to associate jsf extension with the faces servlet.
- </para>
- </listitem>
- <listitem>
- <para><literal>jsf-portlet.jar</literal> This library that can be downloaded here: <ulink url="https://jsfportletbridge.dev.java.net/servlets/ProjectDocumentList">https://jsfportletbridge.dev.java.net/servlets/ProjectDocumentList</ulink>
- contains the classes for the JSF-Portlet bridge. Since they are not included with the JSF
- implementation (unlike myfaces) neither in JBoss AS, it is required to have this library available
- in the package.</para>
- </listitem>
- </itemizedlist>
- </para>
+</web-app>]]>
+</screen>
+</para>
+<para>
+ For the Sun JSF RI, this definition is mandatory to associate <filename>.jsf</filename> extensions with the faces servlet.
+</para>
+<para>
+ <warning>
+ <title>Classes for the JSF-Portlet bridge are not included</title>
+ <para>
+ The classes for the JSF-Portlet bridge are not included with the JSF implementation (unlike Apache MyFaces), JBoss AS, or JBoss EAP. This library must be available in your application package. Navigate to the <ulink url="https://jsfportletbridge.dev.java.net/servlets/ProjectDocumentList">JSF-Portlet bridge webpage</ulink> to download the JSF-Portlet bridge library.
+ </para>
+ </warning>
+</para>
</sect3>
<sect3>
<title>Building and deploying your portlet</title>
16 years, 7 months
JBoss Portal SVN: r9997 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-15 21:54:58 -0500 (Fri, 15 Feb 2008)
New Revision: 9997
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml
Log:
revising 5.2.3. An example Sun JSF Reference Implementation (RI) Portle
*** this will break the book until later commits ***
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml 2008-02-15 21:44:13 UTC (rev 9996)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml 2008-02-16 02:54:58 UTC (rev 9997)
@@ -141,7 +141,7 @@
<sect3>
<title>Introduction</title>
<para>
- This section describes how to deploy a portlet for JBoss Portal. Before proceeding, download the <ulink
+ This section describes how to deploy a portlet in JBoss Portal. Before proceeding, download the <ulink
url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">HelloWorldPortlet</ulink> from <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>.
</para>
</sect3>
@@ -264,7 +264,10 @@
</mediaobject>
</para>
<para>
- The following is an example of the <filename>HelloWorldPortlet/WEB-INF/portlet.xml</filename> file. In order to create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the <filename>helloworldportlet.war</filename> file.This file must adhere to its definition in the JSR-168 Portlet Specification. You may define more than one portlet application in this file:
+ To create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the <filename>helloworldportlet.war</filename> file.
+ </para>
+ <para>
+ The following is an example of the <filename>HelloWorldPortlet/WEB-INF/portlet.xml</filename> file. This file must adhere to its definition in the JSR-168 Portlet Specification. You may define more than one portlet application in this file:
</para>
<para>
<screen><![CDATA[
@@ -640,16 +643,16 @@
<sect3>
<title>Introduction</title>
<para>
- This section describes how to deploy a JSP portlet for JBoss Portal. Before proceeding, download the <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_4/bundles/HelloWorl...">HelloWorldJSPPortlet</ulink> from <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>. The HelloWorldJSPPortlet demonstrates how to use JSPs for view rendering, and the portlet taglib for generating links.
+ This section describes how to deploy a JSP portlet in JBoss Portal. Before proceeding, download the <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_4/bundles/HelloWorl...">HelloWorldJSPPortlet</ulink> from <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>. The HelloWorldJSPPortlet demonstrates how to use JSPs for view rendering, and the portlet tag library (taglib) for generating links.
</para>
</sect3>
<sect3>
- <title>Package Content</title>
+ <title>Package Structure</title>
<para>
The application descriptors for the HelloWorldJSPPortlet portlet are similar to those from the HelloWorldPortlet (<xref linkend="first_portlet_descriptors"/>). See <xref linkend="descriptors_portlet"/> for further information about application descriptors.
</para>
<para>
- The following is an example of the directory structure of the HelloWorldJSPPortlet portlet. The HelloWorldJSPPortlet portlet contains the traditional portlet and JBoss Portal specific application descriptors. In order to create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the <filename>helloworldjspportlet.war</filename> file.
+ The HelloWorldJSPPortlet portlet contains the traditional portlet and JBoss Portal specific application descriptors. The following is an example of the directory structure of the HelloWorldJSPPortlet portlet:
</para>
<para>
<mediaobject>
@@ -658,9 +661,12 @@
</imageobject>
</mediaobject>
</para>
+ <para>
+ To create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the <filename>helloworldjspportlet.war</filename> file.
+ </para>
</sect3>
<sect3>
- <title>Portlet Class</title>
+ <title>Portlet Classes</title>
<para>
The <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_4/bundles/HelloWorl...">HelloWorldJSPPortlet</ulink> contains the <filename>HelloWorldJSPPortlet/src/main/org/jboss/portlet/hello/HelloWorldJSPPortlet.java</filename> file:
</para>
@@ -789,7 +795,7 @@
<sect3>
<title>JSP Files and the Portlet Tag Library</title>
<para>
- The <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view.jsp</filename> and <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view2.jsp</filename> JSP files are included in the HelloWorldJSPPortlet portlet. The <filename>view.jsp</filename> file allows a user to input their name. This is then posted to the <computeroutput>processAction</computeroutput> method in the portlet class, which is set as a <computeroutput>aResponse.setRenderParameter</computeroutput>. The <literal>render</literal> method, <computeroutput>doView</computeroutput>, is invoked, which dispatches to the <filename>view2.jsp</filename> JSP:
+ The <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view.jsp</filename> and <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view2.jsp</filename> JSP files are included in the HelloWorldJSPPortlet portlet. The <filename>view.jsp</filename> file allows a user to input their name. This is then posted to the <computeroutput>processAction</computeroutput> method in the portlet class, which is set as a <computeroutput>aResponse.setRenderParameter</computeroutput>. The <computeroutput>doView</computeroutput> <literal>render</literal> method is invoked, which dispatches to the <filename>view2.jsp</filename> JSP:
</para>
<para>
<mediaobject>
@@ -831,7 +837,7 @@
</screen></term>
<listitem>
<para>
- Define the portlet tag library (taglib). You do not need to bundle the portlet taglib - JBoss Portal handles this for you.
+ Define the portlet taglib. You do not need to bundle the portlet taglib - JBoss Portal handles this for you.
</para>
</listitem>
</varlistentry>
@@ -861,7 +867,7 @@
</screen></term>
<listitem>
<para>
- You can create a link to the <computeroutput>doView</computeroutput> method by creating a <computeroutput>renderURL</computeroutput>, that passes the <computeroutput>yourname</computeroutput> parameter.
+ You can create a link to the <computeroutput>doView</computeroutput> method by creating a <computeroutput>renderURL</computeroutput>, which passes the <computeroutput>yourname</computeroutput> parameter.
</para>
</listitem>
</varlistentry>
@@ -972,7 +978,7 @@
</para>
<para>
<screen>
-touch $JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy//helloworldjspportlet.war/WEB-INF/web.xml
+touch $JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldjspportlet.war/WEB-INF/web.xml
</screen>
</para>
<para>
@@ -989,43 +995,59 @@
</sect3>
</sect2>
<sect2 id="sunri_42x">
- <title>A Sun JSF Reference Implementation (RI) portlet</title>
+ <title>An example Sun JSF Reference Implementation (RI) Portlet</title>
<sect3>
<title>Introduction</title>
- <para>This section will introduce the reader to deploying a simple JSF portlet in JBoss Portal, using
- Apache's MyFaces JSF implementation on JBoss AS 4.2.x. It requires you download the HelloWorldJSFSunRIPortlet
- from PortletSwap.com, using this link:
- <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...</ulink>.
+ <para>
+ This section describes how to deploy a JSF portlet in JBoss Portal, using the Apache MyFaces JSF implementation on JBoss AS or JBoss EAP. Before proceeding, download the <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">HelloWorldJSFSunRIPortlet</ulink> from <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>.
</para>
</sect3>
<sect3>
- <title>Package Content</title>
+ <title>Package Structure</title>
+ <para>
+ JBoss Portal requires certain descriptors to be included in a portlet WAR file. Some of these descriptors are defined by the JSR-168 Portlet Specification, and others are specific to JBoss Portal. Like a typical JSF application, the HelloWorldJSFSunRIPortlet package contains a <filename>faces-config.xml</filename> file, that defines managed-beans, converters, validators, navigation rules, and so on. The following is an example of the directory structure of the HelloWorldJSFSunRIPortlet portlet:
+ </para>
<para>
<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/tutorials/jsf_portlet/package_sunri.png" valign="middle"/>
</imageobject>
</mediaobject>
- Like a typical JSF application, we also package our faces-config.xml that defines our
- managed-beans, converters, validators, navigation rules, etc...
- <note>JBoss Application Server version 4.2.x bundles Sun's JSF Reference Implementation (RI) in
- <literal>JBOSS_HOME/server/default/deploy/jboss-web.deployer/jsf-libs/</literal>. As a result,
- you do not need to package Sun RI's libraries with your portlet application.
+ </para>
+ <para>
+ To create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the helloworldjsfsunriportlet.war file.
+ </para>
+ <para>
+ <note>
+ <title>Bundled Sun JSF RI</title>
+ <para>
+ JBoss AS version 4.2.<replaceable>x</replaceable> and JBoss EAP bundle Sun's JSF RI in the
+ <filename>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/jsf-libs/</filename> directory. Therefore, you do not need to package the Sun JSF RI libraries with your portlet application.
+ </para>
</note>
</para>
- <para>For the sake of brevity, we only discuss the <literal>portlet.xml</literal> and
- <literal>faces-config.xml</literal> descriptors here. For discussion on the other descriptors, please
- view <xref linkend="first_portlet_descriptors"/> or the chapter on descriptors:
- <xref linkend="descriptors_portlet"/>.
+ </sect3>
+ <sect3>
+ <title>Application Descriptors</title>
+ <para>
+ For brevity, only the <filename>portlet.xml</filename>, <filename>faces-config.xml</filename>, and <filename>web.xml</filename> descriptors are defined. For more information on other discriptors, refer to <xref linkend="first_portlet_descriptors"/> and <xref linkend="descriptors_portlet"/>.
+ </para>
+ <para>
+ The following is an example of the directory structure of the HelloWorldJSFSunRIPortlet portlet:
+ </para>
+ <para>
<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/tutorials/jsf_portlet/package_sunri.png" valign="middle"/>
</imageobject>
</mediaobject>
- <itemizedlist>
- <listitem>
- <para><literal>portlet.xml</literal>
-<programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+ </para>
+ <para>
+ The following is an example of the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/portlet.xml</filename> file. This file must adhere to its definition in the JSR-168 Portlet Specification. You may define more than one portlet application in this file:
+ </para>
+ <para>
+<screen><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
@@ -1046,31 +1068,34 @@
<title>HelloWorld JSF Portlet</title>
</portlet-info>
</portlet>
-</portlet-app>]]></programlisting>
- This file must adhere to its definition in the Portlet Specification. You may define more than
- one portlet application in this file. Now let's look at the portions that deal with our use of
- JSF:
- <itemizedlist>
- <listitem>
- <para>
- <programlisting><![CDATA[<portlet-class>com.sun.faces.portlet.FacesPortlet</portlet-class>]]></programlisting>
- Here we specify that com.sun.faces.portlet.FacesPortlet will handle all requests/responses from our
- users. This class is part of jsf-portlet.jar as explained later.
- </para>
- </listitem>
- <listitem>
- <para>
- We need to initialize the portlet with a default view page for it to render, much like
- a welcome page:
- <programlisting><![CDATA[<init-param>
+</portlet-app>]]>
+</screen>
+ </para>
+ <para>
+ <variablelist>
+ <varlistentry><term><screen><![CDATA[
+<portlet-class>com.sun.faces.portlet.FacesPortlet</portlet-class>]]>
+</screen></term>
+<listitem>
+ <para>
+ This specifies that the <computeroutput>com.sun.faces.portlet.FacesPortlet</computeroutput> handles all requests and responses from users. This class is part of the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/lib/jsf-portlet.jar</filename> file.
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<init-param>
<name>com.sun.faces.portlet.INIT_VIEW</name>
<value>/WEB-INF/jsp/index.jsp</value>
-</init-param>]]></programlisting>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </listitem>
+</init-param>]]>
+</screen></term>
+<listitem>
+ <para>
+ You must initializes the portlet with a default view page to render, similar to the default JBoss Portal page.
+ </para>
+</listitem>
+</variabelist>
+</para>
+
<listitem>
<para><literal>faces-config.xml</literal>
<programlisting><![CDATA[<?xml version="1.0"?>
16 years, 7 months
JBoss Portal SVN: r9996 - in demo/trunk: portlets/jbosswiki and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-02-15 16:44:13 -0500 (Fri, 15 Feb 2008)
New Revision: 9996
Added:
demo/trunk/portlets/jbosswiki/portlet-instances.xml
Modified:
demo/trunk/build.xml
Log:
Modified: demo/trunk/build.xml
===================================================================
--- demo/trunk/build.xml 2008-02-15 21:29:46 UTC (rev 9995)
+++ demo/trunk/build.xml 2008-02-15 21:44:13 UTC (rev 9996)
@@ -111,7 +111,8 @@
<fileset dir="${tmp.dir}/jbosswiki"/>
</copy>
<copy file="portlets/jbosswiki/wiki-common.jar" todir="${destination.dir}/${portal.name.dir}/server/default/deploy/wiki.ear"/>
- <delete file="${destination.dir}/${portal.name.dir}/server/default/deploy/wiki.ear/wiki.war/WEB-INF/wiki-object.xml"/>
+ <copy file="portlets/jbosswiki/portlet-instances.xml" todir="${destination.dir}/${portal.name.dir}/server/default/deploy/wiki.ear/wiki.war/WEB-INF"/>
+ <delete file="${destination.dir}/${portal.name.dir}/server/default/deploy/wiki.ear/wiki.war/WEB-INF/wiki-object.xml"/>
</target>
<target name="install-seamBooking">
Added: demo/trunk/portlets/jbosswiki/portlet-instances.xml
===================================================================
--- demo/trunk/portlets/jbosswiki/portlet-instances.xml (rev 0)
+++ demo/trunk/portlets/jbosswiki/portlet-instances.xml 2008-02-15 21:44:13 UTC (rev 9996)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployments>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <instance>
+ <instance-id>WikiPortletInstance</instance-id>
+ <portlet-ref>wikiportlet.WikiPortlet</portlet-ref>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
16 years, 7 months
JBoss Portal SVN: r9995 - in modules/portlet/trunk: test/src/test and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-15 16:29:46 -0500 (Fri, 15 Feb 2008)
New Revision: 9995
Modified:
modules/portlet/trunk/build/pom.xml
modules/portlet/trunk/test/src/test/build.xml
Log:
remove snapshot from portlet trunk for now
Modified: modules/portlet/trunk/build/pom.xml
===================================================================
--- modules/portlet/trunk/build/pom.xml 2008-02-15 21:23:23 UTC (rev 9994)
+++ modules/portlet/trunk/build/pom.xml 2008-02-15 21:29:46 UTC (rev 9995)
@@ -39,7 +39,7 @@
<version.javassist>3.6-beta</version.javassist>
<version.jboss-remoting>2.2.1.GA</version.jboss-remoting>
<version.jboss.portal.common>1.2.0-Beta1</version.jboss.portal.common>
- <version.jboss.portal.web>1.2.0-SNAPSHOT</version.jboss.portal.web>
+ <version.jboss.portal.web>1.2.0-Beta1</version.jboss.portal.web>
<version.jboss.unit>1.2.0-Beta1</version.jboss.unit>
<version.log4j>1.2.14</version.log4j>
<version.apache.commons-logging>1.1.1</version.apache.commons-logging>
@@ -95,7 +95,7 @@
<plugin>
<groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit-tooling-maven2</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.0-Beta1</version>
</plugin>
</plugins>
</pluginManagement>
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-15 21:23:23 UTC (rev 9994)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-15 21:29:46 UTC (rev 9995)
@@ -407,9 +407,6 @@
<!-- MC 2.0.0.Beta4 -->
<path refid="mc.trove"/>
<path refid="mc.javassist"/>
- <path refid="mc.jboss_common_logging_spi"/>
- <path refid="mc.jboss_common_logging_jdk"/>
- <path refid="mc.jboss_common_logging_log4j"/>
<path refid="mc.jboss_common_core"/>
<path refid="mc.jboss_vfs"/>
<path refid="mc.jboss_xb"/>
@@ -446,8 +443,6 @@
<path refid="mc.trove"/>
<path refid="mc.xerces"/>
<path refid="mc.javassist"/>
- <path refid="mc.jboss_common_logging_spi"/>
- <path refid="mc.jboss_common_logging_jdk"/>
<path refid="mc.jboss_common_core"/>
<path refid="mc.jboss_vfs"/>
<path refid="mc.jboss_xb"/>
@@ -604,6 +599,9 @@
<path location="${dependency.activation.jar}"/>
<path location="${dependency.jaxb-api.jar}"/>
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jboss_common_logging_jdk"/>
+
<path location="${dependency.portal-common.jar}"/>
<path location="${dependency.portal-common-portal.jar}"/>
<path location="${dependency.portal-portlet.jar}"/>
16 years, 7 months
JBoss Portal SVN: r9994 - in demo/trunk: conf and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-02-15 16:23:23 -0500 (Fri, 15 Feb 2008)
New Revision: 9994
Modified:
demo/trunk/build.xml
demo/trunk/conf/default-object.xml
Log:
Modified: demo/trunk/build.xml
===================================================================
--- demo/trunk/build.xml 2008-02-15 21:13:25 UTC (rev 9993)
+++ demo/trunk/build.xml 2008-02-15 21:23:23 UTC (rev 9994)
@@ -110,6 +110,7 @@
<copy todir="${destination.dir}/${portal.name.dir}/server/default/deploy">
<fileset dir="${tmp.dir}/jbosswiki"/>
</copy>
+ <copy file="portlets/jbosswiki/wiki-common.jar" todir="${destination.dir}/${portal.name.dir}/server/default/deploy/wiki.ear"/>
<delete file="${destination.dir}/${portal.name.dir}/server/default/deploy/wiki.ear/wiki.war/WEB-INF/wiki-object.xml"/>
</target>
Modified: demo/trunk/conf/default-object.xml
===================================================================
--- demo/trunk/conf/default-object.xml 2008-02-15 21:13:25 UTC (rev 9993)
+++ demo/trunk/conf/default-object.xml 2008-02-15 21:23:23 UTC (rev 9994)
@@ -270,7 +270,7 @@
<window>
<window-name>WeatherPortletWindow</window-name>
<instance-ref>WeatherPortletInstance</instance-ref>
- <region>left</region>
+ <region>center</region>
<height>0</height>
</window>
</page>
16 years, 7 months
JBoss Portal SVN: r9993 - in modules/portlet/tags/JBP_PORTLET_2_0_0_BETA1: test/src/test and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-15 16:13:25 -0500 (Fri, 15 Feb 2008)
New Revision: 9993
Modified:
modules/portlet/tags/JBP_PORTLET_2_0_0_BETA1/build/pom.xml
modules/portlet/tags/JBP_PORTLET_2_0_0_BETA1/test/src/test/build.xml
Log:
make beta1 tag not use snapshots........
Modified: modules/portlet/tags/JBP_PORTLET_2_0_0_BETA1/build/pom.xml
===================================================================
--- modules/portlet/tags/JBP_PORTLET_2_0_0_BETA1/build/pom.xml 2008-02-15 20:16:12 UTC (rev 9992)
+++ modules/portlet/tags/JBP_PORTLET_2_0_0_BETA1/build/pom.xml 2008-02-15 21:13:25 UTC (rev 9993)
@@ -39,7 +39,7 @@
<version.javassist>3.6-beta</version.javassist>
<version.jboss-remoting>2.2.1.GA</version.jboss-remoting>
<version.jboss.portal.common>1.2.0-Beta1</version.jboss.portal.common>
- <version.jboss.portal.web>1.2.0-SNAPSHOT</version.jboss.portal.web>
+ <version.jboss.portal.web>1.2.0-Beta1</version.jboss.portal.web>
<version.jboss.unit>1.2.0-Beta1</version.jboss.unit>
<version.log4j>1.2.14</version.log4j>
<version.apache.commons-logging>1.1.1</version.apache.commons-logging>
@@ -95,7 +95,7 @@
<plugin>
<groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit-tooling-maven2</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.0-Beta1</version>
</plugin>
</plugins>
</pluginManagement>
Modified: modules/portlet/tags/JBP_PORTLET_2_0_0_BETA1/test/src/test/build.xml
===================================================================
--- modules/portlet/tags/JBP_PORTLET_2_0_0_BETA1/test/src/test/build.xml 2008-02-15 20:16:12 UTC (rev 9992)
+++ modules/portlet/tags/JBP_PORTLET_2_0_0_BETA1/test/src/test/build.xml 2008-02-15 21:13:25 UTC (rev 9993)
@@ -407,9 +407,6 @@
<!-- MC 2.0.0.Beta4 -->
<path refid="mc.trove"/>
<path refid="mc.javassist"/>
- <path refid="mc.jboss_common_logging_spi"/>
- <path refid="mc.jboss_common_logging_jdk"/>
- <path refid="mc.jboss_common_logging_log4j"/>
<path refid="mc.jboss_common_core"/>
<path refid="mc.jboss_vfs"/>
<path refid="mc.jboss_xb"/>
@@ -446,8 +443,6 @@
<path refid="mc.trove"/>
<path refid="mc.xerces"/>
<path refid="mc.javassist"/>
- <path refid="mc.jboss_common_logging_spi"/>
- <path refid="mc.jboss_common_logging_jdk"/>
<path refid="mc.jboss_common_core"/>
<path refid="mc.jboss_vfs"/>
<path refid="mc.jboss_xb"/>
@@ -604,6 +599,9 @@
<path location="${dependency.activation.jar}"/>
<path location="${dependency.jaxb-api.jar}"/>
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jboss_common_logging_jdk"/>
+
<path location="${dependency.portal-common.jar}"/>
<path location="${dependency.portal-common-portal.jar}"/>
<path location="${dependency.portal-portlet.jar}"/>
16 years, 7 months