You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ja...@apache.org on 2009/01/30 00:23:38 UTC
svn commit: r739080 [2/2] - in /incubator/jspwiki/trunk: ./ .settings/ etc/
lib/ src/WebContent/ src/WebContent/WEB-INF/
src/WebContent/WEB-INF/classes/ src/WebContent/WEB-INF/lib/
src/WebContent/admin/ src/WebContent/applets/ src/WebContent/error/ src...
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/lucene-highlighter.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/lucene-highlighter.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/lucene.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/lucene.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/mail.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/mail.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/nekohtml.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/nekohtml.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/oscache.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/oscache.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/priha-0.1.12.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/priha-0.1.12.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/priha-0.1.13.jar
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/priha-0.1.13.jar?rev=739080&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/priha-0.1.13.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/sandler.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/sandler.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/servlet-api.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/servlet-api.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/slf4j-api-1.5.6.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/slf4j-api-1.5.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/slf4j-log4j12-1.5.6.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/slf4j-log4j12-1.5.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/stripes-1.5.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/stripes-1.5.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/xmlrpc.jar
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/xmlrpc.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/userdatabase.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/userdatabase.xml
------------------------------------------------------------------------------
svn:mergeinfo =
Added: incubator/jspwiki/trunk/src/WebContent/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/WebContent/WEB-INF/web.xml?rev=739080&view=auto
==============================================================================
--- incubator/jspwiki/trunk/src/WebContent/WEB-INF/web.xml (added)
+++ incubator/jspwiki/trunk/src/WebContent/WEB-INF/web.xml Thu Jan 29 23:23:31 2009
@@ -0,0 +1,481 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app 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-app_2_4.xsd"
+ version="2.4">
+
+ <description>
+ JSPWiki is an open source JSP-based WikiClone. It is licensed
+ under the Apache 2.0 license.
+
+ For more information, please come to http://www.jspwiki.org/
+ </description>
+ <display-name>JSPWiki</display-name>
+
+ <!-- Resource bundle default location -->
+ <context-param>
+ <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
+ <param-value>templates.default</param-value>
+ </context-param>
+
+ <!--
+ WikiServletFilter defines a servlet filter which filters all requests. It was
+ introduced in JSPWiki 2.4.
+
+ In 2.7/2.8, the WikiServlet filter also performs an important security function:
+ it sets authentication status based on container credentials. It should generally
+ execute first. Note that if you configure a filter *before* this one that returns
+ non-null values for getUserPrincipal() or getRemoteUser(), WikiSecurityFilter
+ will pick the credentials up, and set the user's WikiSession state to
+ "authenticated." WikiServletFlter will also set the WikiSession's' state
+ to "authenticated" if jspwiki.properties property "jspwiki.cookieAuthentication"
+ is set to true, and the user possesses the correct authentication cookie.
+
+ Lastly, if jspwiki.properties property "jspwiki.cookieAssertions" is set to true,
+ WikiServletFilter will also set WikiSession state to "asserted" if the user
+ possesses the correct "assertion cookie."
+ -->
+
+ <filter>
+ <filter-name>WikiServletFilter</filter-name>
+ <filter-class>com.ecyrd.jspwiki.ui.WikiServletFilter</filter-class>
+ </filter>
+
+ <!-- Configuration of the Stripes Filter. The Stripes MVC framework provides
+ essential request routing, form processing and type conversion services
+ for JSPWiki. -->
+ <filter>
+ <description>
+ Configures the Stripes framework.
+ </description>
+ <display-name>Stripes Filter</display-name>
+ <filter-name>StripesFilter</filter-name>
+ <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
+ <!-- Look for ActionBean implementations in the JSPWiki "action" package.
+ If you have custom WikiActionBeans you want JSPWiki to use, specify them
+ here (comma-delimited). -->
+ <init-param>
+ <param-name>ActionResolver.Packages</param-name>
+ <param-value>com.ecyrd.jspwiki.action</param-value>
+ </init-param>
+ <!-- Tell Stripes to auto-discover custom extensions from the "ui.stripes"
+ package. Extensions JSPWiki uses includes WikiActionBeanContext,
+ WikiRuntimeConfiguration, WikiInterceptor and the various TypeConverter
+ implementations for JSPWiki-specific types. -->
+ <init-param>
+ <param-name>Extension.Packages</param-name>
+ <param-value>com.ecyrd.jspwiki.ui.stripes</param-value>
+ </init-param>
+ <!-- We override Stripes' normal resource bundle to use ours instead. -->
+ <init-param>
+ <param-name>LocalizationBundleFactory.FieldNameBundle</param-name>
+ <param-value>CoreResources</param-value>
+ </init-param>
+ <init-param>
+ <param-name>LocalizationBundleFactory.ErrorMessageBundle</param-name>
+ <param-value>CoreResources</param-value>
+ </init-param>
+ <!-- Locales supported by this wiki -->
+ <init-param>
+ <param-name>LocalePicker.Locales</param-name>
+ <param-value>en:UTF8,de:UTF8,es:UTF8,fi:UTF8,fr:UTF8,it:UTF8,nl:UTF8,ru:UTF8,zh_CN:UTF8</param-value>
+ </init-param>
+ <!-- Library for parsing multi-part file uploads -->
+ <init-param>
+ <param-name>MultipartWrapper.Class</param-name>
+ <param-value>net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper</param-value>
+ </init-param>
+ <!-- Exception handler classes -->
+ <init-param>
+ <param-name>ExceptionHandler.Class</param-name>
+ <param-value>com.ecyrd.jspwiki.ui.stripes.WikiExceptionHandler</param-value>
+ </init-param>
+ </filter>
+
+ <!--
+ This is new in 2.4. This defines a servlet filter which filters all requests.
+ -->
+
+ <!--
+ <filter>
+ <filter-name>WikiJSPFilter</filter-name>
+ <filter-class>com.ecyrd.jspwiki.ui.WikiJSPFilter</filter-class>
+ </filter>
+ -->
+
+ <filter-mapping>
+ <filter-name>WikiServletFilter</filter-name>
+ <url-pattern>/attach/*</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>WikiServletFilter</filter-name>
+ <url-pattern>/atom/*</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>WikiServletFilter</filter-name>
+ <url-pattern>/dav/*</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>WikiServletFilter</filter-name>
+ <url-pattern>/RPCU/</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>WikiServletFilter</filter-name>
+ <url-pattern>/RPC2/</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>WikiServletFilter</filter-name>
+ <url-pattern>/JSON-RPC</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>WikiServletFilter</filter-name>
+ <url-pattern>*.jsp</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>WikiServletFilter</filter-name>
+ <url-pattern>*.action</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>StripesFilter</filter-name>
+ <url-pattern>*.jsp</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>StripesFilter</filter-name>
+ <servlet-name>StripesDispatcher</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+
+ <!--
+ <filter-mapping>
+ <filter-name>WikiJSPFilter</filter-name>
+ <url-pattern>/wiki/*</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>WikiJSPFilter</filter-name>
+ <url-pattern>*.jsp</url-pattern>
+ </filter-mapping>
+ -->
+
+ <!--
+ HttpSessionListener used for managing WikiSessions.
+ -->
+ <listener>
+ <listener-class>com.ecyrd.jspwiki.auth.SessionMonitor</listener-class>
+ </listener>
+
+ <!--
+ Stripes dispatcher Servlet.
+ -->
+ <servlet>
+ <servlet-name>StripesDispatcher</servlet-name>
+ <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!--
+ Now, let's define the XML-RPC interfaces. You probably don't have to
+ touch these.
+
+ First, we'll define the standard XML-RPC interface.
+ -->
+ <servlet>
+ <servlet-name>XMLRPC</servlet-name>
+ <servlet-class>com.ecyrd.jspwiki.xmlrpc.RPCServlet</servlet-class>
+ <init-param>
+ <param-name>handler</param-name>
+ <param-value>com.ecyrd.jspwiki.xmlrpc.RPCHandler</param-value>
+ </init-param>
+
+ <init-param>
+ <param-name>prefix</param-name>
+ <param-value>wiki</param-value>
+ </init-param>
+ </servlet>
+
+ <!--
+ OK, this then defines that our UTF-8 -capable server.
+ -->
+
+ <servlet>
+ <servlet-name>XMLRPC-UTF8</servlet-name>
+ <servlet-class>com.ecyrd.jspwiki.xmlrpc.RPCServlet</servlet-class>
+ <init-param>
+ <param-name>handler</param-name>
+ <param-value>com.ecyrd.jspwiki.xmlrpc.RPCHandlerUTF8</param-value>
+ </init-param>
+
+ <init-param>
+ <param-name>prefix</param-name>
+ <param-value>wiki</param-value>
+ </init-param>
+ </servlet>
+
+ <!-- JSON AJAX API -->
+ <servlet>
+ <servlet-name>org.jabsorb.JSONRPCServlet</servlet-name>
+ <servlet-class>org.jabsorb.JSONRPCServlet</servlet-class>
+ </servlet>
+
+ <!-- Atom Publishing Protocol -->
+ <servlet>
+ <servlet-name>ATOM</servlet-name>
+ <servlet-class>com.ecyrd.jspwiki.rpc.atom.AtomAPIServlet</servlet-class>
+ </servlet>
+
+ <!-- Maps short URLS to JSPs; also, detects webapp shutdown. -->
+ <servlet>
+ <servlet-name>WikiServlet</servlet-name>
+ <servlet-class>com.ecyrd.jspwiki.WikiServlet</servlet-class>
+ <!--
+ <load-on-startup>1</load-on-startup>
+ -->
+ </servlet>
+
+ <servlet>
+ <servlet-name>DAVServlet</servlet-name>
+ <servlet-class>com.ecyrd.jspwiki.dav.WikiDavServlet</servlet-class>
+ </servlet>
+
+ <!--
+ Attachment exchange handler.
+ -->
+
+ <servlet>
+ <servlet-name>AttachmentServlet</servlet-name>
+ <servlet-class>com.ecyrd.jspwiki.attachment.AttachmentServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>StripesDispatcher</servlet-name>
+ <url-pattern>/dispatcher</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>StripesDispatcher</servlet-name>
+ <url-pattern>/action/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>StripesDispatcher</servlet-name>
+ <url-pattern>*.action</url-pattern>
+ </servlet-mapping>
+
+ <!-- PLACEHOLDER FOR PRE-COMPILED JSP SERVLETS -->
+
+ <!--
+ And finally, let us tell the servlet container which
+ URLs should correspond to which XML RPC servlet.
+ -->
+
+ <!-- By default, this is disabled. If you want to enabled it,
+ just uncomment the whole section. -->
+
+ <!-- REMOVE ME TO ENABLE XML-RPC
+
+ <servlet-mapping>
+ <servlet-name>XMLRPC</servlet-name>
+ <url-pattern>/RPC2/</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>XMLRPC-UTF8</servlet-name>
+ <url-pattern>/RPCU/</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ATOM</servlet-name>
+ <url-pattern>/atom/*</url-pattern>
+ </servlet-mapping>
+
+ AND REMOVE ME TOO -->
+
+ <servlet-mapping>
+ <servlet-name>AttachmentServlet</servlet-name>
+ <url-pattern>/attach/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>WikiServlet</servlet-name>
+ <url-pattern>/wiki/*</url-pattern>
+ </servlet-mapping>
+
+ <!-- Remove to enable WebDav. EXPERIMENTAL FEATURE!
+ <servlet-mapping>
+ <servlet-name>DAVServlet</servlet-name>
+ <url-pattern>/dav/*</url-pattern>
+ </servlet-mapping>
+ -->
+
+ <servlet-mapping>
+ <servlet-name>org.jabsorb.JSONRPCServlet</servlet-name>
+ <url-pattern>/JSON-RPC</url-pattern>
+ </servlet-mapping>
+
+ <!-- This means that we don't have to use redirection
+ from index.html anymore. Yay! -->
+ <welcome-file-list>
+ <welcome-file>Wiki.jsp</welcome-file>
+ </welcome-file-list>
+
+ <!-- Error pages -->
+ <error-page>
+ <error-code>403</error-code>
+ <location>/error/Forbidden.html</location>
+ </error-page>
+
+ <!-- REMOVE ME TO ENABLE JDBC DATABASE
+ <resource-ref>
+ <description>
+ Resource reference to JNDI factory for the JDBCUserDatabase.
+ </description>
+ <res-ref-name>
+ jdbc/UserDatabase
+ </res-ref-name>
+ <res-type>
+ javax.sql.DataSource
+ </res-type>
+ <res-auth>
+ Container
+ </res-auth>
+ </resource-ref>
+ <resource-ref>
+ <description>
+ Resource reference to JNDI factory for the JDBCGroupDatabase.
+ </description>
+ <res-ref-name>
+ jdbc/GroupDatabase
+ </res-ref-name>
+ <res-type>
+ javax.sql.DataSource
+ </res-type>
+ <res-auth>
+ Container
+ </res-auth>
+ </resource-ref>
+ REMOVE ME TO ENABLE JDBC DATABASE -->
+
+ <!-- REMOVE ME TO ENABLE JAVAMAIL
+ <resource-ref>
+ <description>Resource reference to a container-managed JNDI JavaMail factory for sending e-mails.</description>
+ <res-ref-name>mail/Session</res-ref-name>
+ <res-type>javax.mail.Session</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+ REMOVE ME TO ENABLE JAVAMAIL -->
+
+ <!--
+ CONTAINER-MANAGED AUTHENTICATION & AUTHORIZATION
+
+ Here we define the users which are allowed to access JSPWiki.
+ These restrictions cause the web container to apply further
+ contraints to the default security policy in jspwiki.policy,
+ and should be suitable for a corporate intranet or public wiki.
+
+ In particular, the restrictions below allow all users to
+ read documents, but only Authenticated users can comment
+ on or edit them (i.e., access the Edit.jsp page).
+ Users with the role Admin are the only persons who can
+ delete pages.
+
+ To implement this policy, the container enforces two web
+ resource constraints: one for the Administrator resources,
+ and one for Authenticated users. Note that the "role-name"
+ values are significant and should match the role names
+ retrieved by your web container's security realm. The roles
+ of "Admin" and "Authenticated" are assigned by the web
+ container at login time.
+
+ For example, if you are using Tomcat's built-in "memory realm",
+ you should edit the $CATALINA_HOME/conf/tomcat-users.xml file
+ and add the desired actual user accounts. Each user must possess
+ one or both of the Admin or Authenticated roles. For other realm
+ types, consult your web container's documentation.
+
+ Alternatively, you could also replace all references to
+ "Authenticated" and "Admin" with role names that match those
+ returned by your container's security realm. We don't care
+ either way, as long as they match.
+
+ Note that accessing protected resources will cause your
+ container to try to use SSL (default port for Tomcat is 8443)
+ to secure the web session. This, of course, assumes your
+ web container (or web server) is configured with SSL support.
+ If you do not wish to use SSL, remove the "user-data-constraint"
+ elements.
+ -->
+
+ <!-- REMOVE ME TO ENABLE CONTAINER-MANAGED AUTH
+
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Administrative Area</web-resource-name>
+ <url-pattern>/Delete.jsp</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>Admin</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Authenticated area</web-resource-name>
+ <url-pattern>/Edit.jsp</url-pattern>
+ <url-pattern>/Comment.jsp</url-pattern>
+ <url-pattern>/Login.jsp</url-pattern>
+ <url-pattern>/NewGroup.jsp</url-pattern>
+ <url-pattern>/Rename.jsp</url-pattern>
+ <url-pattern>/Upload.jsp</url-pattern>
+ <http-method>DELETE</http-method>
+ <http-method>GET</http-method>
+ <http-method>HEAD</http-method>
+ <http-method>POST</http-method>
+ <http-method>PUT</http-method>
+ </web-resource-collection>
+
+ <web-resource-collection>
+ <web-resource-name>Read-only Area</web-resource-name>
+ <url-pattern>/attach</url-pattern>
+ <http-method>DELETE</http-method>
+ <http-method>POST</http-method>
+ <http-method>PUT</http-method>
+ </web-resource-collection>
+
+ <auth-constraint>
+ <role-name>Admin</role-name>
+ <role-name>Authenticated</role-name>
+ </auth-constraint>
+
+ <user-data-constraint>
+ <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <form-login-config>
+ <form-login-page>/LoginForm.jsp</form-login-page>
+ <form-error-page>/LoginForm.jsp</form-error-page>
+ </form-login-config>
+ </login-config>
+
+ <security-role>
+ <description>
+ This logical role includes all authenticated users
+ </description>
+ <role-name>Authenticated</role-name>
+ </security-role>
+
+ <security-role>
+ <description>
+ This logical role includes all administrative users
+ </description>
+ <role-name>Admin</role-name>
+ </security-role>
+
+ REMOVE ME TO ENABLE CONTAINER-MANAGED AUTH -->
+
+</web-app>
Propchange: incubator/jspwiki/trunk/src/WebContent/Wiki.jsp
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/Workflow.jsp
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/admin/
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/applets/
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/atom.css
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/jspwiki/trunk/src/WebContent/atom.css
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/error/
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/images/
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/rss.jsp
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/scripts/
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/WebContent/templates/
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/src/java/com/
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: incubator/jspwiki/trunk/src/java/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/com/ecyrd/jspwiki/Release.java?rev=739080&r1=738991&r2=739080&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/com/ecyrd/jspwiki/Release.java Thu Jan 29 23:23:31 2009
@@ -77,7 +77,7 @@
* <p>
* If the build identifier is empty, it is not added.
*/
- public static final String BUILD = "57";
+ public static final String BUILD = "58";
/**
* This is the generic version string you should use
Modified: incubator/jspwiki/trunk/src/java/com/ecyrd/jspwiki/content/ContentManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/com/ecyrd/jspwiki/content/ContentManager.java?rev=739080&r1=738991&r2=739080&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/com/ecyrd/jspwiki/content/ContentManager.java (original)
+++ incubator/jspwiki/trunk/src/java/com/ecyrd/jspwiki/content/ContentManager.java Thu Jan 29 23:23:31 2009
@@ -155,6 +155,8 @@
private String m_workspaceName = DEFAULT_WORKSPACE; // FIXME: Make settable
+ private JCRSessionManager m_sessionManager = new JCRSessionManager();
+
/**
* Creates a new PageManager.
*
@@ -246,10 +248,14 @@
*/
private void initialize() throws LoginException, RepositoryException
{
- Session session = m_repository.login(m_workspaceName);
+ Object id = null;
try
{
+ id = m_sessionManager.createSession();
+
+ Session session = m_sessionManager.getSession();
+
//
// Create the proper namespaces
//
@@ -279,7 +285,7 @@
}
finally
{
- session.logout();
+ m_sessionManager.destroySession( id );
}
}
@@ -294,13 +300,15 @@
* @throws ProviderException If the backend has problems.
*/
- public Collection<WikiPage> getAllPages( WikiContext context, String space )
+ public Collection<WikiPage> getAllPages( String space )
throws ProviderException
{
+ Object id = null;
ArrayList<WikiPage> result = new ArrayList<WikiPage>();
try
{
- Session session = getJCRSession( context );
+ id = m_sessionManager.createSession();
+ Session session = m_sessionManager.getSession();
QueryManager mgr = session.getWorkspace().getQueryManager();
@@ -314,7 +322,7 @@
// Hack to make sure we don't add the space root node.
if( n.getDepth() != 2 )
- result.add( new JCRWikiPage(context.getEngine(), n ) );
+ result.add( new JCRWikiPage( getEngine(), n ) );
}
}
catch( RepositoryException e )
@@ -325,6 +333,10 @@
{
throw new ProviderException("getAllPages()",e);
}
+ finally
+ {
+ m_sessionManager.destroySession(id);
+ }
return result;
}
@@ -525,11 +537,11 @@
* @throws ProviderException If the repository fails.
*/
- public List<WikiPage> getVersionHistory( WikiContext context, WikiName path )
+ public List<WikiPage> getVersionHistory( WikiName path )
throws ProviderException
{
List<WikiPage> result = new ArrayList<WikiPage>();
- JCRWikiPage base = getPage(context,path);
+ JCRWikiPage base = getPage(path);
Node baseNode = base.getJCRNode();
@@ -579,11 +591,11 @@
*/
// FIXME: Unfortunately this method is very slow, since it involves gobbling
// up the entire repo.
- public int getTotalPageCount(WikiContext context, String space)
+ public int getTotalPageCount(String space)
{
try
{
- return getAllPages(context, space).size();
+ return getAllPages(space).size();
}
catch( ProviderException e )
{
@@ -600,7 +612,7 @@
* @throws ProviderException If the backend fails or the wikiPath is illegal.
*/
- public boolean pageExists( WikiContext context, WikiName wikiPath )
+ public boolean pageExists( WikiName wikiPath )
throws ProviderException
{
if( wikiPath == null )
@@ -608,9 +620,12 @@
throw new ProviderException("Illegal page name");
}
+ Object id = null;
+
try
{
- Session session = getJCRSession( context );
+ id = m_sessionManager.createSession();
+ Session session = m_sessionManager.getSession();
String jcrPath = getJCRPath( wikiPath );
@@ -618,7 +633,11 @@
}
catch( RepositoryException e )
{
- throw new ProviderException( "Unable to check for page existence",e);
+ throw new ProviderException( "Unable to check for page existence", e );
+ }
+ finally
+ {
+ m_sessionManager.destroySession( id );
}
}
@@ -632,7 +651,7 @@
* @return <code>true</code> if the page exists, <code>false</code> otherwise
* @throws WikiException If the backend fails or the wikiPath is illegal.
*/
- public boolean pageExists( WikiContext context, WikiName wikiPath, int version )
+ public boolean pageExists( WikiName wikiPath, int version )
throws WikiException
{
if( wikiPath == null )
@@ -640,10 +659,12 @@
throw new WikiException("Illegal page name");
}
- Session session;
+ Object id = null;
try
{
- session = getJCRSession( context );
+ id = m_sessionManager.createSession();
+
+ Session session = m_sessionManager.getSession();
return session.itemExists( getJCRPath( wikiPath ) );
}
@@ -651,6 +672,10 @@
{
throw new WikiException("Unable to check for page existence",e);
}
+ finally
+ {
+ m_sessionManager.destroySession( id );
+ }
}
/**
@@ -900,20 +925,6 @@
WikiEventManager.fireEvent(this,new WikiPageEvent(m_engine,type,pagename));
}
}
-
- private Session getJCRSession( WikiContext context ) throws RepositoryException
- {
- Session session = (Session)context.getVariable( "jcrsession" );
-
- if( session == null )
- {
- session = m_repository.login(m_workspaceName);
-
- context.setVariable( "jcrsession", session );
- }
-
- return session;
- }
/**
* Evaluates a WikiName in the context of the current page request.
@@ -968,11 +979,14 @@
* @return the {@link JCRWikiPage}
* @throws WikiException If the backend fails.
*/
- public JCRWikiPage addPage( WikiContext context, WikiName path, String contentType ) throws WikiException
+ public JCRWikiPage addPage( WikiName path, String contentType ) throws WikiException
{
+ Object id = null;
+
try
{
- Session session = getJCRSession( context );
+ id = m_sessionManager.createSession();
+ Session session = m_sessionManager.getSession();
Node nd = session.getRootNode().addNode( getJCRPath(path) );
@@ -984,6 +998,10 @@
{
throw new WikiException( "Unable to add a page", e );
}
+ finally
+ {
+ m_sessionManager.destroySession(id);
+ }
}
/**
@@ -994,11 +1012,13 @@
* @return the {@link JCRWikiPage}
* @throws ProviderException If the backend fails.
*/
- public JCRWikiPage getPage( WikiContext context, WikiName path ) throws ProviderException
+ public JCRWikiPage getPage( WikiName path ) throws ProviderException
{
+ Object id = null;
try
{
- Session session = getJCRSession( context );
+ id = m_sessionManager.createSession();
+ Session session = m_sessionManager.getSession();
Node nd = session.getRootNode().getNode( getJCRPath(path) );
JCRWikiPage page = new JCRWikiPage(m_engine, nd);
@@ -1017,13 +1037,21 @@
{
throw new ProviderException("Unable to get a page",e);
}
+ finally
+ {
+ m_sessionManager.destroySession( id );
+ }
}
- public JCRWikiPage getPage( WikiContext context, WikiName path, int version ) throws WikiException
+ public JCRWikiPage getPage( WikiName path, int version ) throws WikiException
{
+ Object id = null;
+
try
{
- Session session = getJCRSession( context );
+ id = m_sessionManager.createSession();
+
+ Session session = m_sessionManager.getSession();
Node nd = session.getRootNode().getNode( getJCRPath(path) );
@@ -1039,6 +1067,10 @@
{
throw new WikiException( "Unable to get a page", e );
}
+ finally
+ {
+ m_sessionManager.destroySession( id );
+ }
}
/**
@@ -1072,8 +1104,7 @@
{
int pagesChanged = 0;
// FIXME: This is a hack to make this thing compile, not work.
- Collection pages = getAllPages( m_engine.getWikiContextFactory().newViewContext(null,null,null),
- null );
+ Collection pages = getAllPages( null );
for ( Iterator it = pages.iterator(); it.hasNext(); )
{
WikiPage page = (WikiPage)it.next();
@@ -1157,9 +1188,12 @@
public WikiPage getDummyPage() throws WikiException
{
+ Object id = null;
try
{
- Session session = m_repository.login(m_workspaceName);
+ id = m_sessionManager.createSession();
+
+ Session session = m_sessionManager.getSession();
Node nd = session.getRootNode().addNode( "/pages/Main/Dummy" );
return new JCRWikiPage( m_engine, nd );
}
@@ -1167,6 +1201,84 @@
{
throw new WikiException("Unable to get dummy page",e);
}
+ finally
+ {
+ m_sessionManager.destroySession( id );
+ }
}
+ /**
+ * Implements the ThreadLocal pattern for managing JCR Sessions. It is the
+ * responsibility for every user to get a Session, then close it.
+ * <p>
+ * Based on Hibernate ThreadLocal best practices.
+ */
+ private class JCRSessionManager
+ {
+ /** the per thread session **/
+ private final ThreadLocal<Session> currentSession = new ThreadLocal<Session>();
+ /** The constants for describing the ownerships **/
+ private final Owner trueOwner = new Owner(true);
+ private final Owner fakeOwner = new Owner(false);
+
+ /**
+ * This creates a session which can be fetched then with getSession().
+ *
+ * @return An ownership handle which must be passed to destroySession():
+ * @throws LoginException
+ * @throws RepositoryException
+ */
+ public Object createSession() throws LoginException, RepositoryException
+ {
+ Session session = currentSession.get();
+ if(session == null)
+ {
+ session = m_repository.login(m_workspaceName);
+ currentSession.set(session);
+ return trueOwner;
+ }
+ return fakeOwner;
+ }
+
+ /**
+ * Closes the current session, if this caller is the owner. Must be called
+ * in your finally- block.
+ *
+ * @param ownership The ownership parameter from createSession()
+ */
+ public void destroySession(Object ownership)
+ {
+ if( ownership != null && ((Owner)ownership).identity)
+ {
+ Session session = currentSession.get();
+ session.logout();
+ currentSession.set(null);
+ }
+ }
+
+ /**
+ * Between createSession() and destroySession() you may get the Session object
+ * with this call. Otherwise the end result is undefined.
+ *
+ * @return A valid Session object, if called between createSession and destroySession().
+ */
+ public Session getSession()
+ {
+ return currentSession.get();
+ }
+
+ }
+
+ /**
+ * Internal class , for handling the identity. Hidden for the
+ * developers
+ */
+ private static class Owner
+ {
+ public Owner(boolean identity)
+ {
+ this.identity = identity;
+ }
+ boolean identity = false;
+ }
}
Propchange: incubator/jspwiki/trunk/src/java/org/
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/tests/java/SamplePlugin2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/jspwiki/trunk/tests/java/SamplePlugin2.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/tests/java/TranslationsCheck.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/jspwiki/trunk/tests/java/TranslationsCheck.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: incubator/jspwiki/trunk/tests/java/com/
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: incubator/jspwiki/trunk/tests/java/com/ecyrd/jspwiki/content/ContentManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/com/ecyrd/jspwiki/content/ContentManagerTest.java?rev=739080&r1=738991&r2=739080&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/com/ecyrd/jspwiki/content/ContentManagerTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/com/ecyrd/jspwiki/content/ContentManagerTest.java Thu Jan 29 23:23:31 2009
@@ -10,7 +10,6 @@
import org.apache.jspwiki.api.WikiPage;
import com.ecyrd.jspwiki.TestEngine;
-import com.ecyrd.jspwiki.WikiContext;
public class ContentManagerTest extends TestCase
{
@@ -32,8 +31,7 @@
@Override
protected void tearDown() throws Exception
{
- WikiPage p = m_mgr.getPage( m_engine.createContext( null, WikiContext.VIEW ),
- WikiName.valueOf("Main:TestPage") );
+ WikiPage p = m_mgr.getPage( WikiName.valueOf("Main:TestPage") );
if( p != null ) m_mgr.deletePage( p );
@@ -48,8 +46,7 @@
public void testBasicGet() throws Exception
{
String content = "Test Content";
- WikiContext ctx = m_engine.createContext( null, WikiContext.VIEW );
- WikiPage page = m_mgr.addPage( ctx, WikiName.valueOf("Main:TestPage"), ContentManager.JSPWIKI_CONTENT_TYPE );
+ WikiPage page = m_mgr.addPage( WikiName.valueOf("Main:TestPage"), ContentManager.JSPWIKI_CONTENT_TYPE );
assertNotNull("WikiPage create", page);
@@ -57,7 +54,7 @@
page.save();
- WikiPage page2 = m_mgr.getPage( ctx, WikiName.valueOf("Main:TestPage") );
+ WikiPage page2 = m_mgr.getPage( WikiName.valueOf("Main:TestPage") );
assertNotNull( "page2", page2 );
@@ -67,9 +64,8 @@
public void testBasicGetDefaultSpace() throws Exception
{
- WikiContext ctx = m_engine.createContext( null, WikiContext.VIEW );
String content = "Test Content";
- WikiPage page = m_mgr.addPage( ctx, WikiName.valueOf("TestPage"), ContentManager.JSPWIKI_CONTENT_TYPE );
+ WikiPage page = m_mgr.addPage( WikiName.valueOf("TestPage"), ContentManager.JSPWIKI_CONTENT_TYPE );
assertNotNull("WikiPage create", page);
@@ -77,7 +73,7 @@
page.save();
- WikiPage page2 = m_mgr.getPage( ctx, WikiName.valueOf("TestPage") );
+ WikiPage page2 = m_mgr.getPage( WikiName.valueOf("TestPage") );
assertNotNull( "page2", page2 );
Propchange: incubator/jspwiki/trunk/tests/java/stress/
------------------------------------------------------------------------------
svn:mergeinfo =