How to use JavaWS in action/annotation?


(Thibault Meyer) #1

Hello,

Sometime we have to check if the current session Id still valid on the SSO via a simple HTTP request. How to have an instance of JavaWS client on an action / annotation since Play.current() was deprecated ? We are using Play 2.6.15

Thanks


#2

I’ve had success with simply injecting an instance to the constructor of the action.

So any class that extends Action.Simple, you can create a constructor, annotate this constructor with @javax.inject.Inject and provide a WSClient instance as a parameter(or if you have a custom class that orchestrates it, use that).

That works for me, anyways.


(Thibault Meyer) #3

Nice.

thank you