JBoss Portal SVN: r6785 - in trunk: portlet-federation/src/main/org/jboss/portal/portlet/federation/impl and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-20 20:52:41 -0400 (Tue, 20 Mar 2007)
New Revision: 6785
Removed:
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/spi/
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/PortletInvokerRegistrationImpl.java
Modified:
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/PortletInvokerRegistrationService.java
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/OneInvokerNoPortletsTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java
Log:
portlet federation simplification based on Chris suggestion
Modified: trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java
===================================================================
--- trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java 2007-03-20 20:12:06 UTC (rev 6784)
+++ trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java 2007-03-21 00:52:41 UTC (rev 6785)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.federation;
import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
import java.util.Collection;
@@ -37,29 +36,22 @@
public interface FederatingPortletInvoker extends PortletInvoker
{
/**
- * Register an invoker.
+ * Registers an invoker.
*
- * @param registration the invoker to register
+ * @param federatedId the invoker id to register
+ * @param registeredInvoker the invoker to register
* @throws IllegalArgumentException if the invoker is null or already registered
*/
- FederatedPortletInvoker registerInvoker(PortletInvokerRegistration registration) throws IllegalArgumentException;
+ FederatedPortletInvoker registerInvoker(String federatedId, PortletInvoker registeredInvoker) throws IllegalArgumentException;
/**
- * Unregister an invoker.
- *
- * @param registration the invoker to unregister
- * @throws IllegalArgumentException if invoker is null or not registered
- */
- void unregisterInvoker(PortletInvokerRegistration registration) throws IllegalArgumentException;
-
- /**
* Return a portlet invoker registered or null if not found
*
- * @param id the id
+ * @param federatedId the id
* @return the invoker
* @throws IllegalArgumentException if the id is null
*/
- FederatedPortletInvoker getFederatedInvoker(String id) throws IllegalArgumentException;
+ FederatedPortletInvoker getFederatedInvoker(String federatedId) throws IllegalArgumentException;
/**
* Return the registered portlet invokers.
@@ -71,9 +63,9 @@
/**
* Unregisters the invoker associated with the specified identifier.
*
- * @param id the identifier of the invoker to unregister
+ * @param federatedId the identifier of the invoker to unregister
* @throws IllegalArgumentException if the identifier is null or no invoker is registered with this identifier
* @since 2.6
*/
- void unregisterInvoker(String id);
+ void unregisterInvoker(String federatedId);
}
Modified: trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java
===================================================================
--- trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java 2007-03-20 20:12:06 UTC (rev 6784)
+++ trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java 2007-03-21 00:52:41 UTC (rev 6785)
@@ -25,7 +25,6 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.federation.FederatedPortletInvoker;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvoker;
@@ -63,10 +62,10 @@
/** . */
private FederatingPortletInvoker federatingPortletInvoker;
- public FederatedPortletInvokerService(FederatingPortletInvoker federatingPortletInvoker, PortletInvokerRegistration registration)
+ public FederatedPortletInvokerService(FederatingPortletInvoker federatingPortletInvoker, String id, PortletInvoker portletInvoker)
{
- this.id = registration.getId();
- this.portletInvoker = registration.getPortletInvoker();
+ this.id = id;
+ this.portletInvoker = portletInvoker;
this.federatingPortletInvoker = federatingPortletInvoker;
}
Modified: trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java
===================================================================
--- trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java 2007-03-20 20:12:06 UTC (rev 6784)
+++ trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java 2007-03-21 00:52:41 UTC (rev 6785)
@@ -28,9 +28,9 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.federation.FederatedPortletInvoker;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.state.PropertyChange;
@@ -58,57 +58,51 @@
static final String SEPARATOR = ".";
/** The registred FederatedPortletInvokers. */
- private Map registry = new HashMap();
+ private volatile Map registry = new HashMap();
- public synchronized FederatedPortletInvoker registerInvoker(PortletInvokerRegistration registration)
+ public synchronized FederatedPortletInvoker registerInvoker(String federatedId, PortletInvoker federatedInvoker)
{
- if (registration == null)
+ if (federatedId == null)
{
+ throw new IllegalArgumentException("No null id");
+ }
+ if (federatedInvoker == null)
+ {
throw new IllegalArgumentException("No null invoker");
}
- String id = registration.getId();
- if (registry.containsKey(id))
+ if (registry.containsKey(federatedId))
{
- throw new IllegalArgumentException("Attempting dual registration of " + id);
+ throw new IllegalArgumentException("Attempting dual registration of " + federatedId);
}
Map copy = new HashMap(registry);
- FederatedPortletInvokerService invoker = new FederatedPortletInvokerService(this, registration);
- copy.put(id, invoker);
+ FederatedPortletInvokerService invoker = new FederatedPortletInvokerService(this, federatedId, federatedInvoker);
+ copy.put(federatedId, invoker);
registry = copy;
return invoker;
}
- public synchronized void unregisterInvoker(PortletInvokerRegistration registration)
+ public synchronized void unregisterInvoker(String federatedId)
{
- if (registration == null)
+ if (federatedId == null)
{
- throw new IllegalArgumentException("No null invoker");
- }
- unregisterInvoker(registration.getId());
- }
-
- public synchronized void unregisterInvoker(String id)
- {
- if (id == null)
- {
throw new IllegalArgumentException("No null id accepted");
}
- if (!registry.containsKey(id))
+ if (!registry.containsKey(federatedId))
{
- throw new IllegalArgumentException("Attempting to unregister unknown invoker " + id);
+ throw new IllegalArgumentException("Attempting to unregister unknown invoker " + federatedId);
}
Map copy = new HashMap(registry);
- copy.remove(id);
+ copy.remove(federatedId);
registry = copy;
}
- public FederatedPortletInvoker getFederatedInvoker(String id) throws IllegalArgumentException
+ public FederatedPortletInvoker getFederatedInvoker(String federatedId) throws IllegalArgumentException
{
- if (id == null)
+ if (federatedId == null)
{
throw new IllegalArgumentException("No null id provided");
}
- return (FederatedPortletInvoker)registry.get(id);
+ return (FederatedPortletInvoker)registry.get(federatedId);
}
public Collection getFederatedInvokers()
Modified: trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/PortletInvokerRegistrationService.java
===================================================================
--- trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/PortletInvokerRegistrationService.java 2007-03-20 20:12:06 UTC (rev 6784)
+++ trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/PortletInvokerRegistrationService.java 2007-03-21 00:52:41 UTC (rev 6785)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.federation.impl;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.PortletInvoker;
@@ -34,7 +33,7 @@
* @version $Revision: 5448 $
* @since 2.4
*/
-public class PortletInvokerRegistrationService extends AbstractJBossService implements PortletInvokerRegistration
+public class PortletInvokerRegistrationService extends AbstractJBossService
{
/** The registration id. */
@@ -78,11 +77,11 @@
protected void startService() throws Exception
{
- federatingPortletInvoker.registerInvoker(this);
+ federatingPortletInvoker.registerInvoker(id, portletInvoker);
}
protected void stopService() throws Exception
{
- federatingPortletInvoker.unregisterInvoker(this);
+ federatingPortletInvoker.unregisterInvoker(id);
}
}
Modified: trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java
===================================================================
--- trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java 2007-03-20 20:12:06 UTC (rev 6784)
+++ trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java 2007-03-21 00:52:41 UTC (rev 6785)
@@ -74,7 +74,7 @@
// Wire
federatedInvoker.addInternalPortlet("MyPortlet", federatedPortlet);
- federatingInvoker.registerInvoker(new PortletInvokerRegistrationImpl("foo", federatedInvoker));
+ federatingInvoker.registerInvoker("foo", federatedInvoker);
// Basic setup
Set portlets = federatingInvoker.getPortlets();
Modified: trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/OneInvokerNoPortletsTestCase.java
===================================================================
--- trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/OneInvokerNoPortletsTestCase.java 2007-03-20 20:12:06 UTC (rev 6784)
+++ trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/OneInvokerNoPortletsTestCase.java 2007-03-21 00:52:41 UTC (rev 6785)
@@ -43,7 +43,7 @@
{
FederatingPortletInvoker federating = new FederatingPortletInvokerService();
PortletInvokerSupport support = new PortletInvokerSupport();
- federating.registerInvoker(new PortletInvokerRegistrationImpl("foo", support));
+ federating.registerInvoker("foo", support);
//
assertEquals(new HashSet(), federating.getPortlets());
Deleted: trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/PortletInvokerRegistrationImpl.java
===================================================================
--- trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/PortletInvokerRegistrationImpl.java 2007-03-20 20:12:06 UTC (rev 6784)
+++ trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/PortletInvokerRegistrationImpl.java 2007-03-21 00:52:41 UTC (rev 6785)
@@ -1,56 +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.test.portlet.federation;
-
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
-import org.jboss.portal.portlet.PortletInvoker;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletInvokerRegistrationImpl implements PortletInvokerRegistration
-{
-
- /** . */
- private final String id;
-
- /** . */
- private final PortletInvoker portletInvoker;
-
- public PortletInvokerRegistrationImpl(String id, PortletInvoker portletInvoker)
- {
- this.id = id;
- this.portletInvoker = portletInvoker;
- }
-
- public String getId()
- {
- return id;
- }
-
- public PortletInvoker getPortletInvoker()
- {
- return portletInvoker;
- }
-}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java 2007-03-20 20:12:06 UTC (rev 6784)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java 2007-03-21 00:52:41 UTC (rev 6785)
@@ -25,14 +25,13 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
import org.jboss.portal.wsrp.WSRPConsumer;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class WSRPConsumerService extends AbstractJBossService implements PortletInvokerRegistration
+public class WSRPConsumerService extends AbstractJBossService
{
/** . */
@@ -74,14 +73,14 @@
protected void startService() throws Exception
{
super.startService();
- federatingPortletInvoker.registerInvoker(this);
+ federatingPortletInvoker.registerInvoker(getId(), consumer);
consumer.start();
}
protected void stopService() throws Exception
{
consumer.stop();
- federatingPortletInvoker.unregisterInvoker(this);
+ federatingPortletInvoker.unregisterInvoker(getId());
super.stopService();
}
}
17 years, 3 months
JBoss Portal SVN: r6784 - trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-03-20 16:12:06 -0400 (Tue, 20 Mar 2007)
New Revision: 6784
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
Log:
- fix CMSAdminPortlet to not use CachedUserImpl
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-03-20 17:14:51 UTC (rev 6783)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-03-20 20:12:06 UTC (rev 6784)
@@ -1444,9 +1444,18 @@
private boolean isWorkflowManagementAccessible(JBossRenderRequest renderRequest)
{
boolean isAccessible = false;
-
+
User user = renderRequest.getUser();
- PortalCMSSecurityContext securityContext = new PortalCMSSecurityContext(user);
+ try
+ {
+ user = userModule.findUserById(user.getId());
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+
+ PortalCMSSecurityContext securityContext = new PortalCMSSecurityContext(user);
securityContext.setAttribute("manageWorkflow", "true");
securityContext.setAttribute("approvePublish", getApprovePublish());
17 years, 3 months
JBoss Portal SVN: r6783 - in docs/trunk/referenceGuide/en: modules and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-20 13:14:51 -0400 (Tue, 20 Mar 2007)
New Revision: 6783
Added:
docs/trunk/referenceGuide/en/modules/contentIntegration.xml
Modified:
docs/trunk/referenceGuide/en/master.xml
Log:
stub for content integration chapter
Modified: docs/trunk/referenceGuide/en/master.xml
===================================================================
--- docs/trunk/referenceGuide/en/master.xml 2007-03-20 17:00:52 UTC (rev 6782)
+++ docs/trunk/referenceGuide/en/master.xml 2007-03-20 17:14:51 UTC (rev 6783)
@@ -24,6 +24,7 @@
<!ENTITY wsrp SYSTEM "modules/wsrp.xml">
<!ENTITY security SYSTEM "modules/security.xml">
<!ENTITY troubleshooting SYSTEM "modules/troubleshooting.xml">
+ <!ENTITY contentIntegration SYSTEM "modules/contentIntegration.xml">
]>
<book lang="en">
<bookinfo>
@@ -59,6 +60,7 @@
<!-- portlet tutorials --> &tutorials;
<!-- deployment desc --> &xmldescriptors;
<!-- understanding urls --> &urls;
+ <!-- Content integration --> &contentIntegration;
<!-- IPC --> &ipc;
<!-- clustering configuration --> &clustering;
<!-- WSRP --> &wsrp;
Added: docs/trunk/referenceGuide/en/modules/contentIntegration.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/contentIntegration.xml (rev 0)
+++ docs/trunk/referenceGuide/en/modules/contentIntegration.xml 2007-03-20 17:14:51 UTC (rev 6783)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="contentIntegration">
+ <chapterinfo>
+ <author>
+ <firstname>Julien</firstname>
+ <surname>Viet</surname>
+ <email>julien @ jboss dot com</email>
+ </author>
+ </chapterinfo>
+ <title>Content integration</title>
+ <para>Blah.</para>
+</chapter>
17 years, 3 months
JBoss Portal SVN: r6782 - trunk/theme/src/main/org/jboss/portal/theme/page.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-20 13:00:52 -0400 (Tue, 20 Mar 2007)
New Revision: 6782
Modified:
trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
trunk/theme/src/main/org/jboss/portal/theme/page/Region.java
trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java
trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java
Log:
code style
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java 2007-03-20 16:58:27 UTC (rev 6781)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java 2007-03-20 17:00:52 UTC (rev 6782)
@@ -42,15 +42,35 @@
/** . */
protected final Map results;
+
+ /** . */
protected final Map windowContexts;
+
+ /** . */
protected String pageName;
+
+ /** . */
protected Map portalProperties;
+
+ /** . */
protected Map pageProperties;
+
+ /** . */
protected String layoutURI;
+
+ /** . */
protected String layoutState;
+
+ /** . */
protected PortalRenderSet renderSet;
+
+ /** . */
protected ThemeResult themeResult;
+
+ /** . */
protected PortalTheme theme;
+
+ /** . */
protected final Map regions;
public PageResult(String pageName, Map pageProperties, Map portalProperties)
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/Region.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/Region.java 2007-03-20 16:58:27 UTC (rev 6781)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/Region.java 2007-03-20 17:00:52 UTC (rev 6782)
@@ -38,11 +38,22 @@
public final class Region
{
+ /** . */
private final String name;
+
+ /** . */
private boolean sorted;
+
+ /** . */
private final ArrayList windows;
+
+ /** . */
private String cssId;
+
+ /** . */
private RegionOrientation orientation;
+
+ /** . */
private Map properties;
/**
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java 2007-03-20 16:58:27 UTC (rev 6781)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java 2007-03-20 17:00:52 UTC (rev 6782)
@@ -35,14 +35,25 @@
*/
public final class WindowContext implements Comparable, Serializable
{
+
/** The serialVersionUID */
private static final long serialVersionUID = -225656969004976637L;
+
+ /** . */
private final Object windowId;
+
+ /** . */
private final String windowName;
- // mutable properties
+ // Mutable properties
+
+ /** . */
private String regionName;
+
+ /** . */
private int order;
+
+ /** . */
private boolean visible;
public static WindowContext copy(WindowContext template)
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java 2007-03-20 16:58:27 UTC (rev 6781)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java 2007-03-20 17:00:52 UTC (rev 6782)
@@ -39,16 +39,34 @@
public class WindowResult
{
+ /** . */
public static final String MODES_KEY = "mode";
+
+ /** . */
public static final String WINDOWSTATES_KEY = "windowstate";
+ /** . */
private String title;
+
+ /** . */
private String content;
+
+ /** . */
private Map actions;
+
+ /** . */
private final Properties properties;
+
+ /** . */
private final String headerContent;
+
+ /** . */
private Map windowProperties;
+
+ /** . */
private final WindowState windowState;
+
+ /** . */
private final Mode mode;
/**
17 years, 3 months
JBoss Portal SVN: r6781 - in trunk/theme/src/main/org/jboss/portal/theme: tag and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-20 12:58:27 -0400 (Tue, 20 Mar 2007)
New Revision: 6781
Modified:
trunk/theme/src/main/org/jboss/portal/theme/page/RegionOrientation.java
trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java
Log:
simplified type safe enum class
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/RegionOrientation.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/RegionOrientation.java 2007-03-20 16:39:07 UTC (rev 6780)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/RegionOrientation.java 2007-03-20 16:58:27 UTC (rev 6781)
@@ -31,29 +31,31 @@
*/
public final class RegionOrientation
{
+
/** Place portlets in one region in vertical order. */
public static final RegionOrientation VERTICAL = new RegionOrientation("vertical");
/** Place portlets in one region in horizontal order. */
public static final RegionOrientation HORIZONTAL = new RegionOrientation("horizontal");
+ /** The default value which is vertical. */
public static final RegionOrientation DEFAULT = VERTICAL;
- private final String m_orient;
+ /** The literal value. */
+ private final String value;
- private RegionOrientation()
+ private RegionOrientation(String value)
{
- this("vertical");
+ if (value == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.value = value;
}
- private RegionOrientation(String orient)
- {
- m_orient = orient;
- }
-
public String toString()
{
- return m_orient;
+ return value;
}
public boolean equals(Object o)
@@ -62,34 +64,27 @@
{
return true;
}
- if (!(o instanceof RegionOrientation))
+ if (o instanceof RegionOrientation)
{
- return false;
+ RegionOrientation that = (RegionOrientation)o;
+ return this.value.equals(that.value);
}
-
- final RegionOrientation orientation = (RegionOrientation)o;
-
- if (m_orient != null ? !m_orient.equals(orientation.m_orient) : orientation.m_orient != null)
- {
- return false;
- }
-
- return true;
+ return false;
}
public int hashCode()
{
- return (m_orient != null ? m_orient.hashCode() : 0);
+ return value.hashCode();
}
/**
- * parse a string representation of a region orientation into a defined type.
+ * Parse a string representation of a region orientation into a defined type.
*
* @param orientation the string representation of the orientation
* @return the defined type for the string
* @throws IllegalArgumentException if the provided orientation String is invalid
*/
- public static RegionOrientation parseOrientation(String orientation)
+ public static RegionOrientation parse(String orientation)
{
if (orientation != null)
{
@@ -103,6 +98,7 @@
}
}
- throw new IllegalArgumentException("invalid orientation: " + orientation);
+ //
+ throw new IllegalArgumentException("Invalid orientation: " + orientation);
}
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java 2007-03-20 16:39:07 UTC (rev 6780)
+++ trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java 2007-03-20 16:58:27 UTC (rev 6781)
@@ -143,7 +143,7 @@
try
{
- this.orientation = RegionOrientation.parseOrientation(orientation);
+ this.orientation = RegionOrientation.parse(orientation);
}
catch (IllegalArgumentException e)
{
17 years, 3 months
JBoss Portal SVN: r6780 - in trunk: core/src/main/org/jboss/portal/core/model/instance/command and 11 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-20 12:39:07 -0400 (Tue, 20 Mar 2007)
New Revision: 6780
Removed:
trunk/core/src/main/org/jboss/portal/test/core/theme/strategy/
trunk/core/src/resources/portal-core-war/WEB-INF/layout/portal-strategies.xml
trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java
trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutStategyMetaDataFactory.java
trunk/theme/src/main/org/jboss/portal/theme/impl/strategy/
trunk/theme/src/main/org/jboss/portal/theme/metadata/LayoutStrategyMetaData.java
trunk/theme/src/main/org/jboss/portal/theme/strategy/
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/ThemePropertyAction.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
trunk/theme/build.xml
trunk/theme/src/main/org/jboss/portal/theme/LayoutConstants.java
trunk/theme/src/main/org/jboss/portal/theme/LayoutService.java
trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java
trunk/theme/src/main/org/jboss/portal/theme/ServerRegistrationID.java
trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java
trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutFeaturesDeployment.java
trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java
trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java
trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java
Log:
- removed strategy code that was not used anymore
- fix prb when seing dashboard due to the new response handler stuff
Modified: 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-03-20 16:01:43 UTC (rev 6779)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -110,7 +110,7 @@
}
else
{
- executeCommand(ctx, forward.getCommand());
+ handleCommand(ctx, forward.getCommand());
}
}
else
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -99,7 +99,6 @@
Map portalProperties = new HashMap();
portalProperties.put("theme.renderSetId", "divRenderer");
portalProperties.put("theme.id", "renaissance");
- portalProperties.put("layout.strategyId", "maximizedRegion");
PageResult result = new PageResult("BILTO", pageProperties, portalProperties);
//
Deleted: trunk/core/src/resources/portal-core-war/WEB-INF/layout/portal-strategies.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/layout/portal-strategies.xml 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/layout/portal-strategies.xml 2007-03-20 16:39:07 UTC (rev 6780)
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<portal-strategies>
- <set name="maximizedRegion">
- <strategy content-type="text/html">
- <implementation>org.jboss.portal.theme.impl.strategy.MaximizingStrategyImpl</implementation>
- </strategy>
- </set>
-</portal-strategies>
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -152,7 +152,6 @@
portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT, "generic");
portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME, "Nphalanx");
portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_RENDERSET, "divRenderer");
- portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_STRATEGY, "maximizedRegion");
//
portal.getSupportedWindowStates().add(WindowState.MAXIMIZED);
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/ThemePropertyAction.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/ThemePropertyAction.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/ThemePropertyAction.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -145,7 +145,6 @@
portalObject.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT, this.layoutName);
portalObject.setDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME, this.themeName);
portalObject.setDeclaredProperty(ThemeConstants.PORTAL_PROP_RENDERSET, this.renderSetName);
- portalObject.setDeclaredProperty(ThemeConstants.PORTAL_PROP_STRATEGY, this.windowRendererName);
break;
case PortalObject.TYPE_WINDOW:
portalObject.setDeclaredProperty(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, this.windowRendererName);
Modified: trunk/theme/build.xml
===================================================================
--- trunk/theme/build.xml 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/build.xml 2007-03-20 16:39:07 UTC (rev 6780)
@@ -265,7 +265,6 @@
<test todir="${test.reports}" name="org.jboss.portal.test.theme.TestThemeServiceImpl"/>
<!-- theme metadata tests -->
- <test todir="${test.reports}" name="org.jboss.portal.test.theme.metadata.TestLayoutStrategySetMetaData"/>
<test todir="${test.reports}" name="org.jboss.portal.test.theme.metadata.TestPortalLayoutMetaData"/>
<test todir="${test.reports}" name="org.jboss.portal.test.theme.metadata.TestPortalThemeMetaData"/>
<test todir="${test.reports}" name="org.jboss.portal.test.theme.metadata.TestRenderSetMetaData"/>
Deleted: trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -1,168 +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.test.theme.metadata;
-
-import junit.framework.TestCase;
-import org.jboss.portal.common.util.MediaType;
-import org.jboss.portal.theme.deployment.jboss.LayoutStategyMetaDataFactory;
-import org.jboss.portal.theme.metadata.LayoutStrategyMetaData;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.List;
-
-/**
- * Test Layout Strategy (Set) MetaData
- *
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public class TestLayoutStrategySetMetaData extends TestCase
-{
- public void testBuildLayoutStrategyMetaData() throws IOException, ParserConfigurationException, SAXException
- {
- try
- {
- StringBuffer testString = new StringBuffer();
- testString.append("<portal-strategies>");
-
- // first set
- testString.append("<set name=\"StrategyOne\">");
- // for html
- testString.append("<strategy content-type=\"text/html\">");
- testString.append("<implementation>StrategyOneHTML</implementation>");
- testString.append("</strategy>");
- testString.append("</set>");
-
- // first set
- testString.append("<set name=\"StrategyTwo\">");
- // for html
- testString.append("<strategy content-type=\"text/html\">");
- testString.append("<implementation>StrategyTwoHTML</implementation>");
- testString.append("</strategy>");
- // for xml
- testString.append("<strategy content-type=\"application/xhtml+xml\">");
- testString.append("<implementation>StrategyTwoXML</implementation>");
- testString.append("</strategy>");
- testString.append("</set>");
-
- testString.append("</portal-strategies>");
-
- List strategies = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new LayoutStategyMetaDataFactory(), null);
- assertNotNull(strategies);
- assertTrue(strategies.size() == 3);
-
- LayoutStrategyMetaData strategyMD = (LayoutStrategyMetaData)strategies.get(0);
- assertEquals("StrategyOne", strategyMD.getName());
- assertEquals(MediaType.HTML, strategyMD.getMimeType());
- assertEquals("StrategyOneHTML", strategyMD.getClassName());
-
- strategyMD = (LayoutStrategyMetaData)strategies.get(1);
- assertEquals(MediaType.HTML, strategyMD.getMimeType());
- strategyMD = (LayoutStrategyMetaData)strategies.get(2);
- assertEquals(MediaType.XHTML, strategyMD.getMimeType());
- }
- catch (Exception e)
- {
- assertFalse("Unexpected Layout Exception: " + e.getMessage(), true);
- }
- }
-
- public void testLayoutStrategyMetaDataNoName() throws JBossXBException
- {
- StringBuffer testString = new StringBuffer();
- testString.append("<portal-strategies>");
-
- // no name
- testString.append("<set>");
- // for html
- testString.append("<strategy content-type=\"text/html\">");
- testString.append("<implementation>StrategyTwoHTML</implementation>");
- testString.append("</strategy>");
- // for xml
- testString.append("<strategy content-type=\"application/xhtml+xml\">");
- testString.append("<implementation>StrategyTwoXML</implementation>");
- testString.append("</strategy>");
- testString.append("</set>");
-
- testString.append("</portal-strategies>");
-
- List strategies = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new LayoutStategyMetaDataFactory(), null);
- LayoutStrategyMetaData strategyMD = (LayoutStrategyMetaData)strategies.get(0);
- assertNull(strategyMD.getName());
- }
-
- public void testLayoutStrategyMetaDataNoMime() throws JBossXBException
- {
- StringBuffer testString = new StringBuffer();
- testString.append("<portal-strategies>");
-
- // no content type
- testString.append("<set name=\"StrategyOne\">");
- testString.append("<strategy>");
- testString.append("<implementation>StrategyTwoHTML</implementation>");
- testString.append("</strategy>");
- testString.append("</set>");
-
- testString.append("</portal-strategies>");
-
- try
- {
- List strategies = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new LayoutStategyMetaDataFactory(), null);
- LayoutStrategyMetaData strategyMD = (LayoutStrategyMetaData)strategies.get(0);
- assertFalse("expected exception did not occur", true);
- }
- catch (JBossXBException e)
- {
- // expected
- }
- }
-
-
- public void testLayoutStrategyMetaDataEmpty() throws JBossXBException
- {
- StringBuffer testString = new StringBuffer();
- testString.append("<portal-strategies>");
-
- // no strategy definition
- testString.append("<set>");
- testString.append("</set>");
-
- testString.append("</portal-strategies>");
-
- List strategies = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new LayoutStategyMetaDataFactory(), null);
- try
- {
- LayoutStrategyMetaData strategyMD = (LayoutStrategyMetaData)strategies.get(0);
- assertFalse("expected exception did not occur", true);
- }
- catch (IndexOutOfBoundsException ioe)
- {
- // expected
- }
- }
-}
Modified: trunk/theme/src/main/org/jboss/portal/theme/LayoutConstants.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/LayoutConstants.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/LayoutConstants.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -44,7 +44,6 @@
public static final String PARAM_LAYOUT_URI = "layoutURI";
public static final String PARAM_LAYOUT_STATE = "layoutState";
public static final String ATTR_RENDERSET = "_renderSet";
- public static final String ATTR_STRATEGY = "_strategy";
public static final String ATTR_PORTLET_WINDOW_NAME = "windowName";
public static final String ATTR_LAYOUTSERVER = "LAYOUTSERVER";
public static final String ATTR_INFO = "_info";
Modified: trunk/theme/src/main/org/jboss/portal/theme/LayoutService.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/LayoutService.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/LayoutService.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.theme;
-import org.jboss.portal.theme.metadata.LayoutStrategyMetaData;
import org.jboss.portal.theme.metadata.PortalLayoutMetaData;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
@@ -56,17 +55,6 @@
*/
void removeLayouts(String appID) throws LayoutException;
- /** Register a a portal layout strategy with this service */
- void addStrategy(RuntimeContext runtimeContext, LayoutStrategyMetaData strategyMD) throws LayoutException;
-
- /**
- * Remove all strategies that are hosted in the provided application.
- *
- * @param appID the name of the application that hosts the strategie(s) to be removed
- * @throws LayoutException
- */
- void removeStrategies(String appID) throws LayoutException;
-
/** Register a renderSet with this service */
void addRenderSet(RuntimeContext runtimeContext, RenderSetMetaData renderSet) throws LayoutException;
Modified: trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -26,7 +26,6 @@
import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.theme.render.PortalRenderSet;
-import org.jboss.portal.theme.strategy.LayoutStrategy;
import org.jboss.portal.theme.page.PageResult;
import java.util.Collection;
@@ -60,26 +59,6 @@
PortalLayout getLayout(String name, boolean defaultOnNull);
/**
- * Get the layout strategy that matches the provided name and media type
- *
- * @param strategyName the name of the strategy to get
- * @param mediaType the media type (content-type) to get the strategy for
- * @return the layout strategy that matches the provided name and mediatype, or null if no such strategy is
- * registered
- */
- LayoutStrategy getStrategy(String strategyName, MediaType mediaType);
-
- /**
- * Retrieves the strategy for this Layout.
- *
- * @param id the registration id of the strategy to retrieve.
- * @param mediaType the media type that must be supported by the strategy to be retrieved
- * @return the registered strategy identified by the specified id and media type, <code>null</code> otherwise.
- * @since 2.4
- */
- LayoutStrategy getStrategy(ServerRegistrationID id, MediaType mediaType);
-
- /**
* Get the render set for the provided layout.
*
* @param renderSetName the name of the renderSet to find
@@ -106,13 +85,6 @@
Collection getLayouts();
/**
- * Get a Set of all available portal layout strategies
- *
- * @return the set of the ServerRegistrationID for registred layout strategies
- */
- Collection getStrategies();
-
- /**
* Retrieves the set of the ServerRegistrationID for registred render set
*
* @return the set of the ServerRegistrationID for registred render set
Modified: trunk/theme/src/main/org/jboss/portal/theme/ServerRegistrationID.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/ServerRegistrationID.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/ServerRegistrationID.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -77,9 +77,6 @@
/** Type for a registered Portal Layout. */
public static final Type TYPE_LAYOUT = new Type("layout");
- /** Type for a registered Portal Layout Strategy. */
- public static final Type TYPE_STRATEGY = new Type("strategy");
-
/** Type for a registered Portal RenderSet. */
public static final Type TYPE_RENDERSET = new Type("renderSet");
Modified: trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -49,9 +49,6 @@
public static final String PORTAL_PROP_LAYOUT = "layout.id";
- /** Key name to access the selected layout strategy for the portal or page (via the portal or page properties) */
- public static final String PORTAL_PROP_STRATEGY = "layout.strategyId";
-
/** Key name to access the selected theme for the portal or page (via the portal or page properties) */
public static final String PORTAL_PROP_THEME = "theme.id";
Modified: trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutFeaturesDeployment.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutFeaturesDeployment.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutFeaturesDeployment.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -30,7 +30,6 @@
import org.jboss.portal.theme.LayoutException;
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.RuntimeContext;
-import org.jboss.portal.theme.metadata.LayoutStrategyMetaData;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -40,10 +39,9 @@
import java.util.List;
/**
- * Deploy layout strategies and rendersets contained in a WebApplication. <p>A Web Application can define layout
- * strategies and render sets in their respective descriptors. Portal RenderSets are defined in a descriptor called
- * portal-renderSet.xml in the WEB-INF/layout folder. Layout strategies are defined in a descriptor called
- * portal-strategies.xml in the same folder. Additionally, rendersets and layout strategies can be defined as part of a
+ * Deploy rendersets contained in a WebApplication. <p>A Web Application can define
+ * render sets in their respective descriptors. Portal RenderSets are defined in a descriptor called
+ * portal-renderSet.xml in the WEB-INF/layout folder. Additionally, rendersets can be defined as part of a
* layout descriptor (portal-layouts.xml). Those cases are handled by the layout deployment.</p>
*
* @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
@@ -82,17 +80,16 @@
{
if (trace)
{
- log.trace("create new renderset(s) and strategie(s) found in : " + pwa.getId());
+ log.trace("create new renderset(s) found in : " + pwa.getId());
}
try
{
boolean isRenderSet = url.toString().endsWith("-renderSet.xml");
- boolean isStrategy = url.toString().endsWith("-strategies.xml");
// see if there are any named rendersets
- if (isRenderSet || isStrategy)
+ if (isRenderSet)
{
RuntimeContext ctx = new RuntimeContext(pwa.getId(), pwa.getServletContext(), pwa.getContextPath(), pwa.getClassLoader());
LayoutService layoutService = factory.getLayoutService();
@@ -109,15 +106,6 @@
layoutService.addRenderSet(ctx, renderSet);
}
}
- else
- {
- List strategies = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(stream, new LayoutStategyMetaDataFactory(), null);
- for (int i = 0; i < strategies.size(); i++)
- {
- LayoutStrategyMetaData strategy = (LayoutStrategyMetaData)strategies.get(i);
- layoutService.addStrategy(ctx, strategy);
- }
- }
}
finally
{
@@ -134,7 +122,7 @@
if (trace)
{
- log.trace("done creating new renderset(s) and strategie(s) found in : " + pwa.getId());
+ log.trace("done creating new renderset(s) found in : " + pwa.getId());
}
}
catch (Exception e)
@@ -153,13 +141,12 @@
{
if (trace)
{
- log.trace("destroying renderset(s) and layout strategies, found in : " + pwa.getId());
+ log.trace("destroying renderset(s) found in : " + pwa.getId());
}
try
{
LayoutService service = factory.getLayoutService();
service.removeRenderSets(pwa.getId());
- service.removeStrategies(pwa.getId());
}
catch (LayoutException e)
{
@@ -167,7 +154,7 @@
}
if (trace)
{
- log.trace("done destroying renderset(s) and layout strategies, found in : " + pwa.getId());
+ log.trace("done destroying renderset(s) found in : " + pwa.getId());
}
}
}
Deleted: trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutStategyMetaDataFactory.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutStategyMetaDataFactory.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutStategyMetaDataFactory.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -1,84 +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.theme.deployment.jboss;
-
-import org.jboss.portal.common.util.MediaType;
-import org.jboss.portal.theme.metadata.LayoutStrategyMetaData;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-import javax.activation.MimeTypeParseException;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class LayoutStategyMetaDataFactory implements ObjectModelFactory
-{
-
- private String name;
-
- public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
- {
- return new ArrayList();
- }
-
- public Object completeRoot(Object root, UnmarshallingContext nav, String nsURI, String localName)
- {
- return root;
- }
-
- public Object newChild(ArrayList list, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs) throws MimeTypeParseException
- {
- if ("set".equals(localName))
- {
- name = attrs.getValue("name");
- }
- else if ("strategy".equals(localName))
- {
- LayoutStrategyMetaData strategy = new LayoutStrategyMetaData();
- String contentType = attrs.getValue("content-type");
- strategy.setName(name);
- strategy.setMimeType(MediaType.parseMimeType(contentType));
- return strategy;
- }
- return null;
- }
-
- public void addChild(ArrayList list, LayoutStrategyMetaData strategy, UnmarshallingContext nav, String nsURI, String localName)
- {
- list.add(strategy);
- }
-
- public void setValue(LayoutStrategyMetaData strategy, UnmarshallingContext nav, String nsURI, String localName, String value)
- {
- if ("implementation".equals(localName))
- {
- strategy.setClassName(value);
- }
- }
-
-
-}
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -34,12 +34,10 @@
import org.jboss.portal.theme.ServerRegistrationID;
import org.jboss.portal.theme.ThemeConstants;
import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.metadata.LayoutStrategyMetaData;
import org.jboss.portal.theme.metadata.PortalLayoutMetaData;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
import org.jboss.portal.theme.metadata.RendererSetMetaData;
import org.jboss.portal.theme.render.PortalRenderSet;
-import org.jboss.portal.theme.strategy.LayoutStrategy;
import org.jboss.system.Service;
import java.util.ArrayList;
@@ -52,16 +50,15 @@
/**
* Implementaion of the layout server. <p>The layout server is a registry of all available layouts. The server also
- * allows access to all available render sets and layout strategies. Render sets and layout strategies can be
+ * allows access to all available render sets. Render sets can be
* independent (named), or children of a layout. Accordingly, the layout server provides accessor methods to get
- * strategies and render set by name, or by layout. Render sets and layout strategies can, and must, be defined for a
+ * render set by name, or by layout. Render sets can, and must, be defined for a
* specific media type (mime type).</p>
*
* @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>.
* @version <tt>$Revision$</tt>
* @see org.jboss.portal.theme.PortalLayout
* @see org.jboss.portal.theme.render.PortalRenderSet
- * @see org.jboss.portal.theme.strategy.LayoutStrategy
* @see MediaType
*/
public class LayoutServiceImpl extends AbstractJBossService implements LayoutService, Service
@@ -73,12 +70,6 @@
private Map layoutNames;
// map of appID + "." + layout name to layout id
private Map exactLayoutNames;
- // map of strategy registration id to map of strategies (keyed by content type)
- private Map strategies;
- // map of strategy name to layout strategy
- private Map strategyNames;
- // map of appID + "." + strategy name to layout strategy
- private Map exactStrategyNames;
// map of renderSet registration id to list of rendersets
private Map renderSets;
// map of render set name to render set
@@ -102,9 +93,6 @@
layouts = Collections.synchronizedMap(new HashMap());
layoutNames = Collections.synchronizedMap(new HashMap());
exactLayoutNames = Collections.synchronizedMap(new HashMap());
- strategies = Collections.synchronizedMap(new HashMap());
- strategyNames = Collections.synchronizedMap(new HashMap());
- exactStrategyNames = Collections.synchronizedMap(new HashMap());
renderSets = Collections.synchronizedMap(new HashMap());
renderSetNames = Collections.synchronizedMap(new HashMap());
exactRenderSetNames = Collections.synchronizedMap(new HashMap());
@@ -117,8 +105,6 @@
layouts.clear();
layoutNames.clear();
exactLayoutNames.clear();
- strategyNames.clear();
- exactStrategyNames.clear();
renderSetNames.clear();
exactRenderSetNames.clear();
}
@@ -329,84 +315,6 @@
}
}
- public void addStrategy(RuntimeContext runtimeContext, LayoutStrategyMetaData strategyMD) throws LayoutException
- {
- try
- {
- ClassLoader loader = runtimeContext.getClassLoader();
- LayoutStrategy strategy = (LayoutStrategy)loader.loadClass(strategyMD.getClassName()).newInstance();
- strategy.init(runtimeContext, strategyMD);
-
- log.debug("adding strategy for: " + strategy.getRegistrationId());
- Map strategySet = (Map)strategies.get(strategy.getRegistrationId());
- if (strategySet == null)
- {
- strategySet = new HashMap();
- strategies.put(strategy.getRegistrationId(), strategySet);
- }
- strategySet.put(strategy.getMediaType(), strategy);
-
- exactStrategyNames.put(strategy.getAppId() + "." + strategy.getName(), strategy.getRegistrationId());
- strategyNames.put(strategy.getName(), strategy.getRegistrationId());
- }
- catch (Exception e)
- {
- throw new LayoutException(e);
- }
- }
-
- /** @see LayoutService#getStrategy(String,org.jboss.portal.common.util.MediaType) */
- public LayoutStrategy getStrategy(String strategyName, MediaType mediaType)
- {
- ServerRegistrationID id;
-
- id = (ServerRegistrationID)exactStrategyNames.get(strategyName);
- if (id == null)
- {
- id = (ServerRegistrationID)strategyNames.get(strategyName);
- }
-
- return getStrategy(id, mediaType);
- }
-
- public LayoutStrategy getStrategy(ServerRegistrationID id, MediaType mediaType)
- {
- if (id != null)
- {
- Map strategySet = (Map)strategies.get(id);
- return (LayoutStrategy)strategySet.get(mediaType);
- }
- return null;
- }
-
- /** @see LayoutService#removeStrategies(String) */
- public void removeStrategies(String appId) throws LayoutException
- {
- log.debug("removing named strategies for : " + appId);
- List strategiesToDelete = new ArrayList();
- for (Iterator i = strategies.keySet().iterator(); i.hasNext();)
- {
- ServerRegistrationID strategyId = (ServerRegistrationID)i.next();
- if (appId.equals(strategyId.getName(0)))
- {
- strategiesToDelete.add(strategyId);
- }
- }
-
- for (Iterator i = strategiesToDelete.iterator(); i.hasNext();)
- {
- ServerRegistrationID strategyId = (ServerRegistrationID)i.next();
- strategies.remove(strategyId);
- String key = strategyId.getName(0) + "." + strategyId.getName(1);
- log.debug("removing strategy: " + key);
- exactStrategyNames.remove(key);
- if (strategyId.equals(strategyNames.get(strategyId.getName(1))))
- {
- strategyNames.remove(strategyId.getName(1));
- }
- }
- }
-
public void addRenderSet(RuntimeContext runtimeContext, RenderSetMetaData renderSetMD) throws LayoutException
{
try
@@ -493,12 +401,6 @@
return Collections.unmodifiableCollection(layouts.values());
}
- /** @see org.jboss.portal.theme.LayoutService#getStrategies() */
- public Collection getStrategies()
- {
- return Collections.unmodifiableCollection((strategyNames.values()));
- }
-
/** @see org.jboss.portal.theme.LayoutService#getRenderSets() */
public Collection getRenderSets()
{
Deleted: trunk/theme/src/main/org/jboss/portal/theme/metadata/LayoutStrategyMetaData.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/metadata/LayoutStrategyMetaData.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/metadata/LayoutStrategyMetaData.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -1,68 +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.theme.metadata;
-
-import org.jboss.portal.common.util.MediaType;
-
-/**
- * Meta data describing a single layout strategy as provided in the portal-layouts.xml descriptor.
- *
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public final class LayoutStrategyMetaData
-{
- private String className;
- private MediaType mimeType;
- private String name;
-
- public String getClassName()
- {
- return className;
- }
-
- public void setClassName(String className)
- {
- this.className = className;
- }
-
- public MediaType getMimeType()
- {
- return mimeType;
- }
-
- public void setMimeType(MediaType mimeType)
- {
- this.mimeType = mimeType;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-}
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -25,7 +25,7 @@
import java.io.Serializable;
/**
- * A WindowContext represents a portlet window on a page in the scope of one request. <p>It allows the layout strategy
+ * A WindowContext represents a portlet window on a page in the scope of one request. <p>It allows the layout gy
* for instance, to change the position of the window on the page (region, order) without persising the change. The
* change will only be valid for the term of the current request.</p> <p>This context implements the
* <code>Comparable</code> interface to allow natural sorting of the windows in one region, based on their order.</p>
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java 2007-03-20 16:01:43 UTC (rev 6779)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java 2007-03-20 16:39:07 UTC (rev 6780)
@@ -79,7 +79,7 @@
}
this.name = renderSetName;
this.appID = runtimeContext.getAppId();
- this.registrationId = ServerRegistrationID.createID(ServerRegistrationID.TYPE_STRATEGY, new String[]{appID, name});
+ this.registrationId = ServerRegistrationID.createID(ServerRegistrationID.TYPE_RENDERSET, new String[]{appID, name});
this.contentType = rendererSetMD.getContentType();
this.ajaxEnabled = rendererSetMD.isAjaxEnabled();
17 years, 3 months
JBoss Portal SVN: r6779 - trunk/core/src/main/org/jboss/portal/core/portlet/user.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-20 12:01:43 -0400 (Tue, 20 Mar 2007)
New Revision: 6779
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
Log:
Fix User Portlet, was always displaying "You are not connected"
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-20 16:00:04 UTC (rev 6778)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-20 16:01:43 UTC (rev 6779)
@@ -193,8 +193,8 @@
String op;
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
-
- if ((req.getUser() != null) && (!(isEnabled(req.getUser()))))
+/*
+ if (req.getRemoteUser() == null)
{
req.getPortletSession().invalidate();
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/user/login.jsp");
@@ -211,7 +211,7 @@
rd.include(req, resp);
return;
}
-
+*/
if (req.getRemoteUser() != null)
{
if (req.getWindowState() != WindowState.MAXIMIZED)
@@ -1277,21 +1277,6 @@
return null;
}
- private boolean isEnabled(User user)
- {
- Object enabled = getProperty(user, User.INFO_USER_ENABLED);
-
- if (enabled == null || !(enabled instanceof Boolean))
- {
- return false;
- }
-
- return enabled.equals("true");
-
- }
-
-
-
/*
* private String getTimezoneOffsetString(short timezoneOffset) {
* StringBuffer timeZone = new StringBuffer(); for (int i = 0; i <
17 years, 3 months
JBoss Portal SVN: r6778 - trunk/core/src/main/org/jboss/portal/core/controller/classic.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-20 12:00:04 -0400 (Tue, 20 Mar 2007)
New Revision: 6778
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
Log:
defer page assembly to the ClassicController.sendResponse(...) by providing a custom subclass of HTTPResponse which activate the PageRendition from the theme.
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-03-20 15:57:29 UTC (rev 6777)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-03-20 16:00:04 UTC (rev 6778)
@@ -54,6 +54,8 @@
if (response instanceof PageRendition)
{
final PageRendition rendition = (PageRendition)response;
+
+ // 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
17 years, 3 months
JBoss Portal SVN: r6777 - in trunk/core/src/main/org/jboss/portal/core: controller/classic and 1 other directory.
by portal-commits@lists.jboss.org
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/ClassicController.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.java
Log:
defer page assembly to the ClassicController.sendResponse(...) by providing a custom subclass of HTTPResponse which activate the PageRendition from the theme.
Deleted: trunk/core/src/main/org/jboss/portal/core/WindowManipulator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/WindowManipulator.java 2007-03-20 15:23:56 UTC (rev 6776)
+++ trunk/core/src/main/org/jboss/portal/core/WindowManipulator.java 2007-03-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 <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class WindowManipulator
-{
-
- private Map regionMap;
-
- private AttributeResolver navStateResolver;
-
- public WindowManipulator(AttributeResolver navStateResolver, Collection windows)
- {
- this.navStateResolver = navStateResolver;
-
- // Build appropriate structure
- regionMap = new HashMap();
- for (Iterator i = windows.iterator();i.hasNext();)
- {
- try
- {
- Window window = (Window)i.next();
- String region = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
- Integer order = new Integer(window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER));
-
- //
- SortedMap windowMap = (SortedMap)regionMap.get(region);
- if (windowMap == null)
- {
- windowMap = new TreeMap();
- regionMap.put(region, windowMap);
- }
- windowMap.put(order, window);
- }
- catch (NumberFormatException ignore)
- {
- }
- }
- }
-
- public String getRegionName(Window window)
- {
- for (Iterator i = regionMap.entrySet().iterator();i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- SortedMap windows = (SortedMap)entry.getValue();
- for (Iterator j = windows.values().iterator();j.hasNext();)
- {
- Window window2 = (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 = (WindowNavigationalState)navStateResolver.getAttribute(window.getId() + "_window");
- if (wns == null)
- {
- wns = 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/ClassicController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2007-03-20 15:23:56 UTC (rev 6776)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.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, ControllerCommand cmd) throws ServerException
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-03-20 15:23:56 UTC (rev 6776)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.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, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
{
- ServerInvocation invocation = ctx.getServerInvocation();
-
+ final ServerInvocation invocation = ctx.getServerInvocation();
if (response instanceof PageRendition)
{
- PageRendition rendition = (PageRendition)response;
- rendition.render(invocation);
- return null;
+ final PageRendition rendition = (PageRendition)response;
+ return new HTTPResponse()
+ {
+ public void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException
+ {
+ rendition.render(invocation);
+ }
+ };
}
else if (response instanceof SignOutResponse)
{
Modified: 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-03-20 15:23:56 UTC (rev 6776)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.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 IOException;
+ public abstract void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException;
public static class SetStatusCode extends HTTPResponse
{
17 years, 3 months
JBoss Portal SVN: r6776 - in trunk/core/src/main/org/jboss/portal/core: controller/portlet and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-20 11:23:56 -0400 (Tue, 20 Mar 2007)
New Revision: 6776
Added:
trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/HandlerResponse.java
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/classic/AbstractResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/CommandForward.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ResponseHandler.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
Log:
improves the response handling mechanism in the core controller
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-03-20 15:10:11 UTC (rev 6775)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/AbstractResponseHandler.java 2007-03-20 15:23:56 UTC (rev 6776)
@@ -22,43 +22,12 @@
******************************************************************************/
package org.jboss.portal.core.controller.classic;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerException;
import org.jboss.portal.jems.as.system.AbstractJBossService;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public abstract class AbstractResponseHandler extends AbstractJBossService implements ResponseHandler
{
-
- public static void sendStatusCode(ServerInvocation invocation, int sc) throws ServerException
- {
- try
- {
- HttpServletResponse resp = invocation.getServerContext().getClientResponse();
- resp.sendError(sc);
- }
- catch (IOException e)
- {
- throw new ServerException(e);
- }
- }
-
- public static void sendRedirect(ServerInvocation invocation, String redirect) throws ServerException
- {
- try
- {
- HttpServletResponse resp = invocation.getServerContext().getClientResponse();
- resp.sendRedirect(redirect);
- }
- catch (IOException e)
- {
- throw new ServerException(e);
- }
- }
}
Modified: 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-03-20 15:10:11 UTC (rev 6775)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2007-03-20 15:23:56 UTC (rev 6776)
@@ -52,6 +52,7 @@
public class ClassicController extends Controller
{
+ // Unhardcode this
private ResponseHandler[] handlers = new ResponseHandler[]
{
new ClassicResponseHandler(),
@@ -60,11 +61,9 @@
new PortletInstanceResponseHandler()
};
+
public void handle(ServerInvocation invocation) throws ServerException
{
- URLContext urlContext = invocation.getServerContext().getURLContext();
- ControllerContext ctx = new ControllerContext(invocation, this);
-
// Invoke the chain that creates the initial command
ControllerCommand cmd = commandFactory.doMapping(invocation, invocation.getServerContext().getPortalHost(), invocation.getServerContext().getPortalContextPath(), invocation.getServerContext().getPortalRequestPath());
@@ -72,78 +71,123 @@
if (cmd == null)
{
// Handle that case
- throw new ServerException("No valid command");
+ throw new ServerException("No command was produced by the command factory");
}
- try
+ // Create controller context
+ ControllerContext ctx = new ControllerContext(invocation, this);
+
+ // Handle the command created
+ handleCommand(ctx, cmd);
+ }
+
+ /**
+ * 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 ServerException
+ */
+ protected void handleCommand(final ControllerContext ctx, final ControllerCommand cmd) throws ServerException
+ {
+ HandlerResponse handlerResp = executeCommand(ctx, cmd);
+
+ //
+ if (handlerResp == null)
{
- while (true)
+ 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))
{
- CommandForward forward;
+ String url = ctx.renderURL(forward.getCommand(), forward.getURLContext(), null);
+ sendResponse(ctx, new HTTPResponse.SendRedirect(url));
+ }
+ else
+ {
+ executeCommand(ctx, forward.getCommand());
+ }
+ }
+ else
+ {
+ HTTPResponse hr = (HTTPResponse)handlerResp;
+ sendResponse(ctx, hr);
+ }
+ }
- //
- try
- {
- // Execute command
- Object response = ctx.execute(cmd);
+ /**
+ * 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);
+ }
+ }
- // Handle the result
- forward = handleResponse(ctx, cmd, response);
- }
- catch (CommandRedirectionException e)
- {
- // Handle the redirection as forward
- forward = new CommandForward(e.getRedirection(), null);
- }
+ protected HandlerResponse executeCommand(ControllerContext ctx, ControllerCommand cmd) throws ServerException
+ {
+ URLContext urlContext = ctx.getServerInvocation().getServerContext().getURLContext();
- //
- if (forward == null)
- {
- break;
- }
+ try
+ {
+ // Execute command
+ Object commandResponse = ctx.execute(cmd);
- // Find out if we can execute in the same server invocation
- if (requiresRedirect(cmd, urlContext, forward))
+ // Handle the result
+ for (int i = 0;i < handlers.length;i++)
+ {
+ ResponseHandler handler = handlers[i];
+ HandlerResponse handlerResponse = handler.handleResponse(ctx, cmd, commandResponse);
+ if (handlerResponse != null)
{
- String url = ctx.renderURL(forward.getCommand(), forward.getURLContext(), null);
- if (url == null)
- {
- throw new ControllerException();
- }
- AbstractResponseHandler.sendRedirect(invocation, url);
- break;
+ return handlerResponse;
}
- else
- {
- cmd = forward.getCommand();
- }
}
+
+ // We were not able to determine a suitable response
+ return null;
}
+ catch (CommandRedirectionException e)
+ {
+ // Handle the redirection as forward
+ return new CommandForward(e.getRedirection(), null);
+ }
catch (InsufficientTransportGuaranteeException e)
{
urlContext = URLContext.newInstance(true, urlContext.isAuthenticated());
- ServerURL serverURL = getURLFactory().doMapping(invocation, cmd);
- String url = invocation.getResponse().renderURL(serverURL, urlContext, null);
- AbstractResponseHandler.sendRedirect(invocation, url);
+ ServerURL serverURL = getURLFactory().doMapping(ctx.getServerInvocation(), cmd);
+ String url = ctx.getServerInvocation().getResponse().renderURL(serverURL, urlContext, null);
+ return new HTTPResponse.SendRedirect(url);
}
catch (ControllerSecurityException e)
{
if (urlContext.isAuthenticated())
{
- AbstractResponseHandler.sendStatusCode(invocation, HttpServletResponse.SC_UNAUTHORIZED);
+ return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_UNAUTHORIZED);
}
else
{
urlContext = URLContext.newInstance(urlContext.isSecure(), true);
- ServerURL serverURL = getURLFactory().doMapping(invocation, cmd);
- String url = invocation.getResponse().renderURL(serverURL, urlContext, null);
- AbstractResponseHandler.sendRedirect(invocation, url);
+ 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);
- AbstractResponseHandler.sendStatusCode(invocation, HttpServletResponse.SC_NOT_FOUND);
+ return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_NOT_FOUND);
}
catch (ControllerException e)
{
@@ -159,20 +203,6 @@
}
}
- private CommandForward handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
- {
- for (int i = 0;i < handlers.length;i++)
- {
- ResponseHandler handler = handlers[i];
- CommandForward forward = handler.handleResponse(ctx, cmd, response);
- if (forward != null)
- {
- return forward;
- }
- }
- return null;
- }
-
/**
* Return true if the execution of the next command requires a redirect.
*
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-03-20 15:10:11 UTC (rev 6775)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-03-20 15:23:56 UTC (rev 6776)
@@ -36,10 +36,7 @@
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import javax.servlet.ServletException;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-import java.io.InputStream;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -50,7 +47,7 @@
private PortalObjectId defaultPortalPath = PortalObjectId.parse("/default", PortalObjectId.CANONICAL_FORMAT);
- public CommandForward handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
+ public HandlerResponse handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
{
ServerInvocation invocation = ctx.getServerInvocation();
@@ -79,27 +76,12 @@
}
//
- sendRedirect(invocation, location);
-
- //
- return null;
+ return new HTTPResponse.SendRedirect(location);
}
else if (response instanceof StreamContentResponse)
{
StreamContentResponse scr = (StreamContentResponse)response;
- HttpServletResponse resp = invocation.getServerContext().getClientResponse();
- resp.setContentType(scr.getContentType());
- ServletOutputStream sout = resp.getOutputStream();
- InputStream is = scr.getInputStream();
- byte[] buf = new byte[2048];
- int len;
- while ((len = is.read(buf)) > 0)
- {
- sout.write(buf, 0, len);
- }
- sout.flush();
- sout.close();
- return null;
+ return new HTTPResponse.SendBinary(scr.getContentType(), scr.getInputStream());
}
else
{
Modified: 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-03-20 15:10:11 UTC (rev 6775)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/CommandForward.java 2007-03-20 15:23:56 UTC (rev 6776)
@@ -26,10 +26,12 @@
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
+public class CommandForward extends HandlerResponse
{
/** . */
private final ControllerCommand cmd;
Added: trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/HTTPResponse.java 2007-03-20 15:23:56 UTC (rev 6776)
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * 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 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;
+
+ 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);
+ }
+ }
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/classic/HandlerResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/HandlerResponse.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/HandlerResponse.java 2007-03-20 15:23:56 UTC (rev 6776)
@@ -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.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
+{
+}
Modified: 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-03-20 15:10:11 UTC (rev 6775)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ResponseHandler.java 2007-03-20 15:23:56 UTC (rev 6776)
@@ -35,5 +35,5 @@
*/
public interface ResponseHandler
{
- public CommandForward handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException;
+ public HandlerResponse handleResponse(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-03-20 15:10:11 UTC (rev 6775)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-03-20 15:23:56 UTC (rev 6776)
@@ -26,6 +26,8 @@
import org.jboss.portal.core.controller.ControllerContext;
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.model.portal.command.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import org.jboss.portal.core.model.portal.Page;
@@ -59,7 +61,7 @@
StateString navState,
PortletResponse response);
- public CommandForward handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
+ public HandlerResponse handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
{
if (response instanceof PortletResponse)
{
@@ -88,8 +90,7 @@
{
HTTPRedirectionResponse redirectionResult = (HTTPRedirectionResponse)pir;
String url = redirectionResult.getLocation();
- sendRedirect(invocation, url);
- return null;
+ return new HTTPResponse.SendRedirect(url);
}
else if (pir instanceof InsufficientTransportGuaranteeResponse)
{
@@ -124,17 +125,13 @@
}
//
- sendRedirect(invocation, location);
-
- //
- return null;
+ return new HTTPResponse.SendRedirect(location);
}
else if (pir instanceof ErrorResponse)
{
ErrorResponse error = (ErrorResponse)pir;
error.logErrorTo(log, "An portlet exception occured in portlet");
- sendStatusCode(invocation, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return null;
+ return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
else
{
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-03-20 15:10:11 UTC (rev 6775)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-03-20 15:23:56 UTC (rev 6776)
@@ -24,6 +24,7 @@
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.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.command.response.UpdateViewResponse;
@@ -41,7 +42,7 @@
public class PortalObjectResponseHandler extends AbstractResponseHandler
{
- public CommandForward handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
+ public HandlerResponse handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
{
if (response instanceof UpdateViewResponse)
{
17 years, 3 months