eclipse-ee4j / eclipse-ee4j/jersey

Jersey generating invalid "Content-Type: {application/pdf, q=1000}"

Open
#3,330 4 comments 0 reactions 0 assignees View on GitHub
Priority: Major Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

Invalid Content-Type is being returned using Jersey 2.22.1 as the Producer and exception thrown when Jersey 2.22.1 consumes it.

I'm using the following tags;
@PUT
@Consumes("**/**")
@Produces("application/pdf")
@Path("pdf")
public StreamingOutput pdf() ...

When using WireShark to sniff network traffic I see this header being returned;
Content-Type:

{application/pdf, q=1000}

When I want to obtain an InputStream of the response using this line;
final InputStream is = response.readEntity(InputStream.class);

This exception is thrown;
org.glassfish.jersey.message.internal.HeaderValueException: Unable to parse "Content-Type" header value "{application/pdf, q=1000}

"

I've got other resources that work so I know the code is okay, it's purely an issue with Content-Type. No idea why extra Curly Brackets are being added for application/pdf, also from rfc2616 the q value should range from 0.0 to 1.0 and it's defeitnly 1000 (one thousand).
#### Affected Versions
[2.22.1]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.