394870 Make enablement of remote access to test webapp configurable in override-web.xml

This commit is contained in:
Jan Bartel 2012-11-23 10:35:10 +11:00
parent 5f69945b33
commit fc2682ab02
3 changed files with 28 additions and 10 deletions

View File

@ -38,6 +38,22 @@
<load-on-startup>5</load-on-startup>
</servlet>
<!-- Uncomment to override the setup of the test filter -->
<!--
<filter>
<filter-name>TestFilter</filter-name>
<filter-class>com.acme.TestFilter</filter-class>
<async-support>true</async-support>
<init-param>
<param-name>remote</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>TestFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-->
</web-app>

View File

@ -127,12 +127,15 @@ public class TestListener implements HttpSessionListener, HttpSessionAttributeL
/* For servlet 3.0 */
FilterRegistration.Dynamic registration = sce.getServletContext().addFilter("TestFilter",TestFilter.class.getName());
registration.setInitParameter("remote", "false");
registration.setAsyncSupported(true);
registration.addMappingForUrlPatterns(
EnumSet.of(DispatcherType.ERROR,DispatcherType.ASYNC,DispatcherType.FORWARD,DispatcherType.INCLUDE,DispatcherType.REQUEST),
true,
new String[]{"/*"});
if (registration != null) //otherwise defined in web.xml
{
registration.setInitParameter("remote", "false");
registration.setAsyncSupported(true);
registration.addMappingForUrlPatterns(
EnumSet.of(DispatcherType.ERROR,DispatcherType.ASYNC,DispatcherType.FORWARD,DispatcherType.INCLUDE,DispatcherType.REQUEST),
true,
new String[]{"/*"});
}
}
@Override

View File

@ -21,12 +21,11 @@ cross domain scripting vulnerabilities and reveal private information. This pag
is displayed because you have accessed this context from a non local IP address.
</p>
<p>
You can disable the remote address checking by editing webapps/test.d/override-web.xml and changing the
"remote" init parameter to true for the TestFilter.
You can disable the remote address checking by editing webapps/test.d/override-web.xml, uncommenting the declaration of the TestFilter, and changing the
"remote" init parameter to "true".
</p>
<p>
This webapp is deployed in $JETTY_HOME/webapps/test and configured by $JETTY_HOME/webapps/test.xml
and $JETTY_HOME/webapps/test.d/override-web.xml
This webapp is deployed in $JETTY_HOME/webapps/test and configured by $JETTY_HOME/webapps/test.xml and $JETTY_HOME/webapps/test.d/override-web.xml
</p>
</BODY>