Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove filter in web.xml in jetty

I have configured jetty to run my web application using the jetty maven. Jetty is supposed to be a light alternative for development and therefore it doesn't need all the stuff that is in web.xml. More specifically, I want to remove a filter in web.xml.

I tried to use the overrideDescriptor configuration property, but this only allows me to override the web.xml, not replace it. Therefore, the filter is still there.

Any ideas how I can remove the filter without modifying the original web.xml file?

like image 399
Wojciech Górski Avatar asked Dec 06 '25 02:12

Wojciech Górski


1 Answers

Since there is no answer, I'll post my solution, which is not perfect.

<!-- Jetty configuration -->
<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>8.1.5.v20120716</version>
    <configuration>
        <webApp>
            <descriptor>src/main/webapp/mock-web.xml</descriptor>
            [...]
        </webApp>
        [...]
    </configuration>
</plugin>

The downside of this approach is that you have to maintain two almost identical web.xml files. I have not found a solution that will allow me override the original web.xml file and remove a listener.

like image 67
Wojciech Górski Avatar answered Dec 08 '25 15:12

Wojciech Górski