JBoss Portal SVN: r6143 - trunk/core/src/main/org/jboss/portal/core/model/portal.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-01 18:45:02 -0500 (Thu, 01 Feb 2007)
New Revision: 6143
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
Log:
make PortalObjectId implement serializable
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2007-02-01 23:38:15 UTC (rev 6142)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2007-02-01 23:45:02 UTC (rev 6143)
@@ -27,6 +27,7 @@
import org.jboss.portal.common.util.Tools;
import java.util.Iterator;
+import java.io.Serializable;
/**
* A composite id for a portal object.
@@ -34,7 +35,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class PortalObjectId implements Comparable
+public class PortalObjectId implements Comparable, Serializable
{
/** . */
19 years, 2 months
JBoss Portal SVN: r6142 - tags/JBoss_Portal_2_6_0_ALPHA2/core/src/main/org/jboss/portal/core/model/portal.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-01 18:38:15 -0500 (Thu, 01 Feb 2007)
New Revision: 6142
Modified:
tags/JBoss_Portal_2_6_0_ALPHA2/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
Log:
make PortalObjectId serializable
Modified: tags/JBoss_Portal_2_6_0_ALPHA2/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
===================================================================
--- tags/JBoss_Portal_2_6_0_ALPHA2/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2007-02-01 21:44:16 UTC (rev 6141)
+++ tags/JBoss_Portal_2_6_0_ALPHA2/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2007-02-01 23:38:15 UTC (rev 6142)
@@ -27,6 +27,7 @@
import org.jboss.portal.common.util.Tools;
import java.util.Iterator;
+import java.io.Serializable;
/**
* A composite id for a portal object.
@@ -34,7 +35,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class PortalObjectId implements Comparable
+public class PortalObjectId implements Comparable, Serializable
{
/** . */
19 years, 2 months
JBoss Portal SVN: r6141 - trunk/build.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-01 16:44:16 -0500 (Thu, 01 Feb 2007)
New Revision: 6141
Modified:
trunk/build/distrib.xml
Log:
update distrib.xml to correctly package jboss-portal-ha.sar
Modified: trunk/build/distrib.xml
===================================================================
--- trunk/build/distrib.xml 2007-02-01 21:39:07 UTC (rev 6140)
+++ trunk/build/distrib.xml 2007-02-01 21:44:16 UTC (rev 6141)
@@ -191,7 +191,7 @@
<fileset dir="${source.dir}/core/output/resources/jboss-portal-ha.sar"/>
</copy>
<copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar/portal-cms.sar">
- <fileset dir="${source.dir}/core-cms/output/resources" includes="portal-cms-ha.sar/**"/>
+ <fileset dir="${source.dir}/core-cms/output/resources/portal-cms-ha.sar" includes="**"/>
</copy>
<copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar">
<fileset dir="${source.dir}/core-samples/output/resources" includes="portal-samples.sar/**"/>
19 years, 2 months
JBoss Portal SVN: r6140 - tags/JBoss_Portal_2_6_0_ALPHA2/build.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-01 16:39:07 -0500 (Thu, 01 Feb 2007)
New Revision: 6140
Modified:
tags/JBoss_Portal_2_6_0_ALPHA2/build/distrib.xml
Log:
make the jboss-portal-ha.sar/portal-cms.sar be packaged normally
Modified: tags/JBoss_Portal_2_6_0_ALPHA2/build/distrib.xml
===================================================================
--- tags/JBoss_Portal_2_6_0_ALPHA2/build/distrib.xml 2007-02-01 16:44:01 UTC (rev 6139)
+++ tags/JBoss_Portal_2_6_0_ALPHA2/build/distrib.xml 2007-02-01 21:39:07 UTC (rev 6140)
@@ -191,7 +191,7 @@
<fileset dir="${source.dir}/core/output/resources/jboss-portal-ha.sar"/>
</copy>
<copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar/portal-cms.sar">
- <fileset dir="${source.dir}/core-cms/output/resources" includes="portal-cms-ha.sar/**"/>
+ <fileset dir="${source.dir}/core-cms/output/resources/portal-cms-ha.sar" includes="**"/>
</copy>
<copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar">
<fileset dir="${source.dir}/core-samples/output/resources" includes="portal-samples.sar/**"/>
19 years, 2 months
JBoss Portal SVN: r6139 - trunk/build/ide/intellij/idea60/modules/core-cms.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-01 11:44:01 -0500 (Thu, 01 Feb 2007)
New Revision: 6139
Modified:
trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml
Log:
make core-cms depends on theme module as it needs to see classes from it
Modified: trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml 2007-02-01 16:42:11 UTC (rev 6138)
+++ trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml 2007-02-01 16:44:01 UTC (rev 6139)
@@ -52,6 +52,7 @@
<orderEntry type="module" module-name="portlet" />
<orderEntry type="module" module-name="identity" />
<orderEntry type="module" module-name="common" />
+ <orderEntry type="module" module-name="theme" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
19 years, 2 months
JBoss Portal SVN: r6138 - in trunk: core/src/main/org/jboss/portal/core/impl/model/portal and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-01 11:42:11 -0500 (Thu, 01 Feb 2007)
New Revision: 6138
Added:
trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/command/RenderCMSWindowCommand.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentState.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
Log:
JBPORTAL-538 : CMSPortlet displays only in default page when link is clicked on a different page
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-02-01 02:39:33 UTC (rev 6137)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-02-01 16:42:11 UTC (rev 6138)
@@ -209,7 +209,7 @@
//
addResolver(PortletInvocation.REQUEST_SCOPE, controllerContext);
addResolver(PortletInvocation.PRINCIPAL_SCOPE, controllerContext);
- addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, EmptyAttributeResolver.getInstance());
+ addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, new MapAttributeResolver());
addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
}
public HttpServletRequest getClientRequest() throws IllegalStateException
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-02-01 02:39:33 UTC (rev 6137)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-02-01 16:42:11 UTC (rev 6138)
@@ -181,11 +181,23 @@
public void setProperty(String name, String value)
{
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name accepted");
+ }
+ if (name.startsWith("content.") == false)
+ {
+ throw new IllegalArgumentException("Property name must be prefixed by 'content.'");
+ }
setDeclaredProperty(name, value);
}
public String getProperty(String name)
{
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name accepted");
+ }
return getDeclaredProperty(name);
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentState.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentState.java 2007-02-01 02:39:33 UTC (rev 6137)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentState.java 2007-02-01 16:42:11 UTC (rev 6138)
@@ -41,16 +41,18 @@
void setURI(String uri);
/**
+ * Set a content property, the property name must not be null and must start with the litteral 'content.'.
*
- * @param name
- * @param value
+ * @param name the property name
+ * @param value the property value
*/
void setProperty(String name, String value);
/**
+ * Retrieve a content property
*
- * @param name
- * @return
+ * @param name the property name
+ * @return the property value or null if it does not exist
*/
String getProperty(String name);
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java 2007-02-01 02:39:33 UTC (rev 6137)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java 2007-02-01 16:42:11 UTC (rev 6138)
@@ -43,6 +43,7 @@
import org.jboss.portal.portlet.info.WindowStateInfo;
import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
@@ -89,6 +90,16 @@
return context.getController().getCustomizationManager().getInstance(window, user);
}
+ protected void before(PortletInvocation invocation)
+ {
+
+ }
+
+ protected void after(PortletInvocation invocation)
+ {
+
+ }
+
public Object execute() throws ControllerException
{
//
@@ -142,6 +153,7 @@
PortletInvocationResponse response;
try
{
+ before(invocation);
response = instance.invoke(invocation);
}
catch (PortletInvokerException e)
@@ -155,6 +167,10 @@
throw new ControllerException(e);
}
}
+ finally
+ {
+ after(invocation);
+ }
//
if (response instanceof FragmentResponse)
Added: trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java (rev 0)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java 2007-02-01 16:42:11 UTC (rev 6138)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * 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.cms;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CMSConstants
+{
+ /**
+ * Property name for the server config which designates the value of the default window reference for the
+ * CMS integration by the command mapper.
+ */
+ public static final String DEFAULT_CMS_WINDOW_REF_CONFIG_PROPERTY_NAME = "cms.default_window_ref";
+}
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-02-01 02:39:33 UTC (rev 6137)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-02-01 16:42:11 UTC (rev 6138)
@@ -33,8 +33,10 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.core.cms.command.StreamContentCommand;
+import org.jboss.portal.core.cms.ui.CMSPortlet;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.config.ServerConfig;
import java.util.Locale;
@@ -55,6 +57,9 @@
/** . */
protected PortalObjectId targetWindowId;
+ /** . */
+ protected ServerConfig serverConfig;
+
public CMS getCMSService()
{
return CMSService;
@@ -75,11 +80,23 @@
this.targetWindowRef = targetWindowRef;
}
+ public ServerConfig getServerConfig()
+ {
+ return serverConfig;
+ }
+ public void setServerConfig(ServerConfig serverConfig)
+ {
+ this.serverConfig = serverConfig;
+ }
+
protected void startService() throws Exception
{
targetWindowId = PortalObjectId.parse(targetWindowRef, PortalObjectId.LEGACY_FORMAT);
+ // Update the config from the configuration
+ serverConfig.setProperty(CMSConstants.DEFAULT_CMS_WINDOW_REF_CONFIG_PROPERTY_NAME, targetWindowRef);
+
//
super.startService();
}
@@ -93,18 +110,34 @@
targetWindowId = null;
}
+ private File getFile(String requestPath, Locale locale)
+ {
+ Command getCMD = CMSService.getCommandFactory().createFileGetCommand(requestPath, locale);
+ File file = (File)CMSService.execute(getCMD);
+ if (file == null)
+ {
+ getCMD = CMSService.getCommandFactory().createFileGetCommand(requestPath, new Locale(CMSService.getDefaultLocale()));
+ file = (File)CMSService.execute(getCMD);
+ }
+ return file;
+ }
+
public ControllerCommand doMapping(ServerInvocation invocation, String host, String contextPath, String requestPath)
{
try
{
- Command getCMD = CMSService.getCommandFactory().createFileGetCommand(requestPath, invocation.getRequest().getLocale());
- File file = (File)CMSService.execute(getCMD);
- if (file == null)
+ String path = requestPath;
+ Locale requestLocale = invocation.getRequest().getLocale();
+ File file = getFile(requestPath, requestLocale);
+
+ // Redirect to default content if nothing found (and WTF the content is prefixed by /default ???)
+ if (file == null && "/default/index.html".equals(path) == false)
{
- getCMD = CMSService.getCommandFactory().createFileGetCommand(requestPath, new Locale(CMSService.getDefaultLocale()));
- file = (File)CMSService.execute(getCMD);
+ path = "/default/index.html";
+ file = getFile(path, requestLocale);
}
+ //
if (file != null)
{
Content content = file.getContent();
@@ -123,9 +156,10 @@
}
else
{
- //Set the content as a render parameter
+ // Set the content as a render parameter
PortletParametersStateString parameters = new PortletParametersStateString();
- parameters.setValue("path", requestPath);
+ parameters.setValue(CMSPortlet.RENDER_PARAMETER_PATH, path);
+ parameters.setValue(CMSPortlet.REQUEST_PROPERTY_USE_GLOBAL_URLS, "true");
// Perform a render URL on the target window
return new InvokePortletWindowRenderCommand(targetWindowId, Mode.VIEW, null, parameters);
@@ -146,6 +180,7 @@
log.error("CMS error", e);
}
}
+
return null; // TODO: 404?
}
}
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/command/RenderCMSWindowCommand.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/command/RenderCMSWindowCommand.java 2007-02-01 02:39:33 UTC (rev 6137)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/command/RenderCMSWindowCommand.java 2007-02-01 16:42:11 UTC (rev 6138)
@@ -28,8 +28,12 @@
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.cms.ui.CMSPortlet;
+import org.jboss.portal.core.cms.CMSConstants;
import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.server.config.ServerConfig;
import java.util.Map;
import java.util.HashMap;
@@ -69,7 +73,25 @@
return container.getDefinition("CMSPortletInstance");
}
+ protected void before(PortletInvocation invocation)
+ {
+ // Find out if we are invoking the content portlet
+ ServerConfig cfg = getControllerContext().getServerInvocation().getRequest().getServer().getConfig();
+ // Set the request property for it
+ String windowRef = cfg.getProperty(CMSConstants.DEFAULT_CMS_WINDOW_REF_CONFIG_PROPERTY_NAME);
+ if (window.getId().toString(PortalObjectId.LEGACY_FORMAT).equals(windowRef))
+ {
+ invocation.setAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE, CMSPortlet.REQUEST_PROPERTY_USE_GLOBAL_URLS, "true");
+ }
+ }
+
+ protected void after(PortletInvocation invocation)
+ {
+ // Cleanup request property
+ invocation.removeAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE, CMSPortlet.REQUEST_PROPERTY_USE_GLOBAL_URLS);
+ }
+
public Object execute() throws ControllerException
{
Object o = super.execute();
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java 2007-02-01 02:39:33 UTC (rev 6137)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java 2007-02-01 16:42:11 UTC (rev 6138)
@@ -83,6 +83,7 @@
{
String file = files[i];
CMSContent content = (CMSContent)ctx.createWindow(ContentType.CMS, file);
+
}
}
catch (Exception e)
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-02-01 02:39:33 UTC (rev 6137)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-02-01 16:42:11 UTC (rev 6138)
@@ -41,6 +41,7 @@
import javax.portlet.PortletSecurityException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Locale;
@@ -58,11 +59,9 @@
*/
public class CMSPortlet extends GenericPortlet
{
+ /** Logger. */
private static Logger log = Logger.getLogger(CMSPortlet.class);
- private CMS CMSService;
-
- private String indexpage;
/**
* It's easier and more robust to follow the standards. See http://www.ietf.org/rfc/rfc2396.txt of which, Section
* 3.1 on the "Scheme Component" is partially excerpted here:
@@ -84,7 +83,6 @@
* sign (# = ASCII hex 23).
*/
private static final String URI_ignoreRegex = "" + URI_schemeRegex + "|/|\\x23";
- //private static final String URI_ignoreRegex = "(" + URI_schemeRegex + "|/|\\x23)";
private static final String
regex = "((?:href|src)\\s*=\\s*) # Capture preliminaries in $1. \n"
@@ -98,29 +96,19 @@
+ " /?([^\\s>]+) # ...capture URL in $4 \n"
+ ")";
-/* private static final String regex =
-"((?:href|src)\\s*=\\s*) # Capture preliminaries in $1. \n" +
-"(?: # First look for URL in quotes. \n" +
-" ([\"\']) # Capture open quote in $2. \n" +
-" (?!http:) # If it isn't absolute... \n" +
-" /?(.+?) # ...capture URL in $3 \n" +
-" \\2 # Match the closing quote \n" +
-" | # Look for non-quoted URL. \n" +
-" (?![\"\']|http:) # If it isn't absolute... \n" +
-" /?([^\\s>]+) # ...capture URL in $4 \n" +
-")";*/
-
- /** Removes header content, and leaves content between body tags */
+ /** Removes header content, and leaves content between body tags. */
private static final String HTMLStripperRegex = "(.*<body[^>]*>(.+)</body>.*)";
- //private static final String HTMLStripperRegex = "(.*<body[^>]*>(.+)</body>.*')";
+ /** . */
private static final Pattern RELATIVE_URI_PATTERN = Pattern.compile(regex, Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.COMMENTS);
+ /** . */
private static final Pattern STRIP_TAGS_PATTERN = Pattern.compile(HTMLStripperRegex, Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
+ /** . */
static final URLFormat RELATIVE_SERVLET_ENCODED_URL_FORMAT = URLFormat.newInstance(true, true);
- /** Our path to jsp pages */
+ /** Our path to jsp pages. */
static final String CMS_JSP_PATH = "/WEB-INF/jsp/cms";
/** Where we can find the default data in the resource bundle. */
@@ -129,6 +117,18 @@
/** Where we can find the default images in the resource bundle. */
static final String DEFAULT_IMAGES_PATH = "/images/cms";
+ /** The render parameter name of the path of the file the portlet will show. */
+ public static final String RENDER_PARAMETER_PATH = "path";
+
+ /** The request property which tells the portlet to use global URLs instead of portlet URLs. */
+ public static final String REQUEST_PROPERTY_USE_GLOBAL_URLS = "cms.use_global_urls";
+
+ /** . */
+ private CMS CMSService;
+
+ /** . */
+ private String indexpage;
+
public void init() throws PortletException
{
CMSService = (CMS)getPortletContext().getAttribute("CMS");
@@ -140,21 +140,35 @@
public void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
{
- String path = null;
+ String useGlobalURLs = req.getProperty(REQUEST_PROPERTY_USE_GLOBAL_URLS);
+ URLFactory textURLFactory = null;
+ if ("true".equals(useGlobalURLs))
+ {
+ textURLFactory = new GlobalURLFactory(((JBossRenderRequest)req).getControllerContext());
+ }
+ if (textURLFactory == null)
+ {
+ textURLFactory = new LocalURLFactory(resp.createRenderURL());
+ }
+
+ URLFactory resourceURLFactory = new GlobalURLFactory(((JBossRenderRequest)req).getControllerContext());
+
+ //
+ String path;
+ path = req.getParameter(RENDER_PARAMETER_PATH);
+ if (path == null)
+ {
+ PortletPreferences prefs = req.getPreferences();
+ indexpage = prefs.getValue("indexpage", "/default/index.html");
+ }
+
+ //
try
{
- // String linkMode = req.getPreferences().getValue("linkMode", LINK_MODE_PORTLET);
-// boolean useCMSLink = LINK_MODE_CMS.equals(linkMode);
- path = req.getParameter("path");
- if (path == null)
- {
- PortletPreferences prefs = req.getPreferences();
- indexpage = prefs.getValue("indexpage", "/default/index.html");
- }
// Get the file from the CMS, localized.
Command fileGet;
- File file = null;
+ File file;
if (path == null)
{
fileGet = CMSService.getCommandFactory().createFileGetCommand(indexpage, req.getLocale());
@@ -164,18 +178,6 @@
fileGet = CMSService.getCommandFactory().createFileGetCommand(indexpage, new Locale(CMSService.getDefaultLocale()));
file = (File)CMSService.execute(fileGet);
}
-/*
- Command itemExistsCMD = CMSService.getCommandFactory().createItemExistsCommand(indexpage + "/" + req.getLocale().getLanguage());
- Boolean bExists = (Boolean) CMSService.execute(itemExistsCMD);
- if(bExists.booleanValue())
- {
- fileGet = CMSService.getCommandFactory().createFileGetCommand(indexpage, req.getLocale());
- }
- else
- {
- fileGet = CMSService.getCommandFactory().createFileGetCommand(indexpage, new Locale(CMSService.getDefaultLocale()));
- }
-*/
}
else
{
@@ -186,45 +188,31 @@
fileGet = CMSService.getCommandFactory().createFileGetCommand(path, new Locale(CMSService.getDefaultLocale()));
file = (File)CMSService.execute(fileGet);
}
-/*
- Command itemExistsCMD = CMSService.getCommandFactory().createItemExistsCommand(path + "/" + req.getLocale().getLanguage());
- Boolean bExists = (Boolean) CMSService.execute(itemExistsCMD);
- if(bExists.booleanValue())
- {
- fileGet = CMSService.getCommandFactory().createFileGetCommand(path, req.getLocale());
- }
- else
- {
- fileGet = CMSService.getCommandFactory().createFileGetCommand(path, new Locale(CMSService.getDefaultLocale()));
- }
-*/
}
-// File file = (File) CMSService.execute(fileGet);
-
// Translate links to resources.
String sHTML = null;
resp.setContentType("text/html");
if (file != null)
{
sHTML = file.getContent().getContentAsString();
-
+
// clean html and body tags
sHTML = this.cleanupContent(sHTML);
-
+
// begin modifying links
StringBuffer buffer = new StringBuffer();
Matcher m = RELATIVE_URI_PATTERN.matcher(sHTML);
while (m.find())
{
String relURI = m.group(3) != null ? m.group(3) : m.group(4);
- String absoluteURI = this.buildURL((JBossRenderRequest)req, "/" + relURI);
+ URLFactory urlFactory = resourceURLFactory;
+ if (relURI.endsWith(".html"))
+ {
+ urlFactory = textURLFactory;
+ }
+ String absoluteURI = urlFactory.createURL("/" + relURI);
m.appendReplacement(buffer, "$1$2" + FileUtil.cleanDoubleSlashes(absoluteURI) + "$2");
-// if(!relURI.startsWith("mailto") && !relURI.startsWith("http"))
-// {
-// String absoluteURI = this.buildURL(resp, "/" + relURI);
-// m.appendReplacement(buffer, "$1\"" + FileUtil.cleanDoubleSlashes(absoluteURI) + "\"");
-// }
}
m.appendTail(buffer);
sHTML = buffer.toString();
@@ -246,40 +234,29 @@
}
catch (CMSException e)
{
- if(e.toString().indexOf("Access to this resource is denied")!=-1)
- {
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
- String sHTML = "";
- if(path==null || path.trim().length()==0)
- {
- sHTML = "<h2>Access Denied</h2>You are not allowed to access the following resource";
- }
- else
- {
- sHTML = "<h2>Access Denied</h2>You are not allowed to access the following resource - "+path;
- }
- writer.write(sHTML);
- writer.close();
- }
- else
- {
- log.error("CMS error", e);
- }
+ if (e.toString().indexOf("Access to this resource is denied") != -1)
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ String sHTML = "";
+ if (path == null || path.trim().length() == 0)
+ {
+ sHTML = "<h2>Access Denied</h2>You are not allowed to access the following resource";
+ }
+ else
+ {
+ sHTML = "<h2>Access Denied</h2>You are not allowed to access the following resource - " + path;
+ }
+ writer.write(sHTML);
+ writer.close();
+ }
+ else
+ {
+ log.error("CMS error", e);
+ }
}
}
- /**
- * Rewrites urls. Typically, this is used for image src calls from the html, so they route thru the
- * CMSObjectCommandMapper and invoke the StreamObjectCommand.
- */
- public String buildURL(JBossRenderRequest req, String path)
- {
- StreamContentCommand cmd = new StreamContentCommand(path);
- ControllerContext cc = req.getControllerContext();
- return cc.renderURL(cmd, URLContext.newInstance(false, false), RELATIVE_SERVLET_ENCODED_URL_FORMAT);
- }
-
public void doHelp(RenderRequest req, RenderResponse resp) throws IOException, PortletException
{
resp.setContentType("text/html");
@@ -296,25 +273,74 @@
PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMS_JSP_PATH + "/edit.jsp");
prd.include(req, resp);
}
-
+
/**
- *
- * @param originalContent
- * @return
+ *
*/
private String cleanupContent(String content)
- {
- //including content only between the <body> and </body>
- if(content.toLowerCase().indexOf("<body")!=-1)
- {
- Matcher h = STRIP_TAGS_PATTERN.matcher(content);
- while (h.find())
- {
- content = h.group(2);
- }
- }
-
-
- return content;
+ {
+ //including content only between the <body> and </body>
+ if (content.toLowerCase().indexOf("<body") != -1)
+ {
+ Matcher h = STRIP_TAGS_PATTERN.matcher(content);
+ while (h.find())
+ {
+ content = h.group(2);
+ }
+ }
+
+
+ return content;
}
+
+ /**
+ * Creates CMS urls which is used for image src calls from the html.
+ */
+ private abstract static class URLFactory
+ {
+ public abstract String createURL(String path);
+ }
+
+ /**
+ * Implementation that uses a PortletURL object.
+ */
+ private static class LocalURLFactory extends URLFactory
+ {
+
+ /** . */
+ private final PortletURL portletURL;
+
+ public LocalURLFactory(PortletURL portletURL)
+ {
+ this.portletURL = portletURL;
+ }
+
+ public String createURL(String path)
+ {
+ portletURL.setParameter(RENDER_PARAMETER_PATH, path);
+ return portletURL.toString();
+ }
+ }
+
+ /**
+ * Implementation that routes thru the CMSObjectCommandMapper.
+ */
+ private static class GlobalURLFactory extends URLFactory
+ {
+
+ /** . */
+ private final ControllerContext controllerContext;
+
+ public GlobalURLFactory(ControllerContext controllerContext)
+ {
+ this.controllerContext = controllerContext;
+ }
+
+ public String createURL(String path)
+ {
+ StreamContentCommand cmd = new StreamContentCommand(path);
+ return controllerContext.renderURL(cmd, URLContext.newInstance(false, false), RELATIVE_SERVLET_ENCODED_URL_FORMAT);
+ }
+ }
+
}
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-01 02:39:33 UTC (rev 6137)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-01 16:42:11 UTC (rev 6138)
@@ -225,7 +225,12 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<attribute name="TargetWindowRef">default.default.CMSWindow</attribute>
- <depends optional-attribute-name="CMSService" proxy-type="attribute">portal:service=CMS</depends>
+ <depends
+ optional-attribute-name="CMSService"
+ proxy-type="attribute">portal:service=CMS</depends>
+ <depends
+ optional-attribute-name="ServerConfig"
+ proxy-type="attribute">portal:service=ServerConfig</depends>
</mbean>
<mbean
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
19 years, 2 months
JBoss Portal SVN: r6137 - trunk/cms/src/main/org/jboss/portal/cms/hibernate/state.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-01-31 21:39:33 -0500 (Wed, 31 Jan 2007)
New Revision: 6137
Modified:
trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java
Log:
JBPORTAL-983 - Upload of large files fails.
Modified: trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java 2007-02-01 01:31:21 UTC (rev 6136)
+++ trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java 2007-02-01 02:39:33 UTC (rev 6137)
@@ -1388,7 +1388,6 @@
boolean update = exists(blobId);
Session session = Tools.getCurrentSession();
-
if (update)
{
try
@@ -1424,6 +1423,10 @@
log.error(msg, e);
throw new ItemStateException(msg, e);
}
+ finally
+ {
+ session.flush();
+ }
}
else
// insert
@@ -1448,6 +1451,10 @@
log.error(msg, e);
throw new ItemStateException(msg, e);
}
+ finally
+ {
+ session.flush();
+ }
}
}
@@ -1474,6 +1481,10 @@
log.error(msg, e);
throw new ItemStateException(msg, e);
}
+ finally
+ {
+ session.flush();
+ }
}
}
}
19 years, 2 months
JBoss Portal SVN: r6136 - in trunk/test/src: main/org/jboss/portal/test/framework/server and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-31 20:31:21 -0500 (Wed, 31 Jan 2007)
New Revision: 6136
Modified:
trunk/test/src/main/org/jboss/portal/test/framework/JBossServiceLookup.java
trunk/test/src/main/org/jboss/portal/test/framework/JNDIServiceLookup.java
trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java
trunk/test/src/main/org/jboss/portal/test/framework/server/NodeId.java
trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java
trunk/test/src/resources/portal-test-jar/org/jboss/portal/test/framework/container/jboss-beans.xml
Log:
improves slightly NodeManager/Node bean wiring (which was working but not correct, had to find a workaround before I discovered that kind of wiring was possible to be done)
Modified: trunk/test/src/main/org/jboss/portal/test/framework/JBossServiceLookup.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/JBossServiceLookup.java 2007-02-01 00:06:56 UTC (rev 6135)
+++ trunk/test/src/main/org/jboss/portal/test/framework/JBossServiceLookup.java 2007-02-01 01:31:21 UTC (rev 6136)
@@ -54,7 +54,7 @@
{
Class proxyClass = Thread.currentThread().getContextClassLoader().loadClass(proxyClassName);
ObjectName name = new ObjectName(this.name);
- MBeanServer server = node.getServer();
+ MBeanServer server = node.getMBeanServer();
return MBeanProxy.get(proxyClass, name, server);
}
catch (Exception e)
Modified: trunk/test/src/main/org/jboss/portal/test/framework/JNDIServiceLookup.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/JNDIServiceLookup.java 2007-02-01 00:06:56 UTC (rev 6135)
+++ trunk/test/src/main/org/jboss/portal/test/framework/JNDIServiceLookup.java 2007-02-01 01:31:21 UTC (rev 6136)
@@ -25,8 +25,8 @@
import org.jboss.portal.test.framework.server.Node;
-import javax.naming.InitialContext;
import javax.naming.NamingException;
+import javax.naming.Context;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -56,10 +56,10 @@
public Object getService(Node node)
{
- InitialContext ctx = null;
+ Context ctx = null;
try
{
- ctx = node.getInitialContext();
+ ctx = node.getNamingContext();
return ctx.lookup(jndiName);
}
catch (NamingException e)
Modified: trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java 2007-02-01 00:06:56 UTC (rev 6135)
+++ trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java 2007-02-01 01:31:21 UTC (rev 6136)
@@ -26,6 +26,7 @@
import javax.management.MBeanServer;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import javax.naming.Context;
import java.util.Properties;
/**
@@ -35,36 +36,49 @@
public class Node
{
+ /** . */
private final NodeId id;
- private MBeanServer server;
+ /** . */
+ private final MBeanServer mbeanServer;
- private NodeManager nodeManager;
+ /** . */
+ private final Properties jndiEnv;
- private Properties jndiEnv;
-
- public Node(String id, MBeanServer server, NodeManager nodeManager, Properties jndiEnv)
+ public Node(String id, MBeanServer mBeanServer, Properties jndiEnv)
{
this.id = new NodeId(id);
- this.server = server;
- this.nodeManager = nodeManager;
+ this.mbeanServer = mBeanServer;
this.jndiEnv = jndiEnv;
-
- //
- nodeManager.nodeMap.put(this.id, this);
}
+ /**
+ * Returns the node id.
+ *
+ * @return the node id
+ */
public NodeId getId()
{
return id;
}
- public MBeanServer getServer()
+ /**
+ * Returns the MBeanServer of the node.
+ *
+ * @return the mbean server
+ */
+ public MBeanServer getMBeanServer()
{
- return server;
+ return mbeanServer;
}
- public InitialContext getInitialContext() throws NamingException
+ /**
+ * Returns the naming context that resolves to the node.
+ *
+ * @return the naming context
+ * @throws NamingException
+ */
+ public Context getNamingContext() throws NamingException
{
return new InitialContext(jndiEnv);
}
Modified: trunk/test/src/main/org/jboss/portal/test/framework/server/NodeId.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/server/NodeId.java 2007-02-01 00:06:56 UTC (rev 6135)
+++ trunk/test/src/main/org/jboss/portal/test/framework/server/NodeId.java 2007-02-01 01:31:21 UTC (rev 6136)
@@ -41,6 +41,7 @@
/** . */
public static final NodeId PORTS_02 = new NodeId("ports-02");
+ /** . */
private final String value;
public NodeId(String value)
@@ -63,19 +64,12 @@
{
return true;
}
- if (o == null || getClass() != o.getClass())
+ if (o instanceof NodeId)
{
- return false;
+ NodeId that = (NodeId)o;
+ return value.equals(that.value);
}
-
- final NodeId nodeId = (NodeId)o;
-
- if (!value.equals(nodeId.value))
- {
- return false;
- }
-
- return true;
+ return false;
}
public int hashCode()
Modified: trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java 2007-02-01 00:06:56 UTC (rev 6135)
+++ trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java 2007-02-01 01:31:21 UTC (rev 6136)
@@ -26,6 +26,8 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import java.util.List;
+import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -34,16 +36,17 @@
public class NodeManager
{
- Map nodeMap;
+ /** The nodes. */
+ private final Map nodeMap;
- public NodeManager()
+ public NodeManager(List nodes)
{
- nodeMap = new HashMap();
-// for (Iterator i = nodes.iterator(); i.hasNext();)
-// {
-// Node node = (Node)i.next();
-// nodeMap.put(node.getId(), node);
-// }
+ this.nodeMap = new HashMap();
+ for (Iterator i = nodes.iterator();i.hasNext();)
+ {
+ Node node = (Node)i.next();
+ nodeMap.put(node.getId(), node);
+ }
}
public Collection getNodes()
Modified: trunk/test/src/resources/portal-test-jar/org/jboss/portal/test/framework/container/jboss-beans.xml
===================================================================
--- trunk/test/src/resources/portal-test-jar/org/jboss/portal/test/framework/container/jboss-beans.xml 2007-02-01 00:06:56 UTC (rev 6135)
+++ trunk/test/src/resources/portal-test-jar/org/jboss/portal/test/framework/container/jboss-beans.xml 2007-02-01 01:31:21 UTC (rev 6136)
@@ -88,7 +88,6 @@
<constructor>
<parameter><value>default</value></parameter>
<parameter><inject bean="MBeanServerFactory0" property="server"/></parameter>
- <parameter><inject bean="NodeManager"/></parameter>
<parameter name="jndiEnv">
<map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
@@ -112,7 +111,6 @@
<constructor>
<parameter><value>ports-01</value></parameter>
<parameter><inject bean="MBeanServerFactory1" property="server"/></parameter>
- <parameter><inject bean="NodeManager"/></parameter>
<parameter name="jndiEnv">
<map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
@@ -136,7 +134,6 @@
<constructor>
<parameter><value>ports-02</value></parameter>
<parameter><inject bean="MBeanServerFactory2" property="server"/></parameter>
- <parameter><inject bean="NodeManager"/></parameter>
<parameter name="jndiEnv">
<map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
@@ -169,6 +166,15 @@
</bean>
<bean name="NodeManager" class="org.jboss.portal.test.framework.server.NodeManager">
+ <constructor>
+ <parameter>
+ <list>
+ <inject bean="Node0"/>
+ <inject bean="Node1"/>
+ <inject bean="Node2"/>
+ </list>
+ </parameter>
+ </constructor>
</bean>
<bean name="Deployer" class="org.jboss.portal.test.framework.deployment.Deployer">
19 years, 2 months
JBoss Portal SVN: r6135 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-01-31 19:06:56 -0500 (Wed, 31 Jan 2007)
New Revision: 6135
Modified:
docs/trunk/referenceGuide/en/modules/identity.xml
Log:
one more section placeholder
Modified: docs/trunk/referenceGuide/en/modules/identity.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/identity.xml 2007-01-31 23:48:33 UTC (rev 6134)
+++ docs/trunk/referenceGuide/en/modules/identity.xml 2007-02-01 00:06:56 UTC (rev 6135)
@@ -787,10 +787,14 @@
</sect2>
</sect1>
<sect1>
- <title>Identity modules implementations</title>
+ <title>User profile configuration</title>
<para>TODO:</para>
</sect1>
<sect1>
+ <title>Identity modules implementations</title>
+ <para></para>
+ </sect1>
+ <sect1>
<title>Possible configuration scenarios with LDAP and RDBMS</title>
<para>TODO:</para>
</sect1>
19 years, 2 months