perwendel / spark

A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin
Apache License 2.0
9.64k stars 1.56k forks source link

Add matchedRoute field to Request object #1048

Closed robax closed 5 years ago

robax commented 5 years ago

Currently on a Spark request you are able to retrieve the requested URI or path. However, there's no way to work backwards from the URI to find out which route it was mapped to. I should mention that this is specifically only an issue when parameters are involved. I can see that the request's pathInfo is "/users/bob" but I can't pull the matched route of "/users/:username".

For context, we want to inspect requests in the after() block and instrument them by route.

This is a pretty tiny change so if I get approval I'd be happy to submit a PR. Thanks ya'll. :)

jon-ruckwood commented 5 years ago

This would also resolve #959

robax commented 5 years ago

@tipsy do you have an idea of when @perwendel will be back? it seems he's been gone almost 3 months

tipsy commented 5 years ago

Sorry @robax, I don't really know.

tipsy commented 5 years ago

This has been merged now!

robax commented 5 years ago

Thank you @tipsy !

codefromthecrypt commented 5 years ago

Thank you!