Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jim-krueger opened this issue Jan 26, 2024 · 3 comments

Comments

@jim-krueger
Copy link
Contributor

jim-krueger commented Jan 26, 2024

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:

  • Application subclasses
  • UriInfo
  • HttpHeaders
  • Request
  • SecurityContext
  • Providers
  • ResourceContext
  • Configuration (both client and server runtime configurations)
  • Sse
  • SseEventSink

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

@jamezp
Copy link
Contributor

jamezp commented Jan 29, 2024

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
Copy link
Contributor

jamezp commented Jan 29, 2024

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

@jim-krueger
Copy link
Contributor Author

I agree, I'll close #1212.

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

No branches or pull requests

2 participants