Skip to content
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

Open
wants to merge 5 commits into
base: jetty-12.1.x
Choose a base branch
from

Conversation

lachlan-roberts
Copy link
Contributor

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 the ServletChannel.

  • Add checks inside the ErrorHandler implementations to stop dispatching to error pages unless we have already started the ServletChannel.
  • Authenticators now use the ServletChannel mechanism to do a sendError() when the ServletChannel starts handling the request. It uses a new static method ErrorHandler.writeError which is overriden by the servlet ErrorHandlers.

@lachlan-roberts lachlan-roberts marked this pull request as ready for review January 14, 2025 06:48
@janbartel
Copy link
Contributor

@lachlan-roberts this is quite a hefty refactor of ee10 error handling code, of publically available methods - are you sure we shouldn't just be doing this in ee11 only?

@lachlan-roberts
Copy link
Contributor Author

@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 ErrorHandler to extend the core ErrorHandler like the EE11 one does, so that I could introduce this new ErrorHandler.writeError method.

If we really don't want to change the EE10 ErrorHandler I could introduce a new interface which both EE10 and EE11 ErrorHandlers could extend.

Signed-off-by: Lachlan Roberts <[email protected]>
@lachlan-roberts
Copy link
Contributor Author

@gregw @janbartel ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

2 participants