-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-12186] [WEB UI] Send the complete request URI including the query string when redirecting. #10180
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
Conversation
… when redirecting.
|
cc - @vanzin |
|
cc - @srowen, @andrewor14 Can you please ask Jenkins to run the tests. Thanks! |
|
ok to test |
|
Test build #47555 has finished for PR 10180 at commit
|
|
Can someone review this or if it seems okay, merge it? |
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 think this is fine, but maybe slightly less repetitious like ...
val requestURI = req.getRequestURI + (if (req.getQueryString == null) "" else ("?" + req.getQueryString))
res.sendRedirect(res.encodeRedirectURL(requestURI))
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.
or even
val requestURI = req.getRequestURI + req.getQueryString.map("?" + _).getOrElse("")
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.
@andrewor14 Can't use getOrElse:
value getOrElse is not a member of scala.collection.immutable.IndexedSeq[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.
@srowen I think having an if statement like that makes it a little harder to read. How about the following, it has lesser repetition.
val requestURI = if (req.getQueryString == null) {
req.getRequestURI
} else {
req.getRequestURI + "?" + req.getQueryString
}
res.sendRedirect(res.encodeRedirectURL(requestURI))
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? Isn't req.getQueryString a 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.
It is. I am not sure what you are trying to do in that statement:
scala> "spark".map("?" + _)
res0: scala.collection.immutable.IndexedSeq[String] = Vector(?s, ?p, ?a, ?r, ?k)
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.
oh sorry, I meant
val requestURI = req.getRequestURI + Option(req.getQueryString).map("?" + _).getOrElse("")
where
Option(null) == None
Option("something") == Some("something")
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.
Updated.
|
LGTM once you address the comments. |
|
Test build #47839 has finished for PR 10180 at commit
|
|
retest this please |
|
Test build #47853 has finished for PR 10180 at commit
|
|
Merged into master 1.6 |
…ry string when redirecting. Author: Rohit Agarwal <[email protected]> Closes #10180 from mindprince/SPARK-12186. (cherry picked from commit fdb3822) Signed-off-by: Andrew Or <[email protected]>
No description provided.