Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problem in the jetty-client-9.x which leading original listener reading empty content #703

Closed
wants to merge 2 commits into from

Conversation

mei-zengxin
Copy link

Fix problem in the jetty-client-9.x which leading original listener reading empty content

  • Add a unit test to verify that the fix works.
  • Explain briefly why the bug exists and how to fix it.

when using jetty-client 9.x send async request, reponse body is always empty

because the onContent callback could not be executed

        request.send(new BufferingResponseListener() {
            @Override
            public void onComplete(Result result) {
                try { 
                    //this is always empty when use agent
                    byte[] responseBytes = getContent();
                    if (responseBytes == null || responseBytes.length == 0) {
                        System.out.println("responseBytes is empty");
                    }
                    System.out.println(new String(responseBytes, "UTF-8"));
                } catch (UnsupportedEncodingException e) {
                    throw new RuntimeException(e);
                }
            }
        });

@wu-sheng wu-sheng added the plugin label Jul 4, 2024
<jetty-client.version>9.1.0.v20131115</jetty-client.version>
<jetty-client.version>9.4.55.v20240627</jetty-client.version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this? Would this break preview compatibility?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because org.eclipse.jetty.client.api.Response.AsyncContentListener cound not be found in 9.1.x version
if the wrapper not implementing it, application will also get empty result when using jetty client 9.2.x or later,

by testing, it is compatible with preview version 9.1.0.v20131115
, 9.2.12.v20150709, 9.3.30.v20211001 and 9.4.55.v20240627

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't exist in 9.1.0.v20131115, how do we make sure of compatibility? This doesn't make sense.

@wu-sheng
Copy link
Member

wu-sheng commented Jul 4, 2024

You should fix CI, and add more versions of newly supported to verify.

@wu-sheng
Copy link
Member

wu-sheng commented Jul 4, 2024

@wu-sheng
Copy link
Member

@mei-zengxin Are you still working on this?

@wu-sheng wu-sheng added the stale label Jul 16, 2024
@wu-sheng
Copy link
Member

Close as no update.

@wu-sheng wu-sheng closed this Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants