/** Copy the contents of an {@link InputStream} so it can be closed. */ public static InputStream copy(InputStream inputStream) { if ( inputStream == null ) return null ; byte[] b = IO.readWholeFile(inputStream) ; InputStream x = new ByteArrayInputStream(b) ; return x ; }
private void executeBody(HttpAction action) { InputStream input = null ; try { input = action.request.getInputStream() ; } catch (IOException ex) { ServletOps.errorOccurred(ex) ; } if ( action.verbose ) { // Verbose mode only .... capture request for logging (does not scale). byte[] bytes = IO.readWholeFile(input); input = new ByteArrayInputStream(bytes); try { String requestStr = Bytes.bytes2string(bytes) ; action.log.info(format("[%d] Update = %s", action.id, ServletOps.formatForLog(requestStr))) ; } catch (Exception ex) { action.log.info(format("[%d] Update = <failed to decode>", action.id)) ; } } execute(action, input) ; ServletOps.successNoContent(action) ; }
private void executeBody(HttpAction action) { InputStream input = null ; try { input = action.request.getInputStream() ; } catch (IOException ex) { ServletOps.errorOccurred(ex) ; } if ( action.verbose ) { // Verbose mode only .... capture request for logging (does not scale). byte[] bytes = IO.readWholeFile(input); input = new ByteArrayInputStream(bytes); try { String requestStr = Bytes.bytes2string(bytes) ; action.log.info(format("[%d] Update = %s", action.id, ServletOps.formatForLog(requestStr))) ; } catch (Exception ex) { action.log.info(format("[%d] Update = <failed to decode>", action.id)) ; } } execute(action, input) ; ServletOps.successNoContent(action) ; }