About Question enthuware.jwpv6.2.589 :

Moderator: admin

Post Reply
tori3852
Posts: 38
Joined: Wed Oct 31, 2012 2:53 am
Contact:

About Question enthuware.jwpv6.2.589 :

Post 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/.

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.589 :

Post 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.

user

Re: About Question enthuware.jwpv6.2.589 :

Post 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 ?

Jkike79
Posts: 11
Joined: Tue Sep 10, 2013 3:20 pm
Contact:

Re: About Question enthuware.jwpv6.2.589 :

Post 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?

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.589 :

Post 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests