Swagger在Wildfly 8服务器中不能用于表示Rest API

时间:2017-11-24 06:45:01

标签: jboss swagger resteasy wildfly-8

您好我已经集成了Swagger API来代表应用程序开发人员(Abdroid,iOS)的所有Rest Easy API。为此,我在wildfly服务器中的standalone.xml文件(/ opt / wildfly / standalone / configuration)中进行了一些配置,如下面给出的访问控制源设置

这里我在现有的底层模块中添加了过滤器和响应头。

<subsystem xmlns="urn:jboss:domain:undertow:1.2">
   <buffer-cache name="default"/>
     <server name="default-server">
         <http-listener name="default" socket-binding="http"/>
               <host name="default-host" alias="localhost">
                   <location name="/" handler="welcome-content"/>
                   <filter-ref name="server-header"/>
                   <filter-ref name="x-powered-by-header"/>
                   <filter-ref name="Access-Control-Allow-Origin"/>
                   <filter-ref name="Access-Control-Allow-Methods"/>
                   <filter-ref name="Access-Control-Allow-Headers"/>
              <filter-ref name="Access-Control-Allow-Credentials"/>
                    <filter-ref name="Access-Control-Max-Age"/>
                </host>
            </server>
            <servlet-container name="default">
                <jsp-config/>
                <websockets/>
            </servlet-container>
            <handlers>
                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
            </handlers>
            <filters>
                <response-header name="server-header" header-name="Server" header-value="WildFly/8"/>
                <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
                <response-header name="Access-Control-Allow-Origin" header-name="Access-Control-Allow-Origin" header-value="*"/>
                <response-header name="Access-Control-Allow-Methods" header-name="Access-Control-Allow-Methods" header-value="GET, POST, OPTIONS, PUT"/>
                <response-header name="Access-Control-Allow-Headers" header-name="Access-Control-Allow-Headers" header-value="accept, authorization, content-type, x-requested-with"/>
                <response-header name="Access-Control-Allow-Credentials" header-name="Access-Control-Allow-Credentials" header-value="true"/>
                <response-header name="Access-Control-Max-Age" header-name="Access-Control-Max-Age" header-value="1"/>
            </filters>
        </subsystem>

当我点击swagger url(http://host/application/dist/index.html)时,它正在本地计算机上运行,​​但当其他某台计算机点击同一个网址时,它显示的错误如“没有适当的访问控制 - 原点设置”。

0 个答案:

没有答案