我有一个jetty服务器来运行我的Web服务.最近我开发了一个使用Web服务的程序并遇到了Access-Control-Allow-Origin问题.
如何将Access-Control-Allow-Origin:*添加到jetty嵌入式服务器.
下面是webappcontext代码.
public WebAppContext buildWebAppContext(){
webAppContext = new WebAppContext();
webAppContext.setDescriptor(webAppContext + "/WEB-INF/web.xml");
webAppContext.setResourceBase(".");
webAppContext.setContextPath("/posApplication");
webAppContext.setAttribute("webContext", webAppContext);
return webAppContext;
}
Run Code Online (Sandbox Code Playgroud)
谢谢.