Class HttpDownloadProcessor


  • public class HttpDownloadProcessor
    extends Object
    Processes file download request
    Since:
    5.1
    Author:
    Eugene Petrenko, Maxim Manuylov
    • Method Detail

      • processFileDownload

        @Nullable
        @Deprecated
        public org.springframework.web.servlet.ModelAndView processFileDownload​(@NotNull
                                                                                File file,
                                                                                @NotNull
                                                                                javax.servlet.http.HttpServletRequest request,
                                                                                @NotNull
                                                                                javax.servlet.http.HttpServletResponse response)
                                                                         throws IOException
        performs all necessary operations to send file contents into response.
        Parameters:
        file - file to send
        request - original request
        response - response
        Returns:
        spring model and view to return from controller
        Throws:
        IOException - on response or file IO errors
      • processFileDownload

        @Nullable
        public org.springframework.web.servlet.ModelAndView processFileDownload​(@NotNull
                                                                                File file,
                                                                                boolean contentDisposition,
                                                                                boolean restrictMimeTypes,
                                                                                @NotNull
                                                                                javax.servlet.http.HttpServletRequest request,
                                                                                @NotNull
                                                                                javax.servlet.http.HttpServletResponse response,
                                                                                @Nullable
                                                                                Counter loadMetric)
                                                                         throws IOException
        performs all necessary operations to send file contents into response.
        Parameters:
        file - file to send
        request - original request
        response - response
        contentDisposition - whether Content-Disposition header should be set or not
        restrictMimeTypes - 'false' to use all known mime types (should only be used for serving files coming from trusted sources), 'true' to select from "text/plain" : "application/octet-stream"
        Returns:
        spring model and view to return from controller
        Throws:
        IOException - on response or file IO errors
      • processArtifactDownload

        @Nullable
        public org.springframework.web.servlet.ModelAndView processArtifactDownload​(@NotNull
                                                                                    SBuild build,
                                                                                    @NotNull
                                                                                    BuildArtifact artifact,
                                                                                    @NotNull
                                                                                    javax.servlet.http.HttpServletRequest request,
                                                                                    @NotNull
                                                                                    javax.servlet.http.HttpServletResponse response)
                                                                             throws IOException
        performs all necessary operations to send build artifact contents into response.
        Parameters:
        artifact - file to send
        request - original request
        response - response
        Returns:
        spring model and view to return from controller
        Throws:
        IOException - on response or file IO errors
      • processArtifactDownload

        @Nullable
        public org.springframework.web.servlet.ModelAndView processArtifactDownload​(@NotNull
                                                                                    SBuild build,
                                                                                    @NotNull
                                                                                    BuildArtifact artifact,
                                                                                    boolean setContentDisposition,
                                                                                    @Nullable
                                                                                    String forcedETagContent,
                                                                                    @NotNull
                                                                                    javax.servlet.http.HttpServletRequest request,
                                                                                    @NotNull
                                                                                    javax.servlet.http.HttpServletResponse response)
                                                                             throws IOException
        Processes request to download content of the specified build's artifact and writes the response.
        Parameters:
        build - build to serve artifact form
        artifact - build's artifact to serve
        setContentDisposition - if "true", "Content-Disposition" header will be set
        forcedETagContent - if set, the value of the strong ETag to use. If null, default ETag calculation will be used
        request - original request
        response - response
        Returns:
        spring model and view to return from controller
        Throws:
        IOException - on response or file IO errors
        Since:
        2017.1
      • processDownload

        public org.springframework.web.servlet.ModelAndView processDownload​(@NotNull
                                                                            HttpDownloadProcessor.FileInfo info,
                                                                            boolean contentDisposition,
                                                                            boolean restrictMimeTypes,
                                                                            @NotNull
                                                                            javax.servlet.http.HttpServletRequest request,
                                                                            @NotNull
                                                                            javax.servlet.http.HttpServletResponse response)
                                                                     throws IOException
        Parameters:
        restrictMimeTypes - 'false' to use all known mime types (should only be used for serving files coming from trusted sources), 'true' to select from "text/plain" : "application/octet-stream"
        Throws:
        IOException