@ RequestMapping ( value = "/video/{conversionFormat}/**" , method = RequestMethod . GET ) public ResponseEntity < InputStreamResource > getVideo ( WebRequest request , HttpServletRequest servletRequest , @ PathVariable ( value = "conversionFormat" ) String conversionFormat ) throws IOException { String path = extractPathFromPattern ( servletRequest ) ; LOG . debug ( "getVideo(path={}, conversionFormat={})" , path , conversionFormat ) ; try { // GalleryFile galleryFile = galleryService.getGalleryFile(path); GalleryFile galleryFile = galleryService . getVideo ( path , conversionFormat ) ; if ( ! GalleryFileType . VIDEO . equals ( galleryFile . getType ( ) ) ) { LOG . warn ( "File {} was not a video but {}. Throwing ResourceNotFoundException." , path , galleryFile . getType ( ) ) ; throw new ResourceNotFoundException ( ) ; } return returnResource ( request , galleryFile ) ; } catch ( FileNotFoundException fnfe ) { LOG . warn ( "Could not find resource {}" , path ) ; throw new ResourceNotFoundException ( ) ; } catch ( NotAllowedException nae ) { LOG . warn ( "User was not allowed to access resource {}" , path ) ; throw new ResourceNotFoundException ( ) ; } catch ( IOException ioe ) { LOG . error ( "Error when calling getVideo" , ioe ) ; throw ioe ; } }
Requests a video of a certain format .