Jersey:在不使用 web.xml 文件的情况下禁用 OPTIONS 请求的自动 Wadl 生成?

Jersey: Disable automatic Wadl Generation for OPTIONS request without using a web.xml file?

我想完成与这个问题相同的事情:Disable automatic Wadl Generation for OPTIONS request, but we don't have a web.xml file. We also make use of ResourceConfig, where the getProperties method is final, so I cannot override that as suggested in 。我试过在扩展 ResourceConfig 的 class 中调用 property("com.sun.jersey.config.feature.DisableWADL", "true");,但这没有用。

如何禁用 WADL?

我们正在使用 Jersey 2.25.1。我尝试阅读 the Jersey docs on WADL,但无法阅读该页面,因为弹出错误消息说 syntaxhighlightingerror/xml 笔刷。

你用错了属性。您在 com.sun.jersey 中看到的任何内容都将用于 Jersey 1.x。你想要的是jersey.config.server.wadl.disableWadl,或者更好的是只使用常量。

ServerProperties.WADL_FEATURE_DISABLE