Search in sources :

Example 1 with ResponseWrapper

use of com.nr.agent.instrumentation.weblogic12.ResponseWrapper in project newrelic-java-agent by newrelic.

the class WebAppServletContext method execute.

@Trace(dispatcher = true)
void execute(ServletRequestImpl req, ServletResponseImpl rsp) {
    HttpServletRequest request = getHttpServletRequest(req);
    if (!AgentBridge.getAgent().getTransaction().isWebRequestSet()) {
        if (request != null) {
            AgentBridge.getAgent().getTransaction().setWebRequest(new RequestWrapper(request));
        }
    }
    if (!AgentBridge.getAgent().getTransaction().isWebResponseSet()) {
        if (req != null) {
            AgentBridge.getAgent().getTransaction().setWebResponse(new ResponseWrapper(req.getResponse()));
        }
    }
    Weaver.callOriginal();
    if (request != null) {
        Throwable exception = (Throwable) request.getAttribute("javax.servlet.error.exception");
        if (exception != null) {
            NewRelic.noticeError(exception);
        }
    }
    if (request != null && request.isAsyncStarted()) {
        AsyncContext asyncContext = request.getAsyncContext();
        if (asyncContext != null) {
            AgentBridge.asyncApi.suspendAsync(asyncContext);
        }
    }
    AgentBridge.getAgent().getTransaction().addOutboundResponseHeaders();
    AgentBridge.getAgent().getTransaction().markResponseSent();
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) RequestWrapper(com.nr.agent.instrumentation.weblogic12.RequestWrapper) ResponseWrapper(com.nr.agent.instrumentation.weblogic12.ResponseWrapper) AsyncContext(javax.servlet.AsyncContext) Trace(com.newrelic.api.agent.Trace)

Aggregations

Trace (com.newrelic.api.agent.Trace)1 RequestWrapper (com.nr.agent.instrumentation.weblogic12.RequestWrapper)1 ResponseWrapper (com.nr.agent.instrumentation.weblogic12.ResponseWrapper)1 AsyncContext (javax.servlet.AsyncContext)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1