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

Make it possible to set the base URL of the REST Client when actually performing the call #43316

Closed
lasteris opened this issue Sep 16, 2024 · 4 comments · Fixed by #43331
Closed
Assignees
Labels
Milestone

Comments

@lasteris
Copy link
Contributor

lasteris commented Sep 16, 2024

Description

We have the case, where we need to change URL per request.
Mostly that's because we are trying to obtain URL from some other remote API.
For now, we have to write something like that:

try (Client client = ClientBuilder.newClient()) {
                    WebTarget target = client.target(urlObtainedFromAnySource);
                    webiomedResponse = target.request()
                            .header("Authorization", "Bearer ..."))
                            .get(String.class);

But surely, we want just use Quarkus RestClient abstraction via declarative API, or QuarkusRestClientBuilder.

Implementation ideas

Most likely i see this like such things done in Retrofit (@url annotation), or special processing of Url/Uri type (like in HttpExchange in Spring Boot. But you know better :

@lasteris lasteris added the kind/enhancement New feature or request label Sep 16, 2024
@geoand geoand changed the title Make it possible to set URL per call in Quarkus RestClient Make it possible to set the base URL of the REST Client when actually performing the call Sep 16, 2024
@geoand geoand self-assigned this Sep 16, 2024
Copy link

quarkus-bot bot commented Sep 16, 2024

/cc @cescoffier (rest-client)

@geoand
Copy link
Contributor

geoand commented Sep 17, 2024

#43331 introduces this capability and should be available in 3.16

@lasteris
Copy link
Contributor Author

@geoand Holy s**t. You are simply amazing. Thank you.

@geoand
Copy link
Contributor

geoand commented Sep 17, 2024

🙏🏽

@geoand geoand closed this as completed in 3c4e614 Sep 17, 2024
geoand added a commit that referenced this issue Sep 17, 2024
Introduce per invocation override of REST Client's base URL
@quarkus-bot quarkus-bot bot added this to the 3.16 - main milestone Sep 17, 2024
melloware pushed a commit to melloware/quarkus that referenced this issue Sep 17, 2024
This is done by introducing the @url annotation
that can be placed on a method parameter.
When this parameter is not null, it will be
used as the base URL for the specific invocation

Closes: quarkusio#43316
melloware pushed a commit to melloware/quarkus that referenced this issue Sep 17, 2024
This is done by introducing the @url annotation
that can be placed on a method parameter.
When this parameter is not null, it will be
used as the base URL for the specific invocation

Closes: quarkusio#43316
danielsoro pushed a commit to danielsoro/quarkus that referenced this issue Sep 20, 2024
This is done by introducing the @url annotation
that can be placed on a method parameter.
When this parameter is not null, it will be
used as the base URL for the specific invocation

Closes: quarkusio#43316
bschuhmann pushed a commit to bschuhmann/quarkus that referenced this issue Nov 16, 2024
This is done by introducing the @url annotation
that can be placed on a method parameter.
When this parameter is not null, it will be
used as the base URL for the specific invocation

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

Successfully merging a pull request may close this issue.

2 participants