Class StreamingController


  • @RestController
    public class StreamingController
    extends Object
    Based on Omnifaces FileServlet.java (Apache License 2.0)

    This implementation properly deals with ETag, If-None-Match and If-Modified-Since caching requests, hereby improving browser caching. This servlet also properly deals with Range and If-Range ranging requests (RFC7233), which is required by most media players for proper audio/video streaming, and by webbrowsers and for a proper resume of an paused download, and by download accelerators to be able to request smaller parts simultaneously. This implementaion is ideal when you have large files like media files placed outside the web application and you can't use the default servlet.

    • Constructor Detail

      • StreamingController

        public StreamingController()
    • Method Detail

      • getHead

        @RequestMapping(value="/stream/{id}/default.{extension}",
                        method=HEAD)
        public void getHead​(@PathVariable
                            String id,
                            @PathVariable
                            String extension,
                            javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws Exception
        Throws:
        Exception
      • getStream

        @RequestMapping(value="/stream/{id}/default.{extension}",
                        method=GET)
        public void getStream​(@PathVariable
                              String id,
                              @PathVariable
                              String extension,
                              javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws Exception
        Throws:
        Exception