I would like to get the AcceptableLanguage header of the originating request to select the correct translation language.
I thought that this would work:
import javax.ws.rs.core.HttpHeaders;
@ApplicationScoped
public class TranslationService{
@Context HttpHeaders httpHeaders;
....
}
As it seems, I always result in a null
value. When I try the @Context
field directly in a RestEasy controller, the field is assigned with the current HttpHeaders object.
I already have tried to save the http headers inside a ContrainerRequestFilter
to a @RequestScoped
bean, althought the value seems to get lost again until the use in my TranslationService
.
How can I, in quarkus, get or provide the requests http headers, so any bean can access them?