You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned in #94 (comment) I was able to integrate this project successfully in an existing Netty based application, just by picking out the relevant pieces. At the moment, I add the netty-http handlers only if the current request matches a root context (like /api/v1). This is because the default logic in this library is to return HTTP 404 if none of the routes match.
That does not work well with Single Page Applications with client side routing that relies on having index.html returned for all non-matching routes on the server!
What I envision is making today's non-matching routes handling user configurable. To get this to work for us, we would only need to make the handler pass the request on to the next Netty handler in the queue, so a simple boolean flag would suffice.
You can achieve the default handling by adding a method with path @Path("/**") as a catch-all handler. The path matching logic in the library matches from most specific to generic wildcard.
That was not what I envisioned, but maybe I could get that to work ... 🤔 What I originally wanted was to let the request follow the Chain-of-responsibility pattern to the next handler in the chain, if none of the netty-http HttpRequestHandlers could handle the request. Today the netty-http handler is in the middle of the chain, with some handlers following it, but if I let this be the very last handler I guess that would work, if I just rewrite some of the existing Netty Handlers that follow it into netty-http HttpRequestHandlers. Thanks for the tip.
As mentioned in #94 (comment) I was able to integrate this project successfully in an existing Netty based application, just by picking out the relevant pieces. At the moment, I add the
netty-http
handlers only if the current request matches a root context (like/api/v1
). This is because the default logic in this library is to return HTTP 404 if none of the routes match.That does not work well with Single Page Applications with client side routing that relies on having
index.html
returned for all non-matching routes on the server!This is the current setup:
What I envision is making today's non-matching routes handling user configurable. To get this to work for us, we would only need to make the handler pass the request on to the next Netty handler in the queue, so a simple
boolean
flag would suffice.I am not totally sure how the handling in RequestRouter compares to the one in HttpResourceHandler, though.
In any case, I could make the necessary changes, but is this something the project would/could accept?
The text was updated successfully, but these errors were encountered: