-
1. Re: How to implement cross domain resource sharing in switch yard
tadayosi Feb 5, 2016 11:57 AM (in response to ramandeep)Hi Raman,
To my knowledge, there is currently no handy feature to enable CORS on SwitchYard rest endpoints unfortunately. Please see SWITCHYARD-2460.
That said, if you can live with using the native web gateway approach for REST endpoints instead of RESTEasy bindings, then you can leverage the cool Jetty CORS filter implementation in web.xml or whatever CORS filter impls you prefer.
Hope that helps.
-- Tadayoshi
-
2. Re: How to implement cross domain resource sharing in switch yard
ramandeep Feb 7, 2016 8:01 AM (in response to tadayosi)Hi Tadayoshi,
I used RestEasyContext mapper class to set the response headers , so from server we set were able to set the below
target.addHeader("Access-Control-Allow-Origin", "*") . It worked.
Regards,
Ramandeep
-
3. Re: How to implement cross domain resource sharing in switch yard
tadayosi Feb 8, 2016 11:26 PM (in response to ramandeep)Hi Raman,
It's great that it worked for you. However, unfortunately I doubt that your context mapper approach still works under more complex CORS preflight scenarios [1]; the SwitchYard RESTEasy endpoint should reject HTTP "Options" requests even before they reach the context mapper. That's the exact reason I filed SWITCHYARD-2460.
It's okay so long as CORS preflight requests aren't required, but as soon as they are needed it should break. Give it a try.
[1] Cross-origin resource sharing - Wikipedia, the free encyclopedia
-- Tadayoshi
-
4. Re: How to implement cross domain resource sharing in switch yard
ramandeep Feb 11, 2016 12:53 AM (in response to tadayosi)Thanks Tadayoshi , yes your right about preflight requests.
I have another question regarding Switchyard . I wanted to ask you is the switchyard service extensible ?
Is there some behavior like Java's Inheritance feature in switchyard ?. From one I got to know is we have <extensions> tag through which we can extend data formats and gateway bindings ?
E.g if we have exposed a service as SOAP or Rest binding can we extend it ?
-- Raman
-
5. Re: How to implement cross domain resource sharing in switch yard
tadayosi Feb 11, 2016 8:30 PM (in response to ramandeep)Hi Raman,
I have no ideas about the extensibility of SwitchYard services, but I doubt SwitchYard has such a feature. Perhaps it's better to ask it in a new forum thread, and other experts might help you on that question.
-- Tadayoshi