Author: piergiorgiolucidi
Date: 2009-03-03 13:51:31 -0500 (Tue, 03 Mar 2009)
New Revision: 246
Added:
contrib/wikiPortlet/trunk/.settings/
contrib/wikiPortlet/trunk/.settings/org.eclipse.jdt.core.prefs
contrib/wikiPortlet/trunk/.settings/org.maven.ide.eclipse.prefs
contrib/wikiPortlet/trunk/forge-wiki/
contrib/wikiPortlet/trunk/forge-wiki/.classpath
contrib/wikiPortlet/trunk/forge-wiki/.project
contrib/wikiPortlet/trunk/forge-wiki/maven.xml
contrib/wikiPortlet/trunk/forge-wiki/pom.xml
contrib/wikiPortlet/trunk/forge-wiki/project.properties
contrib/wikiPortlet/trunk/forge-wiki/project.xml
contrib/wikiPortlet/trunk/forge-wiki/src/
contrib/wikiPortlet/trunk/forge-wiki/src/etc/
contrib/wikiPortlet/trunk/forge-wiki/src/java/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/fileaccess/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/redirect/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/redirect/WikiRedirectFilter.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/taglib/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/test/
contrib/wikiPortlet/trunk/forge-wiki/src/test/
contrib/wikiPortlet/trunk/forge-wiki/src/web/
contrib/wikiPortlet/trunk/forge-wiki/src/web/META-INF/
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-app.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-portlet.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-web.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet-instances.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet_2_0.tld
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/web.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/wiki-object.xml
Log:
- Portal 2.7.x support: forge-wiki
Added: contrib/wikiPortlet/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- contrib/wikiPortlet/trunk/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++ contrib/wikiPortlet/trunk/.settings/org.eclipse.jdt.core.prefs 2009-03-03 18:51:31 UTC
(rev 246)
@@ -0,0 +1,12 @@
+#Mon Jan 26 16:44:32 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: contrib/wikiPortlet/trunk/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- contrib/wikiPortlet/trunk/.settings/org.maven.ide.eclipse.prefs
(rev 0)
+++ contrib/wikiPortlet/trunk/.settings/org.maven.ide.eclipse.prefs 2009-03-03 18:51:31
UTC (rev 246)
@@ -0,0 +1,8 @@
+#Fri Jan 23 19:06:36 CET 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+version=1
Added: contrib/wikiPortlet/trunk/forge-wiki/.classpath
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/.classpath (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/.classpath 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: contrib/wikiPortlet/trunk/forge-wiki/.project
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/.project (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/.project 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>forge-wiki</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: contrib/wikiPortlet/trunk/forge-wiki/maven.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/maven.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/maven.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,31 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at
gnu.org.
+ -->
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant"
xmlns:u="jelly:util" >
+ <goal name="build">
+
+ <attainGoal name="war" />
+
+ </goal>
+
+ <goal name="deploy">
+
+ <!--<ant:copy todir="${local.deploy.dir}/wiki.ear"
flatten="true">
+ <ant:fileset dir=".">
+ <ant:filename name="target/*.war" />
+ </ant:fileset>
+ </ant:copy>
+ <ant:copy
+ tofile="${local.deploy.dir}/${wiki.ear.name}/META-INF/application.xml"
+ file="src/etc/application.xml" />-->
+
+ </goal>
+
+ <goal name="all">
+ <attainGoal name="build" />
+ <attainGoal name="deploy" />
+ </goal>
+
+</project>
Added: contrib/wikiPortlet/trunk/forge-wiki/pom.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/pom.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/pom.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,125 @@
+<!--
+ JBoss, the OpenSource J2EE webOS Distributable under LGPL license. See
+ terms of license at
gnu.org.
+ Maven manual install: portal-core-lib.jar
+ portal-portlet-lib javax-servlet.jar javax-servlet-jsp.jar
+ activation.jar jboss-ejb3x.jar jboss-ejb3.jar portal-identity-lib.jar
+ jboss-portlet-api-lib.jar
+
+ author: Piergiorgio Lucidi
+-->
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>jboss</groupId>
+ <artifactId>wiki-common</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>forge-wiki</artifactId>
+ <name>JBoss Wiki Forge</name>
+ <version>1.0</version>
+ <description>Wiki portlet and servlet</description>
+ <packaging>war</packaging>
+ <developers>
+ <developer>
+ <name>Tomasz Szymanski</name>
+ <url>http://mamut.net.pl</url>
+ <roles>
+ <role>Retired Project Lead</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Piergiorgio Lucidi</name>
+ <email>p.lucidi(a)sourcesense.com</email>
+ <
url>http://www.open4dev.com/</url>
+ <organization>Sourcesense</organization>
+ <
organizationUrl>http://www.sourcesense.com/</organizationUrl>
+ </developer>
+ </developers>
+ <build>
+ <sourceDirectory>${basedir}/src/java</sourceDirectory>
+ <outputDirectory>${basedir}/src/web/WEB-INF/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/etc/</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.xml</include>
+ <include>**/*.types</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webappDirectory>${basedir}/src/web/</webappDirectory>
+ <warSourceDirectory>${basedir}/src/web/</warSourceDirectory>
+ <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
+ <excludes>**/.svn/**</excludes>
+ <warName>wiki</warName>
+ <outputDirectory>target</outputDirectory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3x</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>wiki-common</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: contrib/wikiPortlet/trunk/forge-wiki/project.properties
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/project.properties (rev
0)
+++ contrib/wikiPortlet/trunk/forge-wiki/project.properties 2009-03-03 18:51:31 UTC (rev
246)
@@ -0,0 +1,6 @@
+maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven,http://dist.codehaus.org/
+maven.junit.fork=yes
+maven.war.src=${basedir}/src/web
+maven.jar.includes=**/WikiEngine.class
+maven.ejb.includes=**/WikiService*
+maven.ear.final.name=wiki.ear
\ No newline at end of file
Added: contrib/wikiPortlet/trunk/forge-wiki/project.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/project.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/project.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,138 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at
gnu.org.
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>../common.xml</extend>
+ <id>wiki</id>
+ <name>Wiki portlet and servlet</name>
+ <currentVersion>1.0</currentVersion>
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.properties</include>
+ </resource>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.xml</include>
+ </resource>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.types</include>
+ </resource>
+ </resources>
+ </build>
+ <organization>
+ <name>Tomasz Szymanski</name>
+ <url>http://mamut.net.pl</url>
+ </organization>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>aslibs</groupId>
+ <artifactId>javax.servlet</artifactId>
+ <version>1.0</version>
+ <jar>javax.servlet.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>wiki-common</groupId>
+ <artifactId>wiki-common</artifactId>
+ <version>1.0</version>
+ <jar>wiki-common.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>aslibs</groupId>
+ <artifactId>javax.servlet.jsp</artifactId>
+ <version>1.0</version>
+ <jar>javax.servlet.jsp.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.0</version>
+ <jar>activation.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload.jar</artifactId>
+ <version>1.0</version>
+ <jar>commons-fileupload-1.0.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3x</artifactId>
+ <version>1.0</version>
+ <jar>jboss-ejb3x.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3</artifactId>
+ <version>1.0</version>
+ <jar>jboss-ejb3.jar</jar>
+ </dependency>
+
+ <dependency>
+ <id>portlet-api</id>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
+ <version>1.0</version>
+ <jar>jboss-jmx.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common</artifactId>
+ <version>1.0</version>
+ <jar>jboss-common.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-common-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-common-lib.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-core-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-core-lib.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-portlet-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-portlet-lib.jar</jar>
+ </dependency>
+ </dependencies>
+</project>
Added:
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java
===================================================================
---
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java
(rev 0)
+++
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,235 @@
+/*
+ * $Header:
/cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUpload.java,v
1.1 2003/10/01 22:21:43 jsackett Exp $
+ * $Revision: 1.1 $
+ * $Date: 2003/10/01 22:21:43 $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (
http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache
Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <
http://www.apache.org/>.
+ *
+ */
+
+package org.apache.commons.fileupload;
+
+import java.io.File;
+import java.util.List;
+import javax.portlet.ActionRequest;
+import org.apache.commons.fileupload.DefaultFileItemFactory;
+
+/**
+ * <p>
+ * High level API for processing file uploads.
+ * </p>
+ *
+ * <p>
+ * This class handles multiple files per single HTML widget, sent using
+ * <code>multipart/mixed</code> encoding type, as specified by <a
+ *
href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use
{@link
+ * #parseRequest(HttpServletRequest)} to acquire a list of {@link
+ * org.apache.commons.fileupload.FileItem}s associated with a given HTML widget.
+ * </p>
+ *
+ * <p>
+ * Individual parts will be stored in temporary disk storage or in memory,
+ * depending on their size, and will be available as {@link
+ * org.apache.commons.fileupload.FileItem}s.
+ * </p>
+ *
+ * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal
Krzewski</a>
+ * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
+ * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
+ * @author Sean C. Sullivan
+ *
+ * @version $Id: PortletDiskFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett
+ * Exp $
+ */
+public class PortletDiskFileUpload extends PortletFileUploadBase {
+
+ // ----------------------------------------------------------- Data members
+
+ /**
+ * The factory to use to create new form items.
+ */
+ private DefaultFileItemFactory fileItemFactory;
+
+ // ----------------------------------------------------------- Constructors
+
+ /**
+ * Constructs an instance of this class which uses the default factory to
+ * create <code>FileItem</code> instances.
+ *
+ * @see #DiskFileUpload(DefaultFileItemFactory fileItemFactory)
+ */
+ public PortletDiskFileUpload() {
+ super();
+ this.fileItemFactory = new DefaultFileItemFactory();
+ }
+
+ /**
+ * Constructs an instance of this class which uses the supplied factory to
+ * create <code>FileItem</code> instances.
+ *
+ * @see #DiskFileUpload()
+ */
+ public PortletDiskFileUpload(DefaultFileItemFactory fileItemFactory) {
+ super();
+ this.fileItemFactory = fileItemFactory;
+ }
+
+ // ----------------------------------------------------- Property accessors
+
+ /**
+ * Returns the factory class used when creating file items.
+ *
+ * @return The factory class for new file items.
+ */
+ public FileItemFactory getFileItemFactory() {
+ return fileItemFactory;
+ }
+
+ /**
+ * Sets the factory class to use when creating file items. The factory must
+ * be an instance of <code>DefaultFileItemFactory</code> or a subclass
+ * thereof, or else a <code>ClassCastException</code> will be thrown.
+ *
+ * @param factory
+ * The factory class for new file items.
+ */
+ public void setFileItemFactory(FileItemFactory factory) {
+ this.fileItemFactory = (DefaultFileItemFactory) factory;
+ }
+
+ /**
+ * Returns the size threshold beyond which files are written directly to
+ * disk.
+ *
+ * @return The size threshold, in bytes.
+ *
+ * @see #setSizeThreshold(int)
+ */
+ public int getSizeThreshold() {
+ return fileItemFactory.getSizeThreshold();
+ }
+
+ /**
+ * Sets the size threshold beyond which files are written directly to disk.
+ *
+ * @param sizeThreshold
+ * The size threshold, in bytes.
+ *
+ * @see #getSizeThreshold()
+ */
+ public void setSizeThreshold(int sizeThreshold) {
+ fileItemFactory.setSizeThreshold(sizeThreshold);
+ }
+
+ /**
+ * Returns the location used to temporarily store files that are larger than
+ * the configured size threshold.
+ *
+ * @return The path to the temporary file location.
+ *
+ * @see #setRepositoryPath(String)
+ */
+ public String getRepositoryPath() {
+ return fileItemFactory.getRepository().getPath();
+ }
+
+ /**
+ * Sets the location used to temporarily store files that are larger than
+ * the configured size threshold.
+ *
+ * @param repositoryPath
+ * The path to the temporary file location.
+ *
+ * @see #getRepositoryPath()
+ */
+ public void setRepositoryPath(String repositoryPath) {
+ fileItemFactory.setRepository(new File(repositoryPath));
+ }
+
+ // --------------------------------------------------------- Public methods
+
+ /**
+ * Processes an <a
href="http://www.ietf.org/rfc/rfc1867.txt">RFC
1867</a>
+ * compliant <code>multipart/form-data</code> stream. If files are stored
+ * on disk, the path is given by <code>getRepository()</code>.
+ *
+ * @param req
+ * The servlet request to be parsed. Must be non-null.
+ * @param sizeThreshold
+ * The max size in bytes to be stored in memory.
+ * @param sizeMax
+ * The maximum allowed upload size, in bytes.
+ * @param path
+ * The location where the files should be stored.
+ *
+ * @return A list of <code>FileItem</code> instances parsed from the
+ * request, in the order that they were transmitted.
+ *
+ * @exception FileUploadException
+ * if there are problems reading/parsing the request or
+ * storing files.
+ */
+ public List /* FileItem */parseRequest(ActionRequest req,
+ int sizeThreshold, long sizeMax, String path)
+ throws FileUploadException {
+ setSizeThreshold(sizeThreshold);
+ setSizeMax(sizeMax);
+ setRepositoryPath(path);
+ return parseRequest(req);
+ }
+
+}
Added:
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java
===================================================================
---
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java
(rev 0)
+++
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,155 @@
+/*
+ * $Header:
/cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUpload.java,v
1.1 2003/10/01 22:21:43 jsackett Exp $
+ * $Revision: 1.1 $
+ * $Date: 2003/10/01 22:21:43 $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (
http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache
Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <
http://www.apache.org/>.
+ *
+ */
+
+package org.apache.commons.fileupload;
+
+
+/**
+ * <p>High level API for processing file uploads.</p>
+ *
+ * <p>This class handles multiple files per single HTML widget, sent using
+ * <code>multipart/mixed</code> encoding type, as specified by
+ * <a
href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use
{@link
+ * #parseRequest(HttpServletRequest)} to acquire a list of {@link
+ * org.apache.commons.fileupload.FileItem}s associated with a given HTML
+ * widget.</p>
+ *
+ * <p>How the data for individual parts is stored is determined by the factory
+ * used to create them; a given part may be in memory, on disk, or somewhere
+ * else.</p>
+ *
+ * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal
Krzewski</a>
+ * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
+ * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
+ * @author Sean C. Sullivan
+ *
+ * @version $Id: PortletFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $
+ */
+public class PortletFileUpload
+ extends PortletFileUploadBase
+ {
+
+ // ----------------------------------------------------------- Data members
+
+
+ /**
+ * The factory to use to create new form items.
+ */
+ private FileItemFactory fileItemFactory;
+
+
+ // ----------------------------------------------------------- Constructors
+
+
+ /**
+ * Constructs an instance of this class which uses the default factory to
+ * create <code>FileItem</code> instances.
+ *
+ * @see #FileUpload(FileItemFactory)
+ */
+ public PortletFileUpload()
+ {
+ super();
+ }
+
+
+ /**
+ * Constructs an instance of this class which uses the supplied factory to
+ * create <code>FileItem</code> instances.
+ *
+ * @see #FileUpload()
+ */
+ public PortletFileUpload(FileItemFactory fileItemFactory)
+ {
+ super();
+ this.fileItemFactory = fileItemFactory;
+ }
+
+
+ // ----------------------------------------------------- Property accessors
+
+
+ /**
+ * Returns the factory class used when creating file items.
+ *
+ * @return The factory class for new file items.
+ */
+ public FileItemFactory getFileItemFactory()
+ {
+ return fileItemFactory;
+ }
+
+
+ /**
+ * Sets the factory class to use when creating file items.
+ *
+ * @param factory The factory class for new file items.
+ */
+ public void setFileItemFactory(FileItemFactory factory)
+ {
+ this.fileItemFactory = factory;
+ }
+
+
+}
+
Added:
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java
===================================================================
---
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java
(rev 0)
+++
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,685 @@
+/*
+ * $Header:
/cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUpload.java,v
1.1 2003/10/01 22:21:43 jsackett Exp $
+ * $Revision: 1.1 $
+ * $Date: 2003/10/01 22:21:43 $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (
http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache
Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <
http://www.apache.org/>.
+ *
+ */
+
+
+package org.apache.commons.fileupload;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.portlet.ActionRequest;
+
+
+/**
+ * <p>High level API for processing file uploads.</p>
+ *
+ * <p>This class handles multiple files per single HTML widget, sent using
+ * <code>multipart/mixed</code> encoding type, as specified by
+ * <a
href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use
{@link
+ * #parseRequest(HttpServletRequest)} to acquire a list of {@link
+ * org.apache.commons.fileupload.FileItem}s associated with a given HTML
+ * widget.</p>
+ *
+ * <p>How the data for individual parts is stored is determined by the factory
+ * used to create them; a given part may be in memory, on disk, or somewhere
+ * else.</p>
+ *
+ * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal
Krzewski</a>
+ * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
+ * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
+ * @author Sean C. Sullivan
+ *
+ * @version $Id: PortletFileUploadBase.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $
+ */
+public abstract class PortletFileUploadBase
+{
+
+ // ---------------------------------------------------------- Class methods
+
+
+ /**
+ * Utility method that determines whether the request contains multipart
+ * content.
+ *
+ * @param req The servlet request to be evaluated. Must be non-null.
+ *
+ * @return <code>true</code> if the request is multipart;
+ * <code>false</code> otherwise.
+ */
+ public static final boolean isMultipartContent(ActionRequest req)
+ {
+ String contentType = req.getContentType();
+ if (contentType == null)
+ {
+ return false;
+ }
+ if (contentType.startsWith(MULTIPART))
+ {
+ return true;
+ }
+ return false;
+ }
+
+
+ // ----------------------------------------------------- Manifest constants
+
+
+ /**
+ * HTTP content type header name.
+ */
+ public static final String CONTENT_TYPE = "Content-type";
+
+
+ /**
+ * HTTP content disposition header name.
+ */
+ public static final String CONTENT_DISPOSITION = "Content-disposition";
+
+
+ /**
+ * Content-disposition value for form data.
+ */
+ public static final String FORM_DATA = "form-data";
+
+
+ /**
+ * Content-disposition value for file attachment.
+ */
+ public static final String ATTACHMENT = "attachment";
+
+
+ /**
+ * Part of HTTP content type header.
+ */
+ public static final String MULTIPART = "multipart/";
+
+
+ /**
+ * HTTP content type header for multipart forms.
+ */
+ public static final String MULTIPART_FORM_DATA = "multipart/form-data";
+
+
+ /**
+ * HTTP content type header for multiple uploads.
+ */
+ public static final String MULTIPART_MIXED = "multipart/mixed";
+
+
+ /**
+ * The maximum length of a single header line that will be parsed
+ * (1024 bytes).
+ */
+ public static final int MAX_HEADER_SIZE = 1024;
+
+
+ // ----------------------------------------------------------- Data members
+
+
+ /**
+ * The maximum size permitted for an uploaded file. A value of -1 indicates
+ * no maximum.
+ */
+ private long sizeMax = -1;
+
+
+ /**
+ * The content encoding to use when reading part headers.
+ */
+ private String headerEncoding;
+
+
+ // ----------------------------------------------------- Property accessors
+
+
+ /**
+ * Returns the factory class used when creating file items.
+ *
+ * @return The factory class for new file items.
+ */
+ public abstract FileItemFactory getFileItemFactory();
+
+
+ /**
+ * Sets the factory class to use when creating file items.
+ *
+ * @param factory The factory class for new file items.
+ */
+ public abstract void setFileItemFactory(FileItemFactory factory);
+
+
+ /**
+ * Returns the maximum allowed upload size.
+ *
+ * @return The maximum allowed size, in bytes.
+ *
+ * @see #setSizeMax(long)
+ *
+ */
+ public long getSizeMax()
+ {
+ return sizeMax;
+ }
+
+
+ /**
+ * Sets the maximum allowed upload size. If negative, there is no maximum.
+ *
+ * @param sizeMax The maximum allowed size, in bytes, or -1 for no maximum.
+ *
+ * @see #getSizeMax()
+ *
+ */
+ public void setSizeMax(long sizeMax)
+ {
+ this.sizeMax = sizeMax;
+ }
+
+
+ /**
+ * Retrieves the character encoding used when reading the headers of an
+ * individual part. When not specified, or <code>null</code>, the
platform
+ * default encoding is used.
+ *
+ * @return The encoding used to read part headers.
+ */
+ public String getHeaderEncoding()
+ {
+ return headerEncoding;
+ }
+
+
+ /**
+ * Specifies the character encoding to be used when reading the headers of
+ * individual parts. When not specified, or <code>null</code>, the
platform
+ * default encoding is used.
+ *
+ * @param encoding The encoding used to read part headers.
+ */
+ public void setHeaderEncoding(String encoding)
+ {
+ headerEncoding = encoding;
+ }
+
+
+ // --------------------------------------------------------- Public methods
+
+
+ /**
+ * Processes an <a
href="http://www.ietf.org/rfc/rfc1867.txt">RFC
1867</a>
+ * compliant <code>multipart/form-data</code> stream. If files are
stored
+ * on disk, the path is given by <code>getRepository()</code>.
+ *
+ * @param req The servlet request to be parsed.
+ *
+ * @return A list of <code>FileItem</code> instances parsed from the
+ * request, in the order that they were transmitted.
+ *
+ * @exception FileUploadException if there are problems reading/parsing
+ * the request or storing files.
+ */
+ public List /* FileItem */ parseRequest(ActionRequest req)
+ throws FileUploadException
+ {
+ if (null == req)
+ {
+ throw new NullPointerException("req parameter");
+ }
+
+ ArrayList items = new ArrayList();
+ String contentType = req.getContentType();
+
+ if ((null == contentType) || (!contentType.startsWith(MULTIPART)))
+ {
+ throw new InvalidContentTypeException(
+ "the request doesn't contain a "
+ + MULTIPART_FORM_DATA
+ + " or "
+ + MULTIPART_MIXED
+ + " stream, content type header is "
+ + contentType);
+ }
+ int requestSize = req.getContentLength();
+
+ if (requestSize == -1)
+ {
+ throw new UnknownSizeException(
+ "the request was rejected because it's size is unknown");
+ }
+
+ if (sizeMax >= 0 && requestSize > sizeMax)
+ {
+ throw new SizeLimitExceededException(
+ "the request was rejected because "
+ + "it's size exceeds allowed range");
+ }
+
+ try
+ {
+ int boundaryIndex = contentType.indexOf("boundary=");
+ if (boundaryIndex < 0)
+ {
+ throw new FileUploadException(
+ "the request was rejected because "
+ + "no multipart boundary was found");
+ }
+ byte[] boundary = contentType.substring(
+ boundaryIndex + 9).getBytes();
+
+ InputStream input = req.getPortletInputStream();
+
+ MultipartStream multi = new MultipartStream(input, boundary);
+ multi.setHeaderEncoding(headerEncoding);
+
+ boolean nextPart = multi.skipPreamble();
+ while (nextPart)
+ {
+ Map headers = parseHeaders(multi.readHeaders());
+ String fieldName = getFieldName(headers);
+ if (fieldName != null)
+ {
+ String subContentType = getHeader(headers, CONTENT_TYPE);
+ if (subContentType != null && subContentType
+ .startsWith(MULTIPART_MIXED))
+ {
+ // Multiple files.
+ byte[] subBoundary =
+ subContentType.substring(
+ subContentType
+ .indexOf("boundary=") + 9).getBytes();
+ multi.setBoundary(subBoundary);
+ boolean nextSubPart = multi.skipPreamble();
+ while (nextSubPart)
+ {
+ headers = parseHeaders(multi.readHeaders());
+ if (getFileName(headers) != null)
+ {
+ FileItem item =
+ createItem(headers, false);
+ OutputStream os = item.getOutputStream();
+ try
+ {
+ multi.readBodyData(os);
+ }
+ finally
+ {
+ os.close();
+ }
+ items.add(item);
+ }
+ else
+ {
+ // Ignore anything but files inside
+ // multipart/mixed.
+ multi.discardBodyData();
+ }
+ nextSubPart = multi.readBoundary();
+ }
+ multi.setBoundary(boundary);
+ }
+ else
+ {
+ if (getFileName(headers) != null)
+ {
+ // A single file.
+ FileItem item = createItem(headers, false);
+ OutputStream os = item.getOutputStream();
+ try
+ {
+ multi.readBodyData(os);
+ }
+ finally
+ {
+ os.close();
+ }
+ items.add(item);
+ }
+ else
+ {
+ // A form field.
+ FileItem item = createItem(headers, true);
+ OutputStream os = item.getOutputStream();
+ try
+ {
+ multi.readBodyData(os);
+ }
+ finally
+ {
+ os.close();
+ }
+ items.add(item);
+ }
+ }
+ }
+ else
+ {
+ // Skip this part.
+ multi.discardBodyData();
+ }
+ nextPart = multi.readBoundary();
+ }
+ }
+ catch (IOException e)
+ {
+ throw new FileUploadException(
+ "Processing of " + MULTIPART_FORM_DATA
+ + " request failed. " + e.getMessage());
+ }
+
+ return items;
+ }
+
+
+ // ------------------------------------------------------ Protected methods
+
+
+ /**
+ * Retrieves the file name from the <code>Content-disposition</code>
+ * header.
+ *
+ * @param headers A <code>Map</code> containing the HTTP request
headers.
+ *
+ * @return The file name for the current <code>encapsulation</code>.
+ */
+ protected String getFileName(Map /* String, String */ headers)
+ {
+ String fileName = null;
+ String cd = getHeader(headers, CONTENT_DISPOSITION);
+ if (cd.startsWith(FORM_DATA) || cd.startsWith(ATTACHMENT))
+ {
+ int start = cd.indexOf("filename=\"");
+ int end = cd.indexOf('"', start + 10);
+ if (start != -1 && end != -1)
+ {
+ fileName = cd.substring(start + 10, end).trim();
+ }
+ }
+ return fileName;
+ }
+
+
+ /**
+ * Retrieves the field name from the <code>Content-disposition</code>
+ * header.
+ *
+ * @param headers A <code>Map</code> containing the HTTP request
headers.
+ *
+ * @return The field name for the current <code>encapsulation</code>.
+ */
+ protected String getFieldName(Map /* String, String */ headers)
+ {
+ String fieldName = null;
+ String cd = getHeader(headers, CONTENT_DISPOSITION);
+ if (cd != null && cd.startsWith(FORM_DATA))
+ {
+ int start = cd.indexOf("name=\"");
+ int end = cd.indexOf('"', start + 6);
+ if (start != -1 && end != -1)
+ {
+ fieldName = cd.substring(start + 6, end);
+ }
+ }
+ return fieldName;
+ }
+
+
+ /**
+ * Creates a new {@link FileItem} instance.
+ *
+ * @param headers A <code>Map</code> containing the HTTP request
+ * headers.
+ * @param isFormField Whether or not this item is a form field, as
+ * opposed to a file.
+ *
+ * @return A newly created <code>FileItem</code> instance.
+ *
+ * @exception FileUploadException if an error occurs.
+ */
+ protected FileItem createItem(Map /* String, String */ headers,
+ boolean isFormField)
+ throws FileUploadException
+ {
+ return getFileItemFactory().createItem(getFieldName(headers),
+ getHeader(headers, CONTENT_TYPE),
+ isFormField,
+ getFileName(headers));
+ }
+
+
+ /**
+ * <p> Parses the <code>header-part</code> and returns as
key/value
+ * pairs.
+ *
+ * <p> If there are multiple headers of the same names, the name
+ * will map to a comma-separated list containing the values.
+ *
+ * @param headerPart The <code>header-part</code> of the current
+ * <code>encapsulation</code>.
+ *
+ * @return A <code>Map</code> containing the parsed HTTP request
headers.
+ */
+ protected Map /* String, String */ parseHeaders(String headerPart)
+ {
+ Map headers = new HashMap();
+ char buffer[] = new char[MAX_HEADER_SIZE];
+ boolean done = false;
+ int j = 0;
+ int i;
+ String header, headerName, headerValue;
+ try
+ {
+ while (!done)
+ {
+ i = 0;
+ // Copy a single line of characters into the buffer,
+ // omitting trailing CRLF.
+ while (i < 2 || buffer[i - 2] != '\r' || buffer[i - 1] !=
'\n')
+ {
+ buffer[i++] = headerPart.charAt(j++);
+ }
+ header = new String(buffer, 0, i - 2);
+ if (header.equals(""))
+ {
+ done = true;
+ }
+ else
+ {
+ if (header.indexOf(':') == -1)
+ {
+ // This header line is malformed, skip it.
+ continue;
+ }
+ headerName = header.substring(0, header.indexOf(':'))
+ .trim().toLowerCase();
+ headerValue =
+ header.substring(header.indexOf(':') + 1).trim();
+ if (getHeader(headers, headerName) != null)
+ {
+ // More that one heder of that name exists,
+ // append to the list.
+ headers.put(headerName,
+ getHeader(headers, headerName) + ','
+ + headerValue);
+ }
+ else
+ {
+ headers.put(headerName, headerValue);
+ }
+ }
+ }
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ // Headers were malformed. continue with all that was
+ // parsed.
+ }
+ return headers;
+ }
+
+
+ /**
+ * Returns the header with the specified name from the supplied map. The
+ * header lookup is case-insensitive.
+ *
+ * @param headers A <code>Map</code> containing the HTTP request
headers.
+ * @param name The name of the header to return.
+ *
+ * @return The value of specified header, or a comma-separated list if
+ * there were multiple headers of that name.
+ */
+ protected final String getHeader(Map /* String, String */ headers,
+ String name)
+ {
+ return (String) headers.get(name.toLowerCase());
+ }
+
+
+ /**
+ * Thrown to indicate that the request is not a multipart request.
+ */
+ public static class InvalidContentTypeException
+ extends FileUploadException
+ {
+ /**
+ * Constructs a <code>InvalidContentTypeException</code> with no
+ * detail message.
+ */
+ public InvalidContentTypeException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs an <code>InvalidContentTypeException</code> with
+ * the specified detail message.
+ *
+ * @param message The detail message.
+ */
+ public InvalidContentTypeException(String message)
+ {
+ super(message);
+ }
+ }
+
+
+ /**
+ * Thrown to indicate that the request size is not specified.
+ */
+ public static class UnknownSizeException
+ extends FileUploadException
+ {
+ /**
+ * Constructs a <code>UnknownSizeException</code> with no
+ * detail message.
+ */
+ public UnknownSizeException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs an <code>UnknownSizeException</code> with
+ * the specified detail message.
+ *
+ * @param message The detail message.
+ */
+ public UnknownSizeException(String message)
+ {
+ super(message);
+ }
+ }
+
+
+ /**
+ * Thrown to indicate that the request size exceeds the configured maximum.
+ */
+ public static class SizeLimitExceededException
+ extends FileUploadException
+ {
+ /**
+ * Constructs a <code>SizeExceededException</code> with no
+ * detail message.
+ */
+ public SizeLimitExceededException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs an <code>SizeExceededException</code> with
+ * the specified detail message.
+ *
+ * @param message The detail message.
+ */
+ public SizeLimitExceededException(String message)
+ {
+ super(message);
+ }
+ }
+
+}
\ No newline at end of file
Added:
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java
(rev 0)
+++
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki;
+
+import javax.portlet.PortletSession;
+
+public class PortletWikiSession implements WikiSession {
+
+ PortletSession portletSession;
+
+ public Object getAttribute(String attributeName) {
+ return portletSession.getAttribute(attributeName);
+ }
+
+ public void setAttribute(String attributeName, Object attribute) {
+ portletSession.setAttribute(attributeName, attribute);
+ }
+
+ public void removeAttribute(String attributeName) {
+ portletSession.removeAttribute(attributeName);
+ }
+
+ public PortletWikiSession(PortletSession portletSession) {
+ this.portletSession = portletSession;
+ }
+
+ public String getId() {
+ return portletSession.getId();
+ }
+
+}
Added:
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java
(rev 0)
+++
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki;
+
+import javax.servlet.http.HttpSession;
+
+public class ServletWikiSession implements WikiSession {
+
+ HttpSession httpSession;
+
+ public Object getAttribute(String arg0) {
+ return httpSession.getAttribute(arg0);
+ }
+
+ public void setAttribute(String arg0, Object arg1) {
+ httpSession.setAttribute(arg0, arg1);
+ }
+
+ public void removeAttribute(String arg0) {
+ httpSession.removeAttribute(arg0);
+ }
+
+ public ServletWikiSession(HttpSession httpSession) {
+ this.httpSession = httpSession;
+ }
+
+ public String getId() {
+ return httpSession.getId();
+ }
+
+}
Added: contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java
(rev 0)
+++
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,643 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSession;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.PortletDiskFileUpload;
+import org.jboss.logging.Logger;
+import org.jboss.portlet.JBossActionRequest;
+import org.jboss.portlet.JBossActionResponse;
+import org.jboss.portlet.JBossPortlet;
+import org.jboss.portlet.JBossRenderRequest;
+import org.jboss.portlet.JBossRenderResponse;
+import org.jboss.wiki.exceptions.EditSessionExpired;
+import org.jboss.wiki.exceptions.EditingNotAllowedException;
+import org.jboss.wiki.exceptions.WikiManagementNotFoundException;
+import org.jboss.wiki.exceptions.WikiSaveException;
+import org.jboss.wiki.management.WikiServiceManagement;
+
+/**
+ * The WikiPortlet.
+ * <p>
+ *
+ * @author <a href="mailto:dsicore@jboss.org">Damon Sicore</a>
+ * @author <a href="mailto:tomasz.szymanski@jboss.com">Tomasz
Szymanski</a>
+ * @author <a href="mailto:piergiorgiolucidi@gmail.com">Piergiorgio
Lucidi</a>
+ * @version $Id$
+ */
+
+public class WikiPortlet extends JBossPortlet {
+
+ final static String jspPath = "/WEB-INF/jsp/";
+
+ private static final String WINDOWS_FILE_NAME = "\\w:\\\\.+";
+
+ private String defaultPage = "Main";
+
+ private WikiEngine wikiEngine;
+
+ private Logger log;
+
+ public void init() {
+ log = Logger.getLogger(WikiPortlet.class);
+
+ WikiCommon wikiCommon = new WikiCommon();
+
+ try {
+ WikiServiceManagement wikiServiceMenagement = wikiCommon
+ .getWikiManagement();
+ wikiEngine = wikiServiceMenagement.getWikiEngine();
+ } catch (WikiManagementNotFoundException e1) {
+ log.error("Couldn't find WikiManagement", e1);
+ wikiEngine = new WikiEngine();
+ }
+ }
+
+ private Map<String, String> convertParameters(ActionRequest rReq) {
+ Map<String, String> convertedParameters = new HashMap<String, String>();
+
+ Map paramMap = rReq.getParameterMap();
+
+ for (Object key : paramMap.keySet()) {
+ try {
+ if (rReq.getParameter("editAction") != null) {
+ convertedParameters.put((String) key, new String(rReq
+ .getParameter((String) key).getBytes("ISO-8859-1"),
+ "UTF-8"));
+ } else {
+ convertedParameters.put((String) key, rReq
+ .getParameter((String) key));
+ }
+ } catch (UnsupportedEncodingException e) {
+ log.error(e);
+ convertedParameters.put((String) key, (String) paramMap
+ .get(key));
+ }
+ }
+
+ return convertedParameters;
+ }
+
+ public void processAction(JBossActionRequest rReq, JBossActionResponse rResp) {
+
+ Map<String, String> convertedParameters = convertParameters(rReq);
+
+ Credentials credentials = wikiEngine.getCredentialsInstance(rReq);
+
+
+
+
+ // wikiContext is null - to get refernece to actual page
+
+ WikiContext wikiContext = null;
+
+ if (PortletDiskFileUpload.isMultipartContent(rReq)) {
+ PortletDiskFileUpload dfu = new PortletDiskFileUpload();
+
+ // maximum allowed file upload size (10 MB)
+ dfu.setSizeMax(10 * 1000 * 1000);
+
+ // maximum size in memory (vs disk) (100 KB)
+ dfu.setSizeThreshold(100 * 1000);
+
+ try {
+ // get the FileItems
+ List fileItems = dfu.parseRequest(rReq);
+ Iterator iter = fileItems.iterator();
+ while (iter.hasNext()) {
+ FileItem item = (FileItem) iter.next();
+ if (item.isFormField()) {
+ // pass along to render request
+ String fieldName = item.getFieldName();
+ String value = item.getString();
+ rResp.setRenderParameter(fieldName, value);
+ } else {
+ // write the uploaded file to a new location
+ String fieldName = item.getFieldName();
+ String fileName = item.getName();
+
+ // change windows names (remove c:\bull\shit\)
+ if (fileName.matches(WINDOWS_FILE_NAME)) {
+ fileName = fileName.substring(fileName
+ .lastIndexOf('\\') + 1, fileName.length());
+ }
+
+ if (fileName.length() == 0) {
+ throw new FileUploadException("Wrong file name: "
+ + item.getName());
+ }
+
+ // delete spaces
+
+ while (fileName.indexOf(' ') != -1) {
+ Character chr = fileName.charAt(fileName
+ .indexOf(' ') + 1);
+
+ fileName = fileName.substring(0, fileName
+ .indexOf(' '))
+ + (char) Character.toUpperCase(chr)
+ + fileName.substring(
+ fileName.indexOf(' ') + 2, fileName
+ .length());
+ }
+
+ String tempDir = System.getProperty("java.io.tmpdir");
+ String serverFileName = fieldName + fileName
+ + "-portlet.tmp";
+
+ File serverFile = new File(tempDir, serverFileName);
+
+ item.write(serverFile);
+
+ log.info("serverFileName : " + tempDir + "/"
+ + serverFileName + " filename: " + fileName);
+
+ WikiPage pageWithAtt = wikiEngine.getByName(
+ convertedParameters.get("page"), null,
+ (String) convertedParameters.get("language"));
+
+ FileInputStream fis = new FileInputStream(serverFile);
+
+ pageWithAtt.addAttachement(fis, fileName, credentials
+ .getName());
+
+ // at the end delete the temp file
+ serverFile.delete();
+ }
+ }
+ } catch (FileUploadException fue) {
+ String msg = "File Upload Exception: " + fue.getMessage();
+ rResp.setRenderParameter("error", msg);
+ getPortletContext().log(msg, fue);
+ } catch (Exception e) {
+ String msg = "Exception: " + e.getMessage();
+ rResp.setRenderParameter("error", msg);
+ getPortletContext().log(msg, e);
+ }
+ }
+
+ if (convertedParameters.get("page") != null
+ && (convertedParameters.get("page").length() > 0)) {
+ StringBuffer sBuf = new StringBuffer(convertedParameters
+ .get("page"));
+
+ if (Character.isLowerCase(sBuf.charAt(0))) {
+ // change first letter to upper if it isn't
+ sBuf.setCharAt(0, Character.toUpperCase(sBuf.charAt(0)));
+ }
+
+ //
+ // Capitalise words in subpages
+ //
+
+ for (int i = 0; i < sBuf.length() - 1; i++) {
+ if ((sBuf.charAt(i) == '/')
+ && (Character.isLowerCase(sBuf.charAt(i + 1)))) {
+ sBuf.setCharAt(i + 1, Character.toUpperCase(sBuf
+ .charAt(i + 1)));
+ }
+ }
+
+ rResp.setRenderParameter("page", sBuf.toString());
+
+ }
+
+ if (convertedParameters.get("searchQuery") != null) {
+ Map<String, Integer> pages = wikiEngine.findPages(
+ convertedParameters.get("searchQuery"),
+ (String) convertedParameters.get("language"));
+
+ rReq.getPortletSession().setAttribute("findResult", pages);
+
+ // show the results
+ rResp.setRenderParameter("page", "FindResult");
+ }
+
+ int i = 1;
+
+ while (convertedParameters.get("var" + i) != null) {
+ rReq.getPortletSession().setAttribute("var" + i,
+ convertedParameters.get("var" + i));
+ i++;
+ }
+
+ if (convertedParameters.get("action") != null) {
+ rResp.setRenderParameter("action", convertedParameters
+ .get("action"));
+ }
+
+ if (convertedParameters.get("type") != null) {
+ rResp.setRenderParameter("type",
convertedParameters.get("type"));
+ }
+
+ if (convertedParameters.get("version") != null) {
+ log.info("[process action]Getting page "
+ + convertedParameters.get("page") + " at version "
+ + convertedParameters.get("version"));
+ rResp.setRenderParameter("version", convertedParameters
+ .get("version"));
+ }
+
+ if (convertedParameters.get("language") != null) {
+ rResp.setRenderParameter("language", (String) convertedParameters
+ .get("language"));
+ } else {
+ rResp.setRenderParameter("language", wikiEngine.defaultLangugeCode);
+ }
+
+ if (convertedParameters.get("editAction") != null) {
+ log.debug("EDITING PAGE");
+
+ String editedPageName = convertedParameters.get("editedPage");
+
+ // unlock page
+ WikiPage edPage = wikiEngine.getByName(editedPageName, wikiContext,
+ (String) convertedParameters.get("language"));
+
+ if (edPage != null) { // it may be null if the page isn't saved
+ // yet
+ edPage.unlock(credentials, Integer
+ .valueOf((String) convertedParameters
+ .get("editSessionId")));
+ }
+
+ // saving, previewing or canceling
+
+ if (convertedParameters.get("editAction").equals("Save")) {
+
+ // save the page
+
+ if (edPage == null) {
+ edPage = new WikiPage(editedPageName, credentials, "", 0,
+ 0, new Date(), wikiEngine, true, true, null, null,
+ 0, (String) convertedParameters.get("language"));
+ }
+
+ // set new content
+ edPage.setContent(convertedParameters.get("wikiContent"));
+
+ // set author name for new version
+ edPage.setLastAuthor(credentials);
+
+ // increase page version
+ edPage.setLastVersion(edPage.getLastVersion() + 1);
+
+ // set new data
+ edPage.setEditDate(new Date());
+
+ // save the page
+ try {
+ edPage.save(credentials, Integer
+ .valueOf((String) convertedParameters
+ .get("editSessionId")),
+ (String) convertedParameters.get("language"),
+ new PortletWikiSession(rReq.getPortletSession()));
+ } catch (NumberFormatException e) {
+ log.error(e);
+ } catch (EditSessionExpired e) {
+ rReq.setAttribute("errorMsg", e.getMessage());
+ log.error(e);
+ } catch (WikiSaveException e) {
+ rReq.setAttribute("errorMsg", e.getMessage());
+ log.error(e);
+ } catch (EditingNotAllowedException e) {
+ rReq.setAttribute("errorMsg", e.getMessage());
+ log.error(e);
+ }
+
+ // and finally remove old page object from memory to force
+ // reloading it
+ wikiEngine.refreshPage(edPage.getName(), edPage.getLangCode());
+ }
+ }
+
+ }
+
+ public void doView(JBossRenderRequest rReq, JBossRenderResponse rRes)
+ throws PortletException, java.io.IOException {
+ try {
+ WikiSession wikiSession = new PortletWikiSession(rReq
+ .getPortletSession());
+
+ Credentials credentials = wikiEngine.getCredentialsInstance(rReq);
+
+ String langCode = rReq.getParameter("language");
+
+ if (langCode == null) {
+ langCode = wikiEngine.defaultLangugeCode;
+ }
+
+ String wikiURL = rRes.createActionURL().toString() + "&language=" +
langCode;
+
+ rReq.setAttribute("actionURL", wikiURL);
+
+ if (langCode == null) {
+ langCode = wikiEngine.defaultLangugeCode;
+ }
+
+ boolean showPage = true;
+
+ // Create server host and put it into session for plugins
+ String hostURL = ((rReq.isSecure()) ? "https" : "http")
+ + "://"
+ + rReq.getServerName()
+ + ((rReq.getServerPort() == 80) ? "" : ":"
+ + rReq.getServerPort());
+
+ prepareSession(rReq.getPortletSession(), credentials, hostURL, wikiURL,
rReq.isSecure());
+
+ /*
+ * WikiPage noSuchPage = new WikiPage("", credentials, "There is no
+ * such page. Click on EDIT to start it.", 0, 0, null,
+ * wikiEngine.getMediaDataSource(), wikiEngine
+ * .getAttachementDataSource(), true, true);
+ */
+
+ String page = "Wiki.jsp";
+
+ String wikiPage = defaultPage;
+
+ WikiPage pageToShow = null;
+
+ WikiContext wikiContext = null;
+
+ if (rReq.getParameter("page") != null) {
+ wikiPage = rReq.getParameter("page");
+ }
+
+ if ((rReq.getParameter("action") != null)
+ && (rReq.getParameter("action").equals("Attach"))) {
+ rReq.setAttribute("fileAttach", "true");
+ }
+
+ if ((rReq.getParameter("action") != null)
+ && (rReq.getParameter("action").equals("Edit"))
+ && (credentials.isLoggedIn())) {
+ page = "Edit.jsp";
+ showPage = false;
+
+ WikiContext editWikiContext = new WikiContext(credentials,
+ wikiEngine.getWikiType("edit"), wikiSession);
+
+ pageToShow = wikiEngine.getByName(wikiPage, editWikiContext,
+ langCode);
+
+ if ((pageToShow != null)
+ && (!pageToShow.isEditable(credentials))) {
+ if (!credentials.isAdmin()) {
+ showPage = true;
+ }
+ } else {
+ if (rReq.getParameter("version") != null) {
+ // show previous version of page
+
+ log.info("Getting page " + wikiPage + " at version "
+ + rReq.getParameter("version"));
+
+ if ((pageToShow.getLastVersion() > Integer.valueOf(rReq
+ .getParameter("version")))) {
+ pageToShow = wikiEngine
+ .getByName(wikiPage, editWikiContext,
+ Integer.valueOf(rReq
+ .getParameter("version")),
+ langCode);
+ }
+
+ if (pageToShow.getLastVersion() != pageToShow
+ .getVersion()) {
+ rReq.setAttribute("showedVersion", Integer
+ .valueOf(rReq.getParameter("version")));
+ }
+ } else {
+ pageToShow = wikiEngine.getByName(wikiPage,
+ editWikiContext, langCode);
+ }
+
+ if (pageToShow == null) {
+ // start editing new page
+ // wikiPage = defaultPage;
+
+ pageToShow = new WikiPage(wikiPage, credentials, "", 0,
+ 0, new Date(), wikiEngine, true, true, null,
+ null, 0, langCode);
+ // wikiEngine.getByName(wikiPage, wikiContext);
+ }
+
+ int editSessionId = wikiEngine.getEditSessionId();
+
+ Date dateLock = wikiEngine.getByName(wikiPage, null,
+ langCode).lock(credentials, editSessionId);
+
+ rReq.setAttribute("editSessionId", String
+ .valueOf(editSessionId));
+
+ if (dateLock != null) {
+ rReq
+ .setAttribute(
+ "lockMsg",
+ "Page is locked by "
+ + pageToShow.getLockUser()
+ + " from "
+ + dateLock
+ + ".<br> I won't stop you from saving, but you or he can
erease each other changes. Lock will expire: ");
+ }
+ }
+ } else if ((rReq.getParameter("action") != null)
+ && (rReq.getParameter("action").equals("Info"))) {
+ page = "PageInfo.jsp";
+ showPage = false;
+
+ pageToShow = wikiEngine.getByName(wikiPage, null, langCode);
+
+ /*
+ * if (pageToShow == null) { // if somebody entered a link to
+ * info // non-existing page page = "Wiki.jsp"; try { pageToShow =
+ * (WikiPage) noSuchPage.clone(); } catch
+ * (CloneNotSupportedException cnse) { log.info(cnse); }
+ *
+ * pageToShow.setName(wikiPage); } else {
+ */
+ rReq.setAttribute("pageAtTop", pageToShow);
+
+ }
+
+ if (showPage) {
+ page = "Wiki.jsp";
+
+ String type = "html";
+
+ if (rReq.getParameter("type") != null) {
+ type = rReq.getParameter("type");
+ // log.info("Getting type: " + type);
+ }
+
+ wikiContext = new WikiContext(credentials, wikiEngine
+ .getWikiType(type), new PortletWikiSession(rReq
+ .getPortletSession()));
+
+ if (rReq.getParameter("version") != null) {
+ // show previous version of page
+ log.info("Getting page " + wikiPage + " at version "
+ + rReq.getParameter("version"));
+ pageToShow = wikiEngine.getByName(wikiPage, wikiContext,
+ Integer.valueOf(rReq.getParameter("version")),
+ langCode);
+
+ if (pageToShow.getLastVersion() != pageToShow.getVersion()) {
+ rReq.setAttribute("showedVersion", Integer.valueOf(rReq
+ .getParameter("version")));
+ }
+ } else {
+ pageToShow = wikiEngine.getByName(wikiPage, wikiContext,
+ langCode);
+ }
+
+ /*
+ * if (pageToShow == null) {
+ *
+ * try { pageToShow = (WikiPage) noSuchPage.clone(); } catch
+ * (CloneNotSupportedException cnse) { log.info(cnse); }
+ *
+ * pageToShow.setName(wikiPage); }
+ */
+
+ }
+
+ rReq
+ .setAttribute(
+ "wikiName",
+ "<img src=\""
+ + hostURL
+ + "/wiki/"
+ + WikiCommon.wikiButtons
+ + "/JBossWikiLogoMedium.png\" width=\"100\"
border=\"0\" style=\"vertical-align: middle\"/>");
+
+ rReq.setAttribute("wikiContent", pageToShow.getContent());
+
+ rReq.setAttribute("wikiImagesUrl", hostURL + "/wiki/"
+ + WikiCommon.wikiButtons + "/");
+
+ rReq.setAttribute("wikiPage", pageToShow.getName());
+
+ rReq.setAttribute("editDate", pageToShow.getEditDate());
+
+ rReq.setAttribute("author", pageToShow.getLastAuthor());
+
+ rReq.setAttribute("logedIn", credentials.isLoggedIn());
+
+ rReq.setAttribute("defaultPage", defaultPage);
+
+ rReq.setAttribute("isEditable", pageToShow.isEditable(credentials));
+
+ rReq.setAttribute("isViewable", pageToShow.isViewable(credentials));
+
+ rReq.setAttribute("isAdmin", credentials.isAdmin());
+
+ rReq.setAttribute("usedLangs", wikiEngine.getUsedLanguageCodes());
+
+ rReq.setAttribute("currentLanguage", langCode);
+
+ rReq
+ .setAttribute(
+ "friendlyLink",
+ hostURL
+ + "/wiki/"
+ + ((!langCode
+ .equals(wikiEngine.defaultLangugeCode)) ? langCode
+ .toLowerCase()
+ + "/"
+ : "") + pageToShow.getName());
+ rReq
+ .setAttribute(
+ "rssLink",
+ hostURL
+ + "/wiki/"
+ + ((!langCode
+ .equals(wikiEngine.defaultLangugeCode)) ? langCode
+ .toLowerCase()
+ + "/"
+ : "") + "rss/"
+ + pageToShow.getName());
+ rReq
+ .setAttribute(
+ "rdfLink",
+ hostURL
+ + "/wiki/"
+ + ((!langCode
+ .equals(wikiEngine.defaultLangugeCode)) ? langCode
+ .toLowerCase()
+ + "/"
+ : "") + "rdf/"
+ + pageToShow.getName());
+ rReq
+ .setAttribute(
+ "atomLink",
+ hostURL
+ + "/wiki/"
+ + ((!langCode
+ .equals(wikiEngine.defaultLangugeCode)) ? langCode
+ .toLowerCase()
+ + "/"
+ : "") + "atom/"
+ + pageToShow.getName());
+
+ rRes.setTitle("Wiki");
+ if (javax.portlet.WindowState.NORMAL.equals(rReq.getWindowState())
+ || javax.portlet.WindowState.MAXIMIZED.equals(rReq
+ .getWindowState())) {
+ rRes.setContentType("text/html; charset=UTF-8");
+ javax.portlet.PortletRequestDispatcher pRD = this
+ .getPortletContext().getRequestDispatcher(
+ jspPath + page);
+ pRD.include(rReq, rRes);
+ return;
+ }
+ doDispatch((JBossRenderRequest)rReq, (JBossRenderResponse)rRes);
+ } catch (RuntimeException e) {
+ e.printStackTrace();
+ throw (e);
+ }
+ }
+
+ private void prepareSession(PortletSession portletSession,
+ Credentials credentials, String hostURL, String wikiURL, Boolean isSecure) {
+ // prepare some data for plugins in session
+ portletSession.setAttribute(WikiSession.CREDENTIALS, credentials);
+ portletSession.setAttribute(WikiSession.HOST_URL, hostURL);
+ portletSession.setAttribute(WikiSession.ACTION_URL, wikiURL);
+ portletSession.setAttribute(WikiSession.IS_SECURE, isSecure);
+ }
+}
\ No newline at end of file
Added:
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java
===================================================================
---
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java
(rev 0)
+++
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,394 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.fileaccess;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.Properties;
+
+import javax.activation.MimetypesFileTypeMap;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.logging.Logger;
+import org.jboss.wiki.FileMediaDataSource;
+import org.jboss.wiki.ServletWikiSession;
+import org.jboss.wiki.SimpleCredentials;
+import org.jboss.wiki.WikiAttachment;
+import org.jboss.wiki.WikiCommon;
+import org.jboss.wiki.WikiContext;
+import org.jboss.wiki.WikiEngine;
+import org.jboss.wiki.WikiPage;
+import org.jboss.wiki.WikiPlugin;
+import org.jboss.wiki.WikiSession;
+import org.jboss.wiki.exceptions.WikiManagementNotFoundException;
+import org.jboss.wiki.management.WikiServiceManagement;
+
+
+/**
+ * A filter that enables to download files form the jspwiki structure +
+ * redirects to pages by typing
http://domain/wiki/Page
+ *
+ * @author tomek
+ */
+
+public class WikiFileAccessFilter implements Filter {
+ /**
+ * <code>BUF_SIZE</code> - size of a buffer, which is used while reading a
+ * file and sending it to the client.
+ */
+
+ private final int BUF_SIZE = 32768;
+
+ private String attachementsPath;
+
+ private String wikiHome;
+
+ private WikiEngine wikiEngine;
+
+ /*
+ * private ForgeHelper forgeHelper; private ContentManager contentManager;
+ */
+ private MimetypesFileTypeMap mimeTypes;
+
+ private Logger log;
+
+ public void init(FilterConfig conf) {
+ // get wikiEnigne form wikiMenagement
+
+ log = Logger.getLogger(WikiFileAccessFilter.class);
+
+ try {
+ WikiServiceManagement wikiServiceMenagement = WikiCommon
+ .getWikiManagement();
+ wikiEngine = wikiServiceMenagement.getWikiEngine();
+ } catch (WikiManagementNotFoundException e1) {
+ log.error("Couldn't find WikiManagement", e1);
+ wikiEngine = new WikiEngine();
+ }
+
+ // load mime types map
+
+ mimeTypes = new MimetypesFileTypeMap(WikiFileAccessFilter.class
+ .getResourceAsStream("mime.types"));
+
+ // load path to attachements from filedatasource.properties
+
+ Properties props = new Properties();
+
+ try {
+ props.load(FileMediaDataSource.class
+ .getResourceAsStream("filedatasource.properties"));
+
+ // get the path to attachment property
+ attachementsPath = props.getProperty("pathToAttachements");
+
+ props.load(WikiPlugin.class
+ .getResourceAsStream("wikiPlugins.properties"));
+
+ // get the host
+ wikiHome = props.getProperty("wikiHome");
+
+ } catch (IOException e) {
+ log.error(e);
+ }
+
+ log.info("Loaded attachements path: " + attachementsPath);
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+
+ String langCode = wikiEngine.defaultLangugeCode;
+
+ if (request instanceof HttpServletRequest) {
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+
+ WikiSession wikiSession = new ServletWikiSession(httpRequest
+ .getSession());
+
+ String hostURL = ((request.isSecure()) ? "https" : "http")
+ + "://"
+ + request.getServerName()
+ + ((request.getServerPort() == 80) ? "" : ":"
+ + request.getServerPort());
+
+ wikiSession.setAttribute("hostURL", hostURL);
+
+ String requestURI = URLDecoder.decode(httpRequest.getRequestURI(),
+ "UTF-8");
+
+ // get off "/wiki/" from the begining
+ requestURI = requestURI.substring("/wiki/".length());
+
+ // support old type link with Wiki.jsp?page=
+ if (requestURI.equals("Wiki.jsp")) {
+ if (httpRequest.getParameter("page") != null)
+ httpResponse.sendRedirect(hostURL + wikiHome + "&page="
+ + httpRequest.getParameter("page"));
+ else
+ httpResponse.sendRedirect(hostURL + wikiHome);
+
+ return;
+ }
+
+ while (requestURI.endsWith("/")) {
+ // get rid of ending "/" character(s)
+ requestURI = requestURI.substring(0, requestURI.length() - 1);
+ }
+
+ int version = -1;
+
+ if (requestURI.matches(".*:\\d+")) {
+ // there is a ":" at the end of request uri - pick a version
+
+ int verStart = requestURI.lastIndexOf(":");
+ version = Integer.valueOf(requestURI.substring(verStart + 1));
+ requestURI = requestURI.substring(0, verStart);
+ }
+ // Parse URI to get filename and page name
+ String[] tokens = requestURI.split("[/]");
+
+ if ((tokens.length == 1) && (tokens[0].equals(""))) {
+ // show Main page - as there is no place to go specified :)
+ httpResponse.sendRedirect(hostURL + wikiHome);
+ return;
+ }
+
+ // check if user is browsing different then default language
+ if (wikiEngine.getUsedLanguageCodes().containsKey(
+ tokens[0].toUpperCase())) {
+ langCode = tokens[0].toUpperCase();
+ // redo tokens but without language
+ if (requestURI.startsWith(tokens[0] + "/")) {
+ requestURI = requestURI.substring((tokens[0] + "/")
+ .length());
+ } else {
+ requestURI = requestURI.substring((tokens[0]).length());
+ }
+
+ tokens = requestURI.split("[/]");
+
+ if ((tokens.length == 1) && (tokens[0].equals(""))) {
+ // show Main page - as there is no place to go specified :)
+ httpResponse.sendRedirect(hostURL + wikiHome + "&language="
+ + langCode);
+ return;
+ }
+ }
+
+ // check if all tokens are UpperCase (meanins they are all wiki
+ // pages)
+ boolean isAllUpperCase = true;
+
+ for (int i = 0; i < tokens.length; i++)
+ // uppercase or UTF character
+ if (!(Character.isUpperCase(tokens[i].charAt(0)) || (tokens[i]
+ .charAt(0) > 127 && Character.isLetter(tokens[i]
+ .charAt(0))))) {
+ isAllUpperCase = false;
+ break;
+ }
+
+ if (isAllUpperCase) {
+ String pageName = "";
+
+ for (int i = 0; i < tokens.length; i++) {
+ pageName += "/" + URLEncoder.encode(tokens[i], "UTF-8");
+ }
+
+ if (Character.isUpperCase(tokens[tokens.length - 1].charAt(0))
+ || (tokens[tokens.length - 1].charAt(0) > 127 && Character
+ .isLetter(tokens[tokens.length - 1].charAt(0)))) {
+ httpResponse.sendRedirect(hostURL + wikiHome + "&page="
+ + pageName.substring(1)
+ + ((version != -1) ? "&version=" + version : "")
+ + "&language=" + langCode);
+ } else {
+ PrintWriter out = httpResponse.getWriter();
+ httpResponse.setContentType("text/html");
+ out
+ .println("<html><body><h3>ERROR</h3><br
/>\nPage name must start with upper case letter.</body></html>");
+ }
+
+ } else if (tokens[0].equals(WikiCommon.wikiButtons)) {
+ // show apropriate buttons
+ InputStream imageIS = WikiFileAccessFilter.class
+ .getResourceAsStream("/images/"
+ + tokens[tokens.length - 1]);
+
+ ServletOutputStream os = response.getOutputStream();
+
+ response.setContentType(mimeTypes
+ .getContentType(tokens[tokens.length - 1]));
+
+ // Transferring the bytes
+ try {
+ byte[] buffer = new byte[BUF_SIZE];
+ int read;
+ while ((read = imageIS.read(buffer)) != -1)
+ os.write(buffer, 0, read);
+ } catch (Exception e2) {
+ // Nothing that we can really do. Just send an
+ // incomplete
+ // file.
+ } finally {
+ os.close();
+ imageIS.close();
+ }
+
+ } else if ((Character.isLowerCase(tokens[0].charAt(0)))
+ && (tokens.length > 1)) {
+ boolean isPageNameUC = true;
+
+ for (int i = 1; i < tokens.length; i++)
+ if (Character.isLowerCase(tokens[i].charAt(0))) {
+ isPageNameUC = false;
+ break;
+ }
+
+ if (isPageNameUC) {
+ // SHOW wikiType firstToken with page secondToken
+
+ String wikiTypeName = tokens[0];
+
+ if (wikiEngine.wikiTypeExists(wikiTypeName)) {
+
+ // get pageName
+ String pageName = "";
+ for (int i = 1; i < tokens.length; i++) {
+ pageName += "/" + tokens[i];
+ }
+
+ pageName = pageName.substring(1);
+
+ WikiPage page = wikiEngine.getByName(pageName,
+ new WikiContext(new SimpleCredentials(""),
+ wikiEngine.getWikiType(wikiTypeName),
+ wikiSession), langCode);
+
+ httpResponse.setContentType(wikiEngine.getWikiType(
+ wikiTypeName).getContentType());
+
+ httpResponse.setContentLength(page.getPageContent()
+ .length());
+
+ httpResponse.getWriter().print(page.getPageContent());
+
+ httpResponse.getWriter().flush();
+ } else {
+ // show error response
+ httpResponse.setContentType("text/html");
+ httpResponse.getWriter().println(
+ "<html><body><h3>ERROR</h3><br />\nThere is no
such wikiType: "
+ + wikiTypeName + "</body></html>");
+ }
+ } else {
+ httpResponse.setContentType("text/html");
+ httpResponse
+ .getWriter()
+ .println(
+ "<html><body><h3>ERROR</h3><br />\nPage name
must start with upper case letter.</body></html>");
+ }
+ } else if (tokens[tokens.length - 1].matches("file:.*")) {
+ // Show file of a page
+
+ // get pageName
+ String pageName = "";
+ for (int i = 0; i < tokens.length - 1; i++) {
+ pageName += ((i > 0) ? "/" : "") + tokens[i];
+ }
+
+ String fileName = tokens[tokens.length - 1].substring("file:"
+ .length());
+
+ WikiAttachment wikiAttachment;
+
+ if (version == -1) {
+ wikiAttachment = wikiEngine.getAttachment(pageName,
+ fileName, langCode);
+ } else {
+ wikiAttachment = wikiEngine.getAttachment(pageName,
+ fileName, version, langCode);
+ }
+
+ if (wikiAttachment != null) {
+ InputStream fileIS = wikiAttachment.getInputStream();
+
+ ServletOutputStream os = response.getOutputStream();
+
+ response.setContentType(mimeTypes.getContentType(fileName));
+ // response.setContentLength((int) fileIS.);
+
+ // Transferring the bytes
+ try {
+ byte[] buffer = new byte[BUF_SIZE];
+ int read;
+ while ((read = fileIS.read(buffer)) != -1)
+ os.write(buffer, 0, read);
+ } catch (Exception e2) {
+ // Nothing that we can really do. Just send an
+ // incomplete
+ // file.
+ } finally {
+ os.close();
+ fileIS.close();
+ }
+ } else {
+ ServletOutputStream os = response.getOutputStream();
+
+ response.setContentType("text/html");
+
+ os
+ .println("<html><body><h3>ERROR</h3><br
/>\nThere is no such file or there is no such version of
file</body></html>");
+ }
+ } else {
+ ServletOutputStream os = response.getOutputStream();
+
+ response.setContentType("text/html");
+
+ os
+ .println("<html><body><h3>ERROR</h3><br
/>\nThere is lack of page name or page name should be
uppercase</body></html>");
+ }
+ } else {
+ throw new IOException(
+ "This servlet should be called as HTTPServletRequest");
+ }
+ }
+
+ public void destroy() {
+
+ }
+}
Added:
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/redirect/WikiRedirectFilter.java
===================================================================
---
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/redirect/WikiRedirectFilter.java
(rev 0)
+++
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/redirect/WikiRedirectFilter.java 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.redirect;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * A filter that redirects from /wiki/Wiki.jsp?page=PageToGo to
+ *
http://labs.jboss.com/wiki/PageToGo (by default, but it's configurable)
+ *
+ * @author Tomasz Szymanski
+ */
+
+public class WikiRedirectFilter implements Filter {
+
+ /**
+ * Old link begginig
+ */
+ private static final String oldLink = "/wiki/Wiki.jsp";
+
+ /**
+ * Host with JBoss Wiki. This is configurable as initParameter
+ */
+ private static String redirectURI = "http://labs.jboss.org/wiki/";
+
+ /**
+ * Name of the initParameter to set redirectURI
+ */
+ private static final String REDIRECT_URI = "redirectURI";
+
+ /**
+ * Where to redirect when wrong uri is entered. This is configurable as
+ * initParameter
+ */
+ private static String errorURI = "/errors/404";
+
+ /**
+ * Name of the initParameter to set errorURI
+ */
+ private static final String ERROR_URI = "errorURI";
+
+ public void init(FilterConfig conf) {
+ // get REDIRECT_URI parameter
+ if (conf.getInitParameter(REDIRECT_URI) != null) {
+ redirectURI = conf.getInitParameter(REDIRECT_URI);
+ }
+
+ // get ERROR_URI parameter
+ if (conf.getInitParameter(ERROR_URI) != null) {
+ errorURI = conf.getInitParameter(ERROR_URI);
+ }
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+
+ if (request instanceof HttpServletRequest) {
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+
+ String requestURI = httpRequest.getRequestURI();
+
+ // if requested URI starts with /wiki/Wiki.jsp?page=Page - do the redirection
+ if (requestURI.startsWith(oldLink)
+ && httpRequest.getParameter("page") != null) {
+
+ // sends redirection to REDIRECT_URI/Page
+ httpResponse.sendRedirect(redirectURI
+ + httpRequest.getParameter("page"));
+ } else {
+
+ // if link is wrong - redirect to error page (ERROR_URI)
+ httpResponse.sendRedirect(errorURI);
+ }
+
+ } else {
+ throw new IOException(
+ "This servlet should be called as HTTPServletRequest");
+ }
+ }
+
+ public void destroy() {
+
+ }
+}
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-app.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-app.xml
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-app.xml 2009-03-03 18:51:31
UTC (rev 246)
@@ -0,0 +1,3 @@
+<jboss-app>
+ <app-name>wikiportlet</app-name>
+</jboss-app>
\ No newline at end of file
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-portlet.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-portlet.xml
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-portlet.xml 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE portlet-app PUBLIC
+ "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+
+<portlet-app>
+
+ <portlet>
+ <portlet-name>WikiPortlet</portlet-name>
+ <transaction>
+ <trans-attribute>Required</trans-attribute>
+ </transaction>
+ </portlet>
+
+</portlet-app>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-web.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-web.xml
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-web.xml 2009-03-03 18:51:31
UTC (rev 246)
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<jboss-web>
+</jboss-web>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp 2009-03-03 18:51:31
UTC (rev 246)
@@ -0,0 +1,77 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at
gnu.org.
+ -->
+<%@ page language="java"
extends="org.jboss.portal.core.servlet.jsp.PortalJsp"
pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
+<%@ page isELIgnored ="false" %>
+
+<%
+ String actionURL = (String)request.getAttribute("actionURL");
+ String wikiName = (String)request.getAttribute("wikiName");
+ String wikiContent = (String)request.getAttribute("wikiContent");
+ String wikiPage = (String)request.getAttribute("wikiPage");
+ String lockMsg = (String)request.getAttribute("lockMsg");
+ String defaultPage = (String)request.getAttribute("defaultPage");
+ String wikiImagesUrl = (String)request.getAttribute("wikiImagesUrl");
+ String editSessionId = (String)request.getAttribute("editSessionId");
+ java.util.Map usedLangs = (java.util.Map)request.getAttribute("usedLangs");
+ String curLang = (String)request.getAttribute("currentLanguage");
+
+ if (lockMsg == null)
+ lockMsg = "";
+
+%>
+
+<h2><a
href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><%=wikiName%></a>/
<%=wikiPage%> [<%=curLang%>] </h2>
+<!--
+<br />
+<a
href="<%=actionURL%>&page=<%=defaultPage%>"><%=defaultPage%></a><br
/>-->
+
+<hr />
+<div style="color:#FF0000"><%=lockMsg%></div>
+<form method="post" action="<%=actionURL%>"
accept-charset="UTF-8">
+Language: <%=curLang %>
+<textarea name="wikiContent" rows="40" cols="80"
style="width:100%;"><%=wikiContent%></textarea>
+<input type="hidden" name="editedPage"
value="<%=wikiPage%>" />
+<input type="hidden" name="page"
value="<%=wikiPage%>" />
+<input type="hidden" name="editSessionId"
value="<%=editSessionId%>" />
+<input type="submit" value="Save" name="editAction"
/>
+<!--<input type="submit" value="Preview"
name="editAction" />-->
+<input type="submit" value="Cancel" name="editAction"
/>
+<input type="button" value="Check Spelling"
onClick="openSpellChecker();"/>
+</form>
+Here's a short reminder on what elements you have at your disposal:
+<PRE>
+---- Horizontal ruler
+\\ Forced line break
+[link] Create hyperlink to "link", where "link" can be
either an internal
+ WikiName or an external link (http://)
+[text|link] Create a hyperlink where the link text is different from the actual
+ hyperlink link.
+[text|wiki:link] Create a hyperlink where the link text is different from the
+ actual hyperlink link, and the hyperlink points to a named Wiki.
+ This supports interWiki linking.
+
+* Make a bulleted list (must be in first column). Use more (**)
+ for deeper indentations.
+# Make a numbered list (must be in first column). Use more (##, ###)
+ for deeper indentations.
+
+!, !!, !!! Start a line with an exclamation mark (!) to make a heading.
+ More exclamation marks mean bigger headings.
+
+__text__ Makes text bold.
+''text'' Makes text in italics (notice that these are single
quotes ('))
+{{text}} Makes text in monospaced font.
+;term:def Defines 'term' with 'def'. Use this with empty
'term' to make short comments.
+
+|text|more text| Makes a table. Double bars for a table heading.
+</PRE>
+<P>
+Don't try to use HTML, since it just won't work.
+<P>
+To embed images just put them available on the web using one of the approved formats, and
they will get inlined automatically.
+
+<P>
+To make a code block, use triple {'s to open, and triple }'s to close.
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,72 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at
gnu.org.
+ -->
+<%@ page language="java"
extends="org.jboss.portal.core.servlet.jsp.PortalJsp"
contentType="text/html; charset=UTF-8"%>
+<%@ page isELIgnored ="false" %>
+
+<%
+ String actionURL = (String)request.getAttribute("actionURL");
+ String wikiName = (String)request.getAttribute("wikiName");
+ //String wikiContent = (String)request.getAttribute("wikiContent");
+ String wikiPage = (String)request.getAttribute("wikiPage");
+ String defaultPage = (String)request.getAttribute("defaultPage");
+ String wikiImagesUrl = (String)request.getAttribute("wikiImagesUrl");
+ String curLang = (String)request.getAttribute("currentLanguage");
+ //java.util.Date editDate = (java.util.Date)request.getAttribute("editDate");
+ //org.jboss.wiki.Credentials author =
(org.jboss.wiki.Credentials)request.getAttribute("author");
+%>
+
+<h2><a
href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><%=wikiName%></a>/
<%=wikiPage%> [<%=curLang%>] </h2>
+
+<!--<hr />
+<a
href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><%=defaultPage%></a>
+<div class="wikiTrail">Your trail: <i>TODO</i></div>
+-->
+<hr />
+<h3>History of page: <a
href="<%=actionURL%>&page=<%=wikiPage%>&language=<%=curLang%>"><%=wikiPage%></a></h3>
+<hr />
+
+<table>
+<tr>
+<td class="wikiContent">
+<table border="1">
+<%
+ org.jboss.wiki.WikiPage pageAtTop =
(org.jboss.wiki.WikiPage)request.getAttribute("pageAtTop");
+ int topVersion = pageAtTop.getLastVersion();
+
+ out.println("<tr><td><b>Version</b></td><td><b>Date</b></td><td><b>Author</b></td><td><b>Size</b></td><td><b>Changes
from previous</b></td></tr>");
+
+
+ for (int i = topVersion; i > 0; i--) {
+ org.jboss.wiki.WikiPage prevWikiPage = pageAtTop.getPageAtVersion(false,i);
+
+ String author;
+
+ if ((author = prevWikiPage.getLastAuthor().getName()) != null) {
+ }
+ else {
+ author = "<i>unknown</i>";
+ }
+
+ out.println("<tr><td><a
href='"+actionURL+"&page="+wikiPage+"&language="+curLang+"&version="+i+"'>"+
+ i+
+ "</a></td><td>"+
+ prevWikiPage.getEditDate()+
+ "</td><td>"+
+ author +
+ "</td><td>"+prevWikiPage.getLength()+
+ "</td><td>"+ ((i > 1) ? "<a
href='"+actionURL+"&type=diff&version="+i+"&page="+wikiPage+"&language="+curLang+"'>Changes
from "+(i-1)+" to "+i+"</a>" : "")
+"</td>");
+ }
+%>
+</table>
+<td>
+</tr>
+<tr>
+<td class="wikiFooter">
+</td>
+</tr>
+
+</table>
+
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2009-03-03 18:51:31
UTC (rev 246)
@@ -0,0 +1,165 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at
gnu.org.
+ -->
+<%@ page language="java"
extends="org.jboss.portal.core.servlet.jsp.PortalJsp"
contentType="text/html; charset=UTF-8"%>
+<%@ taglib
uri="http://java.sun.com/portlet"
prefix="portlet"%>
+<%@ page isELIgnored ="false" %>
+<portlet:defineObjects />
+
+<%
+ String actionURL = (String)request.getAttribute("actionURL");
+ String wikiName = (String)request.getAttribute("wikiName");
+ String wikiContent = (String)request.getAttribute("wikiContent");
+ String wikiPage = (String)request.getAttribute("wikiPage");
+ String defaultPage = (String)request.getAttribute("defaultPage");
+ String friendlyLink = (String)request.getAttribute("friendlyLink");
+ String rssLink = (String)request.getAttribute("rssLink");
+ String rdfLink = (String)request.getAttribute("rdfLink");
+ String atomLink = (String)request.getAttribute("atomLink");
+ String type = (String)request.getParameter("type");
+ java.util.Date editDate = (java.util.Date)request.getAttribute("editDate");
+ org.jboss.wiki.Credentials author =
(org.jboss.wiki.Credentials)request.getAttribute("author");
+ String wikiImagesUrl = (String)request.getAttribute("wikiImagesUrl");
+ String curLang = (String)request.getAttribute("currentLanguage");
+ boolean isAdmin = ((Boolean)request.getAttribute("isAdmin")).booleanValue();
+ boolean isViewable =
((Boolean)request.getAttribute("isViewable")).booleanValue();
+ boolean isEditable =
((Boolean)request.getAttribute("isEditable")).booleanValue();
+ boolean logedIn = ((Boolean)request.getAttribute("logedIn")).booleanValue();
+%>
+
+<%
+ if (request.getUserPrincipal() != null) {
+ out.println("<meta name='gwt:property'
content='tagMeSet/wiki/"+wikiPage+"=/wiki/"+wikiPage+"'
/>");
+ out.println("<meta name='gwt:property'
content='tagMeDiv/wiki/"+wikiPage+"=tagMeWiki' />");
+ out.println("<meta name='gwt:property'
content='tagMePath/wiki/"+wikiPage+"=/wiki/"+wikiPage+"'
/>");
+ out.println("<meta name='gwt:property'
content='tagMeUser/wiki/"+wikiPage+"="+request.getUserPrincipal().getName()+"'
/>");
+ out.println("<meta name='gwt:property'
content='tagMeClass/wiki/"+wikiPage+"=org.jboss.labs.tagme.services.ShotokuTaggingService'
/>");
+ out.println("<meta name='gwt:property'
content='tagMeWebsite/wiki/"+wikiPage+"=true' />");
+ }
+%>
+
+<link rel="stylesheet"
href="<%=wikiImagesUrl%>wikiStyle.css" type="text/css"
media="all">
+
+<div id="tagMeWiki"><!-- tagme div --></div>
+
+<table style="width: 100%" border="0">
+<tr>
+<td style="font-size: large">
+<a
href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><%=wikiName%></a>
: <%=wikiPage%> [<%=curLang%>]
+</td>
+<td style="text-align: right;">
+<a href="<%=actionURL%>&type=recentChanges"><img
alt="Recent Changes" src="<%=wikiImagesUrl%>recentChanges.gif"
border="0" /></a>
+<a
href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><img
alt="<%=defaultPage%>" src="<%=wikiImagesUrl%>main.gif"
border="0" /></a>
+</td>
+</table>
+
+<!--<a
href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><%=defaultPage%></a><br
/>-->
+
+<form method="post"
action="<%=actionURL%>&type=find">
+<table style="width: 100%" border="0">
+<tr style="vertical-align: bottom;">
+<td style="vertical-align: bottom; align-bottom: 0px;">
+<div><a href="<%=friendlyLink%>"><img
style="vertical-align: middle" alt="PERM LINK"
src="<%=wikiImagesUrl%>permaLinkButton.png"
border="0"/></a> <a
href="<%=friendlyLink%>"><%=friendlyLink%></a>
</div>
+
+</td>
+<td style="text-align: right;vertical-align: bottom; align-bottom: 0px;"
>
+
+<%
+
+
+ if ((type == null)||(type.equals("HTML"))) {
+ if ((isAdmin)||((logedIn)&&(isEditable)&&(isViewable))) {
+ out.print("<a
href=\""+actionURL+"&action=Edit&page="+wikiPage+"&language="+curLang+"\"><img
alt=\"EDIT\" src=\""+wikiImagesUrl+"editButton.png\"
border=\"0\" /></a>\n"+
+ "<a
href=\""+actionURL+"&action=Attach&page="+wikiPage+"&language="+curLang+"\"><img
alt=\"ATTACH\" src=\""+wikiImagesUrl+"attachButton.png\"
border=\"0\" /></a>");
+
+ }
+ else if (logedIn) {
+ out.print("<div style='font-size: xx-small'><i>This page IS
NOT editable</i></div>");
+ }
+ else {
+ out.print("<div style='font-size: xx-small'><i>Login to edit
pages and attach files</i></div>");
+ }
+ }
+
+%>
+
+<%
+if (((type == null)||(type.equals("HTML")))&&((isAdmin)||(isViewable)))
{
+ out.println("<a
href=\""+actionURL+"&action=Info&page="+wikiPage+"&language="+curLang+"\"><img
alt=\"HISTORY\" src=\""+wikiImagesUrl+"historyButton.png\"
border=\"0\" /></a>");
+ out.println("<a href=\""+rssLink+"\"><img
alt=\"RSS\" src=\""+wikiImagesUrl+"RSSButton.gif\"
border=\"0\" /></a>");
+ out.println("<a href=\""+rdfLink+"\"><img
alt=\"RSS\" src=\""+wikiImagesUrl+"RDFButton.gif\"
border=\"0\" /></a>");
+ out.println("<a href=\""+atomLink+"\"><img
alt=\"RSS\" src=\""+wikiImagesUrl+"ATOMButton.gif\"
border=\"0\" /></a><br />");
+ }
+ %>
+<input type="text" name="searchQuery" />
+<input type="hidden" name="language"
value="<%=curLang%>" />
+<input type="submit" value="SEARCH" />
+</td>
+</tr>
+</table>
+</form>
+
+<hr />
+
+<%
+ String attachFile = (String)request.getAttribute("fileAttach");
+
+ if (((isEditable)||(isAdmin))&&(attachFile !=
null)&&(attachFile.equals("true"))) {
+ out.println("<h2><b>UPLOAD FILE:</b></h2>\n"+
+ "<FORM
ACTION=\""+actionURL+"&page="+wikiPage+"&language="+curLang+"\"
METHOD=\"POST\" ENCTYPE=\"multipart/form-data\">"+
+ "<INPUT TYPE=\"file\" NAME=\"file_up\" />"+
+ "<INPUT TYPE=\"submit\" VALUE=\"Upload\" />"+
+ "</FORM><hr />");
+ }
+%>
+
+<%
+ Integer showedVersion = (Integer)request.getAttribute("showedVersion");
+
+ if (showedVersion != null) {
+ out.println("<table style='border-style: dashed; text-align: center;
margin-left: auto; margin-right:auto; border-color: red'>"+
+ "<tr><td>This is <b>version
"+showedVersion+"</b> of page "+wikiPage+".<br>"+
+ "You can go back to <a
href='"+actionURL+"&page="+wikiPage+"&language="+curLang+"'>latest
version</a> or ");
+
+ if (logedIn) {
+ out.println("<a
href='"+actionURL+"&action=Edit&page="+wikiPage+"&language="+curLang+"&version="+showedVersion+"'>rollback
this version</a>");
+ }
+ else {
+ out.println("<i>rollback this version (after login)</i>");
+ }
+
+ out.println("</td></tr></table>");
+ }
+%>
+
+<%
+ String errorMsg = (String)request.getAttribute("errorMsg");
+
+ if (errorMsg != null) {
+ out.println("<table style='border-style: dashed; text-align: center;
margin-left: auto; margin-right:auto; border-color: red'>");
+ out.println("<tr><td>"+errorMsg+"</td></tr>");
+ out.println("</table>");
+ }
+%>
+
+<table style="width: 100%; margin: 0px; padding: 0px;">
+<tr style="width: 100%; margin: 0px; padding: 0px;">
+
+<td class="wikiContent"><%=wikiContent%><td>
+</tr>
+<tr>
+<td class="wikiFooter">
+<hr />
+</td>
+</tr>
+</table>
+<br />
+
+<%
+if ((type == null)||(type.equals("HTML"))) {
+ out.println("<div>The page last changed on "+editDate+" by
"+author+". </div>");
+}
+%>
+
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet-instances.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet-instances.xml
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet-instances.xml 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployments>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <instance>
+ <instance-id>WikiPortletInstance</instance-id>
+ <portlet-ref>wikiportlet.WikiPortlet</portlet-ref>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet.xml
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet.xml 2009-03-03 18:51:31
UTC (rev 246)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>WikiPortlet</portlet-name>
+ <portlet-class>org.jboss.wiki.WikiPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <window-state>normal</window-state>
+ <window-state>minimized</window-state>
+ <window-state>maximized</window-state>
+ </supports>
+ <portlet-info>
+ <title>Wiki Portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <filter>
+ <filter-name>JBossPortletFilter</filter-name>
+
<filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JBossPortletFilter</filter-name>
+ <portlet-name>WikiPortlet</portlet-name>
+ </filter-mapping>
+
+</portlet-app>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet_2_0.tld
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet_2_0.tld
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet_2_0.tld 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <taglib
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+
+ <description>Portlet 2.0 Tag Library</description>
+ <display-name>Portlet 2.0 Tags</display-name>
+ <tlib-version>2.0</tlib-version>
+ <short-name>portlet</short-name>
+ <
uri>http://java.sun.com/portlet</uri>
+
+ <tag>
+
+ <name>param</name>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.URLParameter286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>property</name>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.URLProperty286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>renderURL</name>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.RenderURL286Tag</tag-class>
+
<tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.GenerateURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>portletMode</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>windowState</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>copyCurrentRenderParameters</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>defineObjects</name>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.DefineObjects286Tag</tag-class>
+
<tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.DefineObjects286TagTEI</tei-class>
+ <body-content>empty</body-content>
+
+ </tag>
+ <tag>
+
+ <name>actionURL</name>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.ActionURL286Tag</tag-class>
+
<tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.GenerateURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>portletMode</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>windowState</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>copyCurrentRenderParameters</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>name</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+
+ </tag>
+ <tag>
+
+ <name>resourceURL</name>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.ResourceURL286Tag</tag-class>
+
<tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.ResourceURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>cacheability</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>id</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>namespace</name>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.Namespace286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ </tag>
+
+</taglib>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/web.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/web.xml
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/web.xml 2009-03-03 18:51:31 UTC
(rev 246)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <filter>
+ <filter-name>wikiFileAccessFilter</filter-name>
+ <filter-class>org.jboss.wiki.fileaccess.WikiFileAccessFilter</filter-class>
+ </filter>
+
+ <!-- <filter>
+ <filter-name>wikiFileAccessFilter</filter-name>
+ <filter-class>org.jboss.wiki.redirect.WikiRedirectFilter</filter-class>
+ </filter> -->
+
+ <filter-mapping>
+ <filter-name>wikiFileAccessFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+
+</web-app>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/wiki-object.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/wiki-object.xml
(rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/wiki-object.xml 2009-03-03
18:51:31 UTC (rev 246)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployments>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <parent-ref>default</parent-ref>
+ <page>
+ <page-name>wiki</page-name>
+ <window>
+ <window-name>WikiPortletWindow</window-name>
+ <instance-ref>WikiPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <instance>
+ <instance-name>WikiPortletInstance</instance-name>
+ <component-ref>wikiportlet.WikiPortlet</component-ref>
+ </instance>
+ </deployment>
+</deployments>