4.x: Make HttpRouting an interface #8523
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently
HttpRoute
is an interface whereasHttpRouting
isn't. Being able to implement your ownHttpRouting
type can be useful when moving an existing service to Helidon; for example if there already is custom routing logic for it. In addition, making this change seems ideologically correct because it allows for more configurability, and almost everything else that can be specified in aWebServer
builder is an interface.Another issue that's addressed as a side-effect is that while other routing classes (e.g.
GrpcRouting
) aren't final, using a custom implementation isn't easily possible. The reason for this is that theRouterImpl
indexesRouting
instances by their class and itsrouting
method is always called with a fixed class. Therefore, when trying to use a custom implementation, it wouldn't be found.Documentation
The
HttpRouting
class is replaced by an interface and all implementation/builder code previously in it is moved to the new package-privateHttpRoutingImpl
class. This should not break existing applications becauseHttpRouting
wasfinal
(so no subclasses can be defined) and its constructor wasprivate
(so it cannot be called directly).The
routingType()
method is added to theRouting
interface with adefault
implementation consistent with the previous behaviour. Its result is used byRouterImpl
to determine the correctRouting
instance to use. I'm not sure returning aClass
here is the best solution, but it is what was previously used.Resolves #8572