Author: julien(a)jboss.com
Date: 2007-04-05 09:35:24 -0400 (Thu, 05 Apr 2007)
New Revision: 6923
Added:
trunk/core/src/main/org/jboss/portal/core/controller/AjaxResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/CommandForward.java
trunk/core/src/main/org/jboss/portal/core/controller/HTTPResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/HandlerResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerSelector.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
Removed:
trunk/core/src/main/org/jboss/portal/core/controller/ControllerFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/CommandForward.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/HandlerResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ResponseHandler.java
Modified:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java
trunk/core/src/main/org/jboss/portal/core/CoreConstants.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/NavigationalStateInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/Controller.java
trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/AbstractResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-server-war/WEB-INF/web.xml
trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js
trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
trunk/theme/src/main/org/jboss/portal/theme/page/Region.java
Log:
- improved javascript
- finally use only one controller and implement the ajax/classic in the response handler
as it seems to be the appropriate place
Modified: trunk/core/src/main/org/jboss/portal/core/CoreConstants.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/CoreConstants.java 2007-04-04 21:50:16 UTC
(rev 6922)
+++ trunk/core/src/main/org/jboss/portal/core/CoreConstants.java 2007-04-05 13:35:24 UTC
(rev 6923)
@@ -26,13 +26,42 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public interface CoreConstants
+public final class CoreConstants
{
- String SES_GUEST_INFO = "org.jboss.portal.guest_info";
- String SES_USER_FINALIZER = "org.jboss.portal.user_finalizer";
- String REQ_ATT_CONTEXT_PATH = "org.jboss.portal.context_path";
- String REQ_ATT_SERVLET_PATH = "org.jboss.portal.servlet_path";
+ /**
+ * Servlet constants.
+ */
+ public static final class Servlet
+ {
- String REQ_PROP_PREFERRED_MARKUP = "org.jboss.portal.preferred_markup";
+ /**
+ * Servlet session constants.
+ */
+ public static final class Session
+ {
+
+ /** . */
+ public static final String GUEST_INFO = "jboss.portal.guest_info";
+
+ /** . */
+ public static final String USER_FINALIZER =
"jboss.portal.user_finalizer";
+ }
+
+ /**
+ * Servlet request constants.
+ */
+ public static final class Request
+ {
+
+ /** . */
+ public static final String PORTAL_CONTEXT_PATH =
"jboss.portal.context_path";
+
+ /** . */
+ public static final String PORTAL_SERVLET_PATH =
"jboss.portal.servlet_path";
+ }
+ }
+
+ /** . */
+ public static final String REQUEST_TYPE = "jboss.portal.request_type";
}
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/NavigationalStateInterceptor.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/aspects/controller/NavigationalStateInterceptor.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/controller/NavigationalStateInterceptor.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -25,8 +25,6 @@
import org.jboss.portal.core.controller.ControllerInterceptor;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.Controller;
-import org.jboss.portal.core.controller.classic.ClassicController;
import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
import org.jboss.portal.common.invocation.InvocationException;
@@ -44,8 +42,7 @@
// We commit the nav state changes only for the classic controller at the base of
the pipeline
ControllerContext controllerContext = cmd.getControllerContext();
- Controller controller = controllerContext.getController();
- if (controllerContext.getDepth() == 1 && controller instanceof
ClassicController)
+ if (controllerContext.getDepth() == 1 && controllerContext.getType() ==
ControllerContext.CLASSIC_TYPE)
{
PortalObjectNavigationalStateContext ctx =
(PortalObjectNavigationalStateContext)controllerContext.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
ctx.applyChanges();
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -195,20 +195,20 @@
if (user == null)
{
// Erase any previous user finalizer, the side effect of unbinding the session
attribute will finalize the previous user
- UserFinalizer finalizer =
(UserFinalizer)httpSession.getAttribute(CoreConstants.SES_USER_FINALIZER);
+ UserFinalizer finalizer =
(UserFinalizer)httpSession.getAttribute(CoreConstants.Servlet.Session.USER_FINALIZER);
if (finalizer != null)
{
if (trace)
{
log.trace("Removing finalizer for user=" + finalizer.userId);
}
- httpSession.setAttribute(CoreConstants.SES_USER_FINALIZER, null);
+ httpSession.setAttribute(CoreConstants.Servlet.Session.USER_FINALIZER,
null);
}
}
else
{
// Get the current finalizer if any
- UserFinalizer finalizer =
(UserFinalizer)httpSession.getAttribute(CoreConstants.SES_USER_FINALIZER);
+ UserFinalizer finalizer =
(UserFinalizer)httpSession.getAttribute(CoreConstants.Servlet.Session.USER_FINALIZER);
// Get the user id from the request user
if (finalizer == null)
@@ -222,7 +222,7 @@
finalizer = new UserFinalizer(user.getId());
// Bind the new one, the side effect finalizes the previous user
- httpSession.setAttribute(CoreConstants.SES_USER_FINALIZER, finalizer);
+ httpSession.setAttribute(CoreConstants.Servlet.Session.USER_FINALIZER,
finalizer);
}
else if (!finalizer.userId.equals(user.getId()))
{
@@ -235,7 +235,7 @@
finalizer = new UserFinalizer(user.getId());
// Bind the new one, the side effect finalizes the previous user
- httpSession.setAttribute(CoreConstants.SES_USER_FINALIZER, finalizer);
+ httpSession.setAttribute(CoreConstants.Servlet.Session.USER_FINALIZER,
finalizer);
}
}
Copied: trunk/core/src/main/org/jboss/portal/core/controller/AjaxResponse.java (from rev
6921, trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponse.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/AjaxResponse.java
(rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/AjaxResponse.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller;
+
+import org.jboss.portal.core.controller.HandlerResponse;
+import org.jboss.portal.theme.impl.render.dynamic.DynaResponse;
+import org.jboss.portal.theme.impl.render.dynamic.JSONMarshaller;
+import org.jboss.portal.server.ServerInvocationContext;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AjaxResponse extends HandlerResponse
+{
+
+ /** . */
+ private static final JSONMarshaller marshaller = new JSONMarshaller();
+
+ /** The response to the client. */
+ private final DynaResponse dynaResponse;
+
+ public AjaxResponse(DynaResponse dynaResponse)
+ {
+ this.dynaResponse = dynaResponse;
+ }
+
+ public void sendResponse(ServerInvocationContext ctx) throws IOException,
ServletException
+ {
+ HttpServletResponse resp = ctx.getClientResponse();
+ resp.setContentType("text/html");
+ marshaller.write(dynaResponse, resp.getWriter());
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/controller/CommandForward.java (from rev
6921, trunk/core/src/main/org/jboss/portal/core/controller/classic/CommandForward.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/CommandForward.java
(rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/CommandForward.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller;
+
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.core.controller.ControllerCommand;
+
+/**
+ * Forward to a new command.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CommandForward extends HandlerResponse
+{
+ /** . */
+ private final ControllerCommand cmd;
+
+ /** . */
+ private final URLContext urlCtx;
+
+ public CommandForward(ControllerCommand cmd, URLContext urlCtx)
+ {
+ if (cmd == null)
+ {
+ throw new IllegalArgumentException("No command provided");
+ }
+ this.cmd = cmd;
+ this.urlCtx = urlCtx;
+ }
+
+ public ControllerCommand getCommand()
+ {
+ return cmd;
+ }
+
+ public URLContext getURLContext()
+ {
+ return urlCtx;
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/Controller.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-04-04
21:50:16 UTC (rev 6922)
+++ trunk/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -33,12 +33,22 @@
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.server.request.URLContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+
/**
+ * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public abstract class Controller extends AbstractJBossService implements
RequestController
+public class Controller extends AbstractJBossService implements RequestController
{
/** . */
@@ -68,6 +78,9 @@
/** . */
protected ContentRendererRegistry contentRendererRegistry;
+ /** . */
+ protected ResponseHandler responseHandler;
+
public ContentRendererRegistry getContentRendererRegistry()
{
return contentRendererRegistry;
@@ -158,5 +171,155 @@
this.stackFactory = stackFactory;
}
+ public ResponseHandler getResponseHandler()
+ {
+ return responseHandler;
+ }
+ public void setResponseHandler(ResponseHandler responseHandler)
+ {
+ this.responseHandler = responseHandler;
+ }
+
+ public final void handle(ServerInvocation invocation) throws ServerException
+ {
+ // Invoke the chain that creates the initial command
+ ControllerCommand cmd = commandFactory.doMapping(invocation,
invocation.getServerContext().getPortalHost(),
invocation.getServerContext().getPortalContextPath(),
invocation.getServerContext().getPortalRequestPath());
+
+ //
+ if (cmd == null)
+ {
+ // Handle that case
+ throw new ServerException("No command was produced by the command
factory");
+ }
+
+ // Create controller context
+ ControllerContext controllerContext = new ControllerContext(invocation, this);
+
+ // Handle the command created
+ processCommand(controllerContext, cmd);
+ }
+
+ /**
+ * Handle a command which means it executes the command and reacts upon the response
created by the command.
+ *
+ * @param controllerContext the controller context
+ * @param cmd the command
+ * @throws org.jboss.portal.server.ServerException
+ */
+ protected void processCommand(ControllerContext controllerContext, ControllerCommand
cmd) throws ServerException
+ {
+ HandlerResponse handlerResp = executeCommand(controllerContext, cmd);
+
+ //
+ if (handlerResp == null)
+ {
+ return;
+ }
+
+ // Find out if we can execute in the same server invocation
+ if (handlerResp instanceof CommandForward)
+ {
+ CommandForward forward = (CommandForward)handlerResp;
+ processCommand(controllerContext, forward.getCommand());
+ }
+ else if (handlerResp instanceof HTTPResponse)
+ {
+ HTTPResponse hr = (HTTPResponse)handlerResp;
+ sendResponse(controllerContext, hr);
+ }
+ else if (handlerResp instanceof AjaxResponse)
+ {
+ AjaxResponse ar = (AjaxResponse)handlerResp;
+ sendResponse(controllerContext, ar);
+ }
+ }
+
+ protected HandlerResponse executeCommand(ControllerContext controllerContext,
ControllerCommand command) throws ServerException
+ {
+ URLContext urlContext =
controllerContext.getServerInvocation().getServerContext().getURLContext();
+
+ try
+ {
+ // Execute command
+ Object commandResponse = controllerContext.execute(command);
+
+ // Handle the result, might be null if no handling done
+ return responseHandler.processCommandResponse(controllerContext, command,
commandResponse);
+ }
+ catch (CommandRedirectionException e)
+ {
+ // Handle the redirection as forward
+ return new CommandForward(e.getRedirection(), null);
+ }
+ catch (ControllerSecurityException e)
+ {
+ if (urlContext.isAuthenticated())
+ {
+ return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_UNAUTHORIZED);
+ }
+ else
+ {
+ urlContext = URLContext.newInstance(urlContext.isSecure(), true);
+ ServerURL serverURL =
getURLFactory().doMapping(controllerContext.getServerInvocation(), command);
+ String url =
controllerContext.getServerInvocation().getResponse().renderURL(serverURL, urlContext,
null);
+ return new HTTPResponse.SendRedirect(url);
+ }
+ }
+ catch (ResourceNotFoundException e)
+ {
+ log.error("Resource not found " + e.getRef(), e);
+ return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_NOT_FOUND);
+ }
+ catch (ControllerException e)
+ {
+ throw new ServerException(e);
+ }
+ catch (ServletException e)
+ {
+ throw new ServerException(e);
+ }
+ catch (IOException e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ /**
+ * All http responses in the stack should be handled here.
+ */
+ protected void sendResponse(ControllerContext ctx, HTTPResponse resp)
+ {
+ try
+ {
+ resp.sendResponse(ctx.getServerInvocation().getServerContext());
+ }
+ catch (IOException e)
+ {
+ log.error("Cound not send http response", e);
+ }
+ catch (ServletException e)
+ {
+ log.error("Cound not send http response", e);
+ }
+ }
+
+ /**
+ * All http responses in the stack should be handled here.
+ */
+ protected void sendResponse(ControllerContext ctx, AjaxResponse resp)
+ {
+ try
+ {
+ resp.sendResponse(ctx.getServerInvocation().getServerContext());
+ }
+ catch (IOException e)
+ {
+ log.error("Cound not send http response", e);
+ }
+ catch (ServletException e)
+ {
+ log.error("Cound not send http response", e);
+ }
+ }
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2007-04-04
21:50:16 UTC (rev 6922)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -32,7 +32,9 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.core.aspects.server.UserInterceptor;
import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
+import org.jboss.portal.core.CoreConstants;
+import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
@@ -42,12 +44,21 @@
public class ControllerContext extends AbstractInvocationContext
{
+ /** . */
+ public static final int CLASSIC_TYPE = 0;
+
+ /** . */
+ public static final int AJAX_TYPE = 1;
+
/** The server invocation. */
- private ServerInvocation serverInvocation;
+ private final ServerInvocation serverInvocation;
/** The controller. */
- private Controller controller;
+ private final Controller controller;
+ /** . */
+ private final int type;
+
/** The depth of the call stack. */
private int depth;
@@ -68,6 +79,18 @@
this.depth = 0;
//
+ HttpServletRequest req = serverInvocation.getServerContext().getClientRequest();
+ String value = req.getHeader("ajax");
+ if ("true".equalsIgnoreCase(value))
+ {
+ type = AJAX_TYPE;
+ }
+ else
+ {
+ type = CLASSIC_TYPE;
+ }
+
+ //
addResolver(ControllerCommand.REQUEST_SCOPE, serverInvocation.getContext());
addResolver(ControllerCommand.SESSION_SCOPE, serverInvocation.getContext());
addResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, new
PortalObjectNavigationalStateContext(serverInvocation.getContext().getAttributeResolver(ControllerCommand.PRINCIPAL_SCOPE)));
@@ -113,6 +136,11 @@
}
}
+ public int getType()
+ {
+ return type;
+ }
+
public int getDepth()
{
return depth;
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/ControllerFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerFactory.java 2007-04-04
21:50:16 UTC (rev 6922)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerFactory.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -1,94 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller;
-
-import org.jboss.portal.server.RequestControllerFactory;
-import org.jboss.portal.server.RequestController;
-import org.jboss.portal.server.ServerInvocation;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ControllerFactory implements RequestControllerFactory
-{
-
- /** . */
- private RequestController classicController;
-
- /** . */
- private RequestController ajaxController;
-
- public RequestController getClassicController()
- {
- return classicController;
- }
-
- public void setClassicController(RequestController classicController)
- {
- this.classicController = classicController;
- }
-
-
- public RequestController getAjaxController()
- {
- return ajaxController;
- }
-
- public void setAjaxController(RequestController ajaxController)
- {
- this.ajaxController = ajaxController;
- }
-
- public RequestController createRequestController(ServerInvocation invocation)
- {
-
- HttpServletRequest req = invocation.getServerContext().getClientRequest();
- String value = req.getHeader("ajax");
- if ("true".equalsIgnoreCase(value))
- {
- return ajaxController;
- }
- else
- {
- return classicController;
- }
-
-
-// 02:03:58,636 INFO [STDOUT] host = localhost:8080
-// 02:03:58,636 INFO [STDOUT] user-agent = Mozilla/5.0 (Macintosh; U; Intel Mac OS
X; fr; rv:1.8.1) Gecko/20061010 Firefox/2.0
-// 02:03:58,636 INFO [STDOUT] accept = text/javascript, text/html, application/xml,
text/xml, */*
-// 02:03:58,636 INFO [STDOUT] accept-language = fr,en-us;q=0.5
-// 02:03:58,637 INFO [STDOUT] accept-encoding = gzip,deflate
-// 02:03:58,637 INFO [STDOUT] accept-charset = ISO-8859-1,utf-8;q=0.7,*;q=0.7
-// 02:03:58,637 INFO [STDOUT] keep-alive = 300
-// 02:03:58,637 INFO [STDOUT] connection = keep-alive
-// 02:03:58,637 INFO [STDOUT] x-requested-with = XMLHttpRequest
-// 02:03:58,638 INFO [STDOUT] x-prototype-version = 1.5.0_rc1
-// 02:03:58,638 INFO [STDOUT] ajax = true
-// 02:03:58,639 INFO [STDOUT] referer =
http://localhost:8080/portal/auth/portal/dashboard/admin/default/
-// 02:03:58,639 INFO [STDOUT] cookie = JSESSIONID=A0B8EA1EEEAE6D977C0A8074D338B0EB
- }
-}
Copied: trunk/core/src/main/org/jboss/portal/core/controller/HTTPResponse.java (from rev
6921, trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/HTTPResponse.java
(rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/HTTPResponse.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller;
+
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.common.util.Tools;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Response that sends a response to the http stream.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class HTTPResponse extends HandlerResponse
+{
+
+ public abstract void sendResponse(ServerInvocationContext ctx) throws IOException,
ServletException;
+
+ public static class SetStatusCode extends HTTPResponse
+ {
+
+ /** . */
+ private final int statusCode;
+
+ public SetStatusCode(int statusCode)
+ {
+ this.statusCode = statusCode;
+ }
+
+ public void sendResponse(ServerInvocationContext ctx) throws IOException
+ {
+ HttpServletResponse resp = ctx.getClientResponse();
+ resp.sendError(statusCode);
+ }
+ }
+
+ public static class SendRedirect extends HTTPResponse
+ {
+
+ /** . */
+ private final String redirect;
+
+ public SendRedirect(String redirect)
+ {
+ this.redirect = redirect;
+ }
+
+ public void sendResponse(ServerInvocationContext ctx) throws IOException
+ {
+ HttpServletResponse resp = ctx.getClientResponse();
+ resp.sendRedirect(redirect);
+ }
+ }
+
+ public static class SendBinary extends HTTPResponse
+ {
+
+ /** . */
+ private final String contentType;
+
+ /** . */
+ private final InputStream in;
+
+ public SendBinary(String contentType, InputStream inputStream)
+ {
+ this.contentType = contentType;
+ this.in = inputStream;
+ }
+
+ public void sendResponse(ServerInvocationContext ctx) throws IOException
+ {
+ HttpServletResponse resp = ctx.getClientResponse();
+ resp.setContentType(contentType);
+ ServletOutputStream sout = null;
+ try
+ {
+ sout = resp.getOutputStream();
+ byte[] buf = new byte[2048];
+ int len;
+ while ((len = in.read(buf)) > 0)
+ {
+ sout.write(buf, 0, len);
+ }
+ sout.flush();
+ }
+ finally
+ {
+ Tools.safeClose(in);
+ Tools.safeClose(sout);
+ }
+ }
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/controller/HandlerResponse.java (from
rev 6921,
trunk/core/src/main/org/jboss/portal/core/controller/classic/HandlerResponse.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/HandlerResponse.java
(rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/HandlerResponse.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller;
+
+/**
+ * The response from a a response handler.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class HandlerResponse
+{
+}
Copied: trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandler.java (from
rev 6921,
trunk/core/src/main/org/jboss/portal/core/controller/classic/ResponseHandler.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandler.java
(rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandler.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller;
+
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ResponseHandler
+{
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand command, Object commandResponse) throws IOException, ServletException,
ServerException;
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerSelector.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerSelector.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerSelector.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller;
+
+import org.jboss.portal.server.ServerException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ResponseHandlerSelector implements ResponseHandler
+{
+
+ /** . */
+ private ResponseHandler classicResponseHandler;
+
+ /** . */
+ private ResponseHandler ajaxResponseHandler;
+
+ public ResponseHandler getClassicResponseHandler()
+ {
+ return classicResponseHandler;
+ }
+
+ public void setClassicResponseHandler(ResponseHandler classicResponseHandler)
+ {
+ this.classicResponseHandler = classicResponseHandler;
+ }
+
+ public ResponseHandler getAjaxResponseHandler()
+ {
+ return ajaxResponseHandler;
+ }
+
+ public void setAjaxResponseHandler(ResponseHandler ajaxResponseHandler)
+ {
+ this.ajaxResponseHandler = ajaxResponseHandler;
+ }
+
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand command, Object commandResponse) throws IOException, ServletException,
ServerException
+ {
+ if (ControllerContext.AJAX_TYPE == controllerContext.getType())
+ {
+ return ajaxResponseHandler.processCommandResponse(controllerContext, command,
commandResponse);
+ }
+ else
+ {
+ return classicResponseHandler.processCommandResponse(controllerContext, command,
commandResponse);
+ }
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxCommandFactory.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxCommandFactory.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.ajax;
+
+import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.command.MoveWindowCommand;
+import org.jboss.portal.server.ServerInvocation;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AjaxCommandFactory extends AbstractCommandFactory
+{
+ public ControllerCommand doMapping(ServerInvocation invocation, String host, String
contextPath, String requestPath)
+ {
+ HttpServletRequest req = invocation.getServerContext().getClientRequest();
+ String action = req.getParameter("action");
+ if ("windowmove".equals(action))
+ {
+ String windowId = req.getParameter("windowId");
+ String fromPos = req.getParameter("fromPos");
+ String fromRegion = req.getParameter("fromRegion");
+ String toPos = req.getParameter("toPos");
+ String toRegion = req.getParameter("toRegion");
+ int fromPosInt = Integer.parseInt(fromPos);
+ int toPosInt = Integer.parseInt(toPos);
+
+ //
+ PortalObjectId tmp = PortalObjectId.parse(windowId,
PortalObjectId.LEGACY_BASE64_FORMAT);
+
+ //
+ return new MoveWindowCommand(tmp, fromPosInt, fromRegion, toPosInt, toRegion);
+ }
+
+ //
+ return null;
+ }
+}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -1,424 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller.ajax;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.Controller;
-import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
-import org.jboss.portal.core.controller.classic.HandlerResponse;
-import org.jboss.portal.core.controller.classic.CommandForward;
-import org.jboss.portal.core.model.portal.command.MoveWindowCommand;
-import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
-import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
-import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
-import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
-import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
-import org.jboss.portal.core.ns.NavigationalStateChange;
-import org.jboss.portal.core.ns.NavigationalStateKey;
-import org.jboss.portal.core.ns.NavigationalStateObjectChange;
-import org.jboss.portal.server.ServerException;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.render.RenderContext;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.impl.render.dynamic.response.UpdatePageLocationResponse;
-import org.jboss.portal.theme.impl.render.dynamic.response.UpdatePageStateResponse;
-import org.jboss.portal.theme.impl.render.dynamic.DynaConstants;
-import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.RenderResponse;
-import org.jboss.portal.portlet.StateString;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.ServletException;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.Set;
-import java.util.HashSet;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class AjaxController extends Controller
-{
- public void handle(ServerInvocation invocation) throws ServerException
- {
- HttpServletRequest req = invocation.getServerContext().getClientRequest();
-
- //
- ControllerContext controllerContext = new ControllerContext(invocation, this);
-
- // Detect any change that would require a total refresh
- String clientViewId = req.getHeader("view_id");
- if (clientViewId != null)
- {
- PortalObjectNavigationalStateContext ctx =
(PortalObjectNavigationalStateContext)controllerContext.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
- String serverViewId = ctx.getViewId();
- if (!clientViewId.equals(serverViewId))
- {
- // todo : that will not work for FORMS submissions, we need a response for
the client
- // to tell to do the request the normal way
- try
- {
- UpdatePageLocationResponse dresp = new
UpdatePageLocationResponse(req.getRequestURL().toString());
- AjaxResponse aresp = new AjaxResponse(dresp);
- aresp.sendResponse(invocation.getServerContext());
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- catch (ServletException e)
- {
- e.printStackTrace();
- }
- return;
- }
- }
-
- //
- String action = req.getParameter("action");
- if ("windowmove".equals(action))
- {
- String windowId = req.getParameter("windowId");
- String fromPos = req.getParameter("fromPos");
- String fromRegion = req.getParameter("fromRegion");
- String toPos = req.getParameter("toPos");
- String toRegion = req.getParameter("toRegion");
- int fromPosInt = Integer.parseInt(fromPos);
- int toPosInt = Integer.parseInt(toPos);
-
- //
- PortalObjectId tmp = PortalObjectId.parse(windowId,
PortalObjectId.LEGACY_BASE64_FORMAT);
-
- //
- try
- {
- controllerContext.execute(new MoveWindowCommand(tmp, fromPosInt, fromRegion,
toPosInt, toRegion));
- }
- catch (ControllerException e)
- {
- e.printStackTrace();
- }
- }
- else
- {
- // Invoke the chain that creates the initial command
- ControllerCommand command = commandFactory.doMapping(invocation,
invocation.getServerContext().getPortalHost(),
invocation.getServerContext().getPortalContextPath(),
invocation.getServerContext().getPortalRequestPath());
-
- //
- if (command == null)
- {
- // Handle that case
- throw new ServerException("No command was produced by the command
factory");
- }
-
- // Handle the command created
- try
- {
- processCommand(controllerContext, command);
- }
- catch (ControllerException e)
- {
- e.printStackTrace();
- }
- catch (ServletException e)
- {
- e.printStackTrace();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Handle a command which means it executes the command and reacts upon the response
created by the command.
- *
- * @param controllerContext the controller context
- * @param command the command
- * @throws org.jboss.portal.server.ServerException
- */
- protected void processCommand(final ControllerContext controllerContext, final
ControllerCommand command) throws ServerException, ControllerException, ServletException,
IOException
- {
- Object commandResponse = controllerContext.execute(command);
-
- HandlerResponse handlerResp = processCommandResponse(controllerContext, command,
commandResponse);
-
- //
- if (handlerResp == null)
- {
- return;
- }
-
- // Find out if we can execute in the same server invocation
-// if (handlerResp instanceof CommandForward)
-// {
-// CommandForward forward = (CommandForward)handlerResp;
-// URLContext urlContext =
controllerContext.getServerInvocation().getServerContext().getURLContext();
-// if (requiresRedirect(command, urlContext, forward))
-// {
-// String url = controllerContext.renderURL(forward.getCommand(),
forward.getURLContext(), null);
-// sendResponse(controllerContext, new HTTPResponse.SendRedirect(url));
-// }
-// else
-// {
-// processCommand(controllerContext, forward.getCommand());
-// }
-// }
-// else
-// {
-// }
-
- if (handlerResp instanceof CommandForward)
- {
- CommandForward forward = (CommandForward)handlerResp;
-// URLContext urlContext =
ctx.getServerInvocation().getServerContext().getURLContext();
-// if (requiresRedirect(cmd, urlContext, forward))
-// {
-// String url = ctx.renderURL(forward.getCommand(), forward.getURLContext(),
null);
-// sendResponse(ctx, new HTTPResponse.SendRedirect(url));
-// }
-// else
-// {
-// processCommand(ctx, forward.getCommand());
-// }
- processCommand(controllerContext, forward.getCommand());
- }
- else
- {
- AjaxResponse ar = (AjaxResponse)handlerResp;
- ar.sendResponse(controllerContext.getServerInvocation().getServerContext());
- }
- }
-
- public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand command, Object response) throws IOException, ServletException,
ServerException
- {
- if (response instanceof PortletWindowResponse)
- {
- PortletWindowResponse pwr = (PortletWindowResponse)response;
- PortletInvocationResponse pir = pwr.getResult();
- if (pir instanceof RenderResponse)
- {
- RenderResponse rr = (RenderResponse)pir;
- StateString navState = rr.getNavigationalState();
- WindowState windowState = rr.getWindowState();
- Mode mode = rr.getMode();
- ControllerCommand renderCmd =
PortletResponseHandler.createRenderCommand(mode, windowState, navState, pwr);
- if (renderCmd != null)
- {
- return new CommandForward(renderCmd, null);
- }
- else
- {
- return null;
- }
- }
- else
- {
- throw new Error("todo");
- }
- }
- else if (response instanceof UpdateWindowMarkupResponse)
- {
- // We make an assumption here, the window result should carry somehow the window
id
- PortalObjectCommand pocmd = (PortalObjectCommand)command;
-
- //
- ServerInvocation invocation = controllerContext.getServerInvocation();
-
- // Obtain page and portal
- final Window window =
(Window)portalObjectContainer.getObject(pocmd.getTargetId());
- Page page = (Page)window.getParent();
- Portal portal = page.getPortal();
-
- //
- PortalObjectNavigationalStateContext ctx =
(PortalObjectNavigationalStateContext)controllerContext.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
-
- // The windows marked dirty during the request
- Set dirtyWindowIds = new HashSet();
-
- // Whether we need a full refresh or not
- boolean refresh = false;
-
- //
- for (Iterator i = ctx.getChanges();i.hasNext();)
- {
- NavigationalStateChange change = (NavigationalStateChange)i.next();
-
- // A change that modifies potentially the page structure
- if (!(change instanceof NavigationalStateObjectChange))
- {
- refresh = true;
- break;
- }
- NavigationalStateObjectChange update =
(NavigationalStateObjectChange)change;
-
- // A change that modifies potentially the page structure
- if (update.getType() != NavigationalStateObjectChange.UPDATE)
- {
- refresh = true;
- break;
- }
-
- // Get the state key
- NavigationalStateKey key = update.getKey();
-
- // We consider only portal object types
- if (key.getType() == WindowNavigationalState.class)
- {
- // Get old window state
- WindowNavigationalState oldNS =
(WindowNavigationalState)update.getOldValue();
- WindowState oldWindowState = oldNS != null ? oldNS.getWindowState() :
null;
-
- // Get new window state
- WindowNavigationalState newNS =
(WindowNavigationalState)update.getNewValue();
- WindowState newWindowState = newNS != null ? newNS.getWindowState() :
null;
-
- // Check if window state requires a refresh
- if (WindowState.MAXIMIZED.equals(oldWindowState))
- {
- if (!WindowState.MAXIMIZED.equals(newWindowState))
- {
- refresh = true;
- break;
- }
- }
- else if (WindowState.MAXIMIZED.equals(newWindowState))
- {
- refresh = true;
- break;
- }
-
- // Collect the dirty window id
- dirtyWindowIds.add(key.getId());
- }
- }
-
- // Commit changes
- ctx.applyChanges();
-
- //
- if (refresh)
- {
- RenderPageCommand rpc = new RenderPageCommand(page.getId());
- String url = controllerContext.renderURL(rpc, null, null);
- UpdatePageLocationResponse dresp = new UpdatePageLocationResponse(url);
- return new AjaxResponse(dresp);
- }
- else
- {
- ArrayList windowToRefresh = new ArrayList();
- for (Iterator i =
page.getChildren(PortalObject.WINDOW_MASK).iterator();i.hasNext();)
- {
- PortalObject child = (PortalObject)i.next();
- PortalObjectId childId = child.getId();
- if (dirtyWindowIds.contains(childId))
- {
- windowToRefresh.add(child);
- }
- }
-
- // Obtain layout
- LayoutService layoutService = getPageService().getLayoutService();
- PortalLayout layout = RenderPageCommand.getLayout(layoutService, page);
-
- //
- UpdatePageStateResponse updatePage = new
UpdatePageStateResponse(ctx.getViewId());
-
- // Call to the theme framework
- PageResult res = new PageResult(page.getName(), page.getProperties(),
portal.getProperties());
-
- //
- for (Iterator i = windowToRefresh.iterator();i.hasNext();)
- {
- final PortalObject _window = (PortalObject)i.next();
- RenderWindowCommand rwc = new RenderWindowCommand(_window.getId());
- try
- {
- Object wresp = controllerContext.execute(rwc);
- if (wresp instanceof WindowResult)
- {
- final WindowResult windowResult = (WindowResult)wresp;
-
- //
- WindowContext wc = new WindowContext(
- _window.getName(),
- _window.getId().toString(PortalObjectId.LEGACY_BASE64_FORMAT),
- "ABC",
- 0,
- windowResult);
-
- //
- MarkupInfo markupInfo =
(MarkupInfo)invocation.getResponse().getContentInfo();
-
- //
- RenderContext renderContext = layout.getRenderContext(markupInfo,
invocation);
-
- // Should push region context as well
- renderContext.setAttribute(DynaConstants.AJAX_WINDOW_ENABLED,
Boolean.TRUE);
- renderContext.pushObjectRenderContext(res);
-
- //
- renderContext.render(wc);
-
- //
- updatePage.addFragment(wc.getId(),
renderContext.getMarkupFragment().toString());
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- //
- return new AjaxResponse(updatePage);
- }
- }
- else
- {
- System.out.println("Not yet handled " + response);
-
- //
- return null;
- }
- }
-}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -30,8 +30,11 @@
import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
import org.jboss.portal.theme.page.PageRendition;
import org.jboss.portal.theme.impl.render.dynamic.DynaConstants;
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.request.URLFormat;
-import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
@@ -51,22 +54,18 @@
RenderPageCommand rpc = (RenderPageCommand)cmd;
//
+ ServerInvocationContext serverContext =
cmd.getControllerContext().getServerInvocation().getServerContext();
+
+ //
ControllerContext controllerContext = rpc.getControllerContext();
// If user is logged in and is on dashboard we enable ajax
- if
(controllerContext.getServerInvocation().getServerContext().getClientRequest().getRemoteUser()
!= null &&
+ if (serverContext.getClientRequest().getRemoteUser() != null &&
rpc.isDashboard())
{
- // Compute the url for the ajax servlet
- HttpServletRequest req =
cmd.getControllerContext().getServerInvocation().getServerContext().getClientRequest();
- StringBuffer url = new StringBuffer();
- url.append(req.getScheme()).append("://");
- url.append(req.getServerName());
- if (("http".equals(req.getScheme()) && req.getServerPort()
!= 80) || ("https".equals(req.getScheme()) && req.getServerPort() !=
443))
- {
- url.append(':').append(req.getServerPort());
- }
- url.append(req.getContextPath()).append("/ajax");
+ ServerURL surl = new AbstractServerURL();
+ surl.setPortalRequestPath("/ajax");
+ String url = serverContext.renderURL(surl, serverContext.getURLContext(),
URLFormat.newInstance(true, true));
//
PortalObjectNavigationalStateContext ctx =
(PortalObjectNavigationalStateContext)controllerContext.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
@@ -78,7 +77,7 @@
pageProps.put(DynaConstants.JAVASCRIPT_BASE, "/portal-ajax");
pageProps.put(DynaConstants.OBJECT_ENABLED, "true");
- pageProps.put(DynaConstants.ASYNC_SERVER_URL, url.toString());
+ pageProps.put(DynaConstants.ASYNC_SERVER_URL, url);
pageProps.put(DynaConstants.VIEW_STATE, viewId);
}
}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponse.java 2007-04-04
21:50:16 UTC (rev 6922)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponse.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -1,58 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller.ajax;
-
-import org.jboss.portal.core.controller.classic.HandlerResponse;
-import org.jboss.portal.theme.impl.render.dynamic.DynaResponse;
-import org.jboss.portal.theme.impl.render.dynamic.JSONMarshaller;
-import org.jboss.portal.server.ServerInvocationContext;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class AjaxResponse extends HandlerResponse
-{
-
- /** . */
- private static final JSONMarshaller marshaller = new JSONMarshaller();
-
- /** The response to the client. */
- private final DynaResponse dynaResponse;
-
- public AjaxResponse(DynaResponse dynaResponse)
- {
- this.dynaResponse = dynaResponse;
- }
-
- public void sendResponse(ServerInvocationContext ctx) throws IOException,
ServletException
- {
- HttpServletResponse resp = ctx.getClientResponse();
- resp.setContentType("text/html");
- marshaller.write(dynaResponse, resp.getWriter());
- }
-}
Added: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -0,0 +1,328 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.ajax;
+
+import org.jboss.portal.core.controller.ResponseHandler;
+import org.jboss.portal.core.controller.HandlerResponse;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.CommandForward;
+import org.jboss.portal.core.controller.AjaxResponse;
+import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
+import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
+import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
+import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
+import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
+import org.jboss.portal.core.ns.NavigationalStateChange;
+import org.jboss.portal.core.ns.NavigationalStateObjectChange;
+import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.theme.impl.render.dynamic.response.UpdatePageLocationResponse;
+import org.jboss.portal.theme.impl.render.dynamic.response.UpdatePageStateResponse;
+import org.jboss.portal.theme.impl.render.dynamic.DynaConstants;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.PageService;
+import org.jboss.portal.theme.render.RenderContext;
+import org.jboss.portal.theme.page.PageResult;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.page.WindowContext;
+
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AjaxResponseHandler implements ResponseHandler
+{
+
+ // Detect any change that would require a total refresh
+// HttpServletRequest req = invocation.getServerContext().getClientRequest();
+// String clientViewId = req.getHeader("view_id");
+// if (clientViewId != null)
+// {
+// PortalObjectNavigationalStateContext ctx =
(PortalObjectNavigationalStateContext)controllerContext.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
+// String serverViewId = ctx.getViewId();
+// if (!clientViewId.equals(serverViewId))
+// {
+// // todo : that will not work for FORMS submissions, we need a response for
the client
+// // to tell to do the request the normal way
+// try
+// {
+// UpdatePageLocationResponse dresp = new
UpdatePageLocationResponse(req.getRequestURL().toString());
+// AjaxResponse aresp = new AjaxResponse(dresp);
+// aresp.sendResponse(invocation.getServerContext());
+// }
+// catch (IOException e)
+// {
+// e.printStackTrace();
+// }
+// catch (ServletException e)
+// {
+// e.printStackTrace();
+// }
+// return;
+// }
+// }
+
+ /** . */
+ private PortalObjectContainer portalObjectContainer;
+
+ /** . */
+ private PageService pageService;
+
+ public PortalObjectContainer getPortalObjectContainer()
+ {
+ return portalObjectContainer;
+ }
+
+ public void setPortalObjectContainer(PortalObjectContainer portalObjectContainer)
+ {
+ this.portalObjectContainer = portalObjectContainer;
+ }
+
+ public PageService getPageService()
+ {
+ return pageService;
+ }
+
+ public void setPageService(PageService pageService)
+ {
+ this.pageService = pageService;
+ }
+
+ public HandlerResponse processCommandResponse(
+ ControllerContext controllerContext,
+ ControllerCommand command,
+ Object commandResponse) throws IOException, ServletException, ServerException
+ {
+ if (commandResponse instanceof PortletWindowResponse)
+ {
+ PortletWindowResponse pwr = (PortletWindowResponse)commandResponse;
+ PortletInvocationResponse pir = pwr.getResult();
+ if (pir instanceof RenderResponse)
+ {
+ RenderResponse rr = (RenderResponse)pir;
+ StateString navState = rr.getNavigationalState();
+ WindowState windowState = rr.getWindowState();
+ Mode mode = rr.getMode();
+ ControllerCommand renderCmd =
PortletResponseHandler.createRenderCommand(mode, windowState, navState, pwr);
+ if (renderCmd != null)
+ {
+ return new CommandForward(renderCmd, null);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
+ throw new Error("todo");
+ }
+ }
+ else if (commandResponse instanceof UpdateWindowMarkupResponse)
+ {
+ // We make an assumption here, the window result should carry somehow the window
id
+ PortalObjectCommand pocmd = (PortalObjectCommand)command;
+
+ //
+ ServerInvocation invocation = controllerContext.getServerInvocation();
+
+ // Obtain page and portal
+ final Window window =
(Window)portalObjectContainer.getObject(pocmd.getTargetId());
+ Page page = (Page)window.getParent();
+ Portal portal = page.getPortal();
+
+ //
+ PortalObjectNavigationalStateContext ctx =
(PortalObjectNavigationalStateContext)controllerContext.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
+
+ // The windows marked dirty during the request
+ Set dirtyWindowIds = new HashSet();
+
+ // Whether we need a full refresh or not
+ boolean refresh = false;
+
+ //
+ for (Iterator i = ctx.getChanges();i.hasNext();)
+ {
+ NavigationalStateChange change = (NavigationalStateChange)i.next();
+
+ // A change that modifies potentially the page structure
+ if (!(change instanceof NavigationalStateObjectChange))
+ {
+ refresh = true;
+ break;
+ }
+ NavigationalStateObjectChange update =
(NavigationalStateObjectChange)change;
+
+ // A change that modifies potentially the page structure
+ if (update.getType() != NavigationalStateObjectChange.UPDATE)
+ {
+ refresh = true;
+ break;
+ }
+
+ // Get the state key
+ NavigationalStateKey key = update.getKey();
+
+ // We consider only portal object types
+ if (key.getType() == WindowNavigationalState.class)
+ {
+ // Get old window state
+ WindowNavigationalState oldNS =
(WindowNavigationalState)update.getOldValue();
+ WindowState oldWindowState = oldNS != null ? oldNS.getWindowState() :
null;
+
+ // Get new window state
+ WindowNavigationalState newNS =
(WindowNavigationalState)update.getNewValue();
+ WindowState newWindowState = newNS != null ? newNS.getWindowState() :
null;
+
+ // Check if window state requires a refresh
+ if (WindowState.MAXIMIZED.equals(oldWindowState))
+ {
+ if (!WindowState.MAXIMIZED.equals(newWindowState))
+ {
+ refresh = true;
+ break;
+ }
+ }
+ else if (WindowState.MAXIMIZED.equals(newWindowState))
+ {
+ refresh = true;
+ break;
+ }
+
+ // Collect the dirty window id
+ dirtyWindowIds.add(key.getId());
+ }
+ }
+
+ // Commit changes
+ ctx.applyChanges();
+
+ //
+ if (refresh)
+ {
+ RenderPageCommand rpc = new RenderPageCommand(page.getId());
+ String url = controllerContext.renderURL(rpc, null, null);
+ UpdatePageLocationResponse dresp = new UpdatePageLocationResponse(url);
+ return new AjaxResponse(dresp);
+ }
+ else
+ {
+ ArrayList windowToRefresh = new ArrayList();
+ for (Iterator i =
page.getChildren(PortalObject.WINDOW_MASK).iterator();i.hasNext();)
+ {
+ PortalObject child = (PortalObject)i.next();
+ PortalObjectId childId = child.getId();
+ if (dirtyWindowIds.contains(childId))
+ {
+ windowToRefresh.add(child);
+ }
+ }
+
+ // Obtain layout
+ LayoutService layoutService = getPageService().getLayoutService();
+ PortalLayout layout = RenderPageCommand.getLayout(layoutService, page);
+
+ //
+ UpdatePageStateResponse updatePage = new
UpdatePageStateResponse(ctx.getViewId());
+
+ // Call to the theme framework
+ PageResult res = new PageResult(page.getName(), page.getProperties(),
portal.getProperties());
+
+ //
+ for (Iterator i = windowToRefresh.iterator();i.hasNext();)
+ {
+ final PortalObject _window = (PortalObject)i.next();
+ RenderWindowCommand rwc = new RenderWindowCommand(_window.getId());
+ try
+ {
+ Object wresp = controllerContext.execute(rwc);
+ if (wresp instanceof WindowResult)
+ {
+ final WindowResult windowResult = (WindowResult)wresp;
+
+ //
+ WindowContext wc = new WindowContext(
+ _window.getName(),
+ _window.getId().toString(PortalObjectId.LEGACY_BASE64_FORMAT),
+ "ABC",
+ 0,
+ windowResult);
+
+ //
+ MarkupInfo markupInfo =
(MarkupInfo)invocation.getResponse().getContentInfo();
+
+ //
+ RenderContext renderContext = layout.getRenderContext(markupInfo,
invocation);
+
+ // Should push region context as well
+ renderContext.setAttribute(DynaConstants.AJAX_WINDOW_ENABLED,
Boolean.TRUE);
+ renderContext.pushObjectRenderContext(res);
+
+ //
+ renderContext.render(wc);
+
+ //
+ updatePage.addFragment(wc.getId(),
renderContext.getMarkupFragment().toString());
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ //
+ return new AjaxResponse(updatePage);
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/classic/AbstractResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/AbstractResponseHandler.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/AbstractResponseHandler.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.controller.classic;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.core.controller.ResponseHandler;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Deleted:
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -1,241 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller.classic;
-
-import org.jboss.portal.core.controller.Controller;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.CommandRedirectionException;
-import org.jboss.portal.core.controller.ControllerSecurityException;
-import org.jboss.portal.core.controller.ResourceNotFoundException;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
-import org.jboss.portal.core.model.portal.PortalObjectResponseHandler;
-import org.jboss.portal.server.ServerException;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerURL;
-import org.jboss.portal.server.request.URLContext;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ClassicController extends Controller
-{
-
- // Unhardcode this
- private ResponseHandler[] handlers = new ResponseHandler[]
- {
- new ClassicResponseHandler(),
- new PortalObjectResponseHandler(),
- new PortletResponseHandler()
- };
-
- public void handle(ServerInvocation invocation) throws ServerException
- {
- // Invoke the chain that creates the initial command
- ControllerCommand cmd = commandFactory.doMapping(invocation,
invocation.getServerContext().getPortalHost(),
invocation.getServerContext().getPortalContextPath(),
invocation.getServerContext().getPortalRequestPath());
-
- //
- if (cmd == null)
- {
- // Handle that case
- throw new ServerException("No command was produced by the command
factory");
- }
-
- // Create controller context
- ControllerContext controllerContext = new ControllerContext(invocation, this);
-
- // Handle the command created
- processCommand(controllerContext, cmd);
- }
-
- public HandlerResponse processCommandResponse(ControllerContext ctx, ControllerCommand
cmd, Object response) throws IOException, ServletException, ServerException
- {
- for (int i = 0;i < handlers.length;i++)
- {
- ResponseHandler handler = handlers[i];
- HandlerResponse handlerResponse = handler.processCommandResponse(ctx, cmd,
response);
- if (handlerResponse != null)
- {
- return handlerResponse;
- }
- }
-
- //
- return null;
- }
-
- protected HandlerResponse executeCommand(ControllerContext ctx, ControllerCommand cmd)
throws ServerException
- {
- URLContext urlContext =
ctx.getServerInvocation().getServerContext().getURLContext();
-
- try
- {
- // Execute command
- Object commandResponse = ctx.execute(cmd);
-
- // Handle the result, might be null if no handling done
- return processCommandResponse(ctx, cmd, commandResponse);
- }
- catch (CommandRedirectionException e)
- {
- // Handle the redirection as forward
- return new CommandForward(e.getRedirection(), null);
- }
- catch (ControllerSecurityException e)
- {
- if (urlContext.isAuthenticated())
- {
- return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_UNAUTHORIZED);
- }
- else
- {
- urlContext = URLContext.newInstance(urlContext.isSecure(), true);
- ServerURL serverURL = getURLFactory().doMapping(ctx.getServerInvocation(),
cmd);
- String url = ctx.getServerInvocation().getResponse().renderURL(serverURL,
urlContext, null);
- return new HTTPResponse.SendRedirect(url);
- }
- }
- catch (ResourceNotFoundException e)
- {
- log.error("Resource not found " + e.getRef(), e);
- return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_NOT_FOUND);
- }
- catch (ControllerException e)
- {
- throw new ServerException(e);
- }
- catch (ServletException e)
- {
- throw new ServerException(e);
- }
- catch (IOException e)
- {
- throw new ServerException(e);
- }
- }
-
- /**
- * Return true if the execution of the next command requires a redirect.
- *
- * @param currentCmd the current command which has been executed
- * @param currentURLCtx the request URL context
- * @param forward the forward
- * @return
- */
- public boolean requiresRedirect(
- ControllerCommand currentCmd,
- URLContext currentURLCtx,
- CommandForward forward)
- {
- CommandInfo currentCmdInfo = currentCmd.getInfo();
- if (currentCmdInfo instanceof ActionCommandInfo &&
!((ActionCommandInfo)currentCmdInfo).isIdempotent())
- {
- return true;
- }
- else
- {
- URLContext nextURLCtx = forward.getURLContext();
- boolean currentAuthenticated = currentURLCtx.isAuthenticated();
- if (nextURLCtx != null && currentAuthenticated !=
nextURLCtx.isAuthenticated())
- {
- return true;
- }
- else
- {
- boolean currentSecure = currentURLCtx.isSecure();
- if (nextURLCtx != null && nextURLCtx.isSecure() &&
!currentSecure)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Handle a command which means it executes the command and reacts upon the response
created by the command.
- *
- * @param ctx the controller context
- * @param cmd the command
- * @throws org.jboss.portal.server.ServerException
- */
- protected void processCommand(final ControllerContext ctx, final ControllerCommand
cmd) throws ServerException
- {
- HandlerResponse handlerResp = executeCommand(ctx, cmd);
-
- //
- if (handlerResp == null)
- {
- return;
- }
-
- // Find out if we can execute in the same server invocation
- if (handlerResp instanceof CommandForward)
- {
- CommandForward forward = (CommandForward)handlerResp;
- URLContext urlContext =
ctx.getServerInvocation().getServerContext().getURLContext();
- if (requiresRedirect(cmd, urlContext, forward))
- {
- String url = ctx.renderURL(forward.getCommand(), forward.getURLContext(),
null);
- sendResponse(ctx, new HTTPResponse.SendRedirect(url));
- }
- else
- {
- processCommand(ctx, forward.getCommand());
- }
- }
- else
- {
- HTTPResponse hr = (HTTPResponse)handlerResp;
- sendResponse(ctx, hr);
- }
- }
-
- /**
- * All http responses in the stack should be handled here.
- */
- protected void sendResponse(ControllerContext ctx, HTTPResponse resp)
- {
- try
- {
- resp.sendResponse(ctx.getServerInvocation().getServerContext());
- }
- catch (IOException e)
- {
- log.error("Cound not send http response", e);
- }
- catch (ServletException e)
- {
- log.error("Cound not send http response", e);
- }
- }
-}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -29,11 +29,19 @@
import org.jboss.portal.theme.page.PageRendition;
import org.jboss.portal.core.controller.command.response.SignOutResponse;
import org.jboss.portal.core.controller.command.response.StreamContentResponse;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.HTTPResponse;
+import org.jboss.portal.core.controller.HandlerResponse;
+import org.jboss.portal.core.controller.ResponseHandler;
+import org.jboss.portal.core.controller.CommandForward;
+import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.PortalObjectResponseHandler;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import javax.servlet.ServletException;
@@ -46,53 +54,146 @@
public class ClassicResponseHandler extends AbstractResponseHandler
{
- private PortalObjectId defaultPortalPath = PortalObjectId.parse("/default",
PortalObjectId.CANONICAL_FORMAT);
+ private static final PortalObjectId defaultPortalPath =
PortalObjectId.parse("/default", PortalObjectId.CANONICAL_FORMAT);
- public HandlerResponse processCommandResponse(ControllerContext ctx, ControllerCommand
cmd, Object response) throws IOException, ServletException, ServerException
+ public HandlerResponse processCommandResponse(
+ ControllerContext controllerContext,
+ ControllerCommand command,
+ Object commandResponse) throws IOException, ServletException, ServerException
{
- final ServerInvocation invocation = ctx.getServerInvocation();
- if (response instanceof PageRendition)
+
+ HandlerResponse response = processHandlers(controllerContext, command,
commandResponse);
+
+ // Handle redirection here
+ if (response instanceof CommandForward)
{
- final PageRendition rendition = (PageRendition)response;
+ CommandForward forward = (CommandForward)response;
+ URLContext urlContext =
controllerContext.getServerInvocation().getServerContext().getURLContext();
+ if (requiresRedirect(command, urlContext, forward))
+ {
+ String url = controllerContext.renderURL(forward.getCommand(),
forward.getURLContext(), null);
+ return new HTTPResponse.SendRedirect(url);
+ }
+ }
- // Defer execution of rendition to the right place which is in the classic
controller send response
- return new HTTPResponse()
+ //
+ return response;
+ }
+
+ private HandlerResponse processHandlers(
+ ControllerContext controllerContext,
+ ControllerCommand command,
+ Object commandResponse) throws IOException, ServletException, ServerException
+ {
+ for (int i = 0;i < handlers.length;i++)
+ {
+ ResponseHandler handler = handlers[i];
+ HandlerResponse handlerResponse =
handler.processCommandResponse(controllerContext, command, commandResponse);
+ if (handlerResponse != null)
{
- public void sendResponse(ServerInvocationContext ctx) throws IOException,
ServletException
- {
- rendition.render(invocation);
- }
- };
+ return handlerResponse;
+ }
}
- else if (response instanceof SignOutResponse)
+
+ //
+ return null;
+ }
+
+ private static class OtherResponseHandler implements ResponseHandler
+ {
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand command, Object commandResponse) throws IOException, ServletException,
ServerException
{
- // Get the optional signout location
- String location = ((SignOutResponse)response).getLocation();
+ final ServerInvocation invocation = controllerContext.getServerInvocation();
+ if (commandResponse instanceof PageRendition)
+ {
+ final PageRendition rendition = (PageRendition)commandResponse;
- // Indicate that we want a sign out to be done
- invocation.getResponse().setWantSignOut(true);
+ // Defer execution of rendition to the right place which is in the classic
controller send response
+ return new HTTPResponse()
+ {
+ public void sendResponse(ServerInvocationContext ctx) throws IOException,
ServletException
+ {
+ rendition.render(invocation);
+ }
+ };
+ }
+ else if (commandResponse instanceof SignOutResponse)
+ {
+ // Get the optional signout location
+ String location = ((SignOutResponse)commandResponse).getLocation();
- //
- if (location == null)
+ // Indicate that we want a sign out to be done
+ invocation.getResponse().setWantSignOut(true);
+
+ //
+ if (location == null)
+ {
+ PortalObjectContainer portalObjectContainer =
controllerContext.getController().getPortalObjectContainer();
+ Portal portal =
(Portal)portalObjectContainer.getObject(defaultPortalPath);
+ RenderPageCommand renderCmd = new RenderPageCommand(portal.getId());
+ URLContext urlContext = invocation.getServerContext().getURLContext();
+ location = controllerContext.renderURL(renderCmd,
urlContext.asNonAuthenticated(), null);
+ }
+
+ //
+ return new HTTPResponse.SendRedirect(location);
+ }
+ else if (commandResponse instanceof StreamContentResponse)
{
- PortalObjectContainer portalObjectContainer =
ctx.getController().getPortalObjectContainer();
- Portal portal = (Portal)portalObjectContainer.getObject(defaultPortalPath);
- RenderPageCommand renderCmd = new RenderPageCommand(portal.getId());
- URLContext urlContext = invocation.getServerContext().getURLContext();
- location = ctx.renderURL(renderCmd, urlContext.asNonAuthenticated(), null);
+ StreamContentResponse scr = (StreamContentResponse)commandResponse;
+ return new HTTPResponse.SendBinary(scr.getContentType(),
scr.getInputStream());
}
+ else
+ {
+ return null;
+ }
+ }
+ }
- //
- return new HTTPResponse.SendRedirect(location);
- }
- else if (response instanceof StreamContentResponse)
+ // Unhardcode this
+ private ResponseHandler[] handlers = new ResponseHandler[]
+ {
+ new OtherResponseHandler(),
+ new PortalObjectResponseHandler(),
+ new PortletResponseHandler()
+ };
+
+ /**
+ * Return true if the execution of the next command requires a redirect.
+ *
+ * @param currentCmd the current command which has been executed
+ * @param currentURLCtx the request URL context
+ * @param forward the forward
+ * @return
+ */
+ public boolean requiresRedirect(
+ ControllerCommand currentCmd,
+ URLContext currentURLCtx,
+ CommandForward forward)
+ {
+ CommandInfo currentCmdInfo = currentCmd.getInfo();
+ if (currentCmdInfo instanceof ActionCommandInfo &&
!((ActionCommandInfo)currentCmdInfo).isIdempotent())
{
- StreamContentResponse scr = (StreamContentResponse)response;
- return new HTTPResponse.SendBinary(scr.getContentType(), scr.getInputStream());
+ return true;
}
else
{
- return null;
+ URLContext nextURLCtx = forward.getURLContext();
+ boolean currentAuthenticated = currentURLCtx.isAuthenticated();
+ if (nextURLCtx != null && currentAuthenticated !=
nextURLCtx.isAuthenticated())
+ {
+ return true;
+ }
+ else
+ {
+ boolean currentSecure = currentURLCtx.isSecure();
+ if (nextURLCtx != null && nextURLCtx.isSecure() &&
!currentSecure)
+ {
+ return true;
+ }
+ }
}
+ return false;
}
+
}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/classic/CommandForward.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/CommandForward.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/CommandForward.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -1,61 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller.classic;
-
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.core.controller.ControllerCommand;
-
-/**
- * Forward to a new command.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class CommandForward extends HandlerResponse
-{
- /** . */
- private final ControllerCommand cmd;
-
- /** . */
- private final URLContext urlCtx;
-
- public CommandForward(ControllerCommand cmd, URLContext urlCtx)
- {
- if (cmd == null)
- {
- throw new IllegalArgumentException("No command provided");
- }
- this.cmd = cmd;
- this.urlCtx = urlCtx;
- }
-
- public ControllerCommand getCommand()
- {
- return cmd;
- }
-
- public URLContext getURLContext()
- {
- return urlCtx;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -1,119 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller.classic;
-
-import org.jboss.portal.server.ServerInvocationContext;
-import org.jboss.portal.common.util.Tools;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.ServletException;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Response that sends a response to the http stream.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class HTTPResponse extends HandlerResponse
-{
-
- public abstract void sendResponse(ServerInvocationContext ctx) throws IOException,
ServletException;
-
- public static class SetStatusCode extends HTTPResponse
- {
-
- /** . */
- private final int statusCode;
-
- public SetStatusCode(int statusCode)
- {
- this.statusCode = statusCode;
- }
-
- public void sendResponse(ServerInvocationContext ctx) throws IOException
- {
- HttpServletResponse resp = ctx.getClientResponse();
- resp.sendError(statusCode);
- }
- }
-
- public static class SendRedirect extends HTTPResponse
- {
-
- /** . */
- private final String redirect;
-
- public SendRedirect(String redirect)
- {
- this.redirect = redirect;
- }
-
- public void sendResponse(ServerInvocationContext ctx) throws IOException
- {
- HttpServletResponse resp = ctx.getClientResponse();
- resp.sendRedirect(redirect);
- }
- }
-
- public static class SendBinary extends HTTPResponse
- {
-
- /** . */
- private final String contentType;
-
- /** . */
- private final InputStream in;
-
- public SendBinary(String contentType, InputStream inputStream)
- {
- this.contentType = contentType;
- this.in = inputStream;
- }
-
- public void sendResponse(ServerInvocationContext ctx) throws IOException
- {
- HttpServletResponse resp = ctx.getClientResponse();
- resp.setContentType(contentType);
- ServletOutputStream sout = null;
- try
- {
- sout = resp.getOutputStream();
- byte[] buf = new byte[2048];
- int len;
- while ((len = in.read(buf)) > 0)
- {
- sout.write(buf, 0, len);
- }
- sout.flush();
- }
- finally
- {
- Tools.safeClose(in);
- Tools.safeClose(sout);
- }
- }
- }
-}
Deleted:
trunk/core/src/main/org/jboss/portal/core/controller/classic/HandlerResponse.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/HandlerResponse.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/HandlerResponse.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -1,33 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller.classic;
-
-/**
- * The response from a a response handler.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class HandlerResponse
-{
-}
Deleted:
trunk/core/src/main/org/jboss/portal/core/controller/classic/ResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/ResponseHandler.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/ResponseHandler.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -1,39 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller.classic;
-
-import org.jboss.portal.server.ServerException;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerContext;
-
-import javax.servlet.ServletException;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface ResponseHandler
-{
- public HandlerResponse processCommandResponse(ControllerContext ctx, ControllerCommand
cmd, Object response) throws IOException, ServletException, ServerException;
-}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -24,10 +24,10 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.HTTPResponse;
+import org.jboss.portal.core.controller.CommandForward;
import org.jboss.portal.core.controller.classic.AbstractResponseHandler;
-import org.jboss.portal.core.controller.classic.CommandForward;
-import org.jboss.portal.core.controller.classic.HandlerResponse;
-import org.jboss.portal.core.controller.classic.HTTPResponse;
+import org.jboss.portal.core.controller.HandlerResponse;
import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
@@ -85,12 +85,12 @@
}
}
- public HandlerResponse processCommandResponse(ControllerContext ctx, ControllerCommand
cmd, Object response) throws IOException, ServletException, ServerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand command, Object commandResponse) throws IOException, ServletException,
ServerException
{
- if (response instanceof PortletResponse)
+ if (commandResponse instanceof PortletResponse)
{
- ServerInvocation invocation = ctx.getServerInvocation();
- PortletResponse pr = (PortletResponse)response;
+ ServerInvocation invocation = controllerContext.getServerInvocation();
+ PortletResponse pr = (PortletResponse)commandResponse;
PortletInvocationResponse pir = pr.getResult();
//
@@ -119,12 +119,12 @@
else if (pir instanceof InsufficientTransportGuaranteeResponse)
{
boolean authenticated =
invocation.getServerContext().getURLContext().isAuthenticated();
- return new CommandForward(cmd, URLContext.newInstance(true, authenticated));
+ return new CommandForward(command, URLContext.newInstance(true,
authenticated));
}
else if (pir instanceof InsufficientPrivilegesResponse)
{
boolean authenticated =
invocation.getServerContext().getURLContext().isAuthenticated();
- return new CommandForward(cmd, URLContext.newInstance(true, authenticated));
+ return new CommandForward(command, URLContext.newInstance(true,
authenticated));
}
else if (pir instanceof SignOutResponse)
{
@@ -140,12 +140,12 @@
if (location == null)
{
// Redirect to the same page
- InvokePortletWindowActionCommand iwac =
(InvokePortletWindowActionCommand)cmd;
+ InvokePortletWindowActionCommand iwac =
(InvokePortletWindowActionCommand)command;
Page page = iwac.getPage();
RenderPageCommand renderCmd = new RenderPageCommand(page.getId());
boolean secure =
invocation.getServerContext().getURLContext().isSecure();
URLContext urlContext = URLContext.newInstance(secure, false);
- location = ctx.renderURL(renderCmd, urlContext, null);
+ location = controllerContext.renderURL(renderCmd, urlContext, null);
}
//
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -23,8 +23,8 @@
package org.jboss.portal.core.model.portal;
import org.jboss.portal.core.controller.classic.AbstractResponseHandler;
-import org.jboss.portal.core.controller.classic.CommandForward;
-import org.jboss.portal.core.controller.classic.HandlerResponse;
+import org.jboss.portal.core.controller.CommandForward;
+import org.jboss.portal.core.controller.HandlerResponse;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.command.response.UpdateViewResponse;
@@ -42,18 +42,18 @@
public class PortalObjectResponseHandler extends AbstractResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext ctx, ControllerCommand
cmd, Object response) throws IOException, ServletException, ServerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand command, Object commandResponse) throws IOException, ServletException,
ServerException
{
- if (response instanceof UpdateViewResponse)
+ if (commandResponse instanceof UpdateViewResponse)
{
- UpdateViewResponse uvr = (UpdateViewResponse)response;
+ UpdateViewResponse uvr = (UpdateViewResponse)commandResponse;
RenderPageCommand renderCmd = new RenderPageCommand(uvr.getPageId());
return new CommandForward(renderCmd, null);
}
- else if (response instanceof UpdateWindowMarkupResponse)
+ else if (commandResponse instanceof UpdateWindowMarkupResponse)
{
- UpdateWindowMarkupResponse uwmr = (UpdateWindowMarkupResponse)response;
- PortalObjectContainer portalObjectContainer =
ctx.getController().getPortalObjectContainer();
+ UpdateWindowMarkupResponse uwmr = (UpdateWindowMarkupResponse)commandResponse;
+ PortalObjectContainer portalObjectContainer =
controllerContext.getController().getPortalObjectContainer();
PortalObject window = portalObjectContainer.getObject(uwmr.getWindowId());
Page page = (Page)window.getParent();
RenderPageCommand rpc = new RenderPageCommand(page.getId());
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-04-04
21:50:16 UTC (rev 6922)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-04-05
13:35:24 UTC (rev 6923)
@@ -769,6 +769,27 @@
optional-attribute-name="DelegateFactory"
proxy-type="attribute">portal:commandFactory=Dashboard</depends>
</mbean>
+ <mbean
+ code="org.jboss.portal.core.controller.ajax.AjaxCommandFactory"
+ name="portal:commandFactory=Ajax"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
+
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
+ name="portal:commandFactory=Delegate,path=ajax"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="Path">/ajax</attribute>
+ <depends
+ optional-attribute-name="DelegatingFactory"
+
proxy-type="attribute">portal:commandFactory=Delegating</depends>
+ <depends
+ optional-attribute-name="DelegateFactory"
+ proxy-type="attribute">portal:commandFactory=Ajax</depends>
+ </mbean>
<!-- URL factories -->
<mbean
@@ -899,46 +920,49 @@
proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
</mbean>
- <!-- The core controller -->
+ <!-- The classic response handler -->
<mbean
- code="org.jboss.portal.core.controller.classic.ClassicController"
- name="portal:controller=Classic"
+ code="org.jboss.portal.core.controller.classic.ClassicResponseHandler"
+ name="portal:service=ResponseHandler,type=Classic"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
+ </mbean>
+
+ <!-- The ajax response handler -->
+ <mbean
+ code="org.jboss.portal.core.controller.ajax.AjaxResponseHandler"
+ name="portal:service=ResponseHandler,type=Ajax"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
<depends
optional-attribute-name="PageService"
proxy-type="attribute">portal:service=PageService</depends>
<depends
- optional-attribute-name="CommandFactory"
-
proxy-type="attribute">portal:commandFactory=DefaultPortal</depends>
- <depends
- optional-attribute-name="URLFactory"
-
proxy-type="attribute">portal:urlFactory=Delegating</depends>
- <depends
- optional-attribute-name="StackFactory"
-
proxy-type="attribute">portal:service=InterceptorStackFactory,type=Command</depends>
- <depends
optional-attribute-name="PortalObjectContainer"
proxy-type="attribute">portal:container=PortalObject</depends>
+ </mbean>
+
+ <!-- The response handler selector -->
+ <mbean
+ code="org.jboss.portal.core.controller.ResponseHandlerSelector"
+ name="portal:service=ResponseHandler,type=Selector"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
<depends
- optional-attribute-name="InstanceContainer"
- proxy-type="attribute">portal:container=Instance</depends>
+ optional-attribute-name="ClassicResponseHandler"
+
proxy-type="attribute">portal:service=ResponseHandler,type=Classic</depends>
<depends
- optional-attribute-name="PortalAuthorizationManagerFactory"
-
proxy-type="attribute">portal:service=PortalAuthorizationManagerFactory</depends>
- <depends
- optional-attribute-name="CustomizationManager"
-
proxy-type="attribute">portal:service=CustomizationManager</depends>
- <depends
- optional-attribute-name="ContentRendererRegistry"
-
proxy-type="attribute">portal:service=ContentProviderRegistry</depends>
+ optional-attribute-name="AjaxResponseHandler"
+
proxy-type="attribute">portal:service=ResponseHandler,type=Ajax</depends>
</mbean>
- <!-- The ajax controller -->
+ <!-- The controller -->
<mbean
- code="org.jboss.portal.core.controller.ajax.AjaxController"
- name="portal:controller=Ajax"
+ code="org.jboss.portal.core.controller.Controller"
+ name="portal:service=Controller"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
@@ -969,21 +993,21 @@
<depends
optional-attribute-name="ContentRendererRegistry"
proxy-type="attribute">portal:service=ContentProviderRegistry</depends>
+ <depends
+ optional-attribute-name="ResponseHandler"
+
proxy-type="attribute">portal:service=ResponseHandler,type=Selector</depends>
</mbean>
<!-- The controller factory -->
<mbean
- code="org.jboss.portal.core.controller.ControllerFactory"
+ code="org.jboss.portal.server.impl.RequestControllerFactoryImpl"
name="portal:service=ControllerFactory"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends
- optional-attribute-name="ClassicController"
- proxy-type="attribute">portal:controller=Classic</depends>
- <depends
- optional-attribute-name="AjaxController"
- proxy-type="attribute">portal:controller=Ajax</depends>
+ optional-attribute-name="Controller"
+ proxy-type="attribute">portal:service=Controller</depends>
</mbean>
<!-- -->
Modified: trunk/core/src/resources/portal-server-war/WEB-INF/web.xml
===================================================================
--- trunk/core/src/resources/portal-server-war/WEB-INF/web.xml 2007-04-04 21:50:16 UTC
(rev 6922)
+++ trunk/core/src/resources/portal-server-war/WEB-INF/web.xml 2007-04-05 13:35:24 UTC
(rev 6923)
@@ -223,32 +223,4 @@
<role-name>Authenticated</role-name>
</security-role>
- <!-- AJAX -->
-
- <!-- The portal servlet for ajax requests -->
- <servlet>
- <servlet-name>PortalServletForAjax</servlet-name>
-
<servlet-class>org.jboss.portal.server.servlet.PortalServlet</servlet-class>
- <init-param>
- <param-name>asDefaultServlet</param-name>
- <param-value>false</param-value>
- <description>The servlet needs to know wether it is set as a default
servlet or not</description>
- </init-param>
- <init-param>
- <param-name>controllerFactoryName</param-name>
- <param-value>portal:service=ControllerFactory</param-value>
- <description>The request controller factory for the portal
servlet</description>
- </init-param>
- <load-on-startup>0</load-on-startup>
- <security-role-ref>
- <role-name>Authenticated</role-name>
- <role-link>Authenticated</role-link>
- </security-role-ref>
- </servlet>
-
- <!-- Provide secure access to authenticated users -->
- <servlet-mapping>
- <servlet-name>PortalServletForAjax</servlet-name>
- <url-pattern>/ajax/*</url-pattern>
- </servlet-mapping>
</web-app>
Modified: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -130,7 +130,6 @@
writer.write("<div
class=\"portlet-section-header\">Capabilities</div>");
writer.write("<div class=\"portlet-section-body\">");
writer.write("<div>Content type " + req.getResponseContentType() +
"</div>");
- writer.write("<div>Preferred markup " +
req.getProperty(CoreConstants.REQ_PROP_PREFERRED_MARKUP) + "</div>");
writer.write("</div>");
writer.write("</p>");
Modified: trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js
===================================================================
--- trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js 2007-04-04 21:50:16 UTC (rev
6922)
+++ trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js 2007-04-05 13:35:24 UTC (rev
6923)
@@ -119,15 +119,15 @@
// Iterate all changes
for (var id in resp.fragments)
{
- var matchingElts = document.getElementsByClassName(id);
+ var matchingElt = document.getElementById(id);
// Different than 1 is not good
- if (matchingElts.length == 1)
+ if (matchingElt != null)
{
var markup = resp.fragments[id];
markup = markup.substring(25, markup.length - 7);
- var markupContainer = Element.up(matchingElts[0]);
+ var markupContainer = Element.up(matchingElt);
markupContainer.innerHTML = markup;
}
}
@@ -175,12 +175,19 @@
onEnd: function()
{
var elt = Draggables.activeDraggable.element;
+
+ //
+ var windowId = Element.down(elt).id;
var fromRegionId = elt["regionId"];
var fromPos = elt["pos"];
+
+ // Doing the snapshot after move will give us the new region and pos of the
window
snapshot();
var toRegionId = elt["regionId"];
var toPos = elt["pos"];
- sendData("windowmove", elt.id, fromPos, fromRegionId, toPos,
toRegionId);
+
+ // Perform request
+ sendData("windowmove", windowId, fromPos, fromRegionId, toPos,
toRegionId);
}
};
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java 2007-04-04 21:50:16
UTC (rev 6922)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java 2007-04-05 13:35:24
UTC (rev 6923)
@@ -42,7 +42,6 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Iterator;
-import java.util.Collection;
/**
* Layout implementation that uses JSPs (and tags) to render the response back to the
client.
@@ -77,41 +76,47 @@
WindowResult res = wc.getResult();
if (WindowState.MAXIMIZED.equals(res.getWindowState()))
{
- // TODO: Deep clone instead ?
- PageResult newRes = new PageResult(
- pageResult.getPageName(),
- pageResult.getPageProperties(),
- pageResult.getPortalProperties());
- newRes.setThemeResult(pageResult.getThemeResult());
- Collection set = pageResult.getWindowContextMap().values();
- Iterator setIterator = set.iterator();
- while (setIterator.hasNext())
- {
- WindowContext windowContext = (WindowContext)setIterator.next();
- newRes.addWindowContext(windowContext);
- }
+// // TODO: Deep clone instead ?
+// PageResult newRes = new PageResult(
+// pageResult.getPageName(),
+// pageResult.getPageProperties(),
+// pageResult.getPortalProperties());
+//
+// //
+// newRes.setLayoutState("maximized");
+// newRes.setLayoutURI(getLayoutInfo().getURI("maximized"));
+// newRes.setThemeResult(pageResult.getThemeResult());
+//
+// //
+// for (Iterator j =
pageResult.getWindowContextMap().values().iterator();j.hasNext();)
+// {
+// WindowContext windowContext = (WindowContext)j.next();
+//
+// //
+// if (windowContext == wc)
+// {
+// newRes.addWindowContext(new WindowContext(wc.getName(), wc.getId(),
"maximized", 0, res));
+// }
+// else
+// {
+// newRes.addWindowContext(windowContext);
+// }
+// }
+//
+// //
+// pageResult = newRes;
- //
- WindowContext ctx = pageResult.getWindowContext(windowId);
-
- //
- newRes.setLayoutState("maximized");
- newRes.setLayoutURI(getLayoutInfo().getURI("maximized"));
-
- //
- ctx.setRegionName("maximized");
- ctx.setOrder(0);
-
- //
- newRes.addWindowContext(ctx);
-
- //
- pageResult = newRes;
-
+ pageResult.setLayoutState("maximized");
+ pageResult.setLayoutURI(getLayoutInfo().getURI("maximized"));
+ wc.setRegionName("maximized");
+ wc.setOrder(0);
break;
}
}
+ // Yes it is ugly
+ pageResult.rebuild();
+
try
{
ServerInvocation invocation = renderContext.getServerInvocation();
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -97,7 +97,7 @@
markup.append("<script type='text/javascript'>\n");
// Async server URL needed for callbacks
-
markup.append("async_server_url=\"").append(asyncServerURL).append(";\"\n");
+
markup.append("async_server_url=\"").append(asyncServerURL).append("\";\n");
// View state if not null
if (viewState != null)
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2007-04-04
21:50:16 UTC (rev 6922)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2007-04-05
13:35:24 UTC (rev 6923)
@@ -61,7 +61,7 @@
//
StringBuffer out = renderContext.getMarkupFragment();
- out.append("<div
id=\"").append(wrc.getId()).append("\"
class=\"dyna-window\"><div
class=\"").append(wrc.getId()).append("\"/>\n");
+ out.append("<div class=\"dyna-window\"><div
id=\"").append(wrc.getId()).append("\"/>\n");
delegate.render(renderContext, wrc);
out.append("</div></div>\n");
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java 2007-04-04 21:50:16
UTC (rev 6922)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java 2007-04-05 13:35:24
UTC (rev 6923)
@@ -33,6 +33,7 @@
import java.util.Map;
import java.util.Set;
import java.util.Collection;
+import java.util.Iterator;
/**
* Interface to represent the read only information of a rendered portal page.
<p>The page result allows access to all
@@ -222,14 +223,18 @@
{
windowContexts.put(windowContext.getId(), windowContext);
+ //
Region region = (Region)regions.get(windowContext.getRegionName());
+
+ //
if (region == null)
{
region = new Region(this, windowContext.getRegionName());
+ regions.put(region.getId(), region);
}
+
+ //
region.addWindowContext(windowContext);
-
- regions.put(region.getId(), region);
}
// PageRenderContext implementation
*********************************************************************************
@@ -248,7 +253,6 @@
return s;
}
-
public Collection getRegions()
{
return regions.values();
@@ -258,4 +262,34 @@
{
return (RegionRenderContext)regions.get(regionName);
}
+
+ public void rebuild()
+ {
+ // Clear all windows
+ for (Iterator i = regions.values().iterator();i.hasNext();)
+ {
+ Region region = (Region)i.next();
+ region.windows.clear();
+ }
+
+ // Readd all windows
+ for (Iterator i = windowContexts.values().iterator();i.hasNext();)
+ {
+ WindowContext wc = (WindowContext)i.next();
+
+ //
+ Region region = (Region)regions.get(wc.getRegionName());
+
+ //
+ if (region == null)
+ {
+ region = new Region(this, wc.getRegionName());
+ regions.put(region.getId(), region);
+ }
+
+ //
+ region.addWindowContext(wc);
+ }
+ }
}
+
\ No newline at end of file
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/Region.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/Region.java 2007-04-04 21:50:16 UTC
(rev 6922)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/Region.java 2007-04-05 13:35:24 UTC
(rev 6923)
@@ -52,7 +52,7 @@
private boolean sorted;
/** . */
- private final ArrayList windows;
+ final ArrayList windows;
/** . */
private Map properties;