Skip to content

Commit

Permalink
Merge pull request #260 from paultuckey/docs-for-5
Browse files Browse the repository at this point in the history
Docs for 5
  • Loading branch information
paultuckey committed Oct 19, 2023
2 parents 332a831 + bacf03f commit eea2ed6
Show file tree
Hide file tree
Showing 14 changed files with 165 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Expand Up @@ -25,7 +25,7 @@ jobs:
run: mvn --batch-mode --update-snapshots package

- name: Locally install filter
run: mvn install --batch-mode
run: mvn install --batch-mode -Dgpg.skip

- name: Locally install example
working-directory: container-test/example-webapp
Expand Down
7 changes: 3 additions & 4 deletions README.md
Expand Up @@ -23,22 +23,21 @@ See the [manual](https://tuckey.org/urlrewrite/manual/4.0/index.html) for more i

## Quick Start

* Add Maven dependency below or add <a href="http://central.maven.org/maven2/org/tuckey/urlrewritefilter/4.0.3/urlrewritefilter-4.0.3.jar">urlrewritefilter-4.0.3.jar</a> directly into your <b>WEB-INF/lib</b> directory.
* Add Maven dependency below or add <a href="http://central.maven.org/maven2/org/tuckey/urlrewritefilter/5.1.2/urlrewritefilter-5.1.2.jar">urlrewritefilter-5.1.2.jar</a> directly into your <b>WEB-INF/lib</b> directory.
```xml
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>4.0.3</version>
<version>5.1.2</version>
</dependency>
```

For Servlet API 5.0, use Jakarta classifier like
For Servlet API 4 or less (javax), use the old version 4.x
```xml
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>4.0.3</version>
<classifier>jakarta</classifier>
</dependency>
```
* Add the following to your WEB-INF/web.xml (add it near the top above your servlet mappings (if you have any)): (see <a href="https://tuckey.org/urlrewrite/manual/4.0/index.html#filterparams">filter parameters</a> for more options)
Expand Down
12 changes: 3 additions & 9 deletions annotation/pom.xml
Expand Up @@ -12,15 +12,9 @@
Add-on to urlrewritefilter to support annotations
</description>

<mailingLists>
<mailingList>
<name>UrlRewrite users</name>
<post>urlrewrite@googlegroups.com</post>
<subscribe>urlrewrite+subscribe@googlegroups.com</subscribe>
<unsubscribe>urlrewrite+unsubscribe@googlegroups.com</unsubscribe>
<archive>https://groups.google.com/d/forum/urlrewrite</archive>
</mailingList>
</mailingLists>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<licenses>
<license>
Expand Down
2 changes: 1 addition & 1 deletion container-test/example-webapp/pom.xml
Expand Up @@ -58,7 +58,7 @@
<!-- run `mvn install` locally root of project -->
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>5.1.1</version>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
Expand Down
3 changes: 2 additions & 1 deletion container-test/test-with-testcontainers/pom.xml
Expand Up @@ -7,6 +7,7 @@
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<version>1.0.0</version>
<name>UrlRewriteFilter Container Tests</name>
Expand Down Expand Up @@ -46,7 +47,7 @@
<!-- run `mvn install` locally root of project -->
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>5.1.1</version>
<version>5.1.2</version>
</dependency>
<dependency>
<!-- run `mvn install` locally in example-webapp -->
Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Expand Up @@ -5,7 +5,7 @@
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<packaging>jar</packaging>
<version>5.1.1</version>
<version>5.1.2</version>
<name>UrlRewriteFilter</name>
<url>http://www.tuckey.org/urlrewrite/</url>
<inceptionYear>2001</inceptionYear>
Expand All @@ -27,6 +27,7 @@
<app.manual-version>5.0</app.manual-version>
<app.year>2022</app.year>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<licenses>
Expand Down
8 changes: 4 additions & 4 deletions src/doc/manual/5.0/index.html
Expand Up @@ -86,12 +86,12 @@ <h2>Install</h2>

<ol>
<li>Add Maven dependency below or add
<a href="http://central.maven.org/maven2/org/tuckey/urlrewritefilter/4.0.3/urlrewritefilter-4.0.3.jar">urlrewritefilter-<!--@ver-->5.0.0<!--/@ver-->.jar</a>
<a href="http://central.maven.org/maven2/org/tuckey/urlrewritefilter/5.1.2/urlrewritefilter-5.1.2.jar">urlrewritefilter-<!--@ver-->5.1.2<!--/@ver-->.jar</a>
directly into your <b>WEB-INF/lib</b> directory.
<pre><code>&lt;dependency&gt;
&lt;groupId&gt;org.tuckey&lt;/groupId&gt;
&lt;artifactId&gt;urlrewritefilter&lt;/artifactId&gt;
&lt;version&gt;<!--@ver-->5.0.0<!--/@ver-->&lt;/version&gt;
&lt;version&gt;<!--@ver-->5.1.2<!--/@ver-->&lt;/version&gt;
&lt;/dependency&gt;</code></pre></li>
<li>Add the following to your WEB-INF/web.xml (add it near the top above your
servlet mappings (if you have any)): (see <a href="#filterparams">filter
Expand All @@ -106,7 +106,7 @@ <h2>Install</h2>
&lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
&lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
&lt;/filter-mapping&gt;</code></pre></li>
<li>Add <b><a href="https://tuckey.org/urlrewrite/manual/4.0/urlrewrite.xml">urlrewrite.xml</a></b>
<li>Add <b><a href="https://tuckey.org/urlrewrite/manual/5.0/urlrewrite.xml">urlrewrite.xml</a></b>
into your WEB-INF directory. (src/main/webapp/WEB-INF/ for Maven users)</li>
<li>Restart the context.</li>
</ol>
Expand Down Expand Up @@ -255,7 +255,7 @@ <h2>Configuration File WEB-INF/urlrewrite.xml</h2>

<p>Configuration is done via a simple XML file that lives in your <code>WEB-INF</code> folder. It should be named
urlrewrite.xml.
It may be helpful to read the <a href="http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">UrlRewriteFilter DTD
It may be helpful to read the <a href="http://www.tuckey.org/res/dtds/urlrewrite5.0.dtd">UrlRewriteFilter DTD
(Document Type Definition)</a>. Please also make sure you look at the <a href="guide.html">examples</a>. A simple
configuration file looks like:</p>

Expand Down
11 changes: 11 additions & 0 deletions src/doc/manual/5.0/introduction.html
Expand Up @@ -188,6 +188,17 @@ <h2>License</h2>
<h2>Changelog</h2>

<ul>
<li>5.1.2
<ul>
<li>Fix: Add v5 DTD</li>
<li>Docs: Add 5 references for readme and docs</li>
</ul>
</li>
<li>5.1.1
<ul>
<li>Changed to be fully based on jakarta servlet API 5</li>
</ul>
</li>
<li>5.0.0
<ul>
<li>Removed Annotation processor</li>
Expand Down
2 changes: 1 addition & 1 deletion src/doc/manual/5.0/urlrewrite-conf-overview-sample.html
Expand Up @@ -51,7 +51,7 @@
}
</style>
<body>
<h1><a href="http://www.tuckey.org/urlrewrite/">UrlRewriteFilter</a> 5.0.0-SNAPSHOT build 0d262f7db8cf16b93623a16961666e3ac904a7de configuration overview (generated 1/12/17 12:18 PM)</h1>
<h1><a href="http://www.tuckey.org/urlrewrite/">UrlRewriteFilter</a> 5.1.2 build 0d262f7db8cf16b93623a16961666e3ac904a7de configuration overview (generated 1/10/23 12:18 PM)</h1>
<hr />
<h2>Summary
of urlrewrite.xml
Expand Down
4 changes: 2 additions & 2 deletions src/doc/manual/5.0/urlrewrite.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN"
"http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 5.0//EN"
"http://www.tuckey.org/res/dtds/urlrewrite5.0.dtd">

<!--
Expand Down
Expand Up @@ -72,6 +72,7 @@ public class ConfHandler extends DefaultHandler {
dtdPaths.put("-//tuckey.org//DTD UrlRewrite 3.2//EN", "/org/tuckey/web/filters/urlrewrite/dtds/urlrewrite3.2.dtd");
dtdPaths.put("-//tuckey.org//DTD UrlRewrite 3.3//EN", "/org/tuckey/web/filters/urlrewrite/dtds/urlrewrite3.3.dtd");
dtdPaths.put("-//tuckey.org//DTD UrlRewrite 4.0//EN", "/org/tuckey/web/filters/urlrewrite/dtds/urlrewrite4.0.dtd");
dtdPaths.put("-//tuckey.org//DTD UrlRewrite 5.0//EN", "/org/tuckey/web/filters/urlrewrite/dtds/urlrewrite5.0.dtd");
}

public ConfHandler(String confSystemId) {
Expand Down
Expand Up @@ -41,7 +41,7 @@


/**
* Provides a wrapper for {@link javax.servlet.http.HttpServletResponseWrapper}.
* Provides a wrapper for {@link jakarta.servlet.http.HttpServletResponseWrapper}.
* <p/>
* It is used to wrap the real Response so that we can modify it after
* that the target of the request has delivered its response.
Expand Down Expand Up @@ -167,7 +167,7 @@ public PrintWriter getWriter() throws IOException {


/**
* @see javax.servlet.http.HttpServletResponseWrapper#addHeader(java.lang.String, java.lang.String)
* @see jakarta.servlet.http.HttpServletResponseWrapper#addHeader(java.lang.String, java.lang.String)
*/
@Override
public void addHeader(String name, String value) {
Expand All @@ -182,7 +182,7 @@ public void addHeader(String name, String value) {
}

/**
* @see javax.servlet.http.HttpServletResponseWrapper#setHeader(java.lang.String, java.lang.String)
* @see jakarta.servlet.http.HttpServletResponseWrapper#setHeader(java.lang.String, java.lang.String)
*/
@Override
public void setHeader(String name, String value) {
Expand All @@ -194,7 +194,7 @@ public void setHeader(String name, String value) {
}

/**
* @see javax.servlet.http.HttpServletResponseWrapper#addDateHeader(java.lang.String, long)
* @see jakarta.servlet.http.HttpServletResponseWrapper#addDateHeader(java.lang.String, long)
*/
@Override
public void addDateHeader(String name, long date) {
Expand All @@ -209,7 +209,7 @@ public void addDateHeader(String name, long date) {
}

/**
* @see javax.servlet.http.HttpServletResponseWrapper#setDateHeader(java.lang.String, long)
* @see jakarta.servlet.http.HttpServletResponseWrapper#setDateHeader(java.lang.String, long)
*/
@Override
public void setDateHeader(String name, long date) {
Expand All @@ -221,7 +221,7 @@ public void setDateHeader(String name, long date) {
}

/**
* @see javax.servlet.http.HttpServletResponseWrapper#addIntHeader(java.lang.String, int)
* @see jakarta.servlet.http.HttpServletResponseWrapper#addIntHeader(java.lang.String, int)
*/
@Override
public void addIntHeader(String name, int value) {
Expand All @@ -236,7 +236,7 @@ public void addIntHeader(String name, int value) {
}

/**
* @see javax.servlet.http.HttpServletResponseWrapper#setIntHeader(java.lang.String, int)
* @see jakarta.servlet.http.HttpServletResponseWrapper#setIntHeader(java.lang.String, int)
*/
@Override
public void setIntHeader(String name, int value) {
Expand Down
@@ -0,0 +1,125 @@
<!--
UrlRewriteFilter DTD
http://www.tuckey.org/urlrewrite/

Licensed under the BSD License. Text as follows.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
- Neither the name tuckey.org nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-->

<!ELEMENT urlrewrite ((rule|class-rule|outbound-rule)*, catch*)>
<!ATTLIST urlrewrite
use-query-string (true|false) "false"
use-context (true|false) "false"
decode-using CDATA #IMPLIED
default-match-type (regex|wildcard) #IMPLIED
>

<!ELEMENT rule (name?, note?, condition*, from?, set*, run*, gzip?, to?)>
<!ATTLIST rule
enabled (true|false) "true"
match-type (regex|wildcard) #IMPLIED
>

<!ELEMENT class-rule EMPTY>
<!ATTLIST class-rule
class CDATA #IMPLIED
method CDATA "matches"
last (true|false) "true"
>

<!ELEMENT outbound-rule (name?, note?, condition*, from, set*, run*, to?)>
<!ATTLIST outbound-rule
enabled (true|false) "true"
encodefirst (true|false) "false"
match-type (regex|wildcard) #IMPLIED
>

<!ELEMENT name (#PCDATA)>
<!ELEMENT note (#PCDATA)>

<!ELEMENT condition (#PCDATA)>
<!ATTLIST condition
type (time|year|month|dayofmonth|dayofweek|ampm|hourofday|minute|second|millisecond|attribute|auth-type|character-encoding|content-length|content-type|context-path|cookie|header|local-port|method|parameter|path-info|path-translated|protocol|query-string|remote-addr|remote-host|remote-user|requested-session-id|request-uri|request-url|session-attribute|session-isnew|port|server-name|scheme|user-in-role|exception|request-filename) "header"
name CDATA #IMPLIED
next (and|or) "and"
casesensitive (true|false) "false"
operator (equal|notequal|greater|less|greaterorequal|lessorequal|instanceof|isdir|isfile|isfilewithsize|notdir|notfile|notfilewithsize) "equal"
>

<!ELEMENT from (#PCDATA)>
<!ATTLIST from
casesensitive (true|false) "false"
>

<!ELEMENT set (#PCDATA)>
<!ATTLIST set
type (request|session|response-header|cookie|content-type|charset|locale|status|expires|parameter|method) "request"
name CDATA #IMPLIED
>

<!ELEMENT to (#PCDATA)>
<!ATTLIST to
type (redirect|temporary-redirect|permanent-redirect|pre-include|post-include|forward|passthrough|proxy) "forward"
last (true|false) "false"
qsappend (true|false) "false"
drop-cookies (true|false) "true"
encode (true|false) #IMPLIED
context CDATA #IMPLIED
>

<!--
eg,
<run class="org.tuckey.web.filters.urlrewrite.TestTargetOther" method="runMeFool" />
<run class="org.tuckey.web.filters.urlrewrite.TestTargetOther" method="run">
<init-param>
<param-name>biteMe</param-name>
<param-value>10</param-value>
</init-param>
</run>
-->
<!ELEMENT run (init-param*)>
<!ATTLIST run
class CDATA #IMPLIED
method CDATA #IMPLIED
jsonhandler (true|false) "false"
neweachtime (true|false) "false"
>

<!-- shortcut for org.tuckey.web.filters.urlrewrite.utils.GzipFilterRun -->
<!ELEMENT gzip (init-param*)>


<!ELEMENT init-param (param-name, param-value)>
<!ELEMENT param-name (#PCDATA)>
<!ELEMENT param-value (#PCDATA)>

<!ELEMENT catch (run?)>
<!ATTLIST catch
class CDATA #IMPLIED
>
4 changes: 2 additions & 2 deletions src/test/webapp/WEB-INF/urlrewrite.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN"
"http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 5.0//EN"
"http://www.tuckey.org/res/dtds/urlrewrite5.0.dtd">

<!--
Expand Down

0 comments on commit eea2ed6

Please sign in to comment.