Page 1 of 1

About Question enthuware.ocejws.v6.2.316 :

Posted: Wed Nov 16, 2016 1:59 pm
by sttaq0442
Where can I find all the supported types that go with either @Context or @Resource?

Also, for example WebServiceContext is injected using @Context, can it be injected using @Resource? or vice versa?

Thanks

Re: About Question enthuware.ocejws.v6.2.316 :

Posted: Wed Nov 16, 2016 2:53 pm
by fjwalraven
@Resource is defined in JSR-250.
@Context in the Jersey documentation.

The WebServiceContext is described in JAX-WS 2.x:
The javax.annotation.Resource annotation defined by JSR-250 is used to request injection of the WebServiceContext
Regards,
Frits

Re: About Question enthuware.ocejws.v6.2.316 :

Posted: Fri Jun 15, 2018 12:25 pm
by witek_m
Hello, I'd like to make sure: every Object from "ServletConfig, ServletContext, HttpServletRequest and HttpServletResponse." except ServletConfig and ServletContext could be injected by @Context in this case?

Re: About Question enthuware.ocejws.v6.2.316 :

Posted: Sat Jun 16, 2018 8:40 am
by fjwalraven
from the JAX-RS v1.1 specs (important don't read any newer version):
The @Context annotation can be used to indicate a dependency on a Servlet-defined resource. A Servlet- based implementation MUST support injection of the following Servlet-defined types: ServletConfig, ServletContext, HttpServletRequest and HttpServletResponse.
Regards,
Frits