예제 #1
0
 @AfterReturning(value = "allOperation()||athenaServiceOperation()||spartanServiceOperation()")
 public void afterReturning(JoinPoint join) throws IOException {
   counterService.increment(
       "counter.HttpStatus."
           + httpStatusCode.name()
           + "."
           + join.getSignature().getDeclaringType().getSimpleName()
           + "."
           + join.getSignature().getName()
           + ".calls");
   counterService.increment("counter.numberof.calls");
 }
예제 #2
0
  /**
   * Builds the actual integration message from HTTP response entity.
   *
   * @param headers HTTP headers which will be transformed into Message headers
   * @param responseBody the HTTP body of the response
   * @param statusCode HTTP status code received
   * @return the response message
   */
  private Message<?> buildResponseMessage(
      HttpHeaders headers, Object responseBody, HttpStatus statusCode) {
    Map<String, ?> mappedHeaders = headerMapper.toHeaders(headers);

    Message<?> responseMessage =
        MessageBuilder.withPayload(responseBody)
            .copyHeaders(mappedHeaders)
            .copyHeaders(getCustomHeaders(headers, mappedHeaders))
            .setHeader(CitrusHttpMessageHeaders.HTTP_STATUS_CODE, statusCode)
            .setHeader(
                CitrusHttpMessageHeaders.HTTP_VERSION,
                "HTTP/1.1") // TODO check if we have access to version information
            .setHeader(CitrusHttpMessageHeaders.HTTP_REASON_PHRASE, statusCode.name())
            .build();

    return responseMessage;
  }