annotation « Tomcat « JSP-Servlet Q&A





1. Disable annotation processing, but enable web-fragments feature in servlet api 3.0 (Tomcat7)    stackoverflow.com

I am giving a try on Tomcat 7.0 and Servlet API 3.0. I had an application for Servlet API 2.5. So I edited web.xml to configure it for Servlet API 3.0. After ...

2. Does tomcat 7.0.6 already support the SevletSercurity annotation in the servlet 3.0 specification?    stackoverflow.com

I was tring to use the ServletSecurity annotation of servlet 3.0 specification in the tomcat 7.0.6, but it seems that tomcat server doesn't scan the ServletSecurity annotation. The code is following,

@WebServlet(name="IndexServlet",urlPatterns={"/index"})
@DeclareRoles("ROLE_ADMIN")
@ServletSecurity(value=@HttpConstraint(rolesAllowed="ROLE_ADMIN"),httpMethodConstraints=@HttpMethodConstraint("GET"))
public ...

3. @WebServlet annotation with tomcat7    stackoverflow.com

I my application I had a servlet which was defined like this in the web.xml:

<servlet>
    <display-name>Notification Servlet</display-name>
    <servlet-name>NotificationServlet</servlet-name>
    <servlet-class>com.XXX.servlet.NotificationServlet</servlet-class>
    ...