Skip to content

jetty-http-spi: Filters in HttpContext/JettyHttpContext ignored, implementation missing #9125

Closed
@demonti

Description

@demonti

Jetty version(s)
Jetty 9.x is now at End of Community Support
I discovered this in Jetty 9.4, but the problem obviously exists also in 10.x, 11.x

Java version/vendor (use: java -version)
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)

OS type/version
Linux mclane 5.19.0-26-generic #27-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 23 20:44:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 22.10

Description
I ported code that used Java's built-in HTTP-Server (com.sun.net.httpserver) to Jetty's adapter. The code uses HttpContext.getFilters() to add two filters, one dealing with authentication, another with input decompression (we are using HTTP POST with compressed data).

I discovered that both filters do not work. The code is not executed. I downloaded the code for 9.4.x and 10.x from Github and saw that the JettyHttpContext, which extends Java's HttpContext, only stores the filters, but does not process the filters on its own. It is merely a container holding all the data. The only access to the filters is via the getFilters() method. However, nowhere in the Jetty code this method is ever called. Filters are obviously not implemented. I guess this is not intentional. If it actually is, I would highly appreciate a hint on how filtering should be implemented instead.

How to reproduce?

Check the call hierarchy of the JettyHttpContext.getFilters() method and see that it is not called. Thus, any filters added by user code will be ignored.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions