jakartaee / rest

Jakarta RESTful Web Services
Other
351 stars 114 forks source link

Support class field or method parameter injection via CDI for types supported via @Context injection #1213

Open jim-krueger opened 5 months ago

jim-krueger commented 5 months ago

The following types are allowed to be injected in class fields and method parameters via @Context injection. These will need to be supported via CDI going forward:

See: https://jakarta.ee/specifications/restful-ws/3.1/jakarta-restful-ws-spec-3.1#contexttypes

jamezp commented 5 months ago

Just a +1 and this should be fairly simple, at least it is in RESTEasy, to accomplish. Two that we missed are Sse and SseEventSink.

One thing we should determine is the scope these types should have. The following would be my personal recommendation:

Type Scope
Application subclasses @ApplicationScoped
UniInfo @RequestScoped
HttpHeaders @RequestScoped
Rquest @RequestScoped
SecurityContext @RequestScoped
Providers @ApplicationScoped
ResourceContext @ApplicationScoped
Configuration none (@Dependant)
Sse @ApplicationScoped
SseEventSink @RequestScoped

Note that if we end up allowing, or defining, that more than one application can be used per-deployment, then we may need to adjust the @ApplicationScoped ones. Maybe we preemptively do that now.

jamezp commented 5 months ago

I just realized the two I said we missed were already referenced in #1212 :)

jim-krueger commented 5 months ago

I agree, I'll close #1212.