2

I need to expose a local Motion JPEG endpoint (ex. "http://192.168.1.10/video.mjpg") passing from an endpoint in a RestController of my Application Server (jhipster gateway), because I need to gurantee grants and authorization to stream it.

I already tried this solution

@GetMapping("/video")
@Timed
public void stream(@RequestParam(name = "url") String url, HttpServletResponse response) throws IOException {
        log.debug("REST request to stream : {}", url);
        response.setStatus(HttpStatus.OK.value());
        response.setHeader(HttpHeaders.CONTENT_TYPE, "multipart/x-mixed-replace");
        response.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache");
        response.setHeader("Pragma", "no-cache");
        RestTemplate restTemplate = new RestTemplate();
        restTemplate.execute(
            url,
            HttpMethod.GET,
            (ClientHttpRequest requestCallback) -> {},
            responseExtractor -> {
                IOUtils.copy(responseExtractor.getBody(), response.getOutputStream());
                return null;
            });
    }

But it didn't work. Any suggestion?

Jonas
  • 121,568
  • 97
  • 310
  • 388
tommynicoletti
  • 140
  • 1
  • 6

0 Answers0