-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use HandlerList instead of HandlerCollection #4757
Conversation
Signed-off-by: Greg Wilkins <[email protected]>
I've given this a wide review list as I want knowledge of change this spread. |
Signed-off-by: Greg Wilkins <[email protected]>
@sbordet @joakime @janbartel nudge |
@sbordet @joakime @janbartel nudge2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good.
But I would have liked it if you had left some of the HandlerList.addHandler(Handler)
usages in place, as that's an important API that still needs to be tested properly.
examples/embedded/src/main/java/org/eclipse/jetty/embedded/WebSocketJsrServer.java
Show resolved
Hide resolved
jetty-server/src/test/java/org/eclipse/jetty/server/handler/SecuredRedirectHandlerTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I would like to clarify the case where there is (ServletContextHandler, DefaultHandler)
.
If ServletContextHandler
is a terminal Handler
, then there is no point in having a DefaultHandler
afterwards.
If ServletContextHandler
can be configured to be non-terminal, why can it be configured so at all - seems counter intuitive that it can be both.
examples/embedded/src/main/java/org/eclipse/jetty/embedded/WebSocketJsrServer.java
Show resolved
Hide resolved
...et-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/RestartContextTest.java
Show resolved
Hide resolved
...et-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/RestartContextTest.java
Show resolved
Hide resolved
...-jetty-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserDebugTool.java
Show resolved
Hide resolved
...ocket-jetty-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/BadNetworkTest.java
Show resolved
Hide resolved
Is there a filed issue for this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussion with @gregw, LGTM.
The
HandlerCollection
class is both a concrete class and the base class forHandlerList
andContextHandlerCollection
. Behaviours are:HandlerCollection
has a list of handlers that are called in order regardless of errors or handled statusHandlerList
calls handlers in order untilisHandled()==true
or an exceptionContextHandlerCollection
attempts to map a request to a handler by contextPath and virtual host and then calls matching in order until isHandled()==true` or an exceptionOriginally the basic
jetty.xml
setup was:Which with some optional modules was extended to something like:
So the
HandlerCollection
behaviour was needed so that the request was always rewritten and always logged. TheDefaultHandler
does it's ownisHandled()==true
check so it only handles unhandled requests.However, now in Jetty-10 the extended structure is
So the
HandlerCollection
semantic is no longer needed. This PR replaces the common usage ofHandlerCollection
with the more intuitiveHandlerList