-
1. Re: Setting a context variable in RestEasy Implementation
kcbabo Dec 5, 2014 8:44 AM (in response to ajagnade)Context injection is only supported for CDI bean services - you can't inject Context into a context mapper.
-
2. Re: Setting a context variable in RestEasy Implementation
ajagnade Dec 6, 2014 2:56 AM (in response to kcbabo)Hi Keith,
Thanks for reply, Keith. But I am not trying to do context injection in context mapper. It is already done in Restful Service Implementation from which I am retrieving values that are set in mapFrom method of context mapper. I am just trying to send a parameter from Restful web service implementation class to context mapper through response. So that I can get that parameter in mapTo method and set it as Http Response Status. I was trying to set property in context at restful web service implementation class which resulted in below error.
<errorMessage>SWITCHYARD030422: Illegal call to get the SwitchYard Context; must be called within the execution of an ExchangeHandler chain.</errorMessage>
Somehow I was not willing to send it through return parameter of Restful service implementation class as it is already been used.
Thanks
Amit
-
3. Re: Setting a context variable in RestEasy Implementation
ajagnade Jan 7, 2015 2:37 AM (in response to ajagnade)Hi Keith,
Got Problem solved. I have mention return type of method in web service Implementation class as java.lang.Object. Created javax.ws.rs.core.Response object as per your HTTP response status and set headers and body as per requirement and returning same in return type. Now this sets response with custom header variables and body.
One more thing I would like to mention here is that if I set return type of method as javax.ws.rs.core.Response, it will not show any custom header variable in browser. But when I make it as object, it will show all custom headers I have added.
Thanks for your help.
Amit.