Class ReportTabUtil
- java.lang.Object
-
- jetbrains.buildServer.web.reportTabs.ReportTabUtil
-
public class ReportTabUtil extends java.lang.Object
- Since:
- 7.0
- Author:
- Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
-
-
Constructor Summary
Constructors Constructor Description ReportTabUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BuildArtifact
getArtifact(SBuild build, java.lang.String basePath)
Returns the build artifact corresponding to abasePath
in abuild
.static java.lang.String
getResolvedPath(java.lang.String path, SBuild build)
static boolean
isAvailable(SBuild build, java.lang.String startPage)
Returns whether the report page is available for a build (can be found in its artifacts).static java.lang.String
prepareStartPageForWeb(java.lang.String path)
Prepares the start page path for using in jsp (as iframe path).
-
-
-
Method Detail
-
isAvailable
@Contract("null, _ -> false") public static boolean isAvailable(@Nullable SBuild build, @NotNull java.lang.String startPage)
Returns whether the report page is available for a build (can be found in its artifacts). For composite builds, always returns
false
.- Parameters:
build
- the build to search instartPage
- the path to the start page- Returns:
true
if the report page is available for a build
-
getArtifact
@Nullable public static BuildArtifact getArtifact(@NotNull SBuild build, @NotNull java.lang.String basePath)
Returns the build artifact corresponding to abasePath
in abuild
. A shortcut method.- Parameters:
build
- the buildbasePath
- base path- Returns:
- build artifact, or
null
if none - Since:
- 7.1
-
prepareStartPageForWeb
@NotNull public static java.lang.String prepareStartPageForWeb(@NotNull java.lang.String path)
Prepares the start page path for using in jsp (as iframe path). The procedure is important because the report data (javadoc, coverage info, etc) may contain relative paths inside, hence these report resources would be requested according to the path of an iframe displaying the report.The problem especially arises when the report is packed into an archive: in order to be displayed correctly, an iframe path should mock the path of the files inside the artifact.
For example, typical javadoc report starts with an "index.html", which refers to "overview-frame.html", "overview-summary.html", etc. The browser will render these resources as follows: it will find the last slash ("
/
") in an iframe path, and append the name of a resource ("overview-frame.html", ...). This means that the path must end with "/index.html", having last slash unescaped, or internal resources won't be found.Effectively this means that all slash symbols must be unescaped, and if the path is referring to a file inside an archive, it should be formed as
[path-to-archive]!/[relative-path-to-start-page]
. URLs with anchor (e.g. index.html#first-paragraph) are not supported, since '#' will be encoded as '%23' and treated as part of the file name. This is done to be able to view files with '#' symbol in it.- Parameters:
path
- the path to process- Returns:
- the path ready to be used in an iframe
-
getResolvedPath
@NotNull public static java.lang.String getResolvedPath(@NotNull java.lang.String path, @Nullable SBuild build)
-
-