Author: julien(a)jboss.com
Date: 2007-03-05 16:50:53 -0500 (Mon, 05 Mar 2007)
New Revision: 6546
Added:
trunk/core-admin/src/main/org/jboss/portal/core/faces/
trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFActionContext.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFInvocation.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFPortalContext.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFRenderContext.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFSecurityContext.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFUserContext.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFWindowContext.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletActionEvent.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletEvent.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletListener.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletRenderEvent.java
trunk/core-admin/src/main/org/jboss/portal/core/faces/UIPortlet.java
Modified:
trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java
trunk/build/ide/intellij/idea60/modules/core-admin/core-admin.iml
trunk/core-admin/build.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portal.taglib.xml
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java
trunk/portlet/src/main/org/jboss/portal/portlet/PortletParametersStateString.java
Log:
added JSF component that show portlets
Modified: trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java
===================================================================
---
trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java 2007-03-05
20:20:08 UTC (rev 6545)
+++
trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -44,6 +44,7 @@
public class JBossServletContextProvider implements ServletContextProvider
{
+ /** . */
private static final ThreadLocal local = new ThreadLocal();
static void set(BridgeInfo info)
@@ -51,7 +52,7 @@
local.set(info);
}
- static BridgeInfo get()
+ public static BridgeInfo get()
{
return (BridgeInfo)local.get();
}
Modified: trunk/build/ide/intellij/idea60/modules/core-admin/core-admin.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/core-admin/core-admin.iml 2007-03-05 20:20:08
UTC (rev 6545)
+++ trunk/build/ide/intellij/idea60/modules/core-admin/core-admin.iml 2007-03-05 21:50:53
UTC (rev 6546)
@@ -110,6 +110,8 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="bridge" />
+ <orderEntry type="module" module-name="server" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/core-admin/build.xml
===================================================================
--- trunk/core-admin/build.xml 2007-03-05 20:20:08 UTC (rev 6545)
+++ trunk/core-admin/build.xml 2007-03-05 21:50:53 UTC (rev 6546)
@@ -105,6 +105,7 @@
<path refid="jboss.portal-format.classpath"/>
<path refid="jboss.portal-common.classpath"/>
<path refid="jboss.portal-faces.classpath"/>
+ <path refid="jboss.portal-bridge.classpath"/>
<path refid="jboss.portal-server.classpath"/>
<path refid="jboss.portal-registration.classpath"/>
<path refid="jboss.portal-portlet.classpath"/>
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFActionContext.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFActionContext.java
(rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFActionContext.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.faces;
+
+import org.jboss.portal.portlet.impl.spi.AbstractActionContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.EmptyAttributeResolver;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.server.impl.RequestAttributeResolver;
+import org.jboss.portal.server.impl.PrincipalAttributeResolver;
+import org.jboss.portal.server.impl.MapAttributeResolver;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JSFActionContext extends AbstractActionContext
+{
+
+ /** . */
+ private final JSFInvocation invocation;
+
+ public JSFActionContext(
+ Mode mode, WindowState
+ windowState,
+ StateString interactionState,
+ HTTPStreamInfo streamInfo,
+ JSFInvocation invocation)
+ {
+ super(mode, windowState, null, streamInfo, interactionState, null);
+
+ //
+ this.invocation = invocation;
+
+ //
+ addResolver(PortletInvocation.REQUEST_SCOPE, new
RequestAttributeResolver(invocation.clientRequest));
+ addResolver(PortletInvocation.PRINCIPAL_SCOPE, new
PrincipalAttributeResolver(invocation.clientRequest));
+ addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE,
EmptyAttributeResolver.getInstance());
+ addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new
MapAttributeResolver());
+ }
+
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ return invocation.clientRequest;
+ }
+
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ return invocation.clientResponse;
+ }
+
+ public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean
wantAuthenticated, boolean relative)
+ {
+ return invocation.renderURL(portletURL, wantSecure, wantAuthenticated, relative);
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFInvocation.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFInvocation.java
(rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFInvocation.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,193 @@
+/******************************************************************************
+ * 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.faces;
+
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.portlet.spi.RequestContext;
+import org.jboss.portal.portlet.spi.SecurityContext;
+import org.jboss.portal.portlet.spi.UserContext;
+import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.portlet.spi.ActionContext;
+import org.jboss.portal.portlet.impl.PortletRequestEncoder;
+import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
+import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.common.MediaType;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.bridge.JBossServletContextProvider;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.faces.context.FacesContext;
+import javax.faces.application.ViewHandler;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JSFInvocation
+{
+
+ /** . */
+ final HttpServletRequest clientRequest;
+
+ /** . */
+ final HttpServletResponse clientResponse;
+
+ /** . */
+ final FacesContext faces;
+
+ /** . */
+ final UIPortlet uiportlet;
+
+ /** . */
+ final PortalContext portalContext;
+
+ /** . */
+ final RequestContext requestContext;
+
+ /** . */
+ final SecurityContext securityContext;
+
+ /** . */
+ final UserContext userContext;
+
+ /** . */
+ final WindowContext windowContext;
+
+ public JSFInvocation(FacesContext faces, UIPortlet uiportlet)
+ {
+ // Get request and response
+ JBossServletContextProvider.BridgeInfo info = JBossServletContextProvider.get();
+ this.clientRequest = info.getInvocation().getDispatchedRequest();
+ this.clientResponse = info.getInvocation().getDispatchedResponse();
+ this.faces = faces;
+ this.uiportlet = uiportlet;
+
+ //
+ this.portalContext = new JSFPortalContext(faces);
+ this.requestContext = new AbstractRequestContext(clientRequest, clientResponse);
+ this.securityContext = new JSFSecurityContext(faces);
+ this.userContext = new JSFUserContext(faces);
+ this.windowContext = new JSFWindowContext(faces);
+ }
+
+ String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated,
boolean relative)
+ {
+ ViewHandler vh = faces.getApplication().getViewHandler();
+ String viewId = faces.getViewRoot().getViewId();
+ String clientId = uiportlet.getClientId(faces);
+ StringBuffer url = new StringBuffer(vh.getActionURL(faces, viewId));
+
+ //
+ url.append("&").append(clientId).append("=jbp");
+
+ //
+ PortletRequestEncoder encoder = new PortletRequestEncoder();
+ encoder.encode(portletURL);
+ for (Iterator i = encoder.getQueryParameters().entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = FastURLEncoder.DEFAULT_ENCODER.encode((String)entry.getKey());
+ String[] values = (String[])entry.getValue();
+ for (int j = 0;j < values.length;j++)
+ {
+ String value = values[j];
+ url.append("&").append(name).append('=');
+ FastURLEncoder.DEFAULT_ENCODER.encode(value, url);
+ }
+ }
+
+ //
+ return url.toString();
+ }
+
+ public PortletInvocationResponse action(
+ Instance instance,
+ Mode mode,
+ WindowState windowState,
+ StateString interactionState) throws PortletInvokerException
+ {
+ //
+ ActionContext actionContext = new JSFActionContext(
+ mode,
+ windowState,
+ interactionState,
+ new HTTPStreamInfo(MediaType.HTML, "UTF-8"),
+ this);
+
+ //
+ PortletInvocation action = new ActionInvocation(actionContext);
+
+ //
+ return invoke(instance, action);
+ }
+
+ public PortletInvocationResponse render(
+ Instance instance,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState) throws PortletInvokerException
+ {
+ //
+ RenderContext renderContext = new JSFRenderContext(
+ mode,
+ windowState,
+ navigationalState,
+ new HTTPStreamInfo(MediaType.HTML, "UTF-8"),
+ this);
+
+ //
+ PortletInvocation render = new RenderInvocation(renderContext);
+
+ //
+ return invoke(instance, render);
+ }
+
+ private PortletInvocationResponse invoke(
+ Instance instance,
+ PortletInvocation invocation) throws PortletInvokerException
+ {
+ //
+ invocation.setPortalContext(portalContext);
+ invocation.setSecurityContext(securityContext);
+ invocation.setUserContext(userContext);
+ invocation.setRequestContext(requestContext);
+ invocation.setWindowContext(windowContext);
+
+ //
+ return instance.invoke(invocation);
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFPortalContext.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFPortalContext.java
(rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFPortalContext.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * 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.faces;
+
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.spi.PortalContext;
+
+import javax.faces.context.FacesContext;
+import java.util.Set;
+import java.util.Map;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JSFPortalContext implements PortalContext
+{
+
+ /** . */
+ private static final Set modes = Collections.unmodifiableSet(Tools.toSet(new
Mode[]{Mode.VIEW,Mode.EDIT,Mode.HELP}));
+
+ /** . */
+ private static final Set windowStates = Collections.unmodifiableSet(Tools.toSet(new
WindowState[]{WindowState.NORMAL,WindowState.MINIMIZED,WindowState.MAXIMIZED}));
+
+ /** . */
+ private final FacesContext faces;
+
+ public JSFPortalContext(FacesContext faces)
+ {
+ this.faces = faces;
+ }
+
+ public Set getWindowStates()
+ {
+ return windowStates;
+ }
+
+ public Set getModes()
+ {
+ return modes;
+ }
+
+ public Map getProperties()
+ {
+ return Collections.EMPTY_MAP;
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFRenderContext.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFRenderContext.java
(rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFRenderContext.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.faces;
+
+import org.jboss.portal.portlet.impl.spi.AbstractRenderContext;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.EmptyAttributeResolver;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.server.impl.MapAttributeResolver;
+import org.jboss.portal.server.impl.PrincipalAttributeResolver;
+import org.jboss.portal.server.impl.RequestAttributeResolver;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JSFRenderContext extends AbstractRenderContext
+{
+
+ /** . */
+ private final JSFInvocation invocation;
+
+ public JSFRenderContext(
+ Mode mode, WindowState
+ windowState,
+ StateString navigationalState,
+ HTTPStreamInfo streamInfo,
+ JSFInvocation invocation)
+ {
+ super(mode, windowState, navigationalState, streamInfo);
+
+ //
+ this.invocation = invocation;
+
+ //
+ addResolver(PortletInvocation.REQUEST_SCOPE, new
RequestAttributeResolver(invocation.clientRequest));
+ addResolver(PortletInvocation.PRINCIPAL_SCOPE, new
PrincipalAttributeResolver(invocation.clientRequest));
+ addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE,
EmptyAttributeResolver.getInstance());
+ addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new
MapAttributeResolver());
+ }
+
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ return invocation.clientRequest;
+ }
+
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ return invocation.clientResponse;
+ }
+
+ public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean
wantAuthenticated, boolean relative)
+ {
+ return invocation.renderURL(portletURL, wantSecure, wantAuthenticated, relative);
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFSecurityContext.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFSecurityContext.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFSecurityContext.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * 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.faces;
+
+import org.jboss.portal.portlet.spi.SecurityContext;
+
+import javax.faces.context.FacesContext;
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JSFSecurityContext implements SecurityContext
+{
+
+ /** . */
+ private final FacesContext faces;
+
+ public JSFSecurityContext(FacesContext faces)
+ {
+ this.faces = faces;
+ }
+
+ public boolean isSecure()
+ {
+ return false;
+ }
+
+ public boolean isAuthenticated()
+ {
+ return faces.getExternalContext().getRemoteUser() != null;
+ }
+
+ public String getAuthType()
+ {
+ return faces.getExternalContext().getAuthType();
+ }
+
+ public String getRemoteUser()
+ {
+ return faces.getExternalContext().getRemoteUser();
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return faces.getExternalContext().getUserPrincipal();
+ }
+
+ public boolean isUserInRole(String roleName)
+ {
+ return faces.getExternalContext().isUserInRole(roleName);
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFUserContext.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFUserContext.java
(rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFUserContext.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * 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.faces;
+
+import org.jboss.portal.portlet.spi.UserContext;
+import org.jboss.portal.common.util.Tools;
+
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.util.Locale;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JSFUserContext implements UserContext
+{
+
+ /** . */
+ private final FacesContext faces;
+
+ public JSFUserContext(FacesContext faces)
+ {
+ this.faces = faces;
+ }
+
+ public String getId()
+ {
+ return null;
+ }
+
+ public Map getInformations()
+ {
+ return null;
+ }
+
+ public Locale getLocale()
+ {
+ return faces.getExternalContext().getRequestLocale();
+ }
+
+ public List getLocales()
+ {
+ return Tools.toList(faces.getExternalContext().getRequestLocales());
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFWindowContext.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFWindowContext.java
(rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/faces/JSFWindowContext.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * 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.faces;
+
+import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.common.util.UUIDGenerator;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JSFWindowContext implements WindowContext
+{
+
+ /** . */
+ private static final UUIDGenerator generator = new UUIDGenerator();
+
+ /** . */
+ private final FacesContext faces;
+
+ /** . */
+ private String id;
+
+ public JSFWindowContext(FacesContext faces)
+ {
+ this.faces = faces;
+ this.id = generator.generateKey();
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletActionEvent.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletActionEvent.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletActionEvent.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,96 @@
+/******************************************************************************
+ * 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.faces;
+
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletActionEvent extends PortletEvent
+{
+
+ /** . */
+ private final StateString interactionState;
+
+ public PortletActionEvent(UIComponent uiComponent, StateString interactionState)
+ {
+ super(uiComponent);
+
+ //
+ this.interactionState = interactionState;
+ }
+
+ public Map getParameterMap()
+ {
+ if (interactionState instanceof PortletParametersStateString)
+ {
+ PortletParametersStateString ppss =
(PortletParametersStateString)interactionState;
+ return ppss.getMap();
+ }
+
+ //
+ return null;
+ }
+
+ void execute(FacesContext faces)
+ {
+ UIPortlet uiportlet = (UIPortlet)getComponent();
+
+ // Get instance
+ String instanceId = uiportlet.getInstanceId();
+ InstanceContainer instanceContainer =
(InstanceContainer)faces.getApplication().getVariableResolver().resolveVariable(faces,
"InstanceContainer");
+ Instance instance = instanceContainer.getDefinition(instanceId);
+
+ //
+ JSFInvocation invocation = new JSFInvocation(faces, uiportlet);
+
+ //
+ try
+ {
+ PortletInvocationResponse pir = invocation.action(instance, Mode.VIEW,
WindowState.NORMAL, interactionState);
+ if (pir instanceof RenderResponse)
+ {
+ RenderResponse render = (RenderResponse)pir;
+ uiportlet.navState = render.getNavigationalState();
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletEvent.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletEvent.java
(rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletEvent.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.faces;
+
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletEvent extends FacesEvent
+{
+
+ public PortletEvent(UIComponent uiComponent)
+ {
+ super(uiComponent);
+ }
+
+ public boolean isAppropriateListener(FacesListener listener)
+ {
+ return listener instanceof PortletListener;
+ }
+
+ public void processListener(FacesListener listener)
+ {
+ ((PortletListener)listener).processEvent(this);
+ }
+
+ void execute(FacesContext faces)
+ {
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletListener.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletListener.java
(rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletListener.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * 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.faces;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PortletListener extends FacesListener
+{
+ void processEvent(PortletEvent event);
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletRenderEvent.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletRenderEvent.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/core/faces/PortletRenderEvent.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * 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.faces;
+
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletRenderEvent extends PortletEvent
+{
+
+ /** . */
+ private final StateString navigationalState;
+
+ public PortletRenderEvent(UIComponent uiComponent, StateString navigationalState)
+ {
+ super(uiComponent);
+
+ //
+ this.navigationalState = navigationalState;
+ }
+
+ public Map getParameterMap()
+ {
+ if (navigationalState instanceof PortletParametersStateString)
+ {
+ PortletParametersStateString ppss =
(PortletParametersStateString)navigationalState;
+ return ppss.getMap();
+ }
+
+ //
+ return null;
+ }
+
+ void execute(FacesContext faces)
+ {
+ UIPortlet uiportlet = (UIPortlet)getComponent();
+ uiportlet.navState = navigationalState;
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/faces/UIPortlet.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/faces/UIPortlet.java
(rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/faces/UIPortlet.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -0,0 +1,256 @@
+/******************************************************************************
+ * 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.faces;
+
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.portlet.impl.PortletRequestDecoder;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.el.ValueBinding;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.EvaluationException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PhaseId;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UIPortlet extends UIComponentBase
+{
+
+ /** The portlet navigational state. */
+ StateString navState;
+
+ /** The portlet instance id. */
+ private String instanceId;
+
+ /** . */
+ private MethodBinding portletListener = null;
+
+ public String getInstanceId()
+ {
+ if (instanceId != null)
+ {
+ return instanceId;
+ }
+
+ //
+ ValueBinding vb = getValueBinding("instanceId");
+ if (vb != null)
+ {
+ return (String)vb.getValue(getFacesContext());
+ }
+
+ //
+ return null;
+ }
+
+ public void setInstanceId(String instanceId)
+ {
+ this.instanceId = instanceId;
+ }
+
+ public void setportletListenerListener(MethodBinding portletListener)
+ {
+ this.portletListener = portletListener;
+ }
+
+ public MethodBinding getPortletListener()
+ {
+ return portletListener;
+ }
+
+ public String getFamily()
+ {
+ return "org.jboss.portal.core.Portlet";
+ }
+
+ public void broadcast(FacesEvent event) throws AbortProcessingException
+ {
+ super.broadcast(event);
+
+ //
+ if (event instanceof PortletEvent)
+ {
+ FacesContext faces = getFacesContext();
+
+ if (portletListener != null)
+ {
+ try
+ {
+ portletListener.invoke(faces, new Object[] {event});
+ }
+ catch (EvaluationException e)
+ {
+ Throwable cause = e.getCause();
+ if (cause != null && cause instanceof AbortProcessingException)
+ {
+ throw (AbortProcessingException)cause;
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
+
+ //
+ PortletEvent pevent = (PortletEvent)event;
+ pevent.execute(faces);
+ }
+ }
+
+ public Object saveState(FacesContext faces)
+ {
+ String opaqueValue = navState == null ? null : navState.getStringValue();
+
+ //
+ Object values[] = new Object[3];
+ values[0] = super.saveState(faces);
+ values[1] = instanceId;
+ values[2] = opaqueValue;
+ return values;
+ }
+
+ public void restoreState(FacesContext faces, Object state)
+ {
+ Object values[] = (Object[])state;
+ super.restoreState(faces, values[0]);
+ String serializedNavState = (String)values[2];
+
+ //
+ instanceId = (String)values[1];
+ navState = serializedNavState != null ?
PortletParametersStateString.create(serializedNavState) : null;
+ }
+
+ public void decode(FacesContext faces)
+ {
+ String clientId = getClientId(faces);
+ String clientIdValue =
(String)faces.getExternalContext().getRequestParameterMap().get(clientId);
+
+ // We have been targetted
+ if ("jbp".equals(clientIdValue))
+ {
+ Map jsfParams = faces.getExternalContext().getRequestParameterValuesMap();
+ Map portletParams = new HashMap();
+ for (Iterator i = jsfParams.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ if (clientId.equals(name))
+ {
+ // Skip the client id
+ }
+ else
+ {
+ String[] values = (String[])((String[])entry.getValue()).clone();
+ portletParams.put(name, values);
+ }
+ }
+
+ // Decode the request
+ PortletRequestDecoder decoder = new PortletRequestDecoder();
+ decoder.decode(portletParams, null);
+
+ //
+ switch (decoder.getType())
+ {
+ case PortletRequestDecoder.RENDER_TYPE:
+ PortletRenderEvent prevent = new PortletRenderEvent(this,
decoder.getNavigationalstate());
+ prevent.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ queueEvent(prevent);
+ break;
+ case PortletRequestDecoder.ACTION_TYPE:
+ PortletActionEvent paevent = new PortletActionEvent(this,
decoder.getInteractionState());
+ paevent.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ queueEvent(paevent);
+ break;
+ }
+ }
+ }
+
+ public void encodeBegin(FacesContext faces) throws IOException
+ {
+ // Get instance
+ InstanceContainer instanceContainer =
(InstanceContainer)faces.getApplication().getVariableResolver().resolveVariable(faces,
"InstanceContainer");
+ Instance instance = instanceContainer.getDefinition(instanceId);
+
+ //
+ JSFInvocation invocation = new JSFInvocation(faces, this);
+
+ //
+ try
+ {
+ PortletInvocationResponse pir = invocation.render(
+ instance,
+ Mode.VIEW,
+ WindowState.NORMAL,
+ navState);
+
+ //
+ if (pir instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)pir;
+ ResponseWriter writer = faces.getResponseWriter();
+ writer.startElement("div", this);
+ writer.write(fragment.getContent());
+ writer.endElement("div");
+ writer.flush();
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void encodeChildren(FacesContext facesContext) throws IOException
+ {
+ }
+
+ public void encodeEnd(FacesContext facesContext) throws IOException
+ {
+ }
+
+ public String getRendererType()
+ {
+ // Returns null as we handle rendering ourselves
+ return null;
+ }
+}
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-05
20:20:08 UTC (rev 6545)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-05
21:50:53 UTC (rev 6546)
@@ -252,6 +252,11 @@
<component-type>com.jboss.portal.Scroller</component-type>
<component-class>org.jboss.portal.faces.scroller.UIScroller</component-class>
</component>
+
+ <component>
+ <component-type>org.jboss.portal.core.Portlet</component-type>
+
<component-class>org.jboss.portal.core.faces.UIPortlet</component-class>
+ </component>
<render-kit>
<renderer>
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
===================================================================
---
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-05
20:20:08 UTC (rev 6545)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-05
21:50:53 UTC (rev 6546)
@@ -4,6 +4,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ct="http://www.julien.com"
+
xmlns:jbp="http://www.jboss.org/portal"
xmlns:c="http://java.sun.com/jstl/core">
<ui:composition template="objectTemplate.xhtml">
@@ -102,6 +103,10 @@
</div>
</h:form>
+ <div>
+ <jbp:portlet instanceId="URLPortletInstance"/>
+ </div>
+
</ui:define>
</ui:composition>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portal.taglib.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portal.taglib.xml 2007-03-05
20:20:08 UTC (rev 6545)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portal.taglib.xml 2007-03-05
21:50:53 UTC (rev 6546)
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib
1.0//EN" "facelet-taglib_1_0.dtd">
<facelet-taglib>
- <
namespace>http://www.jboss.com/portal</namespace>
+ <
namespace>http://www.jboss.org/portal</namespace>
<tag>
<tag-name>scroller</tag-name>
<component>
@@ -9,4 +9,11 @@
<renderer-type>default</renderer-type>
</component>
</tag>
+ <tag>
+ <tag-name>portlet</tag-name>
+ <component>
+ <component-type>org.jboss.portal.core.Portlet</component-type>
+ <renderer-type>default</renderer-type>
+ </component>
+ </tag>
</facelet-taglib>
\ No newline at end of file
Modified: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java 2007-03-05
20:20:08 UTC (rev 6545)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -90,7 +90,6 @@
writer.print("<a href=\"" + whiteURL +
"\">white</a><br/>");
//
-// PortletURL actionURL = resp.createActionURL();
writer.print("Parameters :<br/>");
writer.print("<table bgcolor=\"" + color +
"\">");
writer.print("<tr><td>Name</td><td>value</td></tr>");
@@ -99,20 +98,21 @@
String name = (String)e.nextElement();
String value = req.getParameter(name);
writer.print("<tr><td>" + name +
"</td><td>" + value + "</td></tr>");
-// actionURL.setParameter(name, value);
}
writer.print("</table>");
-/*
+
+ //
+ PortletURL actionURL = resp.createActionURL();
writer.print("<form action=\"" + actionURL.toString() +
"\" method=\"post\">");
writer.print("<input type=\"text\"
name=\"name\"/>");
writer.print("<input type=\"text\"
name=\"value\"/>");
writer.print("<input type=\"submit\"
value=\"add\"/>");
writer.print("</form>");
-*/
//
writer.print("<a href=\"" + req.getContextPath() +
"/test.txt\">test</a>");
+ //
writer.close();
}
}
\ No newline at end of file
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/PortletParametersStateString.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/PortletParametersStateString.java 2007-03-05
20:20:08 UTC (rev 6545)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/PortletParametersStateString.java 2007-03-05
21:50:53 UTC (rev 6546)
@@ -54,6 +54,25 @@
/** The data. */
private PortletParameters parameters;
+ /**
+ * Factory method that will create the most appropriate form.
+ */
+ public static StateString create(String opaqueValue)
+ {
+ if (opaqueValue == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (opaqueValue.startsWith(JBPNS_PREFIX))
+ {
+ return new PortletParametersStateString(opaqueValue);
+ }
+ else
+ {
+ return new OpaqueStateString(opaqueValue);
+ }
+ }
+
public PortletParametersStateString(String opaqueValue)
{
if (opaqueValue == null)