Github user mindprince commented on a diff in the pull request:
https://github.com/apache/spark/pull/8014#discussion_r36596083
--- Diff: core/src/main/scala/org/apache/spark/ui/JettyUtils.scala ---
@@ -251,6 +251,13 @@ private[spark] object JettyUtils extends Logging {
private def attachPrefix(basePath: String, relativePath: String): String
= {
if (basePath == "") relativePath else (basePath +
relativePath).stripSuffix("/")
}
+
+ /**
+ * Attach a prefix to the given path, don't remove the trailing / if
present.
+ */
+ private def attachPrefixForRedirect(basePath: String, relativePath:
String): String = {
--- End diff --
`basePath == ""` is treated separately because there is a case when
`basePath = ""` and `relativePath = "/"`. In that case, we would return an
empty string if we don't treat `basePath == ""` separately.
Here are the various cases:
```
+ /
+ /json
/history/application_1438648766072_0009 + /jobs
/history/application_1438648766072_0009 + /jobs/json
/history/application_1438648766072_0009 + /jobs/job
/history/application_1438648766072_0009 + /jobs/job/json
/history/application_1438648766072_0009 + /stages
/history/application_1438648766072_0009 + /stages/json
/history/application_1438648766072_0009 + /stages/stage
/history/application_1438648766072_0009 + /stages/stage/json
/history/application_1438648766072_0009 + /stages/pool
/history/application_1438648766072_0009 + /stages/pool/json
/history/application_1438648766072_0009 + /storage
/history/application_1438648766072_0009 + /storage/json
/history/application_1438648766072_0009 + /storage/rdd
/history/application_1438648766072_0009 + /storage/rdd/json
/history/application_1438648766072_0009 + /environment
/history/application_1438648766072_0009 + /environment/json
/history/application_1438648766072_0009 + /executors
/history/application_1438648766072_0009 + /executors/json
* /history/application_1438648766072_0009 + /jobs/
/history/application_1438648766072_0009 + /
* + /stages/
+ /stages/stage/kill
```
The ones with asterisk are for `attachPrefixForRedirect`, the other ones
are for `attachPrefix`.
Earlier `attachPrefix` was called from two places, but now from one of
these places `attachPrefixForRedirect` is being called. Let me know if you want
me to inline these.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]