From portal-commits at lists.jboss.org Sat Mar 31 08:57:51 2007 Content-Type: multipart/mixed; boundary="===============1975257684951270951==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r6894 - trunk/core/src/main/org/jboss/portal/core/controller. Date: Sat, 31 Mar 2007 08:57:51 -0400 Message-ID: --===============1975257684951270951== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: julien(a)jboss.com Date: 2007-03-31 08:57:50 -0400 (Sat, 31 Mar 2007) New Revision: 6894 Added: trunk/core/src/main/org/jboss/portal/core/controller/ControllerFactory.j= ava Log: - added in server RequestControllerFactory so the request controller used b= y the portal servlet can decided at runtime based on the server request Added: trunk/core/src/main/org/jboss/portal/core/controller/ControllerFacto= ry.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/ControllerFactory.= java (rev 0) +++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerFactory.= java 2007-03-31 12:57:50 UTC (rev 6894) @@ -0,0 +1,94 @@ +/*************************************************************************= ***** + * 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 Julien Viet + * @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 =3D classicController; + } + + + public RequestController getAjaxController() + { + return ajaxController; + } + + public void setAjaxController(RequestController ajaxController) + { + this.ajaxController =3D ajaxController; + } + + public RequestController createRequestController(ServerInvocation invoc= ation) + { + + HttpServletRequest req =3D invocation.getServerContext().getClientRe= quest(); + String value =3D req.getHeader("ajax"); + if ("true".equalsIgnoreCase(value)) + { + return ajaxController; + } + else + { + return classicController; + } + + +// 02:03:58,636 INFO [STDOUT] host =3D localhost:8080 +// 02:03:58,636 INFO [STDOUT] user-agent =3D 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 =3D text/javascript, text/html,= application/xml, text/xml, */* +// 02:03:58,636 INFO [STDOUT] accept-language =3D fr,en-us;q=3D0.5 +// 02:03:58,637 INFO [STDOUT] accept-encoding =3D gzip,deflate +// 02:03:58,637 INFO [STDOUT] accept-charset =3D ISO-8859-1,utf-8;q= =3D0.7,*;q=3D0.7 +// 02:03:58,637 INFO [STDOUT] keep-alive =3D 300 +// 02:03:58,637 INFO [STDOUT] connection =3D keep-alive +// 02:03:58,637 INFO [STDOUT] x-requested-with =3D XMLHttpRequest +// 02:03:58,638 INFO [STDOUT] x-prototype-version =3D 1.5.0_rc1 +// 02:03:58,638 INFO [STDOUT] ajax =3D true +// 02:03:58,639 INFO [STDOUT] referer =3D http://localhost:8080/port= al/auth/portal/dashboard/admin/default/ +// 02:03:58,639 INFO [STDOUT] cookie =3D JSESSIONID=3DA0B8EA1EEEAE6D= 977C0A8074D338B0EB + } +} --===============1975257684951270951==--