如何在Websphere Application Server Liberty Profile V8.5中定义CORS [英] How to define CORS in Websphere Application Server Liberty Profile V8.5

查看:555
本文介绍了如何在Websphere Application Server Liberty Profile V8.5中定义CORS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Websphere应用服务器Liberty Profile V8.5中应用跨源资源共享(CORS)?



我搜索了红皮书,找到IBM提到的任何事情。
http://www.redbooks.ibm.com/abstracts/sg248076.html?打开



这是不是我可以像这样以编程方式设置标题:

  Access-Control-Allow-Origin:* 

http://enable-cors.org/server.html


<您必须在 WEB-INF / lib 文件夹中添加以下jar:





web.xml 中,您必须添加以下规则:

 < filter> 
< filter-name> CORS< / filter-name>
< filter-class> com.thetransactioncompany.cors.CORSFilter< / filter-class>
< / filter>
< filter-mapping>
< filter-name> CORS< / filter-name>
< url-pattern> / *< / url-pattern>
< / filter-mapping>


Is it possible to apply cross-origin resource sharing (CORS) in a Websphere Application Server Liberty Profile V8.5 ?

I searched the redbook but couldn't find IBM mention anything about it. (http://www.redbooks.ibm.com/abstracts/sg248076.html?Open)

It's not possibility for me to set the headers programmatically like this:

Access-Control-Allow-Origin: *

(http://enable-cors.org/server.html)

解决方案

You have to add following jars to your WEB-INF/lib folder:

In your web.xml you have to add following rules:

<filter>
    <filter-name>CORS</filter-name>
    <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
</filter>
<filter-mapping>
        <filter-name>CORS</filter-name>
        <url-pattern>/*</url-pattern>
</filter-mapping>

这篇关于如何在Websphere Application Server Liberty Profile V8.5中定义CORS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆