Giter Club home page Giter Club logo

Comments (2)

bjhargrave avatar bjhargrave commented on July 18, 2024

Comment author: Sergey Beryozkin <[email protected]>

RFC 217 recommends registering the container filters with an "osgi.jaxrs.filter.base" property.

It appears to me that this RFC 217 feature can only be applied to JAX-RS filters and implemented by registering an internal PreMatch and PostMatch filters which will run all the registered filters which match the request URI.

The question is, at what priority level this internal filter(s) will be registered with the JAX-RS runtime ? Consider this example, the user registers a number of Per and Post match filters and expects them be applied only if request URI matches "http://host/a/b/c":

  • PreMatchFilter1, priority 3
  • PreMatchFilter2, priority 5

It also registers a global PreMatchFilter3, priority 4

The internal PreMatch filter will run at the most earliest priority - it will have to sort PreMatchFilter1 & PreMatchFilter2 itself. As far as the JAX-RS runtime is concerned, it will only see Internal and PreMatchFilter3 => the priority of PreMatchFilter3 will not be honoured.

Unless the only filter which the runtime sees is this Internal Filter which will do all the sorting of the custom filters itself. This is a bit problematic - the runtime should sort but it might work.

But it will become trickier if the above example is updated for the PostMatch filters - again the priorities can only be guaranteed if the JAX-RS runtime will only see an internal PostMatch filter sorting all the custom filters itself - meaning it will also have to manage both named and non-named filters correctly, discard the named filters whose names do not match, etc.

I wonder how useful the "osgi.jaxrs.filter.base" property can become in practice - to support it the container will have to take on itself what the JAX-RS runtime does with respect to managing the filters. Users can implement themselves this URI-checks in their filters if they need. For PstMatch filters users mean often that all of their global filters will apply to a given method invocation and they can restrict with names if needed or indeed with the custom checks.

from design.

bjhargrave avatar bjhargrave commented on July 18, 2024

Comment author: Sergey Beryozkin <[email protected]>

Perhaps I missed the point of this "osgi.jaxrs.filter.base" property - may be the idea is to use it associate with the separately registered resources...Nonetheless it might make sense to make sure the ordering of the filters (per the Priority annotations) is always preserved

from design.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.