jakartaee / jakartaee/servlet

Clarify behaviour for container managed HTTP headers

Open
#673 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
325
Forks
112
PR merge metrics
No merged PRs in 30d

Description

Taking Greg's text from https://github.com/jakartaee/servlet/pull/672 that adds support for early hints.

I understand that this method doesn't change the response headers, but we have other methods that will ultimately change the response headers, but we have not specified when, as it previously made little difference if they were set when called or when committed.

For example, if `setLocale(Locale)` has been called, would we expect to see a `Content-Type` header? Will `content-length` be sent if set by the application? probably Yes? Will `content-length` be set if the server can guess at it (e.g. some content aggregated in the buffer). Probably No?

We also have other container managed headers such as `Date`, `Server` and maybe `X-Powered`. Are these fields populated in the response prior to dispatch, and thus visible in `response.getHeader()` and would be sent with earlyHints, or are they set on commit?

Currently Jetty is modelling fields such as `Date` and `Server` as persistent fields. They are added to the response pre-dispatch, so they can be seen by the application. Their values can be changed if the application wishes, but they cannot be removed (as sending Date is MUST element in the RFC). So should these would be included in the 103 early hints? I don't see why not, but then I don't see any examples doing so.

I think we have been deliberately vague about server managed headers vs application managed headers. Maybe we need to be a bit less vague now? Or at least have language here that allows for the different possible implementations of server managed headers.

Contributor guide

Open the contributing guide

Research direction

Start with the early-hints support described in pull request 672 and review the behavior of setLocale(Locale), response.getHeader(), and container-managed headers such as Date, Server, and Content-Length. Clarify when these headers become visible, whether they are included in 103 early hints, and how implementations may vary; done means the Servlet specification states this behavior unambiguously.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.