Page 1 of 1
About Question enthuware.jwpv6.2.589 :
Posted: Wed Nov 28, 2012 12:54 am
by tori3852
4. If web.xml specifies metadata-complete=true, then no class is parsed for annotations.
No class from jars in /WEB-INF/lib/.
Re: About Question enthuware.jwpv6.2.589 :
Posted: Wed Nov 28, 2012 6:35 pm
by admin
As per Section 8.1, "If metadata-complete is set to "true", the deployment tool MUST ignore any servlet annotations present in the class files of the application and web fragments.".
It means not just in jars in /web-inf/lib but all class files of the application.
HTH,
Paul.
Re: About Question enthuware.jwpv6.2.589 :
Posted: Wed Feb 13, 2013 12:47 pm
by user
If the @WebFilter name is specified, and it's the same as the DD one, the exception will not be thrown and the container will initialize only one instance of the filter. Moreover, the values specified in the annotation will be added to the attributes defined in the DD.
Is it not true for @WebServlet ?
Re: About Question enthuware.jwpv6.2.589 :
Posted: Fri Sep 13, 2013 3:38 pm
by Jkike79
ḨTH...
If the name for the servlet in the web.xml does not match the name specified via the @WebServlet annotation, the web.xml file does not override the @WebServlet mapping. Instead, it defines an additional mapping to the servlet to the URL mappings defined by the @WebServlet.
If the name of the servlet is the same in both the @WebServlet and the web.xml file, then the mapping in the web.xml overrides any URL mapping defined in the @WebServlet annotation.
Correct?
Re: About Question enthuware.jwpv6.2.589 :
Posted: Fri Sep 13, 2013 4:15 pm
by admin
As per section 8.2.3 of Servlet 3.1 specification:
iv. url-patterns, when specified in a descriptor for a given servlet name
overrides the url patterns specified via the annotation.
v. For a filter defined via the @WebFilter annotation, to override values via
the descriptor, the name of the filter in the descriptor MUST match the name
of the filter specified via the annotation (explicitly specified or the default
name, if one is not specified via the annotation).
-Paul.