-
Notifications
You must be signed in to change notification settings - Fork 974
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
[UNDERTOW-2245]javax.servlet.forward.mapping request attribute is not… #1446
Conversation
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.
Overall it looks very good, but there are some small fixes and cosmetic changes that need to be applied here.
@@ -79,5 +81,10 @@ public static Deployment setupServlet(final ServletExtension servletExtension, f | |||
} | |||
|
|||
|
|||
|
|||
public static boolean isContainString(String fullString, String partString){ |
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.
I would remove this method from here, since deployment utils is an utility class for setting up test deployments. You can add an Utils method to the dispatcher package if you want to keep the utility method somewhere.
Also, I'm sorry if I sound too picky, but I would also rename the method to containsString or maybe even containsWord, since you used the \b in the pattern.
@@ -86,6 +89,7 @@ public static ServletPathMatch dispatchForward(final String path, | |||
requestImpl.setAttribute(FORWARD_SERVLET_PATH, requestImpl.getServletPath()); | |||
requestImpl.setAttribute(FORWARD_PATH_INFO, requestImpl.getPathInfo()); | |||
requestImpl.setAttribute(FORWARD_QUERY_STRING, requestImpl.getQueryString()); | |||
requestImpl.setAttribute(FORWARD_MAPPING,requestImpl.getHttpServletMapping()); |
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 to keep the style (I'm surprised that the code style enforcer didn't catch this), please add a space after commas, two dots, etc.
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.
I see we are missing the new attribute at dispatchError (method of this same class as well), please add FORWARD_MAPPING there (the if statement at line 50)
assertTrue(DeploymentUtils.isContainString(response,"jakarta.servlet.forward.context_path")); | ||
assertTrue(DeploymentUtils.isContainString(response,"jakarta.servlet.forward.servlet_path")); | ||
assertTrue(DeploymentUtils.isContainString(response,"jakarta.servlet.forward.request_uri")); | ||
assertTrue(DeploymentUtils.isContainString(response,"jakarta.servlet.forward.mapping")); |
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.
what about path info and query string attributes?
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.
Hi @fl4via As discussed this is causing test failure, Spec need to review for this to fix.
assertTrue(DeploymentUtils.isContainString(response,"jakarta.servlet.include.context_path")); | ||
assertTrue(DeploymentUtils.isContainString(response,"jakarta.servlet.include.servlet_path")); | ||
assertTrue(DeploymentUtils.isContainString(response,"jakarta.servlet.include.request_uri")); | ||
assertTrue(DeploymentUtils.isContainString(response,"jakarta.servlet.include.mapping")); |
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.
missing path info and query string
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.
Hi @fl4via As discussed this is causing test failure, Spec need to review for this to fix.
f3394b5
to
8780278
Compare
Hi @fl4via |
88e64c6
to
8787bc7
Compare
Hi @moulalis, the new added tests failed in CI.
|
Looking into it. |
8787bc7
to
132af5b
Compare
@fl4via I've updated the PR. Please review it. |
@@ -0,0 +1,40 @@ | |||
/* | |||
* JBoss, Home of Professional Open Source. | |||
* Copyright 2014 Red Hat, Inc., and individual contributors |
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.
Please, update the year to 20223.
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.
@fl4via I've updated the changes to 2023.
@@ -0,0 +1,23 @@ | |||
package io.undertow.servlet.test.dispatcher; |
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.
Missing license header.
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.
@fl4via I've updated the changes.
Thanks.
410ec92
to
f5c34ff
Compare
@@ -0,0 +1,16 @@ | |||
package io.undertow.servlet.test.dispatcher; |
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.
This also needs a license header.
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.
Done. Thanks
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.
s/2014/2023
f5c34ff
to
7922640
Compare
… available in servlets forwarded with RequestDispatcher
7922640
to
4810416
Compare
Issue: https://issues.redhat.com/browse/UNDERTOW-2245
2.x PR: #1445