package org.apache.catalina.core;
+import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
doTest(RoleDenyServlet.class.getName(), false, true, false);
}
+ public void testSecurityAnnotationsWebXmlPriority() throws Exception {
+
+ // Setup Tomcat instance
+ Tomcat tomcat = getTomcatInstance();
+
+ File appDir = new File("test/webapp-3.0-fragments");
+ tomcat.addWebapp(null, "", appDir.getAbsolutePath());
+
+ tomcat.start();
+
+ ByteChunk bc = new ByteChunk();
+ int rc;
+ rc = getUrl("http://localhost:" + getPort() +
+ "/testStandardWrapper/securityAnnotationsWebXmlPriority",
+ bc, null, null);
+
+ assertNull(bc.toString());
+ assertEquals(403, rc);
+ }
+
private void doTest(String servletClassName, boolean usePost,
boolean useRole, boolean expect200) throws Exception {
Used as part of the Tomcat unit tests when a full web application is
required.
</description>
+
+ <servlet>
+ <servlet-name>AllowByAnnotation</servlet-name>
+ <servlet-class>org.apache.catalina.core.TestStandardWrapper$SubclassAllowAllServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>AllowByAnnotation</servlet-name>
+ <url-pattern>/testStandardWrapper/securityAnnotationsWebXmlPriority</url-pattern>
+ </servlet-mapping>
+ <security-constraint>
+ <auth-constraint/>
+ <web-resource-collection>
+ <url-pattern>/testStandardWrapper/securityAnnotationsWebXmlPriority</url-pattern>
+ </web-resource-collection>
+ </security-constraint>
+
</web-app>
\ No newline at end of file