-
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
fixes for Response.writeError with servlet error dispatch #12698
base: jetty-12.1.x
Are you sure you want to change the base?
Conversation
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@lachlan-roberts this is quite a hefty refactor of |
@janbartel I have aligned the EE10 ErrorHandler with changes from the EE11 one. I think maybe the changes can be reduced, but I wanted the EE10 If we really don't want to change the EE10 |
jetty-core/jetty-security/src/main/java/org/eclipse/jetty/security/AuthenticationState.java
Outdated
Show resolved
Hide resolved
jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ErrorHandler.java
Show resolved
Hide resolved
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@gregw @janbartel ready for review |
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.
just a few documentation changes
I also restarted CI, to get a clean build
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java
Outdated
Show resolved
Hide resolved
jetty-ee11/jetty-ee11-servlet/src/main/java/org/eclipse/jetty/ee11/servlet/ErrorHandler.java
Show resolved
Hide resolved
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Hmm AsyncMiddleMan tests failing here as well. So probably unrelated. |
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.
minor niggle
* <p> | ||
* Servlet implementations will override this method to trigger a sendError when the {@code ServletChannel} is started and return {@code false}. | ||
* </p> |
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.
* <p> | |
* Servlet implementations will override this method to trigger a sendError when the {@code ServletChannel} is started and return {@code false}. | |
* </p> | |
* <p> | |
* {@code ErrorHandler} extensions may override this method to modify the state of the | |
* {@code request} and/or {@code response} so that when the method returns {@code false} | |
* an error page will be generated by a subsequent {@code Handler}. For example, | |
* Servlet implementations override this method to set attributes that trigger a | |
* Servlet `sendError` call when the {@code ServletHandler} invokes the {@code ServletChannel}. | |
* </p> |
See issue #12697
Doing a
Response.writeError()
will try to invoke the servlet ErrorHandler, which can do an ERROR dispatch. This does not work properly if it is not done from within the scope of theServletChannel
.ErrorHandler
implementations to stop dispatching to error pages unless we have already started theServletChannel
.Authenticator
s now use theServletChannel
mechanism to do asendError()
when theServletChannel
starts handling the request. It uses a new static methodErrorHandler.writeError
which is overriden by the servletErrorHandler
s.