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> <load-on-startup>5</load-on-startup>
</servlet> </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> </web-app>

View File

@ -127,12 +127,15 @@ public class TestListener implements HttpSessionListener, HttpSessionAttributeL
/* For servlet 3.0 */ /* For servlet 3.0 */
FilterRegistration.Dynamic registration = sce.getServletContext().addFilter("TestFilter",TestFilter.class.getName()); FilterRegistration.Dynamic registration = sce.getServletContext().addFilter("TestFilter",TestFilter.class.getName());
registration.setInitParameter("remote", "false"); if (registration != null) //otherwise defined in web.xml
registration.setAsyncSupported(true); {
registration.addMappingForUrlPatterns( registration.setInitParameter("remote", "false");
EnumSet.of(DispatcherType.ERROR,DispatcherType.ASYNC,DispatcherType.FORWARD,DispatcherType.INCLUDE,DispatcherType.REQUEST), registration.setAsyncSupported(true);
true, registration.addMappingForUrlPatterns(
new String[]{"/*"}); EnumSet.of(DispatcherType.ERROR,DispatcherType.ASYNC,DispatcherType.FORWARD,DispatcherType.INCLUDE,DispatcherType.REQUEST),
true,
new String[]{"/*"});
}
} }
@Override @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. is displayed because you have accessed this context from a non local IP address.
</p> </p>
<p> <p>
You can disable the remote address checking by editing webapps/test.d/override-web.xml and changing the 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 for the TestFilter. "remote" init parameter to "true".
</p> </p>
<p> <p>
This webapp is deployed in $JETTY_HOME/webapps/test and configured by $JETTY_HOME/webapps/test.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
and $JETTY_HOME/webapps/test.d/override-web.xml
</p> </p>
</BODY> </BODY>