public InputStream getBody() throws IOException {
   if (this.body == null) {
     if (response.getBody() != null) {
       this.body = FileCopyUtils.copyToByteArray(response.getBody());
     } else {
       body = new byte[] {};
     }
   }
   return new ByteArrayInputStream(this.body);
 }
示例#2
0
 /** Handle error response message according to error strategy. */
 public void handleError(ClientHttpResponse response) throws IOException {
   if (errorHandlingStrategy.equals(ErrorHandlingStrategy.PROPAGATE)) {
     informReplyMessageHandler(
         buildResponseMessage(
             response.getHeaders(),
             response.getBody() != null ? response.getBody() : "",
             response.getStatusCode()),
         requestMessage);
   } else if (errorHandlingStrategy.equals(ErrorHandlingStrategy.THROWS_EXCEPTION)) {
     new DefaultResponseErrorHandler().handleError(response);
   } else {
     throw new CitrusRuntimeException("Unsupported error strategy: " + errorHandlingStrategy);
   }
 }