Andrew O'Hara

07/21/2022, 9:00 PM
The Advanced routing guide shows how to add a greedy path matcher to capture the rest of the path after a certain point
"/pattern/{rest:.*}" bind { req: Request -> Response(OK).body(req.path("rest") ?: "") }
I've been unable to replicate this for
in a way it will work in a Swagger UI. I've even tried making a lens so it can fit in to the
definition, like:
val restLens = Path.regex(".*").of("rest")
val route = "pattern" / restLens
But it just results in a 404. Has anyone ever gotten this to work with Swagger UI?
Ah, it came to me immediately after posting. This lens works:
val restLens = Path.string().of("rest:.*")


07/21/2022, 9:11 PM
wow! I absolutely 100% thought that would not work! Thank you for the lesson! 🤣

Andrew O'Hara

07/21/2022, 10:05 PM
Maybe it's entirely coincidental that the implementation allows the greediness. I should maybe add a test to ensure it doesn't get broken by accident.


07/21/2022, 11:10 PM
Out of curiosity, what's the use case here? It's always interesting to look at the use cases behind these things :)

Andrew O'Hara

07/22/2022, 7:52 PM
We've got some old weird proxies that need to be maintained. They're used to communicate to IOT devices that maintain a persistent connection with us. Instead of setting an HTTP proxy in our requests, I have to maintain a connection format like:
where the
is used to lookup the IOT device's connection. We get the connection, and then send the device something like
In most cases, we're actually communicating a custom TCP protocol, but the HTTP request above illustrates the point.