2017-04-19 36 views
1

我在servicemix中將angular2 webapp部署爲war文件。這使得該應用在localhost:8181/angular2webapp url上運行。我爲REST請求安裝了一個包,它基本上是一個駱駝組件。在Apache ServiceMix中啓用CORS戰爭

<cxf:rsServer id="rsServer" address="http://localhost:9090" 
    serviceClass="com.mypackage.class.MyClass" /> 

現在在使用本angular2應用程序,我得到

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8181' is therefore not allowed access. 

我試圖用我的路線.setHeader("Access-Control-Allow-Origin", constant("*")),但它似乎並沒有工作。 任何人都可以請幫我解決這個問題嗎?

回答