JBoss Portal SVN: r8335 - in trunk/core-cms/src: resources/portal-cms-war/WEB-INF/jsp/cms/admin and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-09-18 14:39:08 -0400 (Tue, 18 Sep 2007)
New Revision: 8335
Added:
trunk/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_IsDefault.gif
trunk/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_MakeDefault.gif
Modified:
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
Log:
JBPORTAL-1124 - CMS needs to allow admins to make pages as live w/o editing the page (Adding Better icons for live/non-live versions)
Added: trunk/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_IsDefault.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_IsDefault.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_MakeDefault.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_MakeDefault.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-09-18 18:34:01 UTC (rev 8334)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-09-18 18:39:08 UTC (rev 8335)
@@ -262,7 +262,7 @@
if (version.isLive())
{
%>
- <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/live.gif"
+ <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/actionIcon_IsDefault.gif"
alt="${n:i18n("CMS_LIVEVERSION")}" border="0"/>
<%
}else{
@@ -274,7 +274,7 @@
<portlet:param name="version" value="<%= version.getVersionNumber() %>"/>
</portlet:actionURL>"
>
- <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/up.gif" alt="${n:i18n("CMS_LIVEVERSION")}" border="0"/>
+ <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/actionIcon_MakeDefault.gif" alt="${n:i18n("CMS_LIVEVERSION")}" border="0"/>
</a>
<%}%>
</td>
18 years, 7 months
JBoss Portal SVN: r8334 - in branches/JBoss_Portal_Branch_2_6/core-cms/src: resources/portal-cms-war/WEB-INF/jsp/cms/admin and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-09-18 14:34:01 -0400 (Tue, 18 Sep 2007)
New Revision: 8334
Added:
branches/JBoss_Portal_Branch_2_6/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_IsDefault.gif
branches/JBoss_Portal_Branch_2_6/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_MakeDefault.gif
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
Log:
JBPORTAL-1124 - CMS needs to allow admins to make pages as live w/o editing the page (Adding Better icons for live/non-live versions)
Added: branches/JBoss_Portal_Branch_2_6/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_IsDefault.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_6/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_IsDefault.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_6/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_MakeDefault.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_6/core-cms/src/bin/portal-cms-war/images/cms/admin/actionIcon_MakeDefault.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-09-18 17:37:59 UTC (rev 8333)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-09-18 18:34:01 UTC (rev 8334)
@@ -262,7 +262,7 @@
if (version.isLive())
{
%>
- <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/live.gif"
+ <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/actionIcon_IsDefault.gif"
alt="${n:i18n("CMS_LIVEVERSION")}" border="0"/>
<%
}else{
@@ -274,7 +274,7 @@
<portlet:param name="version" value="<%= version.getVersionNumber() %>"/>
</portlet:actionURL>"
>
- <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/up.gif" alt="${n:i18n("CMS_LIVEVERSION")}" border="0"/>
+ <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/actionIcon_MakeDefault.gif" alt="${n:i18n("CMS_LIVEVERSION")}" border="0"/>
</a>
<%}%>
</td>
18 years, 7 months
JBoss Portal SVN: r8333 - in trunk: cms/src/bin and 7 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-09-18 13:37:59 -0400 (Tue, 18 Sep 2007)
New Revision: 8333
Added:
trunk/cms/src/bin/prueba.zip
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/MakeLiveVersionCommand.java
Modified:
trunk/cms/build.xml
trunk/cms/src/main/org/jboss/portal/cms/CommandFactory.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java
trunk/core-cms/build.xml
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
Log:
JBPORTAL-1124 - CMS needs to allow admins to make pages as live w/o editing the page and
JBPORTAL-1693 - Upload Archive throws exception if zip file entries contain special characters in filename
Modified: trunk/cms/build.xml
===================================================================
--- trunk/cms/build.xml 2007-09-18 17:36:25 UTC (rev 8332)
+++ trunk/cms/build.xml 2007-09-18 17:37:59 UTC (rev 8333)
@@ -93,6 +93,7 @@
<path refid="apache.log4j.classpath"/>
<path refid="apache.collections.classpath"/>
<path refid="apache.lucene.classpath"/>
+ <path refid="apache.ant.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
<path refid="jboss.cache.classpath"/>
<path refid="oswego.concurrent.classpath"/>
@@ -214,6 +215,7 @@
<copy todir="${build.resources}/test/jcr/">
<fileset dir="${source.bin}" includes="ziptest.zip"/>
+ <fileset dir="${source.bin}" includes="prueba.zip"/>
<fileset dir="${source.bin}" includes="headerpage.html"/>
<fileset dir="${source.bin}" includes="headerpage_good.html"/>
</copy>
Added: trunk/cms/src/bin/prueba.zip
===================================================================
(Binary files differ)
Property changes on: trunk/cms/src/bin/prueba.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/cms/src/main/org/jboss/portal/cms/CommandFactory.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/CommandFactory.java 2007-09-18 17:36:25 UTC (rev 8332)
+++ trunk/cms/src/main/org/jboss/portal/cms/CommandFactory.java 2007-09-18 17:37:59 UTC (rev 8333)
@@ -85,5 +85,7 @@
Command createGetArchiveCommand(String sRootPath, String sLanguage);
- Command createSearchCommand(Query query);
+ Command createSearchCommand(Query query);
+
+ Command createMakeLiveVersionCommand(String filePath, String language, String version);
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java 2007-09-18 17:36:25 UTC (rev 8332)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java 2007-09-18 17:37:59 UTC (rev 8333)
@@ -44,6 +44,7 @@
import org.jboss.portal.cms.impl.jcr.command.FolderUpdateCommand;
import org.jboss.portal.cms.impl.jcr.command.GetArchiveCommand;
import org.jboss.portal.cms.impl.jcr.command.ItemExistsCommand;
+import org.jboss.portal.cms.impl.jcr.command.MakeLiveVersionCommand;
import org.jboss.portal.cms.impl.jcr.command.MoveCommand;
import org.jboss.portal.cms.impl.jcr.command.RenameCommand;
import org.jboss.portal.cms.impl.jcr.command.SearchCommand;
@@ -184,4 +185,9 @@
{
return new SearchCommand(query);
}
+
+ public Command createMakeLiveVersionCommand(String filePath, String language, String version)
+ {
+ return new MakeLiveVersionCommand(filePath,language,version);
+ }
}
Added: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/MakeLiveVersionCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/MakeLiveVersionCommand.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/MakeLiveVersionCommand.java 2007-09-18 17:37:59 UTC (rev 8333)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * 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.cms.impl.jcr.command;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.impl.jcr.JCRCommand;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+import javax.jcr.version.VersionHistory;
+
+
+/**
+ * Makes the specified version of the file a "LIVE" version
+ *
+ * @author <a href="mailto:sohil.shah@jboss.com">Sohil Shah</a>
+ */
+public class MakeLiveVersionCommand extends JCRCommand
+{
+ /**
+ *
+ */
+ private static Logger log = Logger.getLogger(MakeLiveVersionCommand.class);
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 6853173755818339647L;
+ String msFilePath = null;
+ String language = null;
+ String version = null;
+
+ /**
+ *
+ * @param sFilePath
+ * @param language
+ * @param version
+ */
+ public MakeLiveVersionCommand(String sFilePath, String language, String version)
+ {
+ this.msFilePath = sFilePath;
+ this.version = version;
+ this.language = language;
+ }
+
+ /**
+ *
+ */
+ public Object execute()
+ {
+ String versionMadeLive = null;
+ try
+ {
+ Session session = context.getSession();
+ Node fileNode = (Node)session.getItem(this.msFilePath+"/"+this.language);
+
+ VersionHistory vh = fileNode.getVersionHistory();
+ vh.addVersionLabel(this.version, "LIVE", true);
+ versionMadeLive = this.version;
+ }
+ catch (Exception e)
+ {
+ log.error(this,e);
+ throw new CMSException(e);
+ }
+ return versionMadeLive;
+ }
+}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java 2007-09-18 17:36:25 UTC (rev 8332)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java 2007-09-18 17:37:59 UTC (rev 8333)
@@ -40,14 +40,17 @@
import java.util.List;
import java.util.Locale;
import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
+
+import org.apache.tools.zip.ZipFile;
+import org.apache.tools.zip.ZipEntry;
+
import java.util.StringTokenizer;
/**
* Saves an uploaded archive to the repo.
*
* @author <a href="mailto:roy@jboss.org">Roy Russo</a>
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
public class StoreArchiveCommand extends JCRCommand
{
@@ -83,7 +86,7 @@
ZipFile zipFile = new ZipFile(tmpFile);
ZipEntry zipEntry;
- Enumeration entries = zipFile.entries();
+ Enumeration entries = zipFile.getEntries();
while(entries.hasMoreElements())
{
zipEntry = (ZipEntry)entries.nextElement();
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java 2007-09-18 17:36:25 UTC (rev 8332)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java 2007-09-18 17:37:59 UTC (rev 8333)
@@ -54,6 +54,8 @@
String sJPG = "/hibernate_logo.gif";
String sText = "/training.txt";
+
+ String foreignArchive = "resources/test/jcr/prueba.zip";
/**
@@ -79,6 +81,7 @@
InputStream is = IOTools.safeBufferedWrapper(new FileInputStream(sZipFile));
Command storearchiveCMD = service.getCommandFactory().createStoreArchiveCommand("", is, "en");
List contentsToVersion = (List)service.execute(storearchiveCMD);
+ is.close();
Command createVersions = service.getCommandFactory()
.createContentCreateNewVersionCommand(contentsToVersion, true);
@@ -105,7 +108,12 @@
Folder whopper3 = (Folder)service.execute(listCMD3);
List folders3 = whopper3.getFolders();
List files3 = whopper3.getFiles();
-
+
+ //Create and Test an archive containing foreign files
+ is = IOTools.safeBufferedWrapper(new FileInputStream(this.foreignArchive));
+ storearchiveCMD = service.getCommandFactory().createStoreArchiveCommand("", is, "en");
+ contentsToVersion = (List)service.execute(storearchiveCMD);
+ assertTrue("Foreign Archive Creation Failed",(contentsToVersion != null && !contentsToVersion.isEmpty() && contentsToVersion.size() == 2));
is.close();
}
}
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java 2007-09-18 17:36:25 UTC (rev 8332)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java 2007-09-18 17:37:59 UTC (rev 8333)
@@ -31,7 +31,6 @@
import org.jboss.portal.cms.model.File;
import java.util.Locale;
-import java.util.Map;
/**
@@ -76,10 +75,29 @@
public void testFileGetVersion() throws CMSException
{
createFile();
+
// get specific file version
Command getCMDV = service.getCommandFactory().createFileGetCommand(sFilePath, "1.0", Locale.ENGLISH);
File Vnewfile = (File)service.execute(getCMDV);
assertTrue("Incorrect version number for file object", Vnewfile.getContent().getVersionNumber().equals("1.0"));
+
+ //Update this file and create a new version that goes "LIVE"
+ this.updateFile(Vnewfile);
+
+ //Make sure a new version 1.1 is created and thats the one that is "LIVE"
+ getCMDV = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
+ Vnewfile = (File)service.execute(getCMDV);
+ assertTrue("Incorrect version number for file object", Vnewfile.getContent().getVersionNumber().equals("1.1"));
+
+ //Now switch to 1.0 as being the "LIVE" version
+ Command makeLiveCommand = service.getCommandFactory().createMakeLiveVersionCommand(sFilePath, Locale.ENGLISH.getLanguage(), "1.0");
+ String liveVersion = (String)service.execute(makeLiveCommand);
+ assertEquals("Incorrect version number is 'LIVE'",liveVersion,"1.0");
+
+ //Verify that 1.0 is the "LIVE" version and not 1.1
+ getCMDV = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
+ Vnewfile = (File)service.execute(getCMDV);
+ assertEquals("Incorrect version number for file object ("+liveVersion+")", Vnewfile.getContent().getVersionNumber(), liveVersion);
}
/**
@@ -117,4 +135,14 @@
Command newFileSPCMD = service.getCommandFactory().createNewFileCommand(file, contentSP);
service.execute(newFileSPCMD);
}
+
+ /**
+ *
+ * @throws CMSException
+ */
+ private void updateFile(File updatedFile) throws CMSException
+ {
+ Command updateFileCMD = service.getCommandFactory().createUpdateFileCommand(updatedFile, updatedFile.getContent(), true);
+ service.execute(updateFileCMD);
+ }
}
Modified: trunk/core-cms/build.xml
===================================================================
--- trunk/core-cms/build.xml 2007-09-18 17:36:25 UTC (rev 8332)
+++ trunk/core-cms/build.xml 2007-09-18 17:37:59 UTC (rev 8333)
@@ -252,6 +252,7 @@
<fileset dir="${jcr.jcr.lib}" includes="jcr-1.0.jar"/>
<fileset dir="${apache.collections.lib}" includes="commons-collections.jar"/>
<fileset dir="${apache.lucene.lib}" includes="lucene.jar"/>
+ <fileset dir="${apache.ant.lib}" includes="ant.jar"/>
<!-- cms indexing integration -->
<fileset dir="${jackrabbit.jackrabbit.lib}" includes="jackrabbit-index-filters.jar"/>
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-09-18 17:36:25 UTC (rev 8332)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-09-18 17:37:59 UTC (rev 8333)
@@ -1236,6 +1236,19 @@
aRes.setRenderParameter("path", aReq.getParameter("path"));
aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
}
+ else if(CMSAdminConstants.OP_MAKELIVE.equals(op))
+ {
+ String path = aReq.getParameter("path");
+ String language = aReq.getParameter("language");
+ String version = aReq.getParameter("version");
+
+ //Perform the change in live version here
+ Command makeLiveCommand = CMSService.getCommandFactory().createMakeLiveVersionCommand(path, language, version);
+ CMSService.execute(makeLiveCommand);
+
+ aRes.setRenderParameter("path", path);
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
+ }
}
else
{
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-09-18 17:36:25 UTC (rev 8332)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-09-18 17:37:59 UTC (rev 8333)
@@ -265,8 +265,18 @@
<img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/live.gif"
alt="${n:i18n("CMS_LIVEVERSION")}" border="0"/>
<%
- }
+ }else{
%>
+ <a href="<portlet:actionURL>
+ <portlet:param name="op" value="<%= CMSAdminConstants.OP_MAKELIVE %>"/>
+ <portlet:param name="path" value="<%= sCurrPath %>"/>
+ <portlet:param name="language" value="<%= content.getLocale().getLanguage() %>"/>
+ <portlet:param name="version" value="<%= version.getVersionNumber() %>"/>
+ </portlet:actionURL>"
+ >
+ <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/up.gif" alt="${n:i18n("CMS_LIVEVERSION")}" border="0"/>
+ </a>
+ <%}%>
</td>
<td>
<%
18 years, 7 months
JBoss Portal SVN: r8332 - in branches/JBoss_Portal_Branch_2_6: cms and 8 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-09-18 13:36:25 -0400 (Tue, 18 Sep 2007)
New Revision: 8332
Added:
branches/JBoss_Portal_Branch_2_6/cms/src/bin/prueba.zip
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/MakeLiveVersionCommand.java
Modified:
branches/JBoss_Portal_Branch_2_6/
branches/JBoss_Portal_Branch_2_6/cms/build.xml
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CommandFactory.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java
branches/JBoss_Portal_Branch_2_6/core-cms/build.xml
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
Log:
JBPORTAL-1124 - CMS needs to allow admins to make pages as live w/o editing the page and
JBPORTAL-1693 - Upload Archive throws exception if zip file entries contain special characters in filename
Property changes on: branches/JBoss_Portal_Branch_2_6
___________________________________________________________________
Name: svn:ignore
- .project
.classpath
thirdparty
eclipseBin
myworkspace
bin
*.settings
miscellaneous
local-tests
localbin
+ .project
.classpath
thirdparty
eclipseBin
myworkspace
bin
*.settings
miscellaneous
local-tests
localbin
localBin
Modified: branches/JBoss_Portal_Branch_2_6/cms/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/build.xml 2007-09-18 17:26:04 UTC (rev 8331)
+++ branches/JBoss_Portal_Branch_2_6/cms/build.xml 2007-09-18 17:36:25 UTC (rev 8332)
@@ -97,6 +97,7 @@
<path refid="apache.log4j.classpath"/>
<path refid="apache.collections.classpath"/>
<path refid="apache.lucene.classpath"/>
+ <path refid="apache.ant.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
<path refid="jboss.cache.classpath"/>
<path refid="oswego.concurrent.classpath"/>
@@ -212,6 +213,7 @@
<copy todir="${build.resources}/test/jcr/">
<fileset dir="${source.bin}" includes="ziptest.zip"/>
+ <fileset dir="${source.bin}" includes="prueba.zip"/>
<fileset dir="${source.bin}" includes="headerpage.html"/>
<fileset dir="${source.bin}" includes="headerpage_good.html"/>
</copy>
@@ -419,8 +421,8 @@
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCreate"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileUpdate"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileArchiveUpload"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGet"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGetVersion"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGetVersion"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGet"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGetList"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCopy"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCreateFailed"/>
@@ -437,9 +439,8 @@
<!-- cms fine grained security related tests -->
<test todir="${test.reports}" name="org.jboss.portal.test.cms.security.TestReadAccess"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.security.TestWriteAccess"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.cms.security.TestManageAccess"/>
-
-
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.security.TestManageAccess"/>
+
<!-- cms workflow related tests -->
<test todir="${test.reports}" name="org.jboss.portal.test.cms.workflow.TestApprovedPublish"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.workflow.TestDeniedPublish"/>
Added: branches/JBoss_Portal_Branch_2_6/cms/src/bin/prueba.zip
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_6/cms/src/bin/prueba.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CommandFactory.java 2007-09-18 17:26:04 UTC (rev 8331)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CommandFactory.java 2007-09-18 17:36:25 UTC (rev 8332)
@@ -85,5 +85,7 @@
Command createGetArchiveCommand(String sRootPath, String sLanguage);
- Command createSearchCommand(JCRQuery query);
+ Command createSearchCommand(JCRQuery query);
+
+ Command createMakeLiveVersionCommand(String filePath, String language, String version);
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java 2007-09-18 17:26:04 UTC (rev 8331)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java 2007-09-18 17:36:25 UTC (rev 8332)
@@ -48,6 +48,7 @@
import org.jboss.portal.cms.impl.jcr.command.RenameCommand;
import org.jboss.portal.cms.impl.jcr.command.SearchCommand;
import org.jboss.portal.cms.impl.jcr.command.StoreArchiveCommand;
+import org.jboss.portal.cms.impl.jcr.command.MakeLiveVersionCommand;
import org.jboss.portal.cms.impl.jcr.composite.NewFileCommand;
import org.jboss.portal.cms.impl.jcr.composite.UpdateFileCommand;
import org.jboss.portal.cms.model.Content;
@@ -185,4 +186,9 @@
{
return new SearchCommand(query);
}
+
+ public Command createMakeLiveVersionCommand(String filePath, String language, String version)
+ {
+ return new MakeLiveVersionCommand(filePath,language,version);
+ }
}
Added: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/MakeLiveVersionCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/MakeLiveVersionCommand.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/MakeLiveVersionCommand.java 2007-09-18 17:36:25 UTC (rev 8332)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * 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.cms.impl.jcr.command;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.impl.jcr.JCRCommand;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+import javax.jcr.version.VersionHistory;
+
+
+/**
+ * Makes the specified version of the file a "LIVE" version
+ *
+ * @author <a href="mailto:sohil.shah@jboss.com">Sohil Shah</a>
+ */
+public class MakeLiveVersionCommand extends JCRCommand
+{
+ /**
+ *
+ */
+ private static Logger log = Logger.getLogger(MakeLiveVersionCommand.class);
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 6853173755818339647L;
+ String msFilePath = null;
+ String language = null;
+ String version = null;
+
+ /**
+ *
+ * @param sFilePath
+ * @param language
+ * @param version
+ */
+ public MakeLiveVersionCommand(String sFilePath, String language, String version)
+ {
+ this.msFilePath = sFilePath;
+ this.version = version;
+ this.language = language;
+ }
+
+ /**
+ *
+ */
+ public Object execute()
+ {
+ String versionMadeLive = null;
+ try
+ {
+ Session session = context.getSession();
+ Node fileNode = (Node)session.getItem(this.msFilePath+"/"+this.language);
+
+ VersionHistory vh = fileNode.getVersionHistory();
+ vh.addVersionLabel(this.version, "LIVE", true);
+ versionMadeLive = this.version;
+ }
+ catch (Exception e)
+ {
+ log.error(this,e);
+ throw new CMSException(e);
+ }
+ return versionMadeLive;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java 2007-09-18 17:26:04 UTC (rev 8331)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java 2007-09-18 17:36:25 UTC (rev 8332)
@@ -40,14 +40,17 @@
import java.util.List;
import java.util.Locale;
import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
+
+import org.apache.tools.zip.ZipFile;
+import org.apache.tools.zip.ZipEntry;
+
import java.util.StringTokenizer;
/**
* Saves an uploaded archive to the repo.
*
* @author <a href="mailto:roy@jboss.org">Roy Russo</a>
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
public class StoreArchiveCommand extends JCRCommand
{
@@ -83,7 +86,7 @@
ZipFile zipFile = new ZipFile(tmpFile);
ZipEntry zipEntry;
- Enumeration entries = zipFile.entries();
+ Enumeration entries = zipFile.getEntries();
while(entries.hasMoreElements())
{
zipEntry = (ZipEntry)entries.nextElement();
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java 2007-09-18 17:26:04 UTC (rev 8331)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java 2007-09-18 17:36:25 UTC (rev 8332)
@@ -54,6 +54,8 @@
String sJPG = "/hibernate_logo.gif";
String sText = "/training.txt";
+
+ String foreignArchive = "resources/test/jcr/prueba.zip";
/**
@@ -79,6 +81,7 @@
InputStream is = IOTools.safeBufferedWrapper(new FileInputStream(sZipFile));
Command storearchiveCMD = service.getCommandFactory().createStoreArchiveCommand("", is, "en");
List contentsToVersion = (List)service.execute(storearchiveCMD);
+ is.close();
Command createVersions = service.getCommandFactory()
.createContentCreateNewVersionCommand(contentsToVersion, true);
@@ -105,7 +108,12 @@
Folder whopper3 = (Folder)service.execute(listCMD3);
List folders3 = whopper3.getFolders();
List files3 = whopper3.getFiles();
-
+
+ //Create and Test an archive containing foreign files
+ is = IOTools.safeBufferedWrapper(new FileInputStream(this.foreignArchive));
+ storearchiveCMD = service.getCommandFactory().createStoreArchiveCommand("", is, "en");
+ contentsToVersion = (List)service.execute(storearchiveCMD);
+ assertTrue("Foreign Archive Creation Failed",(contentsToVersion != null && !contentsToVersion.isEmpty() && contentsToVersion.size() == 2));
is.close();
}
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java 2007-09-18 17:26:04 UTC (rev 8331)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java 2007-09-18 17:36:25 UTC (rev 8332)
@@ -31,7 +31,6 @@
import org.jboss.portal.cms.model.File;
import java.util.Locale;
-import java.util.Map;
/**
@@ -76,10 +75,29 @@
public void testFileGetVersion() throws CMSException
{
createFile();
+
// get specific file version
Command getCMDV = service.getCommandFactory().createFileGetCommand(sFilePath, "1.0", Locale.ENGLISH);
File Vnewfile = (File)service.execute(getCMDV);
assertTrue("Incorrect version number for file object", Vnewfile.getContent().getVersionNumber().equals("1.0"));
+
+ //Update this file and create a new version that goes "LIVE"
+ this.updateFile(Vnewfile);
+
+ //Make sure a new version 1.1 is created and thats the one that is "LIVE"
+ getCMDV = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
+ Vnewfile = (File)service.execute(getCMDV);
+ assertTrue("Incorrect version number for file object", Vnewfile.getContent().getVersionNumber().equals("1.1"));
+
+ //Now switch to 1.0 as being the "LIVE" version
+ Command makeLiveCommand = service.getCommandFactory().createMakeLiveVersionCommand(sFilePath, Locale.ENGLISH.getLanguage(), "1.0");
+ String liveVersion = (String)service.execute(makeLiveCommand);
+ assertEquals("Incorrect version number is 'LIVE'",liveVersion,"1.0");
+
+ //Verify that 1.0 is the "LIVE" version and not 1.1
+ getCMDV = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
+ Vnewfile = (File)service.execute(getCMDV);
+ assertEquals("Incorrect version number for file object ("+liveVersion+")", Vnewfile.getContent().getVersionNumber(), liveVersion);
}
/**
@@ -117,4 +135,14 @@
Command newFileSPCMD = service.getCommandFactory().createNewFileCommand(file, contentSP);
service.execute(newFileSPCMD);
}
+
+ /**
+ *
+ * @throws CMSException
+ */
+ private void updateFile(File updatedFile) throws CMSException
+ {
+ Command updateFileCMD = service.getCommandFactory().createUpdateFileCommand(updatedFile, updatedFile.getContent(), true);
+ service.execute(updateFileCMD);
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/build.xml 2007-09-18 17:26:04 UTC (rev 8331)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/build.xml 2007-09-18 17:36:25 UTC (rev 8332)
@@ -253,6 +253,7 @@
<fileset dir="${jcr.jcr.lib}" includes="jcr-1.0.jar"/>
<fileset dir="${apache.collections.lib}" includes="commons-collections.jar"/>
<fileset dir="${apache.lucene.lib}" includes="lucene.jar"/>
+ <fileset dir="${apache.ant.lib}" includes="ant.jar"/>
<!-- cms indexing integration -->
<fileset dir="${jackrabbit.jackrabbit.lib}" includes="jackrabbit-index-filters.jar"/>
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-09-18 17:26:04 UTC (rev 8331)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-09-18 17:36:25 UTC (rev 8332)
@@ -620,7 +620,7 @@
javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/pending_items.jsp");
prd.include(rReq, rRes);
- }
+ }
}
public void processAction(final JBossActionRequest aReq, final JBossActionResponse aRes) throws PortletException
@@ -1239,6 +1239,19 @@
aRes.setRenderParameter("path", aReq.getParameter("path"));
aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
}
+ else if(CMSAdminConstants.OP_MAKELIVE.equals(op))
+ {
+ String path = aReq.getParameter("path");
+ String language = aReq.getParameter("language");
+ String version = aReq.getParameter("version");
+
+ //Perform the change in live version here
+ Command makeLiveCommand = CMSService.getCommandFactory().createMakeLiveVersionCommand(path, language, version);
+ CMSService.execute(makeLiveCommand);
+
+ aRes.setRenderParameter("path", path);
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
+ }
}
else
{
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-09-18 17:26:04 UTC (rev 8331)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-09-18 17:36:25 UTC (rev 8332)
@@ -265,8 +265,18 @@
<img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/live.gif"
alt="${n:i18n("CMS_LIVEVERSION")}" border="0"/>
<%
- }
+ }else{
%>
+ <a href="<portlet:actionURL>
+ <portlet:param name="op" value="<%= CMSAdminConstants.OP_MAKELIVE %>"/>
+ <portlet:param name="path" value="<%= sCurrPath %>"/>
+ <portlet:param name="language" value="<%= content.getLocale().getLanguage() %>"/>
+ <portlet:param name="version" value="<%= version.getVersionNumber() %>"/>
+ </portlet:actionURL>"
+ >
+ <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/up.gif" alt="${n:i18n("CMS_LIVEVERSION")}" border="0"/>
+ </a>
+ <%}%>
</td>
<td>
<%
18 years, 7 months
JBoss Portal SVN: r8331 - trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-09-18 13:26:04 -0400 (Tue, 18 Sep 2007)
New Revision: 8331
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
Log:
- JBPORTAL-1642: removed action CSS classes in path bar that were still present.
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml 2007-09-18 17:24:12 UTC (rev 8330)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml 2007-09-18 17:26:04 UTC (rev 8331)
@@ -13,9 +13,9 @@
<h:form>
<h:panelGroup rendered="#{portalobjectmgr.selectedObject.type == PortalObject.TYPE_PAGE}"><h:commandLink
- action="editPageLayout" actionListener="#{portalobjectmgr.selectObject}">
- <h:outputText value="Page layout"/>
+ action="editPageLayout" actionListener="#{portalobjectmgr.selectObject}" styleClass="actionLayout">
<f:param name="id" value="#{portalobjectmgr.selectedObject.id}"/>
+ Page layout
</h:commandLink> | </h:panelGroup><h:commandLink action="editPageSecurity" styleClass="actionSecurity"
actionListener="#{portalobjectmgr.selectObject}">
<f:param name="id" value="#{portalobjectmgr.selectedObject.id}"/>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-09-18 17:24:12 UTC (rev 8330)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-09-18 17:26:04 UTC (rev 8331)
@@ -76,7 +76,7 @@
<h:commandLink action="#{instancemgr.selectInstance}">Portlet Instances</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionDetails">
+ <li class="selected">
<span class="objectName">#{instancemgr.selectedInstance.id}</span> portlet details
</li>
</ul>
@@ -103,7 +103,7 @@
<h:commandLink action="#{instancemgr.selectInstance}">Portlet Instances</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionPreferences">
+ <li class="selected">
<span class="objectName">#{instancemgr.selectedInstance.id}</span> preferences
</li>
</ul>
@@ -126,7 +126,7 @@
<h:commandLink action="#{instancemgr.selectInstance}">Portlet Instances</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionSecurity">
+ <li class="selected">
<span class="objectName">#{instancemgr.selectedInstance.id}</span> security settings
</li>
</ul>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-09-18 17:24:12 UTC (rev 8330)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-09-18 17:26:04 UTC (rev 8331)
@@ -96,7 +96,7 @@
<h:commandLink action="#{portletmgr.selectPortlet}">Portlet Definitions</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionDetails">
+ <li class="selected">
<span class="objectName">#{portletmgr.selectedPortlet.name.value}</span> details
</li>
</ul>
@@ -115,7 +115,7 @@
<h:commandLink action="#{portletmgr.selectPortlet}">Portlet Definitions</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionPreferences">
+ <li class="selected">
<span class="objectName">#{portletmgr.selectedPortlet.name.value}</span> preferences
</li>
</ul>
@@ -134,7 +134,7 @@
<h:commandLink action="#{portletmgr.selectPortlet}">Portlet Definitions</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionCreateInstance">
+ <li class="selected">
<span class="objectName">#{portletmgr.selectedPortlet.name.value}</span> instance creation
</li>
</ul>
18 years, 7 months
JBoss Portal SVN: r8330 - branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-09-18 13:24:12 -0400 (Tue, 18 Sep 2007)
New Revision: 8330
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
Log:
- JBPORTAL-1642: removed action CSS classes in path bar that were still present.
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml 2007-09-18 16:59:05 UTC (rev 8329)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml 2007-09-18 17:24:12 UTC (rev 8330)
@@ -13,9 +13,9 @@
<h:form>
<h:panelGroup rendered="#{portalobjectmgr.selectedObject.type == PortalObject.TYPE_PAGE}"><h:commandLink
- action="editPageLayout" actionListener="#{portalobjectmgr.selectObject}">
- <h:outputText value="Page layout"/>
+ action="editPageLayout" actionListener="#{portalobjectmgr.selectObject}" styleClass="actionLayout">
<f:param name="id" value="#{portalobjectmgr.selectedObject.id}"/>
+ Page layout
</h:commandLink> | </h:panelGroup><h:commandLink action="editPageSecurity" styleClass="actionSecurity"
actionListener="#{portalobjectmgr.selectObject}">
<f:param name="id" value="#{portalobjectmgr.selectedObject.id}"/>
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-09-18 16:59:05 UTC (rev 8329)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-09-18 17:24:12 UTC (rev 8330)
@@ -76,7 +76,7 @@
<h:commandLink action="#{instancemgr.selectInstance}">Portlet Instances</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionDetails">
+ <li class="selected">
<span class="objectName">#{instancemgr.selectedInstance.id}</span> portlet details
</li>
</ul>
@@ -103,7 +103,7 @@
<h:commandLink action="#{instancemgr.selectInstance}">Portlet Instances</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionPreferences">
+ <li class="selected">
<span class="objectName">#{instancemgr.selectedInstance.id}</span> preferences
</li>
</ul>
@@ -126,7 +126,7 @@
<h:commandLink action="#{instancemgr.selectInstance}">Portlet Instances</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionSecurity">
+ <li class="selected">
<span class="objectName">#{instancemgr.selectedInstance.id}</span> security settings
</li>
</ul>
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-09-18 16:59:05 UTC (rev 8329)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-09-18 17:24:12 UTC (rev 8330)
@@ -96,7 +96,7 @@
<h:commandLink action="#{portletmgr.selectPortlet}">Portlet Definitions</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionDetails">
+ <li class="selected">
<span class="objectName">#{portletmgr.selectedPortlet.name.value}</span> details
</li>
</ul>
@@ -115,7 +115,7 @@
<h:commandLink action="#{portletmgr.selectPortlet}">Portlet Definitions</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionPreferences">
+ <li class="selected">
<span class="objectName">#{portletmgr.selectedPortlet.name.value}</span> preferences
</li>
</ul>
@@ -134,7 +134,7 @@
<h:commandLink action="#{portletmgr.selectPortlet}">Portlet Definitions</h:commandLink>
</li>
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
- <li class="selected actionCreateInstance">
+ <li class="selected">
<span class="objectName">#{portletmgr.selectedPortlet.name.value}</span> instance creation
</li>
</ul>
18 years, 7 months
JBoss Portal SVN: r8329 - in modules/identity/trunk/build: ide/intellij/idea60/modules/identity and 1 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-09-18 12:59:05 -0400 (Tue, 18 Sep 2007)
New Revision: 8329
Modified:
modules/identity/trunk/build/build-thirdparty.xml
modules/identity/trunk/build/ide/intellij/idea60/modules/identity/identity.iml
modules/identity/trunk/build/ide/intellij/idea60/modules/sso/sso.iml
Log:
forgot to commit thirdparty update
Modified: modules/identity/trunk/build/build-thirdparty.xml
===================================================================
--- modules/identity/trunk/build/build-thirdparty.xml 2007-09-18 16:53:54 UTC (rev 8328)
+++ modules/identity/trunk/build/build-thirdparty.xml 2007-09-18 16:59:05 UTC (rev 8329)
@@ -76,7 +76,9 @@
<componentref name="josso" version="1.5"/>
<componentref name="apache-tomcat" version="5.5.20"/>
<componentref name="spring" version="2.0.3"/>
+ <componentref name="opensso" version="20070905-nightly"/>
+
</build>
<synchronizeinfo/>
Modified: modules/identity/trunk/build/ide/intellij/idea60/modules/identity/identity.iml
===================================================================
--- modules/identity/trunk/build/ide/intellij/idea60/modules/identity/identity.iml 2007-09-18 16:53:54 UTC (rev 8328)
+++ modules/identity/trunk/build/ide/intellij/idea60/modules/identity/identity.iml 2007-09-18 16:59:05 UTC (rev 8329)
@@ -154,6 +154,15 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-tomcat/lib/catalina.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: modules/identity/trunk/build/ide/intellij/idea60/modules/sso/sso.iml
===================================================================
--- modules/identity/trunk/build/ide/intellij/idea60/modules/sso/sso.iml 2007-09-18 16:53:54 UTC (rev 8328)
+++ modules/identity/trunk/build/ide/intellij/idea60/modules/sso/sso.iml 2007-09-18 16:59:05 UTC (rev 8329)
@@ -173,6 +173,24 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/opensso/lib/amclientsdk.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jbossas/core-libs/lib/jboss-common.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
18 years, 7 months
JBoss Portal SVN: r8328 - in modules/identity/trunk: identity/src/main/org/jboss/portal/identity and 4 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-09-18 12:53:54 -0400 (Tue, 18 Sep 2007)
New Revision: 8328
Added:
modules/identity/trunk/identity/src/main/org/jboss/portal/identity/helper/
modules/identity/trunk/identity/src/main/org/jboss/portal/identity/helper/IdentityTools.java
Modified:
modules/identity/trunk/identity/build.xml
modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/cas/CASAuthenticationValve.java
modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/josso/JOSSOLogoutValve.java
modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/opensso/OpenSSOAuthenticationValve.java
Log:
remove hardcoded portal URIs from sso integration
Modified: modules/identity/trunk/identity/build.xml
===================================================================
--- modules/identity/trunk/identity/build.xml 2007-09-18 16:50:10 UTC (rev 8327)
+++ modules/identity/trunk/identity/build.xml 2007-09-18 16:53:54 UTC (rev 8328)
@@ -100,6 +100,7 @@
<path refid="hibernate.hibernate.classpath"/>
<path refid="apache.log4j.classpath"/>
<path refid="junit.junit.classpath"/>
+ <path refid="apache.tomcat.classpath"/>
<pathelement location="${project.tools}/lib/ant.jar"/>
<!--<path refid="sun.opends.classpath"/>-->
</path>
Added: modules/identity/trunk/identity/src/main/org/jboss/portal/identity/helper/IdentityTools.java
===================================================================
--- modules/identity/trunk/identity/src/main/org/jboss/portal/identity/helper/IdentityTools.java (rev 0)
+++ modules/identity/trunk/identity/src/main/org/jboss/portal/identity/helper/IdentityTools.java 2007-09-18 16:53:54 UTC (rev 8328)
@@ -0,0 +1,76 @@
+/*
+* 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.identity.helper;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.deploy.SecurityConstraint;
+import org.apache.catalina.deploy.SecurityCollection;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class IdentityTools
+{
+
+ /**
+ * It returns all the urls from security-constraint part of web.xml
+ *
+ * @param context
+ * @return
+ */
+ public static Set findSecuredURLs(Context context)
+ {
+ Set urls = new HashSet();
+ SecurityConstraint[] constraints = context.findConstraints();
+
+ for (int i = 0; i < constraints.length; i++)
+ {
+ SecurityConstraint constraint = constraints[i];
+
+
+ SecurityCollection[] collections = constraint.findCollections();
+
+ for (int j = 0; j < collections.length; j++)
+ {
+ SecurityCollection collection = collections[j];
+
+ String[] patterns = collection.findPatterns();
+
+ for (int k = 0; k < patterns.length; k++)
+ {
+ String pattern = patterns[k];
+
+ // Remove wildcards
+ urls.add(pattern);
+ }
+ }
+
+ }
+
+ return urls;
+ }
+}
Modified: modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/cas/CASAuthenticationValve.java
===================================================================
--- modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/cas/CASAuthenticationValve.java 2007-09-18 16:50:10 UTC (rev 8327)
+++ modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/cas/CASAuthenticationValve.java 2007-09-18 16:53:54 UTC (rev 8328)
@@ -24,6 +24,9 @@
import java.util.List;
import java.util.ArrayList;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.HashSet;
import java.io.IOException;
import java.net.URLEncoder;
import java.security.Principal;
@@ -39,6 +42,7 @@
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.valves.ValveBase;
+import org.jboss.portal.identity.helper.IdentityTools;
import edu.yale.its.tp.cas.client.*;
@@ -49,6 +53,10 @@
*/
public class CASAuthenticationValve extends ValveBase
{
+ /** . */
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(CASAuthenticationValve.class);
+
+
/**
* The name of the filter initialization parameter the value of which should
* be the https: address of the CAS Login servlet. Optional parameter, but
@@ -170,6 +178,11 @@
/**
*
*/
+ private Set urlPatterns;
+
+ /**
+ *
+ */
private String authType = null;
/**
@@ -272,9 +285,7 @@
HttpSession session = httpRequest.getSession();
String requestURI = request.getRequestURI();
- if ((requestURI.indexOf("/auth/") != -1
- || requestURI.indexOf("/authsec/") != -1 || requestURI
- .indexOf("/sec/") != -1)
+ if (isSecuredURI(requestURI)
&& request.getParameter("ticket") == null
&& session.getAttribute(CAS_FILTER_USER) == null)
{
@@ -474,4 +485,45 @@
return serviceString;
}
+
+ private boolean isSecuredURI(String uri)
+ {
+ Set patterns = getSecuredUrlPatterns();
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Checking if requested uri '" + uri + "' matches secured url patterns: " + patterns);
+ }
+
+ for (Iterator iterator = patterns.iterator(); iterator.hasNext();)
+ {
+ String pattern = (String)iterator.next();
+
+ if (uri.indexOf(pattern) != -1)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ public Set getSecuredUrlPatterns()
+ {
+ if (urlPatterns == null)
+ {
+ urlPatterns = IdentityTools.findSecuredURLs((Context)this.container);
+
+ //Remove wildcards
+ Set urls = new HashSet();
+ for (Iterator iterator = urlPatterns.iterator(); iterator.hasNext();)
+ {
+ String pattern = (String)iterator.next();
+ urls.add(pattern.replaceAll("\\*",""));
+ }
+ urlPatterns = urls;
+ }
+
+ return urlPatterns;
+ }
}
Modified: modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/josso/JOSSOLogoutValve.java
===================================================================
--- modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/josso/JOSSOLogoutValve.java 2007-09-18 16:50:10 UTC (rev 8327)
+++ modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/josso/JOSSOLogoutValve.java 2007-09-18 16:53:54 UTC (rev 8328)
@@ -81,7 +81,7 @@
// continue processing the request
this.getNext().invoke(request, response);
- if(httpRequest.getRequestURI().endsWith("/signout"))
+ if(request.getAttribute("org.jboss.portal.logout") != null)
{
String jossoLogout = httpRequest.getContextPath() + org.josso.agent.Constants.JOSSO_LOGOUT_URI;
Modified: modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/opensso/OpenSSOAuthenticationValve.java
===================================================================
--- modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/opensso/OpenSSOAuthenticationValve.java 2007-09-18 16:50:10 UTC (rev 8327)
+++ modules/identity/trunk/sso/src/main/org/jboss/portal/identity/sso/opensso/OpenSSOAuthenticationValve.java 2007-09-18 16:53:54 UTC (rev 8328)
@@ -28,6 +28,7 @@
import org.apache.catalina.Context;
import org.apache.catalina.Session;
import org.apache.catalina.authenticator.Constants;
+import org.jboss.portal.identity.helper.IdentityTools;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -35,6 +36,9 @@
import javax.security.jacc.PolicyContext;
import java.io.IOException;
import java.security.Principal;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.HashSet;
import com.iplanet.sso.SSOTokenManager;
import com.iplanet.sso.SSOToken;
@@ -50,6 +54,8 @@
public static final String WEB_REQUEST_KEY = "javax.servlet.http.HttpServletRequest";
+ private Set urlPatterns;
+
private String loginURL;
private String logoutURL;
@@ -73,11 +79,9 @@
// When token is not present and secured portal url is requested
- if ((requestURI.indexOf("/auth/") != -1
- || requestURI.indexOf("/authsec/") != -1 || requestURI
- .indexOf("/sec/") != -1)
- && token == null)
+ if (isSecuredURI(requestURI) && token == null)
{
+
// Perform OpenSSO login by going to the OpenSSO authentication server
redirectToOpenSSOLogin(request, response);
@@ -115,7 +119,7 @@
// Signout request
- if ((token != null && (!isTokenValid(token) || request.getRequestURI().endsWith("/signout"))))
+ if ((token != null && (!isTokenValid(token) || request.getAttribute("org.jboss.portal.logout") != null)))
{
destroyToken(token);
redirectToOpenSSOLogout(request,response);
@@ -257,6 +261,47 @@
}
}
+ private boolean isSecuredURI(String uri)
+ {
+ Set patterns = getSecuredUrlPatterns();
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Checking if requested uri '" + uri + "' matches secured url patterns: " + patterns);
+ }
+
+ for (Iterator iterator = patterns.iterator(); iterator.hasNext();)
+ {
+ String pattern = (String)iterator.next();
+
+ if (uri.indexOf(pattern) != -1)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ public Set getSecuredUrlPatterns()
+ {
+ if (urlPatterns == null)
+ {
+ urlPatterns = IdentityTools.findSecuredURLs((Context)this.container);
+
+ //Remove wildcards
+ Set urls = new HashSet();
+ for (Iterator iterator = urlPatterns.iterator(); iterator.hasNext();)
+ {
+ String pattern = (String)iterator.next();
+ urls.add(pattern.replaceAll("\\*",""));
+ }
+ urlPatterns = urls;
+ }
+
+ return urlPatterns;
+ }
+
/**
* Register an authenticated Principal and authentication type in our
* request, in the current session (if there is one), and with our
18 years, 7 months
JBoss Portal SVN: r8327 - trunk/core/src/bin/portal-core-war/themes/renaissance.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2007-09-18 12:50:10 -0400 (Tue, 18 Sep 2007)
New Revision: 8327
Modified:
trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
Log:
mirror change from 2.6 branch
Modified: trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
===================================================================
--- trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css 2007-09-18 16:49:24 UTC (rev 8326)
+++ trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css 2007-09-18 16:50:10 UTC (rev 8327)
@@ -274,12 +274,12 @@
font: 11px / normal Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: bold;
color: #8a8a8a;
- line-height: 22px;
padding: 5px 15px 3px 15px; /*background-image: url(../images/tab_left.gif);*/
background-repeat: no-repeat;
background-position: top left;
width: 110px;
white-space: nowrap;
+ line-height: 22px;
}
ul#tabsHeader a:hover {
@@ -303,6 +303,7 @@
color: #000; /* background-image: url(../images/tab_left_current.gif); */
background-repeat: no-repeat;
background-position: top left;
+ line-height: 22px;
}
/* Begin Submenu selectors */
18 years, 7 months
JBoss Portal SVN: r8326 - in branches/JBoss_Portal_Branch_2_6: portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet and 1 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-09-18 12:49:24 -0400 (Tue, 18 Sep 2007)
New Revision: 8326
Added:
branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/aspects/server/SignOutInterceptor.java
Removed:
branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/aspects/server/SessionInvalidatorInterceptor.java
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/JBoss_Portal_Branch_2_6/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/ContextTrackerInterceptor.java
Log:
Rename SessionInvalidationInterceptor to SignOutInterceptor and make it notify about logout using request attribute
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-09-18 16:34:41 UTC (rev 8325)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-09-18 16:49:24 UTC (rev 8326)
@@ -115,7 +115,7 @@
<xmbean/>
</mbean>
<mbean
- code="org.jboss.portal.server.aspects.server.SessionInvalidatorInterceptor"
+ code="org.jboss.portal.server.aspects.server.SignOutInterceptor"
name="portal:service=Interceptor,type=Server,name=SessionInvalidator"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: branches/JBoss_Portal_Branch_2_6/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/ContextTrackerInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/ContextTrackerInterceptor.java 2007-09-18 16:34:41 UTC (rev 8325)
+++ branches/JBoss_Portal_Branch_2_6/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/ContextTrackerInterceptor.java 2007-09-18 16:49:24 UTC (rev 8326)
@@ -40,7 +40,7 @@
String contextPath = (String)invocation.getDispatchedRequest().getAttribute("javax.servlet.include.context_path");
// Add it to the request context path set
- org.jboss.portal.server.aspects.server.SessionInvalidatorInterceptor.getSet().add(contextPath);
+ org.jboss.portal.server.aspects.server.SignOutInterceptor.getSet().add(contextPath);
// Invoke next command
return invocation.invokeNext();
Deleted: branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/aspects/server/SessionInvalidatorInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/aspects/server/SessionInvalidatorInterceptor.java 2007-09-18 16:34:41 UTC (rev 8325)
+++ branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/aspects/server/SessionInvalidatorInterceptor.java 2007-09-18 16:49:24 UTC (rev 8326)
@@ -1,196 +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.server.aspects.server;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.server.ServerInterceptor;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerInvocationContext;
-import org.jboss.portal.web.RequestDispatchCallback;
-import org.jboss.portal.web.ServletContainerFactory;
-import org.jboss.portal.web.ServletContainer;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * This interceptor implementation is used to keep track of all webapp the current user has used during its portal
- * session. When the invocation is tagged for a signout then it performs an additional task of invalidating the sessions
- * of the webapp that have been collected during the portal session as well as invalidating the current portal session.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class SessionInvalidatorInterceptor extends ServerInterceptor
-{
-
- /** . */
- private static final Invalidation invalidator = new Invalidation();
-
- /** . */
- private static final Logger log = Logger.getLogger(SessionInvalidatorInterceptor.class);
-
- /** . */
- private static final String KEY = "org.jboss.portal.session.contexts";
-
- /** . */
- private static final ThreadLocal localContexts = new ThreadLocal()
- {
- protected Object initialValue()
- {
- return new HashSet();
- }
- };
-
- public static Set getSet()
- {
- return (Set)localContexts.get();
- }
-
- /** . */
- private ServletContainerFactory servletContainerFactory;
-
- public ServletContainerFactory getServletContainerFactory()
- {
- return servletContainerFactory;
- }
-
- public void setServletContainerFactory(ServletContainerFactory servletContainerFactory)
- {
- this.servletContainerFactory = servletContainerFactory;
- }
-
- protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
- {
- try
- {
- getSet().clear();
-
- //
- invocation.invokeNext();
- }
- finally
- {
- after(invocation);
- }
- }
-
- private void after(ServerInvocation invocation)
- {
- // Put the contexts that have been used during this invocation into the global set
- ServerInvocationContext context = invocation.getServerContext();
- HttpSession session = context.getClientRequest().getSession();
- Set contexts = (Set)session.getAttribute(KEY);
- if (contexts == null)
- {
- contexts = new HashSet();
- session.setAttribute(KEY, contexts);
- }
- contexts.addAll(getSet());
- getSet().clear();
-
- // If the invocation has been set to signout then perform the invalidations
- if (invocation.getResponse().getWantSignOut())
- {
- // Get portal context
- ServletContext portalContext = session.getServletContext();
-
- //
- HttpServletRequest req = invocation.getServerContext().getClientRequest();
-
- //
- HttpServletResponse resp = invocation.getServerContext().getClientResponse();
-
- // Iterate over all the context that have been used
- for (Iterator i = contexts.iterator(); i.hasNext();)
- {
- String dispatchContextName = (String)i.next();
-
- // Get the context
- ServletContext dispatchContext = portalContext.getContext(dispatchContextName);
-
- // The context could be null if the web app has been removed after the web app has been tracked
- if (dispatchContext != null)
- {
- try
- {
- ServletContainer servletContainer = servletContainerFactory.getServletContainer();
-
- // Execute the command that invalidates the session
- servletContainer.include(dispatchContext, req, resp, invalidator, null);
- }
- catch (Exception e)
- {
- log.error("An error occured when trying to invalidate the session", e);
- }
- }
- }
-
- //Finally invalidate this session
- try
- {
- session.invalidate();
- }
- catch(IllegalStateException stateException)
- {
- if(stateException.toString().indexOf("invalidate: Session already invalidated") != -1)
- {
- //This means Tomcat SSO is probably turned on and part of invalidating the other war context's
- //session, this Portal's session has been invalidated as well
-
- //No need to do anything
- }
- else
- {
- //This is a real issue, don't eat this
- throw stateException;
- }
- }
- }
- }
-
- public static class Invalidation implements RequestDispatchCallback
- {
- public Object doCallback(ServletContext servletContext, HttpServletRequest req, HttpServletResponse resp, Object handback) throws ServletException, IOException
- {
- HttpSession session = req.getSession(false);
-
- //
- if (session != null)
- {
- session.invalidate();
- }
-
- //
- return null;
- }
- }
-}
Copied: branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/aspects/server/SignOutInterceptor.java (from rev 8297, branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/aspects/server/SessionInvalidatorInterceptor.java)
===================================================================
--- branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/aspects/server/SignOutInterceptor.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/aspects/server/SignOutInterceptor.java 2007-09-18 16:49:24 UTC (rev 8326)
@@ -0,0 +1,199 @@
+/******************************************************************************
+ * 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.server.aspects.server;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.server.ServerInterceptor;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.web.RequestDispatchCallback;
+import org.jboss.portal.web.ServletContainerFactory;
+import org.jboss.portal.web.ServletContainer;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * This interceptor implementation is used to keep track of all webapp the current user has used during its portal
+ * session. When the invocation is tagged for a signout then it performs an additional task of invalidating the sessions
+ * of the webapp that have been collected during the portal session as well as invalidating the current portal session.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class SignOutInterceptor extends ServerInterceptor
+{
+
+ /** . */
+ private static final Invalidation invalidator = new Invalidation();
+
+ /** . */
+ private static final Logger log = Logger.getLogger(SignOutInterceptor.class);
+
+ /** . */
+ private static final String KEY = "org.jboss.portal.session.contexts";
+
+ /** . */
+ private static final ThreadLocal localContexts = new ThreadLocal()
+ {
+ protected Object initialValue()
+ {
+ return new HashSet();
+ }
+ };
+
+ public static Set getSet()
+ {
+ return (Set)localContexts.get();
+ }
+
+ /** . */
+ private ServletContainerFactory servletContainerFactory;
+
+ public ServletContainerFactory getServletContainerFactory()
+ {
+ return servletContainerFactory;
+ }
+
+ public void setServletContainerFactory(ServletContainerFactory servletContainerFactory)
+ {
+ this.servletContainerFactory = servletContainerFactory;
+ }
+
+ protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
+ {
+ try
+ {
+ getSet().clear();
+
+ //
+ invocation.invokeNext();
+ }
+ finally
+ {
+ after(invocation);
+ }
+ }
+
+ private void after(ServerInvocation invocation)
+ {
+ // Put the contexts that have been used during this invocation into the global set
+ ServerInvocationContext context = invocation.getServerContext();
+ HttpSession session = context.getClientRequest().getSession();
+ Set contexts = (Set)session.getAttribute(KEY);
+ if (contexts == null)
+ {
+ contexts = new HashSet();
+ session.setAttribute(KEY, contexts);
+ }
+ contexts.addAll(getSet());
+ getSet().clear();
+
+ // If the invocation has been set to signout then perform the invalidations
+ if (invocation.getResponse().getWantSignOut())
+ {
+ // Get portal context
+ ServletContext portalContext = session.getServletContext();
+
+ //
+ HttpServletRequest req = invocation.getServerContext().getClientRequest();
+
+ //
+ HttpServletResponse resp = invocation.getServerContext().getClientResponse();
+
+ // Iterate over all the context that have been used
+ for (Iterator i = contexts.iterator(); i.hasNext();)
+ {
+ String dispatchContextName = (String)i.next();
+
+ // Get the context
+ ServletContext dispatchContext = portalContext.getContext(dispatchContextName);
+
+ // The context could be null if the web app has been removed after the web app has been tracked
+ if (dispatchContext != null)
+ {
+ try
+ {
+ ServletContainer servletContainer = servletContainerFactory.getServletContainer();
+
+ // Execute the command that invalidates the session
+ servletContainer.include(dispatchContext, req, resp, invalidator, null);
+ }
+ catch (Exception e)
+ {
+ log.error("An error occured when trying to invalidate the session", e);
+ }
+ }
+ }
+
+ //Finally invalidate this session
+ try
+ {
+ session.invalidate();
+ }
+ catch(IllegalStateException stateException)
+ {
+ if(stateException.toString().indexOf("invalidate: Session already invalidated") != -1)
+ {
+ //This means Tomcat SSO is probably turned on and part of invalidating the other war context's
+ //session, this Portal's session has been invalidated as well
+
+ //No need to do anything
+ }
+ else
+ {
+ //This is a real issue, don't eat this
+ throw stateException;
+ }
+ }
+
+ // Set information about logout
+ req.setAttribute("org.jboss.portal.logout", "true");
+ }
+ }
+
+ public static class Invalidation implements RequestDispatchCallback
+ {
+ public Object doCallback(ServletContext servletContext, HttpServletRequest req, HttpServletResponse resp, Object handback) throws ServletException, IOException
+ {
+ HttpSession session = req.getSession(false);
+
+ //
+ if (session != null)
+ {
+ session.invalidate();
+ }
+
+ //
+ return null;
+ }
+ }
+}
Property changes on: branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/aspects/server/SignOutInterceptor.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
18 years, 7 months