}
}
- processServletSecurityAnnotation(servlet);
+ processServletSecurityAnnotation(servlet.getClass());
// Special handling for ContainerServlet instances
if ((servlet instanceof ContainerServlet) &&
/**
* {@inheritDoc}
+ * @throws ClassNotFoundException
*/
@Override
public void servletSecurityAnnotationScan() throws ServletException {
if (instance == null) {
- load();
+ Class<?> clazz = null;
+ try {
+ clazz = getParentClassLoader().loadClass(getServletClass());
+ processServletSecurityAnnotation(clazz);
+ } catch (ClassNotFoundException e) {
+ // Safe to ignore. No class means no annotations to process
+ }
} else {
if (servletSecurityAnnotationScanRequired) {
- processServletSecurityAnnotation(instance);
+ processServletSecurityAnnotation(instance.getClass());
}
}
}
- private void processServletSecurityAnnotation(Servlet servlet) {
+ private void processServletSecurityAnnotation(Class<?> clazz) {
// Calling this twice isn't harmful so no syncs
servletSecurityAnnotationScanRequired = false;
}
ServletSecurity secAnnotation =
- servlet.getClass().getAnnotation(ServletSecurity.class);
+ clazz.getAnnotation(ServletSecurity.class);
if (secAnnotation != null) {
ctxt.addServletSecurity(
new ApplicationServletRegistration(this, ctxt),