@Qualifier
@Retention(value=RUNTIME)
@Target(value={METHOD,FIELD,PARAMETER,TYPE})
public @interface JerseyContext
Qualifier used for injecting the CDI beans using @Inject. Used only for beans that originate in Specification other
than Jakarta RESTful Web Services (such as Servlet). Such beans must not be produced with @Default qualifier so that
there is no ambiguity for the CDI injection.
Jakarta REST Spec. Section 11 demands HttpServletRequest, HttpServletResponse, ServletContext,
ServletConfig, and FilterConfig to be available by injections using @Context. For CDI, these
servlet classes are available with JerseyContext qualifier.
Note that @Context injection is not aware of the qualifier and using @Context in conjuction with
@JerseyContext will not work.
Can be used as e.g.
@Inject @JerseyContext //internal HttpServletRequest httpServletRequest;or as iterable of all
HttpServletRequest beans
@Inject @Any Instance<HttpServletRequest> httpServletRequests;
Copyright © 2007-2024,Oracleand/or its affiliates.All Rights Reserved. Use is subject to license terms.