Class ReportTabUtil


  • public class ReportTabUtil
    extends Object
    Since:
    7.0
    Author:
    Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
    • Constructor Detail

      • ReportTabUtil

        public ReportTabUtil()
    • Method Detail

      • isAvailable

        @Contract("null, _ -> false")
        public static boolean isAvailable​(@Nullable
                                          SBuild build,
                                          @NotNull
                                          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 in
        startPage - 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
                                                String basePath)
        Returns the build artifact corresponding to a basePath in a build. A shortcut method.
        Parameters:
        build - the build
        basePath - base path
        Returns:
        build artifact, or null if none
        Since:
        7.1
      • prepareStartPageForWeb

        @NotNull
        public static String prepareStartPageForWeb​(@NotNull
                                                    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 String getResolvedPath​(@NotNull
                                             String path,
                                             @Nullable
                                             SBuild build)