The source of HttpClients disappeared from version v3.x.But in read me file I can still find it.is readme doc incorrect?
duc-zhou-tianxiong opened this issue · comments
About HttpClients.
We can find “HttpClients” in the last version of v2.0.2[microsoftgraph/msgraph-sdk-java-core at v2.0.21 (github.com)],
But the source of it disappeared from version v3.xx[microsoftgraph/msgraph-sdk-java-core at v3.1.0 (github.com)]
I check out readme files.
The chapters「2.3 Get a HttpClients object」is mentioned both in v2.x
and v3.x.
Question1:
Was it missed from version v3.x or removed from v3.x?
Question2:
So far I am using HttpClients in my source code.
What should I do, if I want to update my Graph SDK from v5 to v6.
It would be very appreciated if you can give me any suggestions.
Hi @DUC-zhoutianxiong ,
Thanks for using the SDK and for reaching out.
-
We at the time had multiple http pipelines and it was creating headaches. We removed it to move to a single one
-
Do you have an example of code you're trying to migrate?
Hi @DUC-zhoutianxiong , Thanks for using the SDK and for reaching out.
- We at the time had multiple http pipelines and it was creating headaches. We removed it to move to a single one
- Do you have an example of code you're trying to migrate?
Hello baywet
Thank you very much for getting back to me so quickly.
I uploaded a sample source as an attchment(file name :sample_code.txt)
The below is code I extracted for the sample_code.txt
We are using "HttpClients.createDefault" at the line 15.
but it was removed from v3.x.
How should I do ? are there any functions can replace "HttpClients.createDefault(authenticationProvider)" in SDK v3?
Line#12 public UserHelper(ICoreAuthenticationProvider authenticationProvider) {
Line#13 super();
Line#14 this.authenticationProvider = authenticationProvider;
Line#15 this.httpclient = HttpClients.createDefault(authenticationProvider).newBuilder() //HttpClients was removed from v3.x, how to use [HttpClients.createDefault(authenticationProvider)]
Line#16 .connectTimeout(ConnectTimeout, TimeUnit.SECONDS).readTimeout(ReadWriteTimeout, TimeUnit.SECONDS)
Line#17 .writeTimeout(ReadWriteTimeout, TimeUnit.SECONDS).retryOnConnectionFailure(true).build();
Line#18 }
Thanks for the additional information.
From what I can read from your code, you shouldn't need this http client anymore.
You should be able to write the following instead
UserCollectionResponse result = graphClient.users().get(); // GET /v1.0/users
Which will provide you with a much better experience.
Thanks for the additional information. From what I can read from your code, you shouldn't need this http client anymore.
You should be able to write the following instead
UserCollectionResponse result = graphClient.users().get(); // GET /v1.0/usersWhich will provide you with a much better experience.
Hello baywet
Thank you so much for your supporting.
I will try this code.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.