use of spray.http.HttpHeader in project newrelic-java-agent by newrelic.
the class SprayToResponseMarshallingContext method marshalTo.
@Trace(async = true)
public void marshalTo(HttpResponse httpResponse) {
Transaction transaction = AgentBridge.getAgent().getTransaction(false);
if (transaction != null) {
// First, convert to a java collection so we can add our CAT headers
List<HttpHeader> modifiableHeaders = new ArrayList<>(JavaConversions.asJavaCollection(httpResponse.headers()));
// Run through CAT related code to set headers
transaction.setWebResponse(new ResponseWrapper(httpResponse.status(), modifiableHeaders));
OutboundWrapper outboundWrapper = new OutboundWrapper(modifiableHeaders);
transaction.getCrossProcessState().processOutboundResponseHeaders(outboundWrapper, getContentLength(outboundWrapper));
transaction.markFirstByteOfResponse();
httpResponse = httpResponse.withHeaders(JavaConversions.asScalaBuffer(modifiableHeaders).toList());
}
Weaver.callOriginal();
}
Aggregations