From portal-commits at lists.jboss.org Tue Mar 20 11:57:29 2007 Content-Type: multipart/mixed; boundary="===============0341053185858171136==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r6777 - in trunk/core/src/main/org/jboss/portal/core: controller/classic and 1 other directory. Date: Tue, 20 Mar 2007 11:57:29 -0400 Message-ID: --===============0341053185858171136== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: julien(a)jboss.com Date: 2007-03-20 11:57:29 -0400 (Tue, 20 Mar 2007) New Revision: 6777 Removed: trunk/core/src/main/org/jboss/portal/core/WindowManipulator.java Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicCont= roller.java trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResp= onseHandler.java trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPRespons= e.java Log: defer page assembly to the ClassicController.sendResponse(...) by providing= a custom subclass of HTTPResponse which activate the PageRendition from th= e theme. Deleted: trunk/core/src/main/org/jboss/portal/core/WindowManipulator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/WindowManipulator.java 2007-0= 3-20 15:23:56 UTC (rev 6776) +++ trunk/core/src/main/org/jboss/portal/core/WindowManipulator.java 2007-0= 3-20 15:57:29 UTC (rev 6777) @@ -1,122 +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; - -import org.jboss.portal.common.invocation.AttributeResolver; -import org.jboss.portal.theme.ThemeConstants; -import org.jboss.portal.theme.navigation.WindowNavigationalState; -import org.jboss.portal.core.model.portal.Window; - -import java.util.Collection; -import java.util.Iterator; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; -import java.util.SortedMap; -import java.util.Set; - -/** - * @author Julien Viet - * @version $Revision: 1.1 $ - */ -public class WindowManipulator -{ - - private Map regionMap; - - private AttributeResolver navStateResolver; - - public WindowManipulator(AttributeResolver navStateResolver, Collection= windows) - { - this.navStateResolver =3D navStateResolver; - - // Build appropriate structure - regionMap =3D new HashMap(); - for (Iterator i =3D windows.iterator();i.hasNext();) - { - try - { - Window window =3D (Window)i.next(); - String region =3D window.getDeclaredProperty(ThemeConstants.PO= RTAL_PROP_REGION); - Integer order =3D new Integer(window.getDeclaredProperty(Theme= Constants.PORTAL_PROP_ORDER)); - - // - SortedMap windowMap =3D (SortedMap)regionMap.get(region); - if (windowMap =3D=3D null) - { - windowMap =3D new TreeMap(); - regionMap.put(region, windowMap); - } - windowMap.put(order, window); - } - catch (NumberFormatException ignore) - { - } - } - } - - public String getRegionName(Window window) - { - for (Iterator i =3D regionMap.entrySet().iterator();i.hasNext();) - { - Map.Entry entry =3D (Map.Entry)i.next(); - SortedMap windows =3D (SortedMap)entry.getValue(); - for (Iterator j =3D windows.values().iterator();j.hasNext();) - { - Window window2 =3D (Window)j.next(); - if (window.getId().equals(window2.getId())) - { - return (String)entry.getKey(); - } - } - } - return null; - } - - public Set getRegionNames() - { - return regionMap.keySet(); - } - - public Collection getWindows(String regionName) - { - return ((Map)regionMap.get(regionName)).values(); - } - - public WindowNavigationalState getNavigationalState(Window window) - { - WindowNavigationalState wns =3D (WindowNavigationalState)navStateRes= olver.getAttribute(window.getId() + "_window"); - if (wns =3D=3D null) - { - wns =3D new WindowNavigationalState(); - navStateResolver.setAttribute(window.getId() + "_window", wns); - } - return wns; - } - - public void setNavigationalState(Window window, WindowNavigationalState= windowNS) - { - navStateResolver.setAttribute(window.getId() + "_window", windowNS); - } - -} Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/Clas= sicController.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicCon= troller.java 2007-03-20 15:23:56 UTC (rev 6776) +++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicCon= troller.java 2007-03-20 15:57:29 UTC (rev 6777) @@ -133,6 +133,10 @@ { log.error("Cound not send http response", e); } + catch (ServletException e) + { + log.error("Cound not send http response", e); + } } = protected HandlerResponse executeCommand(ControllerContext ctx, Control= lerCommand cmd) throws ServerException Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/Clas= sicResponseHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicRes= ponseHandler.java 2007-03-20 15:23:56 UTC (rev 6776) +++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicRes= ponseHandler.java 2007-03-20 15:57:29 UTC (rev 6777) @@ -24,6 +24,7 @@ = import org.jboss.portal.server.ServerException; import org.jboss.portal.server.ServerInvocation; +import org.jboss.portal.server.ServerInvocationContext; import org.jboss.portal.server.request.URLContext; import org.jboss.portal.theme.PageRendition; import org.jboss.portal.core.controller.command.response.SignOutResponse; @@ -49,13 +50,17 @@ = public HandlerResponse handleResponse(ControllerContext ctx, Controller= Command cmd, Object response) throws IOException, ServletException, ServerE= xception { - ServerInvocation invocation =3D ctx.getServerInvocation(); - + final ServerInvocation invocation =3D ctx.getServerInvocation(); if (response instanceof PageRendition) { - PageRendition rendition =3D (PageRendition)response; - rendition.render(invocation); - return null; + final PageRendition rendition =3D (PageRendition)response; + return new HTTPResponse() + { + public void sendResponse(ServerInvocationContext ctx) throws I= OException, ServletException + { + rendition.render(invocation); + } + }; } else if (response instanceof SignOutResponse) { Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTP= Response.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPRespon= se.java 2007-03-20 15:23:56 UTC (rev 6776) +++ trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPRespon= se.java 2007-03-20 15:57:29 UTC (rev 6777) @@ -27,6 +27,7 @@ = import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletOutputStream; +import javax.servlet.ServletException; import java.io.IOException; import java.io.InputStream; = @@ -39,7 +40,7 @@ public abstract class HTTPResponse extends HandlerResponse { = - public abstract void sendResponse(ServerInvocationContext ctx) throws I= OException; + public abstract void sendResponse(ServerInvocationContext ctx) throws I= OException, ServletException; = public static class SetStatusCode extends HTTPResponse { --===============0341053185858171136==--