@ GET public Response getStreamContents ( ) { // Intercept all output StreamingOutput stream = new StreamingOutput ( ) { @ Override public void write ( OutputStream output ) throws IOException { try { tunnel . interceptStream ( streamIndex , output ) ; } catch ( GuacamoleException e ) { throw new IOException ( e ) ; } } } ; // Begin successful response ResponseBuilder responseBuilder = Response . ok ( stream , mediaType ) ; // Set Content-Disposition header for "application/octet-stream" if ( mediaType . equals ( MediaType . APPLICATION_OCTET_STREAM ) ) responseBuilder . header ( "Content-Disposition" , "attachment" ) ; return responseBuilder . build ( ) ; }
Intercepts and returns the entire contents the stream represented by this StreamResource .