Dropwizard 0.8.0 WADL支持

时间:2015-03-09 09:08:14

标签: jersey-2.0 dropwizard wadl

可以在Dropwizard 0.7.1中配置Wadl,如下所示:

environment
        .jersey()
        .getResourceConfig()
        .getProperties()
        .put(ResourceConfig.FEATURE_DISABLE_WADL, Boolean.FALSE);//Create WADL

如何在Dropwizard 0.8.0中设置它

2 个答案:

答案 0 :(得分:6)

属性键的位置已更改且地图无法修改 - 因此您需要使用addProperties方法:

import org.glassfish.jersey.server.ServerProperties;
...
Map<String, Object> properties = new HashMap<>();
properties.put(ServerProperties.WADL_FEATURE_DISABLE, false);
environment.jersey().getResourceConfig().addProperties(properties);

从0.8.0 Dropwizard is disabling WADL generation开始,您需要明确启用它。

答案 1 :(得分:0)

import org.glassfish.jersey.server.ServerProperties;
...
environment.jersey().disable(ServerProperties.WADL_FEATURE_DISABLE);