1

我有一个使用 enunciate 记录的 REST 服务。我的端点都没有提供应用程序/xml 输出。我仍然得到类似于这里的文档: http: //enunciate.codehaus.org/wannabecool/step4/el_persona_persona.html(示例 XML)和这里:http ://enunciate.codehaus.org/wannabecool/step4/persona_persona.html ( XML 属性)。

我只提供带有 JSON 输出的服务(不要问我为什么,这不是我的决定)。因此,我不需要 XML 输出,因为它会向界面用户建议可以将界面与 XML 数据一起使用。

您可以在下面找到我的 enunciate.xml。您可以看到我已经尝试通过仅将 content-type application/json 放入 content-types 并放入 xml/disabled=true 来禁用 XML 生成:

<?xml version="1.0" encoding="UTF-8"?>
<enunciate label="blubb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.28.xsd">
    <deployment protocol="https" host="blubb" context="blubbService/v1"/>
    <namespaces>
        <namespace id="api" uri="https://blubb.com/blubbService/v1/"/>
    </namespaces>
    <services>
        <rest>
            <content-types>
                <content-type type="application/json" id="json" />
            </content-types>
        </rest>
    </services>
    <modules>
        <docs splashPackage="blubbService.api" title="blubb API" copyright="blubb"/>
        <jersey useSubcontext="false" usePathBasedConneg="false"/>
        <xml disabled="true"/>
        <jaxws disabled="true" />
        <jaxws-client disabled="true" />
        <jaxws-ri disabled="true" />
    </modules>
</enunciate>

如何正确停用 XML 文档?

4

1 回答 1

4

尝试将以下内容应用于您的enunciate.xml配置文件:

  <enunciate>
    ...
    <modules>
      ...
      <docs includeExampleXml="false">
      ...
于 2014-04-09T21:45:54.830 回答