[jboss-cvs] jboss-seam/examples/wiki/src/etc/WEB-INF ...
Christian Bauer
christian at hibernate.org
Sat Aug 25 13:59:27 EDT 2007
User: cbauer
Date: 07/08/25 13:59:27
Modified: examples/wiki/src/etc/WEB-INF pages.xml urlrewrite.xml
Log:
Major refactoring of navigation
Revision Changes Path
1.22 +145 -235 jboss-seam/examples/wiki/src/etc/WEB-INF/pages.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: pages.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/etc/WEB-INF/pages.xml,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- pages.xml 17 Aug 2007 13:00:30 -0000 1.21
+++ pages.xml 25 Aug 2007 17:59:27 -0000 1.22
@@ -1,292 +1,225 @@
<?xml version="1.0" encoding="UTF-8"?>
<pages xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd"
+ xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
- login-view-id="/loginRequired.xhtml"
- no-conversation-view-id="/display.xhtml">
-
- <page view-id="/display.xhtml" action="#{browser.prepare}">
- <param name="nodeId" value="#{browser.nodeId}"/>
-
- <!-- End any pending long-running conversation that was propagated into his view -->
- <end-conversation/>
-
- <!-- These are the "start pages", outcomes of browser.prepare() and various request parameters -->
+ <page view-id="/wiki.xhtml">
+ <param name="nodeId" value="#{wikiRequestResolver.nodeId}"/>
+ <param name="areaName" value="#{wikiRequestResolver.areaName}"/>
+ <param name="nodeName" value="#{wikiRequestResolver.nodeName}"/>
+ <param name="message" value="#{wikiRequestResolver.message}"/>
+ <action execute="#{wikiRequestResolver.resolve}"/>
<navigation>
- <rule if-outcome="search">
- <redirect view-id="/search.xhtml">
- <param name="conversationPropagation" value="#{'none'}"/>
- <param name="lastConversationId" value="#{conversation.id}"/>
- </redirect>
- </rule>
- <rule if="#{!empty currentDocument}">
+ <rule if-outcome="docDisplay">
+ <raise-event type="DocumentHome.init"/>
<render view-id="/docDisplay.xhtml"/>
</rule>
- <rule>
+ <rule if-outcome="dirDisplay">
+ <raise-event type="DirectoryHome.init"/>
<render view-id="/dirDisplay.xhtml"/>
</rule>
</navigation>
</page>
- <page view-id="/docDisplay.xhtml" action="#{browser.prepare}">
- <param name="nodeId" value="#{browser.nodeId}"/>
-
- <!-- End any pending long-running conversation that was propagated into his view -->
- <end-conversation/>
-
+ <page view-id="/docDisplay.xhtml">
+ <param name="documentId" value="#{documentHome.nodeId}"/>
+ <action execute="#{documentHome.init}"/>
<navigation>
- <rule if-outcome="createDoc">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/docEdit.xhtml">
- <param name="parentDirId" value="#{currentDirectory.id}"/>
- </redirect>
+ <rule if-outcome="missingParameters">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/wiki.xhtml"/>
</rule>
+ </navigation>
+ </page>
- <rule if-outcome="editDoc">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/docEdit.xhtml">
- <param name="nodeId" value="#{currentDocument.id}"/>
- <param name="parentDirId" value="#{currentDirectory.id}"/>
+ <page view-id="/docHistory.xhtml" no-conversation-view-id="/wiki.xhtml">
+ <description>Document History</description>
+ <param name="nodeId" value="#{nodeHistory.nodeId}"/>
+ <action execute="#{nodeHistory.init}"/>
+ <begin-conversation flush-mode="MANUAL" join="true"/>
+ <navigation>
+ <rule if-outcome="missingParameters">
+ <end-conversation/>
+ <redirect view-id="/message.xhtml">
+ <message severity="ERROR">No request parameters specified.</message>
</redirect>
</rule>
-
- <rule if-outcome="showHistory">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/docHistory.xhtml">
- <param name="nodeId" value="#{currentDocument.id}"/>
+ <rule if-outcome="rollback">
+ <redirect view-id="/docEdit.xhtml">
+ <param name="documentId" value="#{currentNode.id}"/>
+ <param name="parentDirectoryId" value="#{currentNode.parent.id}"/>
</redirect>
</rule>
-
- <rule if-outcome="browseDir">
- <redirect view-id="/dirDisplay.xhtml"/>
- </rule>
-
</navigation>
-
</page>
- <page view-id="/docEdit.xhtml">
- <description>Edit Document</description>
+ <page view-id="/docEdit.xhtml" no-conversation-view-id="/wiki.xhtml">
+ <description>#{documentHome.idDefined ? 'Edit Document' : 'Create Document'}</description>
+ <param name="documentId" value="#{documentHome.nodeId}"/>
+ <param name="parentDirectoryId" value="#{documentHome.parentDirectoryId}"/>
+ <action execute="#{documentHome.init}"/>
+ <begin-conversation flush-mode="MANUAL" join="true"/>
<navigation>
- <rule if-outcome="removed">
- <end-conversation/>
+ <rule if-outcome="missingParameters">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/wiki.xhtml"/>
+ </rule>
+ <rule if-outcome="exitManaged">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/docDisplay"/>
+ </rule>
+ <rule if-outcome="exitUnmanaged">
+ <end-conversation before-redirect="true"/>
<redirect view-id="/dirDisplay.xhtml">
- <param name="nodeId" value="#{documentHome.parentDirectory.id}"/>
+ <param name="directoryId" value="#{documentHome.parentDirectoryId}"/>
</redirect>
</rule>
- <rule if-outcome="uploadFile">
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/fileEdit.xhtml">
- <param name="lastConversationId" value="#{param.lastConversationId}"/>
- <param name="parentDirId" value="#{param.parentDirId}"/>
+ <rule if-outcome="removed">
+ <end-conversation/>
+ <redirect view-id="/dirDisplay.xhtml">
+ <param name="directoryId" value="#{documentHome.parentDirectoryId}"/>
</redirect>
</rule>
</navigation>
-
-
</page>
- <page view-id="/docHistory.xhtml">
- <description>Document History '#{currentNode.name}'</description>
-
+ <page view-id="/dirDisplay.xhtml">
+ <param name="directoryId" value="#{directoryHome.nodeId}"/>
+ <action execute="#{directoryHome.init}"/>
<navigation>
- <rule if-outcome="rollback">
- <redirect view-id="/docEdit.xhtml">
- <param name="nodeId" value="#{currentNode.id}"/>
- <param name="parentDirId" value="#{currentNode.parent.id}"/>
- </redirect>
+ <rule if-outcome="missingParameters">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/wiki.xhtml"/>
</rule>
</navigation>
-
</page>
- <page view-id="/dirDisplay.xhtml" action="#{browser.prepare}">
- <param name="nodeId" value="#{browser.nodeId}"/>
-
- <!-- End any pending long-running conversation that was propagated into his view -->
- <end-conversation/>
+ <page view-id="/dirEdit.xhtml" no-conversation-view-id="/wiki.xhtml">
+ <description>#{directoryHome.idDefined ? 'Edit Directory' : 'Create Directory'}</description>
+ <param name="directoryId" value="#{directoryHome.nodeId}"/>
+ <param name="parentDirectoryId" value="#{directoryHome.parentDirectoryId}"/>
+ <action execute="#{directoryHome.init}"/>
+ <begin-conversation flush-mode="MANUAL" join="true"/>
<navigation>
- <rule if-outcome="createDir">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/dirEdit.xhtml">
- <param name="parentDirId" value="#{currentDirectory.id}"/>
- </redirect>
- </rule>
- <rule if-outcome="editDir">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/dirEdit.xhtml">
- <param name="nodeId" value="#{currentDirectory.id}"/>
- <param name="parentDirId" value="#{currentDirectory.parent.id}"/>
- </redirect>
- </rule>
- <rule if-outcome="createDoc">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/docEdit.xhtml">
- <param name="parentDirId" value="#{currentDirectory.id}"/>
- </redirect>
+ <rule if-outcome="missingParameters">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/wiki.xhtml"/>
+ </rule>
+ <rule if-outcome="exitManaged">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/dirDisplay"/>
</rule>
- <rule if-outcome="uploadFile">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/fileEdit.xhtml">
- <param name="parentDirId" value="#{currentDirectory.id}"/>
- </redirect>
- </rule>
- <rule if-outcome="editFile">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/fileEdit.xhtml">
- <param name="nodeId" value="#{param.fileId}"/>
- <param name="parentDirId" value="#{currentDirectory.id}"/>
+ <rule if-outcome="exitUnmanaged">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/dirDisplay.xhtml">
+ <param name="directoryId" value="#{directoryHome.parentDirectoryId}"/>
</redirect>
</rule>
-
- </navigation>
-
- </page>
-
- <page view-id="/dirEdit.xhtml">
- <description>Edit Directory</description>
-
- <navigation>
<rule if-outcome="removed">
<end-conversation/>
<redirect view-id="/dirDisplay.xhtml">
- <param name="nodeId" value="#{directoryHome.parentDirectory.id}"/>
+ <param name="directoryId" value="#{directoryHome.parentDirectoryId}"/>
</redirect>
</rule>
</navigation>
-
</page>
- <page view-id="/fileEdit.xhtml" action="#{browser.captureConversationEntryPoint}">
- <description>Edit File</description>
+ <page view-id="/fileEdit.xhtml" no-conversation-view-id="/wiki.xhtml">
+ <description>#{fileHome.idDefined ? 'Edit File' : 'Create File'}</description>
+ <param name="fileId" value="#{fileHome.nodeId}"/>
+ <param name="parentDirectoryId" value="#{fileHome.parentDirectoryId}"/>
+ <action execute="#{fileHome.init}"/>
+ <begin-conversation flush-mode="MANUAL" join="true"/>
- <!-- TODO: If this is a nested or parallel conversation we really want to exit to the parent view or
- the entry point after remove(), e.g. editDoc -> uploadFile -> editDoc instead of currently
- editDoc -> uploadFile -> dirDisplay... This needs navigation actions or the
- already required polymorphic exitConversation() feature -->
<navigation>
+ <rule if-outcome="missingParameters">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/wiki.xhtml"/>
+ </rule>
+ <rule if-outcome="exit">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/dirDisplay.xhtml">
+ <param name="directoryId" value="#{fileHome.parentDirectoryId}"/>
+ </redirect>
+ </rule>
<rule if-outcome="removed">
<end-conversation/>
<redirect view-id="/dirDisplay.xhtml">
- <param name="nodeId" value="#{fileHome.parentDirectory.id}"/>
+ <param name="directoryId" value="#{fileHome.parentDirectoryId}"/>
</redirect>
</rule>
</navigation>
-
</page>
- <page view-id="/search.xhtml" action="#{browser.captureConversationEntryPoint}">
- <param name="query" value="#{wikiSearch.simpleQuery}"/>
- <!-- Conversation is started in wikiSearch.search() action/factory -->
+ <page view-id="/search.xhtml">
<description>Search (Results: #{searchResult.size})</description>
+ <param name="query" value="#{wikiSearch.simpleQuery}"/>
+ <begin-conversation flush-mode="MANUAL" join="true"/>
</page>
- <page view-id="/userHome.xhtml" action="#{browser.captureConversationEntryPoint}">
- <description>Managing Member Account</description>
- <navigation from-action="#{userHome.persist}">
- <rule>
+ <page view-id="/adminHome.xhtml" no-conversation-view-id="/wiki.xhtml">
+ <description>System Administration</description>
+ <restrict>#{s:hasPermission('User', 'isAdmin', currentUser)}</restrict>
+ <begin-conversation flush-mode="MANUAL" join="true"/>
+ </page>
+
+ <page view-id="/userRegister.xhtml" no-conversation-view-id="/wiki.xhtml">
+ <description>#{identity.loggedIn ? 'Create Account' : 'Registration'}</description>
+ <action execute="#{userHome.init}"/>
+ <begin-conversation flush-mode="MANUAL" join="true"/>
+ <navigation>
+ <rule if-outcome="persisted" if="#{s:hasPermission('User', 'isAdmin', currentUser)}">
+ <end-conversation before-redirect="true"/>
<redirect view-id="/userHome.xhtml">
- <param name="userId" value="#{userHome.instance.id}"/>
+ <param name="userId" value="#{userHome.userId}"/>
</redirect>
</rule>
- </navigation>
- </page>
-
- <page view-id="/userRegister.xhtml" action="#{browser.captureConversationEntryPoint}">
- <description>Registration</description>
- <navigation from-action="#{userHome.persist}">
- <rule>
- <redirect view-id="/display.xhtml"/>
+ <rule if-outcome="persisted">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/wiki.xhtml"/>
</rule>
</navigation>
</page>
- <page view-id="/userList.xhtml" action="#{browser.captureConversationEntryPoint}">
- <description>Member Search (Results: #{userSearch.rowCount})</description>
+ <page view-id="/userHome.xhtml" no-conversation-view-id="/wiki.xhtml">
+ <description>Managing Account: #{userHome.instance.username}</description>
+ <param name="userId" value="#{userHome.userId}"/>
+ <action execute="#{userHome.init}"/>
+ <begin-conversation flush-mode="MANUAL" join="true"/>
<navigation>
- <rule if-outcome="createUser">
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/userRegister.xhtml">
- <param name="lastConversationId" value="#{param.lastConversationId}"/>
+ <rule if-outcome="updatedCurrentCredentials">
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/wiki.xhtml">
+ <param name="message" value="updatedCurrentCredentials"/>
</redirect>
</rule>
+ <rule if-outcome="removed">
+ <end-conversation/>
+ <redirect view-id="/wiki.xhtml"/>
+ </rule>
</navigation>
</page>
- <page view-id="/adminHome.xhtml" action="#{browser.captureConversationEntryPoint}">
- <restrict>#{s:hasPermission('User', 'isAdmin', currentUser)}</restrict>
- <description>System Administration</description>
+ <page view-id="/userList.xhtml">
+ <description>Member Search (Results: #{userSearch.rowCount})</description>
+ <begin-conversation flush-mode="MANUAL" join="true"/>
</page>
- <!-- Global actions -->
-
<page view-id="/*">
<navigation>
- <!-- Not perfect, but we need to force some re-rendering of the view when users log in or out -->
- <rule if-outcome="loggedIn" if="#{!empty currentUser.memberHome}">
- <redirect view-id="/display.xhtml">
- <param name="nodeId" value="#{currentUser.memberHome.id}"/>
- </redirect>
- </rule>
- <rule if-outcome="loggedIn" if="#{empty currentUser.memberHome}">
- <redirect view-id="/display.xhtml"/>
- </rule>
+ <!-- Go to start page on logout because the session has been invalidated -->
<rule if-outcome="loggedOut">
- <end-conversation/>
- <redirect view-id="/display.xhtml"/>
- </rule>
-
- <rule if-outcome="register">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/userRegister.xhtml">
- <param name="lastConversationId" value="#{param.lastConversationId}"/>
- </redirect>
- </rule>
- <rule if-outcome="listUsers">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/userList.xhtml">
- <param name="lastConversationId" value="#{param.lastConversationId}"/>
- </redirect>
- </rule>
- <rule if-outcome="editUser">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/userHome.xhtml">
- <param name="lastConversationId" value="#{param.lastConversationId}"/>
- <param name="userId" value="#{param.userId}"/>
- </redirect>
+ <end-conversation before-redirect="true"/>
+ <redirect view-id="/wiki.xhtml"/>
</rule>
- <rule if-outcome="adminHome">
- <raise-event type="NodeBrowser.prepare"/>
- <begin-conversation flush-mode="MANUAL"/>
- <redirect view-id="/adminHome.xhtml">
- <param name="lastConversationId" value="#{param.lastConversationId}"/>
- </redirect>
- </rule>
-
- <!-- 'Find' postback starts a new root conversation, see /search.xhtml -->
+ <!-- 'search' is a POST submit, turn it into a bookmarkable GET -->
<rule if-outcome="search">
- <raise-event type="NodeBrowser.prepare"/>
- <redirect view-id="/search.xhtml">
- <param name="conversationPropagation" value="#{'none'}"/>
- <param name="lastConversationId" value="#{conversation.id}"/>
- </redirect>
+ <redirect view-id="/search.xhtml"/>
</rule>
<rule if-outcome="error">
@@ -298,27 +231,12 @@
</page>
- <!-- Special pages -->
-
- <page view-id="/confirmRegistration.xhtml" action="#{authenticator.activate}">
- <navigation>
- <rule if-outcome="activated">
- <redirect view-id="/display.xhtml">
- <param name="nodeId" value="#{wikiPreferences.defaultDocumentId}"/>
- <message severity="INFO">Your account has been activated, you can login now.</message>
- </redirect>
- </rule>
- <rule if-outcome="notFound">
+ <exception class="org.jboss.seam.framework.EntityNotFoundException">
+ <end-conversation/>
<redirect view-id="/message.xhtml">
- <message severity="ERROR">Your activation code is invalid.</message>
+ <message severity="ERROR">Entity not found.</message>
</redirect>
- </rule>
- </navigation>
- </page>
-
- <!-- These effectively "block" the user from navigating forward, he stays on the last browsed page and
- gets an error message. -->
- <page view-id="/loginRequired.xhtml" action="#{browser.redirectToLastBrowsedPageWithConversation}"/>
+ </exception>
<exception class="org.jboss.seam.security.AuthorizationException">
<end-conversation/>
@@ -329,23 +247,15 @@
<exception class="javax.persistence.OptimisticLockException">
<end-conversation/>
- <!-- TODO: I'd rather redirect to the entry point of the conversation but we don't have navigation actions -->
<redirect view-id="/message.xhtml">
<message severity="ERROR">Someone modified the same record while you were editing it. Please restart your workspace.</message>
</redirect>
</exception>
- <exception class="org.jboss.seam.web.FileUploadException">
- <redirect view-id="/message.xhtml">
- <message severity="ERROR">File upload failed, possibly due to size limitation (max. #{wiki:displayFilesize(org.jboss.seam.web.multipartFilter.maxRequestSize)}).</message>
- </redirect>
- </exception>
-
- <!--
+ <!-- This breaks unit tests...
<exception>
- <end-conversation/>
<redirect view-id="/message.xhtml">
- <message severity="ERROR">Exception!</message>
+ <message severity="ERROR">Exception: #{org.jboss.seam.exception.message}</message>
</redirect>
</exception>
-->
1.5 +68 -55 jboss-seam/examples/wiki/src/etc/WEB-INF/urlrewrite.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: urlrewrite.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/etc/WEB-INF/urlrewrite.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- urlrewrite.xml 17 Aug 2007 13:00:30 -0000 1.4
+++ urlrewrite.xml 25 Aug 2007 17:59:27 -0000 1.5
@@ -1,85 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
- "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
+<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
<!--
- Configuration file for UrlRewriteFilter
- http://tuckey.org/urlrewrite/
+ Rewrite various Wiki-like URL paths to request parameters (http://tuckey.org/urlrewrite/)
+
+ @author Christian Bauer
-->
<urlrewrite>
+ <!-- /123.lace -->
<rule>
<from>^/([0-9]+)\.[a-zA-z]+$</from>
- <to last="true">/display.seam?nodeId=$1</to>
+ <to last="true">/wiki.seam?nodeId=$1</to>
</rule>
+ <!-- /Foo -->
<rule>
<from casesensitive="true">^/([A-Za-z0-9]+[A-Za-z0-9]*)$</from>
- <to last="true">/display.seam?areaName=$1</to>
+ <to last="true">/wiki.seam?areaName=$1</to>
</rule>
+ <!-- /Foo/Bar -->
<rule>
<from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)$</from>
- <to last="true">/display.seam?areaName=$1&nodeName=$2</to>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2</to>
</rule>
+ <!-- /Foo/Bar/2007 -->
<rule>
- <from>^/$</from>
- <to>/display.seam</to>
+ <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)/([0-9]{4})$</from>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2&year=$3</to>
</rule>
- <!--
+ <!-- /Foo/Bar/2007/08 -->
+ <rule>
+ <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)/([0-9]{4})/([0-9]{2})$</from>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2&year=$3&month=$4</to>
+ </rule>
- INSTALLATION
+ <!-- /Foo/Bar/2007/08/23 -->
+ <rule>
+ <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)/([0-9]{4})/([0-9]{2})/([0-9]{2})$</from>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2&year=$3&month=$4&day=$5</to>
+ </rule>
- in your web.xml add...
+ <!-- /Foo/Bar/Page/3 -->
+ <rule>
+ <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)/Page/([0-9]+)$</from>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2&page=$3</to>
+ </rule>
- <filter>
- <filter-name>UrlRewriteFilter</filter-name>
- <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
- <init-param>
- <param-name>logLevel</param-name>
- <param-value>WARN</param-value>
- </init-param>
- </filter>
- <filter-mapping>
- <filter-name>UrlRewriteFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
+ <!-- /Foo/Bar/2007/Page/3 -->
+ <rule>
+ <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)/([0-9]{4})/Page/([0-9]+)$</from>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2&year=$3&page=$4</to>
+ </rule>
- EXAMPLES
+ <!-- /Foo/Bar/2007/08/Page/3 -->
+ <rule>
+ <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)/([0-9]{4})/([0-9]{2})/Page/([0-9]+)$</from>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2&year=$3&month=$4&page=$5</to>
+ </rule>
- Redirect one url
+ <!-- /Foo/Bar/2007/08/23/Page/3 -->
<rule>
- <from>/some/old/page.html</from>
- <to type="redirect">/very/new/page.html</to>
+ <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)/([0-9]{4})/([0-9]{2})/([0-9]{2})/Page/([0-9]+)$</from>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2&year=$3&month=$4&day=$5&page=$6</to>
</rule>
- Redirect a directory
+ <!-- /Foo/Bar/2007/Summary-->
<rule>
- <from>/some/olddir/(.*)</from>
- <to type="redirect">/very/newdir/$1</to>
+ <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)/([0-9]{4})/Summary$</from>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2&year=$3&summary=true</to>
</rule>
- Clean a url
+ <!-- /Foo/Bar/2007/08/Summary -->
<rule>
- <from>/products/([0-9]+)</from>
- <to>/products/index.jsp?product_id=$1</to>
+ <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)/([0-9]{4})/([0-9]{2})/Summary$</from>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2&year=$3&month=$4&summary=true</to>
</rule>
- eg, /products/1234 will be passed on to /products/index.jsp?product_id=1234 without the user noticing.
- Browser detection
+ <!-- /Foo/Bar/2007/08/23/Summary -->
<rule>
- <condition name="user-agent">Mozilla/[1-4]</condition>
- <from>/some/page.html</from>
- <to>/some/page-for-old-browsers.html</to>
+ <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)/([A-Z0-9]+[A-Za-z0-9]*)/([0-9]{4})/([0-9]{2})/([0-9]{2})/Summary$</from>
+ <to last="true">/wiki.seam?areaName=$1&nodeName=$2&year=$3&month=$4&day=$5&summary=true</to>
</rule>
- eg, will pass the request for /some/page.html on to /some/page-for-old-browsers.html only for older
- browsers whose user agent srtings match Mozilla/1, Mozilla/2, Mozilla/3 or Mozilla/4.
- -->
+ <!-- / -->
+ <rule>
+ <from>^/$</from>
+ <to>/wiki.seam</to>
+ </rule>
</urlrewrite>
More information about the jboss-cvs-commits
mailing list