Replies: 2 comments 9 replies
-
Maybe @FroMage @stuartwdouglas or @geoand might know where to look? |
Beta Was this translation helpful? Give feedback.
9 replies
-
Found a working solution in the scope of a prematching filter |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For a little api versioning feature, I would like to "override" a couple of endpoint in versioned controller classes (Simply added a version at the begin of the base path). Those controller may only define endpoints which are relevant for this version, e.g. breaking change on the next version.
I would like to reroute an incoming request in a
ContainerRequestFilter
to the corresponding versioned controller if necessary. For this, I am using the version which I receive as a header, look out for a relevant versioned controller and if one found check if it contains an overridden version of the current request path. The rerouting then is done by simply adding the version to the begin of the request path. I did understand that a rerouting needs to be done in aPreMatching
filter.Now I have the problem that I could not found a reasonable way to make the matching. I see two possibilities for which I both miss a piece:
@Path
expression of the versioned controller to the current request path -> I could not find a util or class that conveniently allows me to do that. Does this exist?@Path
annotation to find a matching endpoint on my versioned controllers. With this approach, I was not able to find a way to resolve an incoming request to the target endpoint (method) in aPrematching
ContainerRequestFilter
. Is there a util or a way to resolve an incoming request? Maybe somehow with aRequestMapper
which I could not find out on how to access if possible at all.Is it possible to resolve my problem with on of the both described ways?
Example
If have this default controller
and this versioned controller which handles request up to 10.0 which only "overrides" the GET endpoint
On an incoming request like:
Example incoming request:
I select the matching versioned controller and want to reroute to the overridden endpoint if exists. In this case, the rerouted request would look like:
While selecting the versioned controller is not a problem, I have the problem (described above) to verify if the versioned controller contains an overridden endpoint for the incoming request.
Beta Was this translation helpful? Give feedback.
All reactions