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

Jetty 12.1.x tck error message #12011

Merged
merged 4 commits into from
Jul 8, 2024
Merged

Conversation

janbartel
Copy link
Contributor

This PR fixes the output of ErrorHandler in accordance with TCK expectations. See #11931 (comment).

There is also a branch for entirely refactoring the servlet api ErrorHandler (https://github.com/jetty/jetty.project/tree/jetty-12.1.x-refactor-servlet-error-handler) however that is orthogonal to this fix.

@janbartel janbartel added the TCK For various Specification Test Compatibility Kits (eg: Servlet, WebSocket, HTTP/2, etc) label Jul 8, 2024
@janbartel janbartel requested a review from gregw July 8, 2024 02:13
@janbartel janbartel self-assigned this Jul 8, 2024
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a minimal fix just to pass the TCK, then it needs a TODO saying so

@@ -73,6 +73,14 @@ public boolean errorPageForMethod(String method)
};
}

private static Object getRequestErrorAttribute(HttpServletRequest request, String servletApiName, String jettyName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this method necessary?
I thought the policy was that we would always set the jetty(core) attribute and then any request wrapper used for an error dispatch to a filter/servlet would intercept the servlet attributes and lookup the jetty ones

So our code should then only ever need to lookup jetty(core) attributes? Unless there is a case where an application sets them and we are expected to act on them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is part of the refactoring effort, which is a much wider scope than just satisfying the tck.

{
Object o = request.getAttribute(servletApiName);
if (o == null)
o = request.getAttribute(jettyName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
o = request.getAttribute(jettyName);
o = request.getAttribute(coreAttributeName);

@@ -73,6 +73,14 @@ public boolean errorPageForMethod(String method)
};
}

private static Object getRequestErrorAttribute(HttpServletRequest request, String servletApiName, String jettyName)
{
Object o = request.getAttribute(servletApiName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Object o = request.getAttribute(servletApiName);
Object o = request.getAttribute(servletAttributeName);

@janbartel janbartel requested a review from gregw July 8, 2024 04:50
@janbartel janbartel merged commit 2587fe8 into jetty-12.1.x Jul 8, 2024
3 of 5 checks passed
@janbartel janbartel deleted the jetty-12.1.x-tck-error-message branch July 8, 2024 05:30
@olamy olamy mentioned this pull request Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TCK For various Specification Test Compatibility Kits (eg: Servlet, WebSocket, HTTP/2, etc)
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants