|
From: <fg...@us...> - 2007-12-02 16:48:49
|
Revision: 512
http://openutils.svn.sourceforge.net/openutils/?rev=512&view=rev
Author: fgiust
Date: 2007-12-02 08:48:54 -0800 (Sun, 02 Dec 2007)
Log Message:
-----------
[maven-release-plugin] copy for tag openutils-mgnlstripes-3.5-rc2
Added Paths:
-----------
tags/openutils-mgnlstripes-3.5-rc2/
tags/openutils-mgnlstripes-3.5-rc2/pom.xml
tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MagnoliaMultipartWrapper.java
tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java
tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesMagnoliaFilter.java
tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java
tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java
tags/openutils-mgnlstripes-3.5-rc2/src/main/resources/mgnl-bootstrap/stripes/config.server.filters.stripes.xml
Removed Paths:
-------------
tags/openutils-mgnlstripes-3.5-rc2/pom.xml
tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java
tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesModule.java
tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java
tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/AddMimeMappingTask.java
tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java
Copied: tags/openutils-mgnlstripes-3.5-rc2 (from rev 509, trunk/openutils-mgnlstripes)
Deleted: tags/openutils-mgnlstripes-3.5-rc2/pom.xml
===================================================================
--- trunk/openutils-mgnlstripes/pom.xml 2007-11-14 14:17:57 UTC (rev 509)
+++ tags/openutils-mgnlstripes-3.5-rc2/pom.xml 2007-12-02 16:48:54 UTC (rev 512)
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils</artifactId>
- <version>4</version>
- <relativePath>..</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <packaging>jar</packaging>
- <artifactId>openutils-mgnlstripes</artifactId>
- <name>openutils-mgnlstripes</name>
- <version>0.3-SNAPSHOT</version>
- <build>
- <resources>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
- <filtering>true</filtering>
- <directory>src/main/resources</directory>
- <includes>
- <include>META-INF/magnolia/*</include>
- </includes>
- </resource>
- </resources>
- </build>
- <dependencies>
- <dependency>
- <groupId>net.sourceforge.stripes</groupId>
- <artifactId>stripes</artifactId>
- <version>1.4.3</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>info.magnolia</groupId>
- <artifactId>magnolia-core</artifactId>
- <version>3.1-m3</version>
- </dependency>
- <dependency>
- <groupId>info.magnolia</groupId>
- <artifactId>magnolia-module-admininterface</artifactId>
- <version>3.1-m3</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jsp-api</artifactId>
- <version>2.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <classifier>jdk15</classifier>
- <version>5.1</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-</project>
Copied: tags/openutils-mgnlstripes-3.5-rc2/pom.xml (from rev 511, trunk/openutils-mgnlstripes/pom.xml)
===================================================================
--- tags/openutils-mgnlstripes-3.5-rc2/pom.xml (rev 0)
+++ tags/openutils-mgnlstripes-3.5-rc2/pom.xml 2007-12-02 16:48:54 UTC (rev 512)
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils</artifactId>
+ <version>4</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+ <artifactId>openutils-mgnlstripes</artifactId>
+ <name>openutils-mgnlstripes</name>
+ <version>3.5-rc2</version>
+ <licenses>
+ <license>
+ <name>GPLv3</name>
+ <url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
+ </license>
+ </licenses>
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>META-INF/magnolia/*</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.stripes</groupId>
+ <artifactId>stripes</artifactId>
+ <version>1.4.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>info.magnolia</groupId>
+ <artifactId>magnolia-core</artifactId>
+ <version>3.5-rc2</version>
+ </dependency>
+ <dependency>
+ <groupId>info.magnolia</groupId>
+ <artifactId>magnolia-module-admininterface</artifactId>
+ <version>3.5-rc2</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <classifier>jdk15</classifier>
+ <version>5.1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>repository.magnolia.info</id>
+ <name>magnolia repository</name>
+ <url>http://svn.magnolia.info/maven/m2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <scm>
+ <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlstripes-3.5-rc2</connection>
+ <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlstripes-3.5-rc2</developerConnection>
+ <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-mgnlstripes-3.5-rc2</url>
+ </scm>
+</project>
Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MagnoliaMultipartWrapper.java (from rev 510, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/MagnoliaMultipartWrapper.java)
===================================================================
--- tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MagnoliaMultipartWrapper.java (rev 0)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MagnoliaMultipartWrapper.java 2007-12-02 16:48:54 UTC (rev 512)
@@ -0,0 +1,179 @@
+package it.openutils.magnoliastripes;
+
+import info.magnolia.cms.beans.runtime.Document;
+import info.magnolia.cms.beans.runtime.MultipartForm;
+import info.magnolia.context.Context;
+import info.magnolia.context.MgnlContext;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+
+import net.sourceforge.stripes.action.FileBean;
+import net.sourceforge.stripes.controller.FileUploadLimitExceededException;
+import net.sourceforge.stripes.controller.multipart.MultipartWrapper;
+
+import org.apache.commons.io.IOUtils;
+
+
+/**
+ * An implementation of MultipartWrapper that delegates to the standard magnolia multipart form handling.
+ * @author fgiust
+ * @version $Id: $
+ */
+public class MagnoliaMultipartWrapper implements MultipartWrapper
+{
+
+ /**
+ * Nothing to do here {@inheritDoc}
+ */
+ public void build(HttpServletRequest request, File tempDir, long maxPostSize) throws IOException,
+ FileUploadLimitExceededException
+ {
+ // nothing to do, already provided by magnolia
+
+ }
+
+ private MultipartForm getForm()
+ {
+ return (MultipartForm) MgnlContext.getAttribute(MultipartForm.REQUEST_ATTRIBUTE_NAME, Context.LOCAL_SCOPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public Enumeration<String> getParameterNames()
+ {
+ return getForm().getParameterNames();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String[] getParameterValues(String name)
+ {
+ return getForm().getParameterValues(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public Enumeration<String> getFileParameterNames()
+ {
+ return new IteratorEnumeration(getForm().getDocuments().keySet().iterator());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public FileBean getFileParameterValue(String name)
+ {
+ final Document item = getForm().getDocument(name);
+ if (item == null)
+ {
+ return null;
+ }
+ else
+ {
+ // Use an anonymous inner subclass of FileBean that overrides all the
+ // methods that rely on having a File present, to use the FileItem
+ // created by commons upload instead.
+ return new FileBean(null, item.getType(), item.getFileNameWithExtension())
+ {
+
+ @Override
+ public long getSize()
+ {
+ return item.getLength();
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException
+ {
+ return item.getStream();
+ }
+
+ @Override
+ public void save(File toFile) throws IOException
+ {
+ OutputStream os = null;
+ InputStream is = null;
+ try
+ {
+ os = new BufferedOutputStream(new FileOutputStream(toFile));
+ is = item.getStream();
+ IOUtils.copyLarge(is, os);
+
+ delete();
+ }
+ catch (Exception e)
+ {
+ if (e instanceof IOException)
+ {
+ throw (IOException) e;
+ }
+ else
+ {
+ IOException ioe = new IOException("Problem saving uploaded file.");
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+ finally
+ {
+ IOUtils.closeQuietly(is);
+ IOUtils.closeQuietly(os);
+ }
+ }
+
+ @Override
+ public void delete() throws IOException
+ {
+ item.delete();
+ }
+ };
+ }
+ }
+
+ /**
+ * Little helper class to create an enumeration as per the interface.
+ */
+ private static class IteratorEnumeration implements Enumeration<String>
+ {
+
+ Iterator<String> iterator;
+
+ /**
+ * Constructs an enumeration that consumes from the underlying iterator.
+ */
+ IteratorEnumeration(Iterator<String> iterator)
+ {
+ this.iterator = iterator;
+ }
+
+ /**
+ * Returns true if more elements can be consumed, false otherwise.
+ */
+ public boolean hasMoreElements()
+ {
+ return this.iterator.hasNext();
+ }
+
+ /**
+ * Gets the next element out of the iterator.
+ */
+ public String nextElement()
+ {
+ return this.iterator.next();
+ }
+ }
+}
Deleted: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java
===================================================================
--- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java 2007-11-14 14:17:57 UTC (rev 509)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java 2007-12-02 16:48:54 UTC (rev 512)
@@ -1,79 +0,0 @@
-package it.openutils.magnoliastripes;
-
-import info.magnolia.cms.beans.config.Paragraph;
-import info.magnolia.cms.beans.config.ParagraphManager;
-import net.sourceforge.stripes.action.ActionBean;
-import net.sourceforge.stripes.controller.NameBasedActionResolver;
-
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * ActionResolver that extends <code>NameBasedActionResolver</code>, registering any found Stripe action as a
- * Magnolia paragraph.
- * @author fgiust
- * @version $Id: $
- */
-public class MgnlActionResolver extends NameBasedActionResolver
-{
-
- /**
- * Logger.
- */
- private Logger log = LoggerFactory.getLogger(MgnlActionResolver.class);
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void addActionBean(Class< ? extends ActionBean> clazz)
- {
- String binding = getUrlBinding(clazz);
-
- // Only process the class if it's properly annotated
- if (binding != null)
- {
- String dialogName = actionNameToParagraphName(binding);
- registerSpringParagraph(dialogName, binding);
- super.addActionBean(clazz);
- }
- }
-
- /**
- * Generate a paragraph name from a Stripes binding. This method will take the last token after "/", strip any
- * extension and convert everything to lowercase.
- * @param binding Stripe action binding
- * @return paragraph name
- */
- protected String actionNameToParagraphName(String binding)
- {
- String dialogName = StringUtils.lowerCase(StringUtils.substringBeforeLast(StringUtils.substringAfterLast(
- binding,
- "/"), "."));
- return dialogName;
- }
-
- /**
- * Registers a Magnolia paragraph which will delegate to a Stripe action.
- * @param name dialog name
- * @param binding Stripes action binding
- */
- @SuppressWarnings("unchecked")
- private void registerSpringParagraph(String name, String binding)
- {
- Paragraph paragraph = new Paragraph();
-
- paragraph.setName(name);
- paragraph.setTitle("paragraph." + name + ".title");
- paragraph.setDescription("paragraph." + name + ".description");
- paragraph.setDialog(name);
- paragraph.setTemplatePath(binding);
- paragraph.setType("stripes");
-
- log.info("Registering stripes paragraph {}", paragraph.getName()); //$NON-NLS-1$
- ParagraphManager.getInstance().getParagraphs().put(paragraph.getName(), paragraph);
- }
-
-}
Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java (from rev 510, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java)
===================================================================
--- tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java (rev 0)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java 2007-12-02 16:48:54 UTC (rev 512)
@@ -0,0 +1,99 @@
+package it.openutils.magnoliastripes;
+
+import info.magnolia.cms.beans.config.Paragraph;
+import info.magnolia.cms.beans.config.ParagraphManager;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import net.sourceforge.stripes.action.ActionBean;
+import net.sourceforge.stripes.controller.NameBasedActionResolver;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * ActionResolver that extends <code>NameBasedActionResolver</code>, registering any found Stripe action as a
+ * Magnolia paragraph.
+ * @author fgiust
+ * @version $Id: $
+ */
+public class MgnlActionResolver extends NameBasedActionResolver
+{
+
+ /**
+ * Logger.
+ */
+ private static Logger log = LoggerFactory.getLogger(MgnlActionResolver.class);
+
+ /**
+ * Configured Stripes paragraphs.
+ */
+ private static Set<Paragraph> paragraphs = new HashSet<Paragraph>();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void addActionBean(Class< ? extends ActionBean> clazz)
+ {
+ String binding = getUrlBinding(clazz);
+
+ // Only process the class if it's properly annotated
+ if (binding != null)
+ {
+ String dialogName = actionNameToParagraphName(binding);
+ collectStripesParagraphs(dialogName, binding);
+ super.addActionBean(clazz);
+ }
+ }
+
+ /**
+ * Generate a paragraph name from a Stripes binding. This method will take the last token after "/", strip any
+ * extension and convert everything to lowercase.
+ * @param binding Stripe action binding
+ * @return paragraph name
+ */
+ protected String actionNameToParagraphName(String binding)
+ {
+ String dialogName = StringUtils.lowerCase(StringUtils.substringBeforeLast(StringUtils.substringAfterLast(
+ binding,
+ "/"), "."));
+ return dialogName;
+ }
+
+ /**
+ * Registers a Magnolia paragraph which will delegate to a Stripe action.
+ * @param name dialog name
+ * @param binding Stripes action binding
+ */
+ @SuppressWarnings("unchecked")
+ private void collectStripesParagraphs(String name, String binding)
+ {
+ Paragraph paragraph = new Paragraph();
+
+ paragraph.setName(name);
+ paragraph.setTitle("paragraph." + name + ".title");
+ paragraph.setDescription("paragraph." + name + ".description");
+ paragraph.setDialog(name);
+ paragraph.setTemplatePath(binding);
+ paragraph.setType("stripes");
+ paragraphs.add(paragraph);
+
+ log.info("Registering stripes paragraph {}", paragraph.getName()); //$NON-NLS-1$
+ ParagraphManager.getInstance().getParagraphs().put(paragraph.getName(), paragraph);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void registerParagraphs()
+ {
+ for (Paragraph paragraph : paragraphs)
+ {
+ log.info("Registering stripes paragraph {}", paragraph.getName()); //$NON-NLS-1$
+ ParagraphManager.getInstance().getParagraphs().put(paragraph.getName(), paragraph);
+ }
+ }
+
+}
Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesMagnoliaFilter.java (from rev 510, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesMagnoliaFilter.java)
===================================================================
--- tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesMagnoliaFilter.java (rev 0)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesMagnoliaFilter.java 2007-12-02 16:48:54 UTC (rev 512)
@@ -0,0 +1,96 @@
+package it.openutils.magnoliastripes;
+
+import info.magnolia.cms.filters.MgnlFilter;
+import info.magnolia.context.MgnlContext;
+import info.magnolia.context.WebContext;
+import info.magnolia.voting.Voter;
+import info.magnolia.voting.Voting;
+
+import javax.servlet.http.HttpServletRequest;
+
+import net.sourceforge.stripes.controller.StripesFilter;
+import net.sourceforge.stripes.controller.StripesRequestWrapper;
+import net.sourceforge.stripes.exception.StripesServletException;
+
+import org.apache.commons.lang.ArrayUtils;
+
+
+/**
+ * @author fgiust
+ * @version $Id: $
+ */
+public class StripesMagnoliaFilter extends StripesFilter implements MgnlFilter
+{
+
+ private String name;
+
+ private Voter[] bypasses = new Voter[0];
+
+ private boolean enabled = true;
+
+ public boolean bypasses(HttpServletRequest request)
+ {
+ if (!isEnabled())
+ {
+ return true;
+ }
+ if (MgnlContext.hasInstance())
+ {
+ return Voting.Factory.getDefaultVoting().vote(bypasses, request) > 0;
+ }
+ return false;
+ }
+
+ public Voter[] getBypasses()
+ {
+ return this.bypasses;
+ }
+
+ public void addBypass(Voter voter)
+ {
+ this.bypasses = (Voter[]) ArrayUtils.add(this.bypasses, voter);
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public boolean isEnabled()
+ {
+ return this.enabled;
+ }
+
+ public void setEnabled(boolean enabled)
+ {
+ this.enabled = enabled;
+ }
+
+ /**
+ * Wraps the HttpServletRequest with a StripesServletRequest. This is done to ensure that any form posts that
+ * contain file uploads get handled appropriately.
+ * @param servletRequest the HttpServletRequest handed to the dispatcher by the container
+ * @return an instance of StripesRequestWrapper, which is an HttpServletRequestWrapper
+ * @throws StripesServletException if the wrapper cannot be constructed
+ */
+ @Override
+ protected StripesRequestWrapper wrapRequest(HttpServletRequest servletRequest) throws StripesServletException
+ {
+ StripesRequestWrapper srw = new StripesRequestWrapper(servletRequest);
+
+ if (MgnlContext.hasInstance())
+ {
+ // be sure that the request wrapper gets setted in mgnlcontext too
+ WebContext webContext = (WebContext) MgnlContext.getInstance();
+ webContext.init(servletRequest, webContext.getResponse(), webContext.getServletContext());
+ }
+
+ return srw;
+ }
+
+}
Deleted: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesModule.java
===================================================================
--- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesModule.java 2007-11-14 14:17:57 UTC (rev 509)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesModule.java 2007-12-02 16:48:54 UTC (rev 512)
@@ -1,23 +0,0 @@
-package it.openutils.magnoliastripes;
-
-import info.magnolia.module.ModuleLifecycle;
-import info.magnolia.module.ModuleLifecycleContext;
-
-
-/**
- * Stripes module.
- * @author fgiust
- * @version $Id: $
- */
-public class StripesModule implements ModuleLifecycle
-{
-
- /**
- * {@inheritDoc}
- */
- public void start(ModuleLifecycleContext moduleLifecycleContext)
- {
- // anything to do?
- }
-
-}
\ No newline at end of file
Deleted: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java
===================================================================
--- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java 2007-11-14 14:17:57 UTC (rev 509)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java 2007-12-02 16:48:54 UTC (rev 512)
@@ -1,333 +0,0 @@
-package it.openutils.magnoliastripes;
-
-import info.magnolia.cms.beans.config.Paragraph;
-import info.magnolia.cms.beans.runtime.ParagraphRenderer;
-import info.magnolia.cms.core.Content;
-import info.magnolia.cms.core.NodeData;
-import info.magnolia.context.MgnlContext;
-import info.magnolia.context.WebContext;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Stack;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.PageContext;
-
-import net.sourceforge.stripes.action.ActionBeanContext;
-import net.sourceforge.stripes.action.Resolution;
-import net.sourceforge.stripes.config.Configuration;
-import net.sourceforge.stripes.controller.DispatcherHelper;
-import net.sourceforge.stripes.controller.DispatcherServlet;
-import net.sourceforge.stripes.controller.ExecutionContext;
-import net.sourceforge.stripes.controller.LifecycleStage;
-import net.sourceforge.stripes.controller.StripesConstants;
-import net.sourceforge.stripes.controller.StripesFilter;
-import net.sourceforge.stripes.exception.StripesServletException;
-import net.sourceforge.stripes.validation.BooleanTypeConverter;
-
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * <p>
- * A Magnolia paragraph renderer that delegates to Stripes actions. Most of the code is just a cut and paste from
- * Stripes' {@link DispatcherServlet}, adapted to work withing magnolia by:
- * </p>
- * <ul>
- * <li>wrap the request in order to modify the request path and provide a custom requestDispatcher</li>
- * <li>wrap the response in order to provide a custom Writer</li>
- * <li>use a fake servlet instance/context to setup a Stripe context (there is no servlet here)</li>
- * <li>injiect any paragraph property as a parameter</li>
- * </ul>
- * <p>
- * <strong>Todo:</strong>
- * </p>
- * <ul>
- * <li>Handle multipart forms in request wrapper (should be easy to do)</li>
- * <li>A better way of handling multivalued properties in paragraph</li>
- * <li>Handle binary properties in paragraph</li>
- * </ul>
- * @author fgiust
- * @version $Id: $
- */
-public class StripesParagraphRenderer implements ParagraphRenderer
-{
-
- private Boolean alwaysInvokeValidate;
-
- /**
- * Logger.
- */
- private Logger log = LoggerFactory.getLogger(StripesParagraphRenderer.class);
-
- /**
- * <p>
- * Invokes the following instance level methods in order to coordinate the processing of requests:
- * </p>
- * <ul>
- * <li>{@link #resolveActionBean(ExecutionContext)}</li>
- * <li>{@link #resolveHandler(ExecutionContext)}</li>
- * <li>{@link #doBindingAndValidation(ExecutionContext)}</li>
- * <li>{@link #doCustomValidation(ExecutionContext)}</li>
- * <li>{@link #handleValidationErrors(ExecutionContext)}</li>
- * <li>{@link #invokeEventHandler(ExecutionContext)}</li>
- * </ul>
- * <p>
- * If any of the above methods return a {@link Resolution} the rest of the request processing is aborted and the
- * resolution is executed.
- * </p>
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public void render(Content content, Paragraph paragraph, Writer out) throws IOException
- {
- // @fgiust start custom magnolia setup
-
- WebContext webContext = (WebContext) MgnlContext.getInstance();
- HttpServletResponse response = new StripesParagraphResponseWrapper(webContext.getResponse(), out);
-
- final String templatePath = paragraph.getTemplatePath();
- Map<String, String[]> nodeDataMap = contentToMap(content);
-
- HttpServletRequest request;
- try
- {
- request = new StripesParagraphRequestWrapper(
- ((WebContext) MgnlContext.getInstance()).getRequest(),
- templatePath,
- nodeDataMap);
-
- ((StripesParagraphRequestWrapper) request).setLocale(MgnlContext.getLocale());
- }
- catch (StripesServletException e)
- {
- throw new RuntimeException(e);
- }
-
- // @todo fgiust force include instead of forwarding. Not needed anymore since we are wrapping requestDispatcher?
- request.setAttribute(StripesConstants.REQ_ATTR_INCLUDE_PATH, templatePath);
-
- PageContext pageContext = webContext.getPageContext();
- ServletContext servletContext = null;
-
- if (pageContext != null)
- {
- pageContext.getServletContext();
- }
- // @fgiust end custom magnolia setup
-
- // It sucks that we have to do this here (in the request cycle), but there doesn't
- // seem to be a good way to get at the Configuration from the Filter in init()
- doOneTimeConfiguration();
-
- log.debug("Dispatching request to URL: ", request.getRequestURI());
-
- try
- {
- final Configuration config = StripesFilter.getConfiguration();
-
- // First manufacture an ActionBeanContext
- final ActionBeanContext context = config
- .getActionBeanContextFactory()
- .getContextInstance(request, response);
- context.setServletContext(servletContext);
-
- // Then setup the ExecutionContext that we'll use to process this request
- final ExecutionContext ctx = new ExecutionContext();
- ctx.setInterceptors(config.getInterceptors(LifecycleStage.ActionBeanResolution));
- ctx.setLifecycleStage(LifecycleStage.ActionBeanResolution);
- ctx.setActionBeanContext(context);
-
- ActionBeanContext abc = ctx.getActionBeanContext();
- if (pageContext != null)
- {
- DispatcherHelper.setPageContext(pageContext);
- }
-
- // Resolve the ActionBean, and if an interceptor returns a resolution, bail now
- saveActionBean(request);
- Resolution resolution = DispatcherHelper.resolveActionBean(ctx);
-
- if (resolution == null)
- {
- resolution = DispatcherHelper.resolveHandler(ctx);
-
- if (resolution == null)
- {
- // Then run binding and validation
- resolution = DispatcherHelper.doBindingAndValidation(ctx, true);
-
- if (resolution == null)
- {
- // Then continue on to custom validation
- resolution = DispatcherHelper.doCustomValidation(ctx, alwaysInvokeValidate);
-
- if (resolution == null)
- {
- // And then validation error handling
- resolution = DispatcherHelper.handleValidationErrors(ctx);
-
- if (resolution == null)
- {
- // And finally(ish) invoking of the event handler
- resolution = DispatcherHelper.invokeEventHandler(ctx);
-
- // If the event produced errors, fill them in
- DispatcherHelper.fillInValidationErrors(ctx);
- }
- }
- }
- }
- }
-
- // Whatever stage it came from, execute the resolution
- if (resolution != null)
- {
- DispatcherHelper.executeResolution(ctx, resolution);
- }
- }
- catch (RuntimeException re)
- {
- throw re;
- }
- catch (InvocationTargetException ite)
- {
- if (ite.getTargetException() instanceof RuntimeException)
- {
- throw (RuntimeException) ite.getTargetException();
- }
- else
- {
- throw new RuntimeException("ActionBean execution threw an exception.", ite.getTargetException());
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException("Exception encountered processing request.", e);
- }
- finally
- {
-
- if (pageContext != null)
- {
- // *Don't* release the page context, if set it will be closed by the main magnolia template
- // JspFactory.getDefaultFactory().releasePageContext(pageContext);
- DispatcherHelper.setPageContext(null);
- }
- restoreActionBean(request);
- }
- }
-
- /**
- * @param content paragraph node
- * @return a map of Strings (converted nodedata)
- */
- @SuppressWarnings("unchecked")
- protected Map<String, String[]> contentToMap(Content content)
- {
- Collection<NodeData> paragraphsData = content.getNodeDataCollection();
- Map<String, String[]> nodeDataMap = new HashMap<String, String[]>();
- for (NodeData nodeData : paragraphsData)
- {
- String name = StringUtils.replaceChars(nodeData.getName(), "{}", "[]");
- String value = nodeData.getString();
- if (StringUtils.contains(name, "multiple"))
- {
- nodeDataMap.put(name, StringUtils.split(value, "\n"));
- }
- else
- {
- nodeDataMap.put(name, new String[]{value });
- }
- }
- return nodeDataMap;
- }
-
- /**
- * Performs a simple piece of one time configuration that requires access to the Configuration object delivered
- * through the Stripes Filter.
- */
- private void doOneTimeConfiguration()
- {
- if (alwaysInvokeValidate == null)
- {
- // Check to see if, in this application, validate() methods should always be run
- // even when validation errors already exist
- String callValidateWhenErrorsExist = StripesFilter
- .getConfiguration()
- .getBootstrapPropertyResolver()
- .getProperty(DispatcherServlet.RUN_CUSTOM_VALIDATION_WHEN_ERRORS);
-
- if (callValidateWhenErrorsExist != null)
- {
- BooleanTypeConverter c = new BooleanTypeConverter();
- this.alwaysInvokeValidate = c.convert(callValidateWhenErrorsExist, Boolean.class, null);
- }
- else
- {
- this.alwaysInvokeValidate = false; // Default behaviour
- }
- }
- }
-
- /**
- * Fetches, and lazily creates if required, a Stack in the request to store ActionBeans should the current request
- * involve forwards or includes to other ActionBeans.
- * @param request the current HttpServletRequest
- * @param create create a Stack if not already set
- * @return the Stack if present, or if creation is requested
- */
- @SuppressWarnings("unchecked")
- protected Stack getActionBeanStack(HttpServletRequest request, boolean create)
- {
- Stack stack = (Stack) request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN_STACK);
- if (stack == null && create)
- {
- stack = new Stack();
- request.setAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN_STACK, stack);
- }
-
- return stack;
- }
-
- /**
- * Saves the current value of the 'actionBean' attribute in the request so that it can be restored at a later date
- * by calling {@link #restoreActionBean(HttpServletRequest)}. If no ActionBean is currently stored in the request,
- * nothing is changed.
- * @param request the current HttpServletRequest
- */
- @SuppressWarnings("unchecked")
- protected void saveActionBean(HttpServletRequest request)
- {
- if (request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN) != null)
- {
- Stack stack = getActionBeanStack(request, true);
- stack.push(request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN));
- }
- }
-
- /**
- * Restores the previous value of the 'actionBean' attribute in the request. If no ActionBeans have been saved using
- * {@link #saveActionBean(HttpServletRequest)} then this method has no effect.
- * @param request the current HttpServletRequest
- */
- @SuppressWarnings("unchecked")
- protected void restoreActionBean(HttpServletRequest request)
- {
- Stack stack = getActionBeanStack(request, false);
- if (stack != null && !stack.empty())
- {
- request.setAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN, stack.pop());
- }
- }
-
-}
Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java (from rev 510, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java)
===================================================================
--- tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java (rev 0)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java 2007-12-02 16:48:54 UTC (rev 512)
@@ -0,0 +1,334 @@
+package it.openutils.magnoliastripes;
+
+import info.magnolia.cms.beans.config.Paragraph;
+import info.magnolia.cms.beans.runtime.ParagraphRenderer;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.core.NodeData;
+import info.magnolia.context.MgnlContext;
+import info.magnolia.context.WebContext;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Stack;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.PageContext;
+
+import net.sourceforge.stripes.action.ActionBeanContext;
+import net.sourceforge.stripes.action.Resolution;
+import net.sourceforge.stripes.config.Configuration;
+import net.sourceforge.stripes.controller.DispatcherHelper;
+import net.sourceforge.stripes.controller.DispatcherServlet;
+import net.sourceforge.stripes.controller.ExecutionContext;
+import net.sourceforge.stripes.controller.LifecycleStage;
+import net.sourceforge.stripes.controller.StripesConstants;
+import net.sourceforge.stripes.controller.StripesFilter;
+import net.sourceforge.stripes.exception.StripesServletException;
+import net.sourceforge.stripes.validation.BooleanTypeConverter;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * <p>
+ * A Magnolia paragraph renderer that delegates to Stripes actions. Most of the code is just a cut and paste from
+ * Stripes' {@link DispatcherServlet}, adapted to work withing magnolia by:
+ * </p>
+ * <ul>
+ * <li>wrap the request in order to modify the request path and provide a custom requestDispatcher</li>
+ * <li>wrap the response in order to provide a custom Writer</li>
+ * <li>use a fake servlet instance/context to setup a Stripe context (there is no servlet here)</li>
+ * <li>injiect any paragraph property as a parameter</li>
+ * </ul>
+ * <p>
+ * <strong>Todo:</strong>
+ * </p>
+ * <ul>
+ * <li>Handle multipart forms in request wrapper (should be easy to do)</li>
+ * <li>A better way of handling multivalued properties in paragraph</li>
+ * <li>Handle binary properties in paragraph</li>
+ * </ul>
+ * @author fgiust
+ * @version $Id: $
+ */
+public class StripesParagraphRenderer implements ParagraphRenderer
+{
+
+ private Boolean alwaysInvokeValidate;
+
+ /**
+ * Logger.
+ */
+ private Logger log = LoggerFactory.getLogger(StripesParagraphRenderer.class);
+
+ /**
+ * <p>
+ * Invokes the following instance level methods in order to coordinate the processing of requests:
+ * </p>
+ * <ul>
+ * <li>{@link #resolveActionBean(ExecutionContext)}</li>
+ * <li>{@link #resolveHandler(ExecutionContext)}</li>
+ * <li>{@link #doBindingAndValidation(ExecutionContext)}</li>
+ * <li>{@link #doCustomValidation(ExecutionContext)}</li>
+ * <li>{@link #handleValidationErrors(ExecutionContext)}</li>
+ * <li>{@link #invokeEventHandler(ExecutionContext)}</li>
+ * </ul>
+ * <p>
+ * If any of the above methods return a {@link Resolution} the rest of the request processing is aborted and the
+ * resolution is executed.
+ * </p>
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public void render(Content content, Paragraph paragraph, Writer out) throws IOException
+ {
+ // @fgiust start custom magnolia setup
+
+ WebContext webContext = (WebContext) MgnlContext.getInstance();
+ HttpServletResponse response = new StripesParagraphResponseWrapper(webContext.getResponse(), out);
+
+ final String templatePath = paragraph.getTemplatePath();
+ Map<String, String[]> nodeDataMap = contentToMap(content);
+
+ HttpServletRequest request;
+ try
+ {
+ request = new StripesParagraphRequestWrapper(
+ ((WebContext) MgnlContext.getInstance()).getRequest(),
+ templatePath,
+ nodeDataMap);
+
+ ((StripesParagraphRequestWrapper) request).setLocale(MgnlContext.getLocale());
+ }
+ catch (StripesServletException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ // @todo fgiust force include instead of forwarding. Not needed anymore since we are wrapping requestDispatcher?
+ request.setAttribute(StripesConstants.REQ_ATTR_INCLUDE_PATH, templatePath);
+
+ PageContext pageContext = webContext.getPageContext();
+ ServletContext servletContext = null;
+
+ if (pageContext != null)
+ {
+ pageContext.getServletContext();
+ }
+ // @fgiust end custom magnolia setup
+
+ // It sucks that we have to do this here (in the request cycle), but there doesn't
+ // seem to be a good way to get at the Configuration from the Filter in init()
+ doOneTimeConfiguration();
+
+ log.debug("Dispatching request to URL: ", request.getRequestURI());
+
+ try
+ {
+ final Configuration config = StripesFilter.getConfiguration();
+
+ // First manufacture an ActionBeanContext
+ final ActionBeanContext context = config
+ .getActionBeanContextFactory()
+ .getContextInstance(request, response);
+ context.setServletContext(servletContext);
+
+ // Then setup the ExecutionContext that we'll use to process this request
+ final ExecutionContext ctx = new ExecutionContext();
+ ctx.setInterceptors(config.getInterceptors(LifecycleStage.ActionBeanResolution));
+ ctx.setLifecycleStage(LifecycleStage.ActionBeanResolution);
+ ctx.setActionBeanContext(context);
+
+ ActionBeanContext abc = ctx.getActionBeanContext();
+ if (pageContext != null)
+ {
+ DispatcherHelper.setPageContext(pageContext);
+ }
+
+ // Resolve the ActionBean, and if an interceptor returns a resolution, bail now
+ saveActionBean(request);
+ Resolution resolution = DispatcherHelper.resolveActionBean(ctx);
+
+ if (resolution == null)
+ {
+ resolution = DispatcherHelper.resolveHandler(ctx);
+
+ if (resolution == null)
+ {
+ // Then run binding and validation
+ resolution = DispatcherHelper.doBindingAndValidation(ctx, true);
+
+ if (resolution == null)
+ {
+ // Then continue on to custom validation
+ resolution = DispatcherHelper.doCustomValidation(ctx, alwaysInvokeValidate);
+
+ if (resolution == null)
+ {
+ // And then validation error handling
+ resolution = DispatcherHelper.handleValidationErrors(ctx);
+
+ if (resolution == null)
+ {
+ // And finally(ish) invoking of the event handler
+ resolution = DispatcherHelper.invokeEventHandler(ctx);
+
+ // If the event produced errors, fill them in
+ DispatcherHelper.fillInValidationErrors(ctx);
+ }
+ }
+ }
+ }
+ }
+
+ // Whatever stage it came from, execute the resolution
+ if (resolution != null)
+ {
+ DispatcherHelper.executeResolution(ctx, resolution);
+ }
+ }
+ catch (RuntimeException re)
+ {
+ throw re;
+ }
+ catch (InvocationTargetException ite)
+ {
+ if (ite.getTargetException() instanceof RuntimeException)
+ {
+ throw (RuntimeException) ite.getTargetException();
+ }
+ else
+ {
+ Throwable targetEx = ite.getTargetException();
+ throw new RuntimeException(targetEx.getClass().getName() + ": " + targetEx.getMessage(), targetEx);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Exception encountered processing request: " + e.getMessage(), e);
+ }
+ finally
+ {
+
+ if (pageContext != null)
+ {
+ // *Don't* release the page context, if set it will be closed by the main magnolia template
+ // JspFactory.getDefaultFactory().releasePageContext(pageContext);
+ DispatcherHelper.setPageContext(null);
+ }
+ restoreActionBean(request);
+ }
+ }
+
+ /**
+ * @param content paragraph node
+ * @return a map of Strings (converted nodedata)
+ */
+ @SuppressWarnings("unchecked")
+ protected Map<String, String[]> contentToMap(Content content)
+ {
+ Collection<NodeData> paragraphsData = content.getNodeDataCollection();
+ Map<String, String[]> nodeDataMap = new HashMap<String, String[]>();
+ for (NodeData nodeData : paragraphsData)
+ {
+ String name = StringUtils.replaceChars(nodeData.getName(), "{}", "[]");
+ String value = nodeData.getString();
+ if (StringUtils.contains(name, "multiple"))
+ {
+ nodeDataMap.put(name, StringUtils.split(value, "\n"));
+ }
+ else
+ {
+ nodeDataMap.put(name, new String[]{value });
+ }
+ }
+ return nodeDataMap;
+ }
+
+ /**
+ * Performs a simple piece of one time configuration that requires access to the Configuration object delivered
+ * through the Stripes Filter.
+ */
+ private void doOneTimeConfiguration()
+ {
+ if (alwaysInvokeValidate == null)
+ {
+ // Check to see if, in this application, validate() methods should always be run
+ // even when validation errors already exist
+ String callValidateWhenErrorsExist = StripesFilter
+ .getConfiguration()
+ .getBootstrapPropertyResolver()
+ .getProperty(DispatcherServlet.RUN_CUSTOM_VALIDATION_WHEN_ERRORS);
+
+ if (callValidateWhenErrorsExist != null)
+ {
+ BooleanTypeConverter c = new BooleanTypeConverter();
+ this.alwaysInvokeValidate = c.convert(callValidateWhenErrorsExist, Boolean.class, null);
+ }
+ else
+ {
+ this.alwaysInvokeValidate = false; // Default behaviour
+ }
+ }
+ }
+
+ /**
+ * Fetches, and lazily creates if required, a Stack in the request to store ActionBeans should the current request
+ * involve forwards or includes to other ActionBeans.
+ * @param request the current HttpServletRequest
+ * @param create create a Stack if not already set
+ * @return the Stack if present, or if creation is requested
+ */
+ @SuppressWarnings("unchecked")
+ protected Stack getActionBeanStack(HttpServletRequest request, boolean create)
+ {
+ Stack stack = (Stack) request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN_STACK);
+ if (stack == null && create)
+ {
+ stack = new Stack();
+ request.setAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN_STACK, stack);
+ }
+
+ return stack;
+ }
+
+ /**
+ * Saves the current value of the 'actionBean' attribute in the request so that it can be restored at a later date
+ * by calling {@link #restoreActionBean(HttpServletRequest)}. If no ActionBean is currently stored in the request,
+ * nothing is changed.
+ * @param request the current HttpServletRequest
+ */
+ @SuppressWarnings("unchecked")
+ protected void saveActionBean(HttpServletRequest request)
+ {
+ if (request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN) != null)
+ {
+ Stack stack = getActionBeanStack(request, true);
+ stack.push(request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN));
+ }
+ }
+
+ /**
+ * Restores the previous value of the 'actionBean' attribute in the request. If no ActionBeans have been saved using
+ * {@link #saveActionBean(HttpServletRequest)} then this method has no effect.
+ * @param request the current HttpServletRequest
+ */
+ @SuppressWarnings("unchecked")
+ protected void restoreActionBean(HttpServletRequest request)
+ {
+ Stack stack = getActionBeanStack(request, false);
+ if (stack != null && !stack.empty())
+ {
+ request.setAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN, stack.pop());
+ }
+ }
+
+}
Deleted: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/AddMimeMappingTask.java
===================================================================
--- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/setup/AddMimeMappingTask.java 2007-11-14 14:17:57 UTC (rev 509)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/AddMimeMappingTask.java 2007-12-02 16:48:54 UTC (rev 512)
@@ -1,67 +0,0 @@
-package it.openutils.magnoliastripes.setup;
-
-import info.magnolia.cms.beans.config.ContentRepository;
-import info.magnolia.cms.core.Content;
-import info.magnolia.cms.core.HierarchyManager;
-import info.magnolia.cms.core.ItemType;
-import info.magnolia.module.InstallContext;
-import info.magnolia.module.delta.AbstractRepositoryTask;
-import info.magnolia.module.delta.TaskExecutionException;
-
-import javax.jcr.RepositoryException;
-
-
-/**
- * Task that adds a mime mapping to <code>server/MIMIMapping</code>.
- * @author fgiust
- * @version $Revision: $ ($Author: $)
- */
-public class AddMimeMappingTask extends AbstractRepositoryTask
-{
-
- /**
- * Extension (without the <code>.</code>)
- */
- private String extension;
-
- /**
- * mime type.
- */
- private String mime;
-
- /**
- * Icon path.
- */
- private String icon;
-
- /**
- * @param extension Extension (without the <code>.</code>)
- * @param mime mime type.
- * @param icon Icon path.
- */
- public AddMimeMappingTask(String extension, String mime, String icon)
- {
- super("Add mime mapping task", "Adds a MIME mapping for the " + extension + " extension");
- this.extension = extension;
- this.mime = mime;
- this.icon = icon;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException
- {
- HierarchyManager hm = ctx.getHierarchyManager(ContentRepository.CONFIG);
- Content mimeNode = hm.getContent("/server/MIMEMapping");
-
- if (!mimeNode.hasContent(extension))
- {
- Content m = mimeNode.createContent(extension, ItemType.CONTENTNODE);
- m.createNodeData("mime-type").setValue(mime);
- m.createNodeData("icon").setValue(icon);
- }
- }
-
-}
Deleted: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java
===================================================================
--- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java 2007-11-14 14:17:57 UTC (rev 509)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java 2007-12-02 16:48:54 UTC (rev 512)
@@ -1,30 +0,0 @@
-package it.openutils.magnoliastripes.setup;
-
-import info.magnolia.module.DefaultModuleVersionHandler;
-import info.magnolia.module.InstallContext;
-import info.magnolia.module.delta.Task;
-
-import java.util.List;
-
-
-/**
- * @author fgiust
- * @version $Id: $
- */
-public class StripesModuleVersionHandler extends DefaultModuleVersionHandler
-{
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- @Override
- protected List<Task> getBasicInstallTasks(InstallContext installContext)
- {
- List<Task> installTasks = super.getBasicInstallTasks(installContext);
-
- installTasks.add(new AddMimeMappingTask("action", "text/plain", "/.resources/file-icons/htm.png"));
-
- return installTasks;
- }
-}
Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java (from rev 510, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java)
===================================================================
--- tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java (rev 0)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java 2007-12-02 16:48:54 UTC (rev 512)
@@ -0,0 +1,36 @@
+package it.openutils.magnoliastripes.setup;
+
+import info.magnolia.module.DefaultModuleVersionHandler;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.AddMimeMappingTask;
+import info.magnolia.module.delta.FilterOrderingTask;
+import info.magnolia.module.delta.Task;
+
+import java.util.List;
+
+
+/**
+ * @author fgiust
+ * @version $Id: $
+ */
+public class StripesModuleVersionHandler extends DefaultModuleVersionHandler
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected List<Task> getBasicInstallTasks(InstallContext installContext)
+ {
+ List<Task> tasks = super.getBasicInstallTasks(installContext);
+
+ tasks.add(new AddMimeMappingTask("action", "text/plain", "/.resources/file-icons/htm.png"));
+
+ tasks.add(new FilterOrderingTask(
+ "stripes",
+ new String[]{"context", "login", "uriSecurity", "multipartRequest" }));
+
+ return tasks;
+ }
+}
Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/resources/mgnl-bootstrap/stripes/config.server.filters.stripes.xml (from rev 510, trunk/openutils-mgnlstripes/src/main/resources/mgnl-bootstrap/stripes/config.server.filters.stripes.xml)
===================================================================
--- tags/openutils-mgnlstripes-3.5-rc2/src/main/resources/mgnl-bootstrap/stripes/config.server.filters.stripes.xml (rev 0)
+++ tags/openutils-mgnlstripes-3.5-rc2/src/main/resources/mgnl-bootstrap/stripes/config.server.filters.stripes.xml 2007-12-02 16:48:54 UTC (rev 512)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sv:node sv:name="stripes" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:mgnl="http://www.magnolia.info/jcr/mgnl"
+ xmlns:rep="internal" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
+ xmlns:jcrfn="http://www.jcp.org/jcr/xpath-functions/1.0">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:content</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
+ <sv:value>mix:versionable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>871bc964-af22-4713-a1d7-a71c80ffcf2f</sv:value>
+ </sv:property>
+ <sv:property sv:name="class" sv:type="String">
+ <sv:value>it.openutils.magnoliastripes.StripesMagnoliaFilter</sv:value>
+ </sv:property>
+ <sv:property sv:name="enabled" sv:type="Boolean">
+ <sv:value>true</sv:value>
+ </sv:property>
+ <sv:node sv:name="MetaData">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:metaData</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:activated" sv:type="Boolean">
+ <sv:value>false</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:activatorid" sv:type="String">
+ <sv:value>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:authorid" sv:type="String">
+ <sv:value>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2006-07-28T23:39:30.812+02:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastaction" sv:type="Date">
+ <sv:value>2007-10-04T23:04:20.237+02:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2007-10-04T23:05:02.810+02:00</sv:value>
+ </sv:property>
+ </sv:node>
+ <sv:node sv:name="bypasses">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:contentNode</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
+ <sv:value>mix:versionable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>6cc0bc00-3efa-41be-9278-70f2f93d23c6</sv:value>
+ </sv:property>
+ <sv:node sv:name="MetaData">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:metaData</sv:value>
+ </sv:prope...
[truncated message content] |