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

[239] Ensure sub-resources are also proxied. #241

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

jamezp
Copy link
Contributor

@jamezp jamezp commented Jan 3, 2024

resolves #239

@cghislai
Copy link

cghislai commented Jan 4, 2024

Thank you!
The only concern I have is with the close method.
It will close the client, so the parent resource instance could not be used anymore afterwards.
I think it would be more intuitive if the subresource was not closable, or that closing it would not have impact on the parent resource lifecycle.

If it is closable, I would expect something like that to work:

try (RootResource root = builder.build(Root.class)) {
  try (SubResource sub1 = root.getSubResource1() {
   //..
  }
  try (SubResource sub2 = root.getSubResource2() {
   //..
  }
}

@jamezp
Copy link
Contributor Author

jamezp commented Jan 4, 2024

Thank you! The only concern I have is with the close method. It will close the client, so the parent resource instance could not be used anymore afterwards. I think it would be more intuitive if the subresource was not closable, or that closing it would not have impact on the parent resource lifecycle.

If it is closable, I would expect something like that to work:

try (RootResource root = builder.build(Root.class)) {
  try (SubResource sub1 = root.getSubResource1() {
   //..
  }
  try (SubResource sub2 = root.getSubResource2() {
   //..
  }
}

That's a good point. I did it mainly because https://download.eclipse.org/microprofile/microprofile-rest-client-3.0/microprofile-rest-client-spec-3.0.html#lifecycle indicates a client must implement Closeable, but I guess a sub-resource is different than a client. I'll undo that part as I agree with you.

I'll also remove the RestClientProxy interface too. I'll add some more tests around closing too.

@cghislai
Copy link

cghislai commented Jan 4, 2024

lgtm, thank you!

@jamezp jamezp merged commit 736d8a0 into resteasy:main Jan 4, 2024
13 checks passed
@jamezp
Copy link
Contributor Author

jamezp commented Jan 4, 2024

@cghislai Thank you so much for your help on this. I'll get a release out by next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using restclient builder, exceptions are not mapped when calling subresources methods
2 participants