Search before asking
Apache SkyWalking Component
OAP server (apache/skywalking)
What happened
When using the Jetty client, the application cannot receive the returned data
What you expected to happen
When using the Jetty client, the application can receive the returned data
How to reproduce
Use the Jetty client to request the HTTP interface and check the response
Anything else
AsyncHttpRequestSendInterceptor.java beforeMethod below, This is my repair method
if (allArguments[0] instanceof BufferingResponseListener) {
BufferingResponseListener callback = (BufferingResponseListener) allArguments[0];
allArguments[0] = new BufferingResponseListenerWrapper(callback, ContextManager.capture());
} else {
Response.CompleteListener callback = (Response.CompleteListener) allArguments[0];
allArguments[0] = new CompleteListenerWrapper(callback, ContextManager.capture());
}
public class BufferingResponseListenerWrapper extends BufferingResponseListener {
private BufferingResponseListener callback;
private ContextSnapshot context;
public BufferingResponseListenerWrapper(BufferingResponseListener callback, ContextSnapshot context) {
this.callback = callback;
this.context = context;
}
@Override
public void onComplete(Result result) {
AbstractSpan span = ContextManager.createLocalSpan(Constants.PLUGIN_NAME + "/CompleteListener/onComplete");
span.setComponent(ComponentsDefine.JETTY_CLIENT);
SpanLayer.asHttp(span);
if (context != null) {
ContextManager.continued(context);
}
if (callback != null) {
callback.onComplete(result);
}
ContextManager.stopSpan();
}
@Override
public void onHeaders(Response response) {
callback.onHeaders(response);
}
@Override
public void onContent(Response response, ByteBuffer content) {
callback.onContent(response, content);
}
@Override
public void onBegin(Response response) {
callback.onBegin(response);
}
@Override
public boolean onHeader(Response response, HttpField field) {
return callback.onHeader(response, field);
}
@Override
public void onSuccess(Response response) {
callback.onSuccess(response);
}
@Override
public void onFailure(Response response, Throwable failure) {
callback.onFailure(response, failure);
}
}
Are you willing to submit a pull request to fix on your own?
Code of Conduct
Search before asking
Apache SkyWalking Component
OAP server (apache/skywalking)
What happened
When using the Jetty client, the application cannot receive the returned data
What you expected to happen
When using the Jetty client, the application can receive the returned data
How to reproduce
Use the Jetty client to request the HTTP interface and check the response
Anything else
AsyncHttpRequestSendInterceptor.java beforeMethod below, This is my repair method
Are you willing to submit a pull request to fix on your own?
Code of Conduct