use of com.newrelic.api.agent.Response in project newrelic-java-agent by newrelic.
the class AgentHelper method getWebRequestDispatcher.
public static Dispatcher getWebRequestDispatcher(final MockHttpServletRequest request, MockHttpServletResponse response, Transaction transaction) {
Request req = new Request() {
@Override
public String getRequestURI() {
return request.getRequestURI();
}
@Override
public String getRemoteUser() {
return request.getRemoteUser();
}
@Override
public String[] getParameterValues(String name) {
return request.getParameterValues(name);
}
@Override
public Enumeration getParameterNames() {
return request.getParameterNames();
}
@Override
public String getHeader(String name) {
return request.getHeader(name);
}
@Override
public String getCookieValue(String name) {
return null;
}
@Override
public Object getAttribute(String name) {
return request.getAttribute(name);
}
@Override
public HeaderType getHeaderType() {
return HeaderType.HTTP;
}
};
Response res = new Response() {
@Override
public int getStatus() throws Exception {
return 0;
}
@Override
public String getStatusMessage() throws Exception {
return null;
}
@Override
public void setHeader(String name, String value) {
}
@Override
public String getContentType() {
return null;
}
@Override
public HeaderType getHeaderType() {
return HeaderType.HTTP;
}
};
return new com.newrelic.agent.dispatchers.WebRequestDispatcher(req, res, transaction);
}
use of com.newrelic.api.agent.Response in project newrelic-java-agent by newrelic.
the class WebRequestDispatcherTest method createDispatcher.
private WebRequestDispatcher createDispatcher(MockHttpRequest httpRequest) throws Exception {
Transaction tx = Transaction.getTransaction();
Response httpResponse = new MockHttpResponse();
ClassMethodSignature sig = new ClassMethodSignature(getClass().getName(), "methodName", "()V");
DefaultTracer tracer = new OtherRootTracer(tx, sig, this, new SimpleMetricNameFormat("test"));
tx.getTransactionActivity().tracerStarted(tracer);
WebRequestDispatcher dispatcher = new WebRequestDispatcher(httpRequest, httpResponse, tx);
tx.setDispatcher(dispatcher);
return dispatcher;
}
use of com.newrelic.api.agent.Response in project newrelic-java-agent by newrelic.
the class BasicRequestDispatcherTracerTest method createDispatcher.
private WebRequestDispatcher createDispatcher(Request httpRequest) throws Exception {
Transaction tx = Transaction.getTransaction();
Response httpResponse = new MockHttpResponse();
ClassMethodSignature sig = new ClassMethodSignature(getClass().getName(), "dude", "()V");
DefaultTracer tracer = new OtherRootTracer(tx, sig, this, new SimpleMetricNameFormat("test"));
tx.getTransactionActivity().tracerStarted(tracer);
WebRequestDispatcher dispatcher = new WebRequestDispatcher(httpRequest, httpResponse, tx);
tx.setDispatcher(dispatcher);
return dispatcher;
}
Aggregations