Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Ordering issue with RFC-217 "osgi.jaxrs.filter.base" filters #29

Open
bjhargrave opened this issue Dec 2, 2016 · 2 comments
Open

Ordering issue with RFC-217 "osgi.jaxrs.filter.base" filters #29

bjhargrave opened this issue Dec 2, 2016 · 2 comments
Assignees
Labels
publiccomment Public comment

Comments

@bjhargrave
Copy link
Member

Original bug ID: BZ#200
From: Sergey Beryozkin <sberyozkin@talend.com>
Reported version: unspecified

@bjhargrave
Copy link
Member Author

Comment author: Sergey Beryozkin <sberyozkin@talend.com>

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.

@bjhargrave
Copy link
Member Author

Comment author: Sergey Beryozkin <sberyozkin@talend.com>

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
publiccomment Public comment
Projects
None yet
Development

No branches or pull requests

2 participants