Can you pack WebFilter into a library

And if so, how do you do it?

Yes, it sounds like my last question. And this is essentially the same problem. I have @javax.servlet.annotation.WebFilterone that works great when packing directly into war. Now I would like to move the filter to the library. But if I do this, it will no longer be called.

Any pitfalls I should look for, or is it just not possible?

+3
source share
2 answers

Install <web-app metadata-complete="false">.

This means that the metadata for this web application is not limited to this particular xml (and webapp classes), but can use metadata from third-party libraries.

"-". web-fragment.xml META-INF .

.

+3

web.xml, Servlet 3.0, /META-INF JAR.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="yourProjectId" version="3.0">
</web-app>

Servlet 3.0 JAR /META-INF/web.xml , , JAR Servlet 3.0. .

JSF 2.0 , , /META-INF/faces-config.xml.

+1

Source: https://habr.com/ru/post/1791005/


All Articles