diff --git a/impl-servlet-tests/src/test/java/org/ocpsoft/rewrite/servlet/container/ContainerSecurityTest.java b/impl-servlet-tests/src/test/java/org/ocpsoft/rewrite/servlet/container/ContainerSecurityTest.java
new file mode 100644
index 000000000..696c8ba3e
--- /dev/null
+++ b/impl-servlet-tests/src/test/java/org/ocpsoft/rewrite/servlet/container/ContainerSecurityTest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2011 Lincoln Baxter, III
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.ocpsoft.rewrite.servlet.container;
+
+import junit.framework.Assert;
+
+import org.apache.http.client.methods.HttpGet;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ocpsoft.rewrite.config.ConfigurationProvider;
+import org.ocpsoft.rewrite.servlet.ServletRoot;
+import org.ocpsoft.rewrite.test.HttpAction;
+import org.ocpsoft.rewrite.test.RewriteTest;
+
+/**
+ * @author Lincoln Baxter, III
+ */
+@RunWith(Arquillian.class)
+public class ContainerSecurityTest extends RewriteTest
+{
+ @Deployment(testable = false)
+ public static WebArchive getDeployment()
+ {
+ WebArchive deployment = RewriteTest.getDeployment()
+ .addPackages(true, ServletRoot.class.getPackage())
+ .addAsWebInfResource("org/ocpsoft/rewrite/servlet/container/web.xml")
+ .addAsWebResource("org/ocpsoft/rewrite/servlet/container/login.html")
+ .addAsWebResource("org/ocpsoft/rewrite/servlet/container/login-fail.html")
+ .addAsWebResource("org/ocpsoft/rewrite/servlet/container/home.html", "/user/home.html")
+ .addAsServiceProvider(ConfigurationProvider.class, ContainerSecurityTestProvider.class);
+
+ System.out.println(deployment.toString(true));
+
+ return deployment;
+ }
+
+ @Test
+ public void testContainerSecurityFunctionsWithRewriteJoin() throws Exception
+ {
+ HttpAction action = get("/user/home");
+ Assert.assertEquals(200, action.getResponse().getStatusLine().getStatusCode());
+ Assert.assertTrue(action.getResponseContent().contains("LOGIN PAGE"));
+ }
+
+ @Test
+ public void testContainerSecurityFunctionsWithRewriteUnHandled() throws Exception
+ {
+ HttpAction action = get("/user/x");
+ Assert.assertEquals(200, action.getResponse().getStatusLine().getStatusCode());
+ Assert.assertTrue(action.getResponseContent().contains("LOGIN PAGE"));
+ }
+}
diff --git a/impl-servlet-tests/src/test/java/org/ocpsoft/rewrite/servlet/container/ContainerSecurityTestProvider.java b/impl-servlet-tests/src/test/java/org/ocpsoft/rewrite/servlet/container/ContainerSecurityTestProvider.java
new file mode 100644
index 000000000..ca4e97326
--- /dev/null
+++ b/impl-servlet-tests/src/test/java/org/ocpsoft/rewrite/servlet/container/ContainerSecurityTestProvider.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2011 Lincoln Baxter, III
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.ocpsoft.rewrite.servlet.container;
+
+import javax.servlet.ServletContext;
+
+import org.ocpsoft.rewrite.config.Configuration;
+import org.ocpsoft.rewrite.config.ConfigurationBuilder;
+import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider;
+import org.ocpsoft.rewrite.servlet.config.rule.Join;
+
+/**
+ * @author Lincoln Baxter, III
+ *
+ */
+public class ContainerSecurityTestProvider extends HttpConfigurationProvider
+{
+ @Override
+ public int priority()
+ {
+ return 0;
+ }
+
+ @Override
+ public Configuration getConfiguration(final ServletContext context)
+ {
+ Configuration config = ConfigurationBuilder.begin()
+ .addRule(Join.path("/user/home").to("/user/home.html"));
+
+ return config;
+ }
+
+}
diff --git a/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/home.html b/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/home.html
new file mode 100644
index 000000000..b855714b5
--- /dev/null
+++ b/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/home.html
@@ -0,0 +1 @@
+USER HOME
\ No newline at end of file
diff --git a/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/login-fail.html b/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/login-fail.html
new file mode 100644
index 000000000..562127f72
--- /dev/null
+++ b/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/login-fail.html
@@ -0,0 +1 @@
+LOGIN FAIL
\ No newline at end of file
diff --git a/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/login.html b/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/login.html
new file mode 100644
index 000000000..3ef91188e
--- /dev/null
+++ b/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/login.html
@@ -0,0 +1 @@
+LOGIN PAGE
diff --git a/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/web.xml b/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/web.xml
new file mode 100644
index 000000000..bb0b3beed
--- /dev/null
+++ b/impl-servlet-tests/src/test/resources/org/ocpsoft/rewrite/servlet/container/web.xml
@@ -0,0 +1,42 @@
+
+
+
+
+ Administrators
+ admin
+
+
+ Users
+ user
+
+
+
+ General
+ /user/*
+ DELETE
+ GET
+ POST
+ PUT
+ HEAD
+ TRACE
+ OPTIONS
+
+
+ user
+
+
+ NONE
+
+
+
+
+ FORM
+
+ /login.html
+ /login-fail.html
+
+
+
\ No newline at end of file
diff --git a/impl-servlet/src/main/java/org/ocpsoft/rewrite/servlet/impl/HttpRewriteWrappedRequest.java b/impl-servlet/src/main/java/org/ocpsoft/rewrite/servlet/impl/HttpRewriteWrappedRequest.java
index 37528b3a1..3897b10ff 100644
--- a/impl-servlet/src/main/java/org/ocpsoft/rewrite/servlet/impl/HttpRewriteWrappedRequest.java
+++ b/impl-servlet/src/main/java/org/ocpsoft/rewrite/servlet/impl/HttpRewriteWrappedRequest.java
@@ -21,7 +21,6 @@
import java.util.Map;
import java.util.TreeMap;
-import javax.servlet.ServletRequestWrapper;
import javax.servlet.http.HttpServletRequest;
import org.ocpsoft.rewrite.servlet.RewriteWrappedRequest;
@@ -41,8 +40,7 @@ public class HttpRewriteWrappedRequest extends RewriteWrappedRequest
*/
public HttpRewriteWrappedRequest(final HttpServletRequest request, final Map additionalParams)
{
- super((HttpServletRequest) (request instanceof ServletRequestWrapper ? ((ServletRequestWrapper) request)
- .getRequest() : request));
+ super(request);
modifiableParameters = new TreeMap();
modifiableParameters.putAll(additionalParams);