Skip to content

Added application/x-www-form-urlencoded support to the Jakarta REST client backed by a collection of NameValuePair#844

Open
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:rest-form-urlencoded
Open

Added application/x-www-form-urlencoded support to the Jakarta REST client backed by a collection of NameValuePair#844
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:rest-form-urlencoded

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

No description provided.

@arturobernalg arturobernalg requested a review from ok2c July 4, 2026 17:37
@ok2c

ok2c commented Jul 5, 2026

Copy link
Copy Markdown
Member

@arturobernalg Great! But we also need a content consumer, don't we?

@arturobernalg arturobernalg force-pushed the rest-form-urlencoded branch 3 times, most recently from 8edd9f6 to 9cc7a7e Compare July 5, 2026 11:53
@arturobernalg arturobernalg force-pushed the rest-form-urlencoded branch from 9cc7a7e to b1be68b Compare July 5, 2026 12:10
@arturobernalg arturobernalg requested a review from ok2c July 5, 2026 16:44
}
final List<ContentType> consumesContentTypes = rm.getConsumesContentTypes();
if (consumesContentTypes != null && !consumesContentTypes.isEmpty()) {
// @Produces declares the media type(s) the client accepts back (Accept header).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@arturobernalg Indeed. It looks like I made a mistake here. @Produces declares what the endpoint produces and what client can choose to accept. Good catch.

.thenApply(result -> {
throwIfError(result);
final Header header = result.getHead().getFirstHeader(HttpHeaders.CONTENT_TYPE);
final ContentType contentType = header != null ? ContentType.parse(header.getValue()) : null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@arturobernalg One small thing. Let's make ContentType parsing more efficient:

final ContentType contentType = header != null ? MessageSupport.parserHeaderValue(header, ContentType::parse) : null;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@ok2c done

…) to the Jakarta REST client backed by a collection of NameValuePair

Corrects the @Consumes/@produces content-type mapping to JAX-RS semantics (@consumes = request body, @produces = Accept).
@arturobernalg arturobernalg force-pushed the rest-form-urlencoded branch from b1be68b to 672a54a Compare July 8, 2026 12:29
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.

2 participants