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 2008/12/20 10:51:36 UTC

svn commit: r728263 [1/3] - in /incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH: ./ doc/ etc/ etc/i18n/ etc/i18n/plugin/ etc/i18n/templates/ etc/ini/ src/com/ecyrd/jspwiki/ src/com/ecyrd/jspwiki/action/ src/com/ecyrd/jspwiki/diff/ src/com/ecyrd/jspwiki/p...

Author: jalkanen
Date: Sat Dec 20 01:51:25 2008
New Revision: 728263

URL: http://svn.apache.org/viewvc?rev=728263&view=rev
Log:
Merged with trunk r728241.

Added:
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/i18n/CoreResources_ru.properties
      - copied unchanged from r728261, incubator/jspwiki/trunk/etc/i18n/CoreResources_ru.properties
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/i18n/plugin/PluginResources_ru.properties
      - copied unchanged from r728261, incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_ru.properties
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/i18n/templates/default_ru.properties
      - copied unchanged from r728261, incubator/jspwiki/trunk/etc/i18n/templates/default_ru.properties
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/stripes/LocaleConverter.java
      - copied unchanged from r728261, incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/LocaleConverter.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/stripes/TimeZoneConverter.java
      - copied unchanged from r728261, incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/TimeZoneConverter.java
Removed:
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/jstl-fmt.tld
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/stripes.tld
Modified:
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/ChangeLog
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/build.xml
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/doc/README - Stripes Migration
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/i18n/templates/default.properties
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/ini/default_jspwiki.properties
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/jspwiki.tld
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/web.xml
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/Release.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/WikiPage.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/action/WikiContextFactory.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/preferences/Preferences.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/TemplateManager.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/WikiRequestWrapper.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/WikiServletFilter.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/migrator/JSPWikiJspTransformer.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/migrator/JspDocument.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/migrator/StripesJspTransformer.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/stripes/DefaultWikiContext.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Captcha.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Comment.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/CookieError.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/CreateProfile.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Delete.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/DeleteGroup.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Diff.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Edit.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/EditGroup.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Error.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Group.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Install.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/LoginForm.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Message.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/NewBlogEntry.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/NewGroup.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/PageInfo.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/PageModified.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Preview.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Rename.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Search.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Upload.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/UserPreferences.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Wiki.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/Workflow.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/admin/Admin.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/admin/SecurityConfig.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/AJAXCategories.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/AJAXPreview.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/AJAXSearch.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/AttachmentTab.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/CommentContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/ConflictContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/CreateProfileContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/DiffContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/DiffTab.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/DisplayMessage.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/EditContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/EditGroupContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/EditLayout.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/EditTemplate.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/Favorites.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/FindContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/Footer.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/GroupContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/GroupTab.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/Header.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/InfoContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/LoginContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/NewGroupContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/PageActionsBottom.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/PageActionsTop.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/PageContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/PageTab.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/PreferencesContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/PreferencesTab.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/PreviewContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/ProfileTab.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/SearchBox.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/UploadTemplate.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/UserBox.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/ViewLayout.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/ViewTemplate.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/WorkflowContent.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/admin/AdminTemplate.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/admin/UserManagement.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/commonheader.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/editors/FCK.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/editors/plain.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/default/editors/preview.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/webdocs/templates/raw/ViewTemplate.jsp
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/JspParserTest.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/StripesJspTransformerTest.java

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/ChangeLog?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/ChangeLog (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/ChangeLog Sat Dec 20 01:51:25 2008
@@ -1,3 +1,20 @@
+2008-12-19  Andrew Jaquith <ajaquith AT apache DOT org>
+
+        * 3.0.0-svn-34
+        
+        * Migrated UserPreferences.jsp and related; completely overhauled Preferences
+        code so that it is much simpler, and leverages Stripes. UserPreferences.jsp and
+        the collaborating UserPreferencesActionBean, in particular, are excellent
+        examples of what the JSPs will look like when we are done migrating everything.
+        A few bugs remain. Removed jspwiki & stripes TLDs from WEB-INF; they are
+        both in their respective jars' META-INF directories now.
+
+2008-12-19 Harry Metske <me...@apache.org>
+
+        * 3.0.0-svn-33
+        
+        * JSPWIKI-451 Russian translation, thanks to Andrew Rikhlivsky
+
 2008-12-17  Andrew Jaquith <ajaquith AT apache DOT org>
 
         * 3.0.0-svn-32

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/build.xml
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/build.xml?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/build.xml (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/build.xml Sat Dec 20 01:51:25 2008
@@ -306,6 +306,7 @@
       </classpath>
       <arg value="src/webdocs" />
       <arg value="build/migrated" />
+      <sysproperty key="stripes.migrator.migrateForms" value="${stripes.migrator.migrateForms}" />
     </java>
   </target>
 
@@ -337,6 +338,7 @@
          <fileset dir="${code.src}" includes="templates/**/*.properties" />
          <fileset dir="${code.i18n}" />
          <fileset dir="etc" includes="ini/*.xml ini/*.properties" />
+         <metainf dir="etc" includes="jspwiki.tld" />
       </jar>
   </target>
 
@@ -429,7 +431,7 @@
          <include name="commons-logging.properties" />
          <include name="jspwiki.policy" />
          <include name="jspwiki.properties" />
-         <include name="*.tld" />
+         <include name="oscache.tld" />
          <include name="userdatabase.xml" />
          <include name="groupdatabase.xml" />
        </webinf>
@@ -856,7 +858,7 @@
           <include name="dtd/**" />
           <include name="commons-logging.properties" />
           <include name="jspwiki.policy" />
-          <include name="*.tld" />
+          <include name="oscache.tld" />
         </fileset>
         <fileset dir="tests/etc" includes="userdatabase.xml groupdatabase.xml" />
       </copy>

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/doc/README - Stripes Migration
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/doc/README%20-%20Stripes%20Migration?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/doc/README - Stripes Migration (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/doc/README - Stripes Migration Sat Dec 20 01:51:25 2008
@@ -26,7 +26,7 @@
 Include these lines for all top-level JSPs:
 
 <%@ page import="com.ecyrd.jspwiki.action.*" %>
-<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
+<%@ taglib uri="http://stripes.sourceforge.net/stripes.tld" prefix="stripes" %>
 
 WikiContext Creation
 --------------------

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/i18n/templates/default.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/i18n/templates/default.properties?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/i18n/templates/default.properties (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/i18n/templates/default.properties Sat Dec 20 01:51:25 2008
@@ -450,6 +450,10 @@
 profile.nameCollision=Another user already has a profile with {0} set to {1}
 profile.noPasswordMatch=Passwords must match
 
+# Enumerated types
+Orientation.LEFT=Left
+Orientation.RIGHT=Right
+
 # Workflow generic messages
 workflow.tab=Workflow
 workflow.heading=Your Workflow Items

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/ini/default_jspwiki.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/ini/default_jspwiki.properties?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/ini/default_jspwiki.properties (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/ini/default_jspwiki.properties Sat Dec 20 01:51:25 2008
@@ -20,9 +20,9 @@
 
 # Set position of the favorites menu (aka left menu)
 # The value determines the css-class used to change the position of the #favorites block
-# Possible values: fav-left or fav-right
-# Default value is fav-left
-jspwiki.defaultprefs.template.orientation =fav-left
+# Possible values: LEFT or RIGHT
+# Default value is LEFT
+jspwiki.defaultprefs.template.orientation =LEFT
 
 # Set editor type : plain, WikiWizard, FCK 
 jspwiki.defaultprefs.template.editor =plain

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/jspwiki.tld
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/jspwiki.tld?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/jspwiki.tld (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/jspwiki.tld Sat Dec 20 01:51:25 2008
@@ -4,14 +4,12 @@
 
 <!--
      JSPWiki tag libraries are defined here.
-
-     Note that we support only the 1.1 spec for now,
-     simply because there is no reason to break compatibility.
  -->
 <taglib>
-  <tlibversion>1.0</tlibversion>
-  <jspversion>1.1</jspversion>
+  <tlibversion>3.0</tlibversion>
+  <jspversion>2.0</jspversion>
   <shortname>jspwiki</shortname>
+  <uri>http://jakarta.apache.org/jspwiki.tld</uri>
 
   <tag>
     <name>AdminBeanIterator</name>

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/web.xml
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/web.xml?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/web.xml (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/web.xml Sat Dec 20 01:51:25 2008
@@ -1,5 +1,4 @@
 <?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"
@@ -59,8 +58,8 @@
          <param-name>ActionResolver.Packages</param-name>
          <param-value>com.ecyrd.jspwiki.action</param-value>
       </init-param>
-      <!-- Tell Stripes to auto-discover custom extension classes from the "action"
-           package also. Extensions JSPWiki uses includes WikiActionBeanContext,
+      <!-- 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>
@@ -79,7 +78,7 @@
       <!-- Locales supported by this wiki -->
       <init-param>
          <param-name>LocalePicker.Locales</param-name>
-         <param-value>en:UTF8,de:UTF8,es:UTF8,fi:UTF8,it:UTF8,ln:UTF8,zh_CN:UTF8,</param-value>
+         <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>
@@ -128,18 +127,24 @@
        <filter-name>WikiServletFilter</filter-name>
        <url-pattern>/JSON-RPC</url-pattern>
    </filter-mapping> 
-    <filter-mapping>
-        <filter-name>StripesFilter</filter-name>
-        <url-pattern>*.jsp</url-pattern>
-        <dispatcher>REQUEST</dispatcher>
-        <dispatcher>FORWARD</dispatcher>
-    </filter-mapping>
-
-    <filter-mapping>
-        <filter-name>StripesFilter</filter-name>
-        <servlet-name>StripesDispatcher</servlet-name>
-        <dispatcher>REQUEST</dispatcher>
-    </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>
@@ -153,7 +158,7 @@
    -->
 
    <!--
-       HttpSessionListener used for managing WikiSession's.
+       HttpSessionListener used for managing WikiSessions.
      -->
    <listener>
       <listener-class>com.ecyrd.jspwiki.auth.SessionMonitor</listener-class>
@@ -318,22 +323,6 @@
      <error-code>403</error-code>
      <location>/error/Forbidden.html</location>
    </error-page>
-   
-   <!-- Taglibs -->
-   <!--
-   <taglib>
-     <taglib-location>/WEB-INF/jstl-core.tld</taglib-location>
-     <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
-   </taglib>
-   <taglib>
-     <taglib-location>/WEB-INF/jstl-fmt.tld</taglib-location>
-     <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
-   </taglib>
-   -->
-   <taglib>
-     <taglib-location>/WEB-INF/stripes.tld</taglib-location>
-     <taglib-uri>http://stripes.sourceforge.net/stripes.tld</taglib-uri>
-   </taglib>
 
    <!--  REMOVE ME TO ENABLE JDBC DATABASE
    <resource-ref>

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/Release.java?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/Release.java Sat Dec 20 01:51:25 2008
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "32";
+    public static final String     BUILD         = "34";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/WikiPage.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/WikiPage.java?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/WikiPage.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/WikiPage.java Sat Dec 20 01:51:25 2008
@@ -83,8 +83,8 @@
     /**
      *  Create a new WikiPage using a given engine and name.
      *  
-     *  @param engine The WikiEngine that owns this page.
-     *  @param name   The path of the page.
+     *  @param engine the WikiEngine that owns this page
+     *  @param path the path of the page
      */
     public WikiPage( WikiEngine engine, String path )
     {

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java Sat Dec 20 01:51:25 2008
@@ -1,18 +1,22 @@
 package com.ecyrd.jspwiki.action;
 
 import java.security.Principal;
+import java.util.Locale;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
 import net.sourceforge.stripes.action.*;
+import net.sourceforge.stripes.controller.LifecycleStage;
 import net.sourceforge.stripes.validation.Validate;
 
+import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.auth.login.CookieAssertionLoginModule;
 import com.ecyrd.jspwiki.auth.permissions.WikiPermission;
 import com.ecyrd.jspwiki.log.Logger;
 import com.ecyrd.jspwiki.log.LoggerFactory;
+import com.ecyrd.jspwiki.preferences.Preferences;
 import com.ecyrd.jspwiki.ui.EditorManager;
 import com.ecyrd.jspwiki.ui.TemplateManager;
 import com.ecyrd.jspwiki.ui.stripes.HandlerPermission;
@@ -33,6 +37,20 @@
 
     private String m_redirect = null;
 
+    private Locale m_locale = null;
+
+    private Preferences.Orientation m_orientation = null;
+
+    private String m_timeFormat = null;
+
+    private String m_timeZone = null;
+
+    private boolean m_showQuickLinks = false;
+
+    private boolean m_sectionEditing = false;
+
+    private String m_skin = null;
+
     /**
      * Clears the user's asserted name by removing the cookie from the user's
      * session, then logs out the user by redirecting to <code>/Login.jsp</code>.
@@ -49,19 +67,6 @@
     }
 
     /**
-     * Redirects the user to their favorites page.
-     * 
-     * @return a redirection to the favorites page
-     */
-    @HandlesEvent( "editFavorites" )
-    @WikiRequestContext( "favorites" )
-    public Resolution editFavorites()
-    {
-        Principal principal = getContext().getCurrentUser();
-        return new RedirectResolution( "/Edit.jsp?" + principal.getName() + "Favorites" );
-    }
-
-    /**
      * Sets the user's asserted name by setting a cookie in the user's session,
      * then redirects to the wiki front page. This method will <em>not</em>
      * set the cookie if the user is already authenticated.
@@ -91,24 +96,26 @@
     }
 
     /**
-     * Returns the asserted name for the user prefererences.
+     * Redirects the user to their favorites page.
      * 
-     * @return the asserted name
+     * @return a redirection to the favorites page
      */
-    public String getAssertedName()
+    @HandlesEvent( "editFavorites" )
+    @WikiRequestContext( "favorites" )
+    public Resolution editFavorites()
     {
-        return m_assertedName;
+        Principal principal = getContext().getCurrentUser();
+        return new RedirectResolution( "/Edit.jsp?" + principal.getName() + "Favorites" );
     }
 
     /**
-     * Sets the asserted name for the user prefererences.
+     * Returns the asserted name for the user preferences.
      * 
-     * @param name the asserted name
+     * @return the asserted name
      */
-    @Validate( required = true, on = "createAssertedName", minlength=1, maxlength=128 )
-    public void setAssertedName( String name )
+    public String getAssertedName()
     {
-        m_assertedName = name;
+        return m_assertedName;
     }
 
     /**
@@ -121,6 +128,126 @@
         return m_editor;
     }
 
+    public Locale getLocale()
+    {
+        return m_locale;
+    }
+
+    public Preferences.Orientation getOrientation()
+    {
+        return m_orientation;
+    }
+
+    /**
+     * Returns the URL to redirect to after the event handler methods fire.
+     * 
+     * @return the URL to redirect to
+     */
+    public String getRedirect()
+    {
+        return m_redirect;
+    }
+
+    public String getSkin()
+    {
+        return m_skin;
+    }
+
+    public String getTimeFormat()
+    {
+        return m_timeFormat;
+    }
+
+    public String getTimeZone()
+    {
+        return m_timeZone;
+    }
+
+    /**
+     * Pre-action that loads the available set of skins, languages, time formats
+     * and time zones based on the current template returned by
+     * {@link com.ecyrd.jspwiki.ui.stripes.WikiActionBeanContext#getTemplate()}.
+     * It also pre-populates the form values with the preferences stored in the
+     * session attribute
+     * {@link com.ecyrd.jspwiki.preferences.Preferences#SESSIONPREFS}.
+     * 
+     * @return always returns <code>null</code>
+     */
+    @Before( stages = LifecycleStage.BindingAndValidation )
+    public Resolution initPreferenceOptions()
+    {
+        WikiContext c = getContext();
+        TemplateManager t = c.getEngine().getTemplateManager();
+        HttpServletRequest request = getContext().getRequest();
+        HttpSession session = request.getSession();
+        
+        // Set request attributes
+        request.setAttribute( "skins", t.listSkins( request, c.getTemplate() ) );
+        request.setAttribute( "locales", t.listLocales( request ) );
+        request.setAttribute( "timeformats", t.listTimeFormats( getContext() ) );
+        request.setAttribute( "timezones", t.listTimeZones( request ) );
+        
+        // Pre-populate values
+        m_editor = Preferences.getPreference( session, Preferences.PREFS_EDITOR );
+        m_locale = new Locale( Preferences.getPreference( session, Preferences.PREFS_LOCALE ) );
+        try
+        {
+            m_orientation = Preferences.Orientation.valueOf( Preferences.getPreference( session, Preferences.PREFS_ORIENTATION ) );
+        }
+        catch ( Exception e )
+        {
+            m_orientation = Preferences.Orientation.LEFT;
+        }
+        m_sectionEditing = Boolean.parseBoolean( Preferences.getPreference( session, Preferences.PREFS_SECTION_EDITING ) );
+        m_skin = Preferences.getPreference( session, Preferences.PREFS_SKIN );
+        m_timeFormat = Preferences.getPreference( session, Preferences.PREFS_TIME_FORMAT );
+        m_timeZone = Preferences.getPreference( session, Preferences.PREFS_TIME_ZONE );
+        
+        return null;
+    }
+
+    public boolean isSectionEditing()
+    {
+        return m_sectionEditing;
+    }
+
+    public boolean isShowQuickLinks()
+    {
+        return m_showQuickLinks;
+    }
+
+    /**
+     * Saves the user's currently selected preferences to cookies, and to the
+     * Preferences map associated with the user's session.
+     * 
+     * @return resolution redirecting user to the display JSP for this ActionBean
+     */
+    @HandlesEvent( "save" )
+    public Resolution save()
+    {
+        HttpSession session = getContext().getHttpRequest().getSession();
+        HttpServletResponse response = getContext().getResponse();
+        Preferences.setPreference( session, response, Preferences.PREFS_EDITOR, m_editor );
+        Preferences.setPreference( session, response, Preferences.PREFS_LOCALE, m_locale.toString() );
+        Preferences.setPreference( session, response, Preferences.PREFS_ORIENTATION, m_orientation.name() );
+        Preferences.setPreference( session, response, Preferences.PREFS_SECTION_EDITING, Boolean.toString( m_sectionEditing ) );
+        Preferences.setPreference( session, response, Preferences.PREFS_SKIN, m_skin );
+        Preferences.setPreference( session, response, Preferences.PREFS_TIME_FORMAT, m_timeFormat );
+        Preferences.setPreference( session, response, Preferences.PREFS_TIME_ZONE, m_timeZone );
+        return new RedirectResolution( UserPreferencesActionBean.class );
+    }
+
+    /**
+     * Sets the asserted name for the user preferences.
+     * 
+     * @param name the asserted name
+     */
+    @Validate( required = true, on = "createAssertedName", minlength = 1, maxlength = 128 )
+    public void setAssertedName( String name )
+    {
+        m_assertedName = name;
+    }
+
     /**
      * Sets the editor for editing preferences. If this
      * UserPreferencesActionBean has an associated WikiActionBeanContext, and
@@ -130,7 +257,7 @@
      * 
      * @param editor the editor
      */
-    @Validate()
+    @Validate( )
     public void setEditor( String editor )
     {
         m_editor = editor;
@@ -141,25 +268,57 @@
         }
     }
 
+    @Validate( )
+    public void setLocale( Locale locale )
+    {
+        m_locale = locale;
+    }
+
+    @Validate( )
+    public void setOrientation( Preferences.Orientation orientation )
+    {
+        m_orientation = orientation;
+    }
+
     /**
      * Sets the URL to redirect to after the event handler methods fire.
      * 
      * @param url the URL to redirect to
      */
-    @Validate()
+    @Validate( )
     public void setRedirect( String url )
     {
         m_redirect = url;
     }
 
-    /**
-     * Returns the URL to redirect to after the event handler methods fire.
-     * 
-     * @return the URL to redirect to
-     */
-    public String getRedirect()
+    @Validate( )
+    public void setSectionEditing( boolean sectionEditing )
     {
-        return m_redirect;
+        m_sectionEditing = sectionEditing;
+    }
+
+    @Validate( )
+    public void setShowQuickLinks( boolean showQuickLinks )
+    {
+        m_showQuickLinks = showQuickLinks;
+    }
+
+    @Validate( )
+    public void setSkin( String skin )
+    {
+        m_skin = skin;
+    }
+
+    @Validate( )
+    public void setTimeFormat( String timeFormat )
+    {
+        m_timeFormat = timeFormat;
+    }
+
+    @Validate( )
+    public void setTimeZone( String timeZone )
+    {
+        m_timeZone = timeZone;
     }
 
     /**
@@ -169,7 +328,7 @@
      * @return a forward to the content template
      */
     @DefaultHandler
-    @HandlesEvent("prefs")
+    @HandlesEvent( "prefs" )
     @HandlerPermission( permissionClass = WikiPermission.class, target = "${context.engine.applicationName}", actions = WikiPermission.EDIT_PREFERENCES_ACTION )
     @WikiRequestContext( "prefs" )
     public Resolution view()

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/action/WikiContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/action/WikiContextFactory.java?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/action/WikiContextFactory.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/action/WikiContextFactory.java Sat Dec 20 01:51:25 2008
@@ -3,7 +3,10 @@
 import java.lang.reflect.Method;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -22,7 +25,6 @@
 import com.ecyrd.jspwiki.log.Logger;
 import com.ecyrd.jspwiki.log.LoggerFactory;
 import com.ecyrd.jspwiki.parser.MarkupParser;
-import com.ecyrd.jspwiki.preferences.Preferences;
 import com.ecyrd.jspwiki.providers.ProviderException;
 import com.ecyrd.jspwiki.tags.WikiTagBase;
 import com.ecyrd.jspwiki.ui.stripes.HandlerInfo;
@@ -90,22 +92,6 @@
     }
 
     /**
-     * Returns the locale of the HTTP request if available, otherwise returns
-     * the default Locale of the server.
-     * 
-     * @return A valid locale object
-     * @param context The WikiContext
-     */
-    public static Locale getLocale( WikiContext context )
-    {
-        return Preferences.getLocale( context );
-        /*
-         * HttpServletRequest request = context.getHttpRequest(); return (
-         * request != null ) ? request.getLocale() : Locale.getDefault();
-         */
-    }
-
-    /**
      * <p>
      * Saves the supplied WikiContext, and the related WikiEngine and
      * WikiSession, in request scope. The WikiContext is saved as an attribute

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java Sat Dec 20 01:51:25 2008
@@ -38,7 +38,6 @@
 import com.ecyrd.jspwiki.NoRequiredPropertyException;
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.action.WikiContextFactory;
 import com.ecyrd.jspwiki.i18n.InternationalizationManager;
 
 
@@ -183,7 +182,7 @@
             double[] choiceLimits = { 1, 2 };
             
             MessageFormat fmt = new MessageFormat("");
-            fmt.setLocale( WikiContextFactory.getLocale(m_context) );
+            fmt.setLocale( m_context.getHttpRequest().getLocale() );
             ChoiceFormat cfmt = new ChoiceFormat( choiceLimits, choiceString );
             fmt.applyPattern( type );
             Format[] formats = { NumberFormat.getInstance(), cfmt, NumberFormat.getInstance() };

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/preferences/Preferences.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/preferences/Preferences.java?rev=728263&r1=728262&r2=728263&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/preferences/Preferences.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/preferences/Preferences.java Sat Dec 20 01:51:25 2008
@@ -24,272 +24,165 @@
 import java.text.SimpleDateFormat;
 import java.util.*;
 
+import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 import javax.servlet.jsp.PageContext;
 
-import org.apache.commons.lang.StringUtils;
-import com.ecyrd.jspwiki.log.Logger;
-import com.ecyrd.jspwiki.log.LoggerFactory;
-import org.json.JSONException;
-import org.json.JSONObject;
-
 import com.ecyrd.jspwiki.InternalWikiException;
 import com.ecyrd.jspwiki.PropertyReader;
 import com.ecyrd.jspwiki.WikiContext;
-import com.ecyrd.jspwiki.action.WikiContextFactory;
+import com.ecyrd.jspwiki.WikiEngine;
 import com.ecyrd.jspwiki.i18n.InternationalizationManager;
-import com.ecyrd.jspwiki.util.HttpUtil;
-import com.ecyrd.jspwiki.util.TextUtil;
+import com.ecyrd.jspwiki.log.Logger;
+import com.ecyrd.jspwiki.log.LoggerFactory;
+import com.ecyrd.jspwiki.ui.stripes.LocaleConverter;
 
 /**
- *  Represents an object which is used to store user preferences.
- *  
+ * <p>
+ * Represents user preferences for language, timezone, preferred template skin
+ * and other customizable user interface items. Preferences are initialized by
+ * JSPWiki by reading a series of cookies from the user's HTTP request. This
+ * happens once per request, during the execution of
+ * {@link com.ecyrd.jspwiki.ui.WikiServletFilter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)}.
+ * The method {@link #setupPreferences(HttpServletRequest)} performs the actual
+ * initialization.
+ * <p>
+ * After initialization, Preferences are stashed in the user's session as an
+ * attribute named {@link #SESSIONPREFS}. Preferences may be subsequently
+ * changed by calling
+ * {@link com.ecyrd.jspwiki.action.UserPreferencesActionBean#save()} with
+ * appropriate parameters, generally from a JSP.
+ * </p>
  */
-public class Preferences
-    extends HashMap<String,String>
+public class Preferences extends HashMap<String, String>
 {
-    private static final long serialVersionUID = 1L;
-    
     /**
-     *  The name under which a Preferences object is stored in the HttpSession.
-     *  Its value is {@value}.
-     */
-    public static final String SESSIONPREFS = "prefs";
-     
-    private static Logger log = LoggerFactory.getLogger( Preferences.class );
-    
-    /**
-     *  This is an utility method which is called to make sure that the
-     *  JSP pages do have proper access to any user preferences.  It should be
-     *  called from the commonheader.jsp.
-     *  <p>
-     *  This method reads user cookie preferences and mixes them up with any
-     *  default preferences (and in the future, any user-specific preferences)
-     *  and puts them all in the session, so that they do not have to be rewritten
-     *  again.
-     *  <p>
-     *  This method will remember if the user has already changed his prefs.
-     *  
-     *  @param pageContext The JSP PageContext.
+     * <p>
+     * Enumeration of three different date formats that JSPWiki supports.
+     * </p>
+     * <ul>
+     * <li>TIME: A time format, without date</li>
+     * <li>DATE: A date format, without a time</li>
+     * <li>DATETIME: A date format, with a time</li>
+     * </ul>
+     * 
+     * @since 2.8
      */
-    public static void setupPreferences( PageContext pageContext )
+    public enum TimeFormat
     {
-        HttpSession session = pageContext.getSession();
+        /** Time only; no date. */
+        TIME,
 
-        if( session.getAttribute( SESSIONPREFS ) == null )
-        {
-            reloadPreferences( pageContext );
-        }
+        /** Date only; no time. */
+        DATE,
+
+        /** Date plus time. */
+        DATETIME
     }
-    
+
     /**
-     *  Reloads the preferences from the PageContext into the WikiContext.
-     *  
-     *  @param pageContext The page context.
-     */
-    // FIXME: The way that date preferences are chosen is currently a bit wacky: it all
-    //        gets saved to the cookie based on the browser state with which the user
-    //        happened to first arrive to the site with.  This, unfortunately, means that
-    //        even if the user changes e.g. language preferences (like in a web cafe),
-    //        the old preferences still remain in a site cookie.
-    public static void reloadPreferences( PageContext pageContext )
+     * Enumeration of the orientation formats for favorites.
+     */
+    public enum Orientation
     {
-        Preferences prefs = new Preferences();
-        Properties props = PropertyReader.loadWebAppProps( pageContext.getServletContext() );
-        WikiContext ctx = WikiContextFactory.findContext( pageContext );
-        
-        prefs.put("SkinName", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.skinname", "PlainVanilla" ) );
-        prefs.put("DateFormat", 
-                  TextUtil.getStringProperty( props, 
-                                              "jspwiki.defaultprefs.template.dateformat", 
-                                              ctx.getEngine().getInternationalizationManager().get( InternationalizationManager.CORE_BUNDLE, 
-                                                                                                    getLocale( ctx ), 
-                                                                                                    "common.datetimeformat" ) ) );
-
-        prefs.put("TimeZone", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.timezone", 
-                                                          java.util.TimeZone.getDefault().getID() ) );
-
-        prefs.put("Orientation", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.orientation", "fav-left" ) );
-        
-        prefs.put("Language", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.language",
-                                                          getLocale( ctx ).toString() ) );
+        /** Favorites to the left. */
+        LEFT,
+        /** Favorites to the right. */
+        RIGHT
+    }
 
-        prefs.put("SectionEditing", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.sectionediting",
-                                                          "" ) );
+    /**
+     * Cookie name for the user's preference for displaying dates and times.
+     */
+    public static final String PREFS_TIME_FORMAT = "TimeFormat";
 
-        // FIXME: "editor" property does not get registered, may be related with http://bugs.jspwiki.org/show_bug.cgi?id=117
-        // disabling it until knowing why it's happening
-        // FIXME: editormanager reads jspwiki.editor -- which of both properties should continue
-        prefs.put("editor", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.editor", "plain" ) );
-                
-        parseJSONPreferences( (HttpServletRequest) pageContext.getRequest(), prefs );
+    /**
+     * Cookie name for the user's preference for displaying time zones.
+     */
+    public static final String PREFS_TIME_ZONE = "TimeZone";
 
-        pageContext.getSession().setAttribute( SESSIONPREFS, prefs );        
-    }
+    /**
+     * Cookie name for the user's preference for text orientation.
+     */
+    public static final String PREFS_ORIENTATION = "Orientation";
 
- 
     /**
-     *  Parses new-style preferences stored as JSON objects and stores them
-     *  in the session.  Everything in the cookie is stored.
-     *  
-     *  @param request
-     *  @param prefs The default hashmap of preferences
-     *  
+     * Cookie name for the user's preference for section editing (on/off).
      */
-    private static void parseJSONPreferences( HttpServletRequest request, Preferences prefs )
-    {
-        //FIXME: urlDecodeUTF8 should better go in HttpUtil ??
-        String prefVal = TextUtil.urlDecodeUTF8( HttpUtil.retrieveCookieValue( request, "JSPWikiUserPrefs" ) );
-        
-        if( prefVal != null )
-        {
-            try
-            {
-                JSONObject jo = new JSONObject( prefVal );
-    
-                for( Iterator i = jo.keys(); i.hasNext(); )
-                {
-                    String key = TextUtil.replaceEntities( (String)i.next() );
-                    prefs.put(key, jo.getString(key) );
-                }
-            }
-            catch( JSONException e )
-            {
-            }
-        }
-    }
+    public static final String PREFS_SECTION_EDITING = "SectionEditing";
 
     /**
-     *  Returns a preference value programmatically.
-     *  FIXME
-     *  
-     *  @param wikiContext
-     *  @param name
-     *  @return the preference value
+     * Cookie name for the user's preferred {@link com.ecyrd.jspwiki.ui.Editor}.
      */
-    public static String getPreference( WikiContext wikiContext, String name )
-    {
-        HttpServletRequest request = wikiContext.getHttpRequest();
-        if ( request == null ) return null;
-        
-        Preferences prefs = (Preferences)request.getSession().getAttribute( SESSIONPREFS );
-        
-        if( prefs != null )
-            return prefs.get( name );
-        
-        return null;
-    }
+    public static final String PREFS_EDITOR = "Editor";
+
     /**
-     *  Returns a preference value programmatically.
-     *  FIXME
-     *  
-     *  @param pageContext
-     *  @param name
-     *  @return the preference value
+     * The name under which a Preferences object is stored in the HttpSession.
+     * Its value is {@value}.
      */
-    public static String getPreference( PageContext pageContext, String name )
-    {
-        Preferences prefs = (Preferences)pageContext.getSession().getAttribute( SESSIONPREFS );
-        
-        if( prefs != null )
-            return prefs.get( name );
-        
-        return null;
-    }
+    public static final String SESSIONPREFS = "prefs";
 
-    
     /**
-     * Get Locale according to user-preference settings or the Stripes ActionBeanContext.
-     * 
-     * @param context The context to examine.
-     * @return a Locale object.
-     * @since 2.8
+     * Cookie name for the user's preferred {@link java.util.Locale}.
      */
-    public static Locale getLocale(WikiContext context)
-    {
-        Locale loc = null;
-        
-        String langSetting = Preferences.getPreference( context, "Language" );
-        
-        //
-        // parse language and construct valid Locale object
-        //
-        if( langSetting != null)
-        {
-            String language = "";
-            String country  = "";
-            String variant  = "";
-            
-            String[] res = StringUtils.split( langSetting, "-_" );
-            
-            if( res.length > 2 ) variant = res[2];
-            if( res.length > 1 ) country = res[1];
-            
-            if( res.length > 0 )
-            {
-                language = res[0];
-            
-                loc = new Locale( language, country, variant );
-            }
-        }
-        
-        // otherwise try to find out the browser's preferred language setting, or use the JVM's default
-        if( loc == null)
-        {    
-            HttpServletRequest request = context.getHttpRequest();
-            loc = ( request != null ) ? request.getLocale() : Locale.getDefault();
-        }
+    public static final String PREFS_LOCALE = "Locale";
 
-        //log.info( "using locale "+loc.toString() );
-        return loc;
-    }
+    /**
+     * Cookie name for the user's preferred template skin.
+     */
+    public static final String PREFS_SKIN = "SkinName";
+
+    private static final long serialVersionUID = 2L;
+
+    private static Logger log = LoggerFactory.getLogger( Preferences.class );
+
+    private static final LocaleConverter LOCALE_CONVERTER = new LocaleConverter();
 
     /**
-     *  Get SimpleTimeFormat according to user browser locale and preferred time
-     *  formats. If not found, it will revert to whichever format is set for the
-     *  default
+     * Get SimpleTimeFormat according to user browser locale and preferred time
+     * formats. If not found, it will revert to whichever format is set for the
+     * default
      * 
-     *  @param context WikiContext to use for rendering.
-     *  @param tf Which version of the dateformat you are looking for?
-     *  @return A SimpleTimeFormat object which you can use to render
-     *  @since 2.8
+     * @param context WikiContext to use for rendering.
+     * @param tf Which version of the dateformat you are looking for?
+     * @return A SimpleTimeFormat object which you can use to render
+     * @since 2.8
      */
     public static SimpleDateFormat getDateFormat( WikiContext context, TimeFormat tf )
     {
         InternationalizationManager imgr = context.getEngine().getInternationalizationManager();
-        Locale clientLocale = Preferences.getLocale( context );
-        String prefTimeZone = Preferences.getPreference( context, "TimeZone" );
+        Locale clientLocale = getLocale( context.getHttpRequest() );
+        String prefTimeZone = Preferences.getPreference( context, PREFS_TIME_ZONE );
         String prefDateFormat;
-        
-        log.debug("Checking for preferences...");
-        
+
+        log.debug( "Checking for preferences..." );
+
         switch( tf )
         {
             case DATETIME:
-                prefDateFormat = Preferences.getPreference( context, "DateFormat" );
-                log.debug("Preferences fmt = "+prefDateFormat);
-                if( prefDateFormat == null ) 
+                prefDateFormat = Preferences.getPreference( context, PREFS_TIME_FORMAT );
+                log.debug( "Preferences fmt = " + prefDateFormat );
+                if( prefDateFormat == null )
                 {
-                    prefDateFormat = imgr.get( InternationalizationManager.CORE_BUNDLE, 
-                                               clientLocale, 
-                                               "common.datetimeformat" );
-                    log.debug("Using locale-format = "+prefDateFormat);
+                    prefDateFormat = imgr.get( InternationalizationManager.CORE_BUNDLE, clientLocale, "common.datetimeformat" );
+                    log.debug( "Using locale-format = " + prefDateFormat );
                 }
                 break;
-                
+
             case TIME:
                 prefDateFormat = imgr.get( "common.timeformat" );
                 break;
-                
+
             case DATE:
                 prefDateFormat = imgr.get( "common.dateformat" );
                 break;
-                
+
             default:
                 throw new InternalWikiException( "Got a TimeFormat for which we have no value!" );
         }
-        
+
         try
         {
             SimpleDateFormat fmt = new SimpleDateFormat( prefDateFormat, clientLocale );
@@ -312,41 +205,216 @@
     }
 
     /**
-     *  A simple helper function to render a date based on the user preferences.
-     *  This is useful for example for all plugins.
-     *  
-     *  @param context  The context which is used to get the preferences
-     *  @param date     The date to render.
-     *  @param tf       In which format the date should be rendered.
-     *  @return A ready-rendered date.
-     *  @since 2.8
+     * Returns the user's preferred {@link java.util.Locale} according the
+     * contents of the cookie value {@link #PREFS_LOCALE}, or alternatively the
+     * Locale supplied by the HTTP request object.
+     * 
+     * @param request the HTTP request
+     * @return a Locale object.
+     * @since 2.8
+     */
+    public static Locale getLocale( HttpServletRequest request )
+    {
+        String localePref = getCookieValue( request, PREFS_LOCALE, request.getLocale().toString() );
+        Locale locale = LOCALE_CONVERTER.convert( localePref, Locale.class, null );
+
+        // Otherwise use the JVM's default
+        if( locale == null )
+        {
+            locale = Locale.getDefault();
+        }
+        return locale;
+    }
+
+    /**
+     * Returns a preference value from the Preferences object stored in the
+     * user's session.
+     * 
+     * @param session the HTTP session
+     * @param name the name of the preference to retrieve
+     * @return the preference value, or <code>null</code> if not found
+     */
+    public static String getPreference( HttpSession session, String name )
+    {
+        Preferences prefs = (Preferences) session.getAttribute( SESSIONPREFS );
+        if( prefs != null )
+        {
+            return prefs.get( name );
+        }
+        return null;
+    }
+
+    /**
+     * Returns a preference value from the Preferences object stored in the
+     * user's session.
+     * 
+     * @param pageContext the page context
+     * @param name the name of the preference to retrieve
+     * @return the preference value, or <code>null</code> if not found
+     */
+    public static String getPreference( PageContext pageContext, String name )
+    {
+        return getPreference( pageContext.getSession(), name );
+    }
+
+    /**
+     * Returns a preference value from the Preferences object stored in the
+     * user's session.
+     * 
+     * @param wikiContext the wiki context
+     * @param name the name of the preference to retrieve
+     * @return the preference value, or <code>null</code> if not found
+     */
+    public static String getPreference( WikiContext wikiContext, String name )
+    {
+        return getPreference( wikiContext.getHttpRequest().getSession(), name );
+    }
+
+    /**
+     * Saves a preference value as a cookie. If <code>key</code> or
+     * <code>value</code> is <code>null</code>, the cookie is not set.
+     * 
+     * @param session the HTTP session
+     * @param response the HTTP response
+     * @param key the cookie name
+     * @param value the cookie value
+     */
+    public static void setPreference( HttpSession session, HttpServletResponse response, String key, String value )
+    {
+        if( key != null && value != null )
+        {
+            Cookie cookie = new Cookie( key, value );
+            response.addCookie( cookie );
+            Preferences prefs = (Preferences) session.getAttribute( SESSIONPREFS );
+            if( prefs != null )
+            {
+                prefs.put( key, value );
+            }
+        }
+    }
+
+    /**
+     * A simple helper function to render a date based on the user preferences.
+     * This is useful for example for all plugins.
+     * 
+     * @param context The context which is used to get the preferences
+     * @param date The date to render.
+     * @param tf In which format the date should be rendered.
+     * @return A ready-rendered date.
+     * @since 2.8
      */
     public static String renderDate( WikiContext context, Date date, TimeFormat tf )
     {
         DateFormat df = getDateFormat( context, tf );
-        
+
         return df.format( date );
     }
 
     /**
-     *  Is used to choose between the different date formats that JSPWiki supports.
-     *  <ul>
-     *   <li>TIME: A time format, without  date</li>
-     *   <li>DATE: A date format, without a time</li>
-     *   <li>DATETIME: A date format, with a time</li>
-     *  </ul>
-     *  
-     *  @since 2.8
+     * <p>
+     * This method checks to see if user preferences have been loaded from
+     * request cookies, and if not, loads them. This method is called from three
+     * places: from
+     * {@link com.ecyrd.jspwiki.ui.stripes.WikiInterceptor#intercept(net.sourceforge.stripes.controller.ExecutionContext)},
+     * {@link com.ecyrd.jspwiki.action.WikiContextFactory#newContext(HttpServletRequest, javax.servlet.http.HttpServletResponse, String)}
+     * and
+     * {@link com.ecyrd.jspwiki.action.WikiContextFactory#newViewContext(HttpServletRequest, javax.servlet.http.HttpServletResponse, com.ecyrd.jspwiki.WikiPage)}.
+     * </p>
+     * <p>
+     * Every user preference is read from a unique cookie. This method parses
+     * each value from the respective cookie, and applies a default value if the
+     * cookie is not found in the request. Once all preference values are
+     * parsed, this method stashes the Preferences object in the user's
+     * HTTPSession so that as an attribute named {@link #SESSIONPREFS}, so that
+     * it can be recalled later. So that JSPWiki does not waste excessive cycles
+     * parsing preference cookies on every request, if this method finds the
+     * SESSIONPREFS already present in the session, it returns silently without
+     * doing any more work.
+     * </p>
+     * <p>
+     * To change user preference values after the initial parse, users normally
+     * invoke {@link com.ecyrd.jspwiki.action.UserPreferencesActionBean#save()}.
+     * </p>
+     * 
+     * @param request the HTTP request
      */
-    public enum TimeFormat
+    public static void setupPreferences( HttpServletRequest request )
     {
-        /** A time format, no date. */
-        TIME,
-        
-        /** A date format, no time. */
-        DATE,
-        
-        /** A date+time format. */
-        DATETIME
+        HttpSession session = request.getSession();
+
+        if( session.getAttribute( SESSIONPREFS ) != null )
+        {
+            return;
+        }
+
+        // Ok, set up the preferences now
+        WikiEngine engine = WikiEngine.getInstance( session.getServletContext(), null );
+        Preferences prefs = new Preferences();
+        Properties props = PropertyReader.loadWebAppProps( session.getServletContext() );
+        Locale locale = request.getLocale();
+
+        // FIXME: "editor" property does not get registered, may be related with
+        // http://bugs.jspwiki.org/show_bug.cgi?id=117
+        // disabling it until knowing why it's happening
+        // FIXME: editormanager reads jspwiki.editor -- which of both properties
+        // should continue
+        String defaultValue = props.getProperty( "jspwiki.defaultprefs.template.editor", "plain" );
+        prefs.put( PREFS_EDITOR, getCookieValue( request, PREFS_EDITOR, defaultValue ) );
+
+        // Init the Locale
+        defaultValue = props.getProperty( "jspwiki.defaultprefs.template.language", locale.toString() );
+        prefs.put( PREFS_LOCALE, getCookieValue( request, PREFS_LOCALE, defaultValue ) );
+
+        // Init the orientation
+        defaultValue = props.getProperty( "jspwiki.defaultprefs.template.orientation", Orientation.LEFT.name() );
+        prefs.put( PREFS_ORIENTATION, getCookieValue( request, PREFS_ORIENTATION, defaultValue ) );
+
+        // Init section editing
+        defaultValue = props.getProperty( "jspwiki.defaultprefs.template.sectionediting", "false" );
+        prefs.put( PREFS_SECTION_EDITING, getCookieValue( request, PREFS_SECTION_EDITING, defaultValue ) );
+
+        // Init the template skin
+        defaultValue = props.getProperty( "jspwiki.defaultprefs.template.skinname", "PlainVanilla" );
+        prefs.put( PREFS_SKIN, getCookieValue( request, PREFS_SKIN, defaultValue ) );
+
+        // Init the date format
+        defaultValue = props.getProperty( "jspwiki.defaultprefs.template.dateformat", engine.getInternationalizationManager()
+            .get( InternationalizationManager.CORE_BUNDLE, locale, "common.datetimeformat" ) );
+        prefs.put( PREFS_TIME_FORMAT, getCookieValue( request, PREFS_TIME_FORMAT, defaultValue ) );
+
+        // Init the time zone
+        defaultValue = props.getProperty( "jspwiki.defaultprefs.template.timezone", java.util.TimeZone.getDefault().getID() );
+        prefs.put( PREFS_TIME_ZONE, getCookieValue( request, PREFS_TIME_ZONE, defaultValue ) );
+
+        // We're done here...
+        session.setAttribute( SESSIONPREFS, prefs );
+    }
+
+    private static String getCookieValue( HttpServletRequest request, String key, String defaultValue )
+    {
+        String cookieValue = null;
+        Cookie[] cookies = request.getCookies();
+        if( cookies != null )
+        {
+            for( Cookie cookie : request.getCookies() )
+            {
+                if( key.equals( cookie.getName() ) )
+                {
+                    cookieValue = cookie.getValue();
+                    break;
+                }
+            }
+        }
+        return cookieValue == null ? defaultValue : cookieValue;
+    }
+
+    public static void main( String[] args )
+    {
+        Orientation r = Orientation.LEFT;
+        System.out.println( r.toString() );
+        System.out.println( r.name() );
+        r = Orientation.valueOf( "LEFT" );
+        System.out.println( r.name() );
+        r = Orientation.valueOf( "foo" );
     }
 }