Java EE 7 Application Developer — Question 6

You created two filters for your web application by using the @WebFilter annotation, one for authorization and the other for narrowing results by the provided search criteria. The authorization filter must be invoked first.
How can you specify this?

Answer options

Correct answer: A

Explanation

The correct answer is A because the @WebFilter annotation allows you to set a priority attribute that determines the order in which filters are applied. Options B and C refer to the web.xml deployment descriptor and @WebFilterMapping, which do not control the execution order in the same way. Option D is incorrect because the @Priority annotation is not applicable to the @WebFilter annotation.