• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JAX-RS cannot inject @Resource WebServiceContext

 
Bartender
Posts: 2440
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a servlet-based JAX-RS example:


When the client connect to this get method using user name as john, the output on the server is:
INFO: GET students/{studentId} [studentId=13005529]
INFO: User principal name injected from @Context security context :john
INFO: Web service context is null.

Obviously, @Context can inject the security context which contains john as the user principal.
But, I think @Resource WebServiceContext only works for JAX-WS service , not JAX-RS service. The WebServiceContext injected is null.
 
Creator of Enthuware JWS+ V6
Posts: 3412
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Himai Minh wrote:But, I think @Resource WebServiceContext only works for JAX-WS service , not JAX-RS service. The WebServiceContext injected is null.


Correct: the WebServiceContext is only for JAX-WS.
 
I don't like that guy. The tiny ad agrees with me.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic