Esempio n. 1
0
  @Override
  public void build() {
    ResponseHeaders responseHeaders = getObjectFactory().createResponseHeaders();

    responseHeaders.getFidelity().addAll(fidelity);

    if (fidelityValidator.hasValidFidelity()) {

      for (String headerName : response.getHeaderNames()) {

        if (fidelityValidator.hasStarFidelity()) {
          ComplexParameter complexParameter = getObjectFactory().createComplexParameter();
          complexParameter.setName(headerName);

          for (String nextElement : response.getHeaders(headerName)) {
            complexParameter.getValue().add(nextElement);
          }

          responseHeaders.getHeader().add(complexParameter);
        }
      }
    }

    responseHead.setHeaders(responseHeaders);
  }
  /**
   * @see
   *     org.springframework.web.servlet.handler.HandlerInterceptorAdapter#postHandle(javax.servlet.http.HttpServletRequest,
   *     javax.servlet.http.HttpServletResponse, java.lang.Object,
   *     org.springframework.web.servlet.ModelAndView)
   */
  @Override
  public void postHandle(
      HttpServletRequest request,
      HttpServletResponse response,
      Object handler,
      ModelAndView modelAndView)
      throws Exception {
    if (LOGGER.isTraceEnabled()) {
      StringBuilder responseRepresentation = new StringBuilder();

      responseRepresentation.append(request.getMethod());

      responseRepresentation.append(" url=");
      responseRepresentation.append(request.getRequestURL());
      if (request.getQueryString() != null) {
        responseRepresentation.append('?');
        responseRepresentation.append(request.getQueryString());
      }

      responseRepresentation.append(",status=");
      responseRepresentation.append(response.getStatus());

      responseRepresentation.append(",headers={");
      Iterator<String> headerNames = response.getHeaderNames().iterator();
      while (headerNames.hasNext()) {
        String headerName = headerNames.next();

        responseRepresentation.append(headerName);
        responseRepresentation.append(": ");
        responseRepresentation.append(response.getHeader(headerName));

        if (headerNames.hasNext()) responseRepresentation.append(", ");
      }
      responseRepresentation.append('}');

      /*
       * Note: We don't currently log the body/message content. It's
       * tricky to get, and I don't (yet) have a need for it.
       */

      LOGGER.trace("Response: {}", responseRepresentation.toString());
    }
  }
 @Override
 public Collection<String> getHeaderNames() {
   return response.getHeaderNames();
 }
Esempio n. 4
0
 @Override
 public Collection<String> getHeaderNames() {
   return wrap.getHeaderNames();
 }