我在使用Java + Jboss的Web项目中使用Jersey 1.19.1。
每当我从Webservice请求某些内容时,它会在server.log上显示此条目:
ERROR [STDERR] com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class java.lang.String
搜索如何禁用它,我发现了这个:
<init-param>
<param-name>com.sun.jersey.config.server.wadl.DisableWADL</param-name>
<param-value>true</param-value>
</init-param>
但它并没有改变我的想法。
如何禁用WADL,以免这个烦人的消息再次出现?
这是servlet的完整条目:
<servlet>
<servlet-name>windi-mobile-service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.server.wadl.DisableWADL</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>br.com.altimus.mobile.service</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
答案 0 :(得分:3)
想出来:在版本1.19.x上,param名称必须如下:
com.sun.jersey.config.feature.DisableWADL
答案 1 :(得分:0)
使用ApplicationConfig禁用使用以下属性
jersey.config.server.wadl.disableWadl =“true”
@ApplicationPath("/rest")
public class ApplicationConfig extends Application {
@Override
public Map<String, Object> getProperties() {
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("jersey.config.server.provider.packages", "com.study.rest");
properties.put("jersey.config.server.wadl.disableWadl", "true");
properties.put("jersey.config.server.provider.classnames","org.glassfish.jersey.media.multipart.MultiPartFeature");
properties.put(CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER,"0");
System.out.println("getProperties:-> CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER_SERVER :" + CommonProperties.getValue(properties,CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER,String.class));
return properties;
}
}
您是否可以检查 DisableWADL disableWadl 是否有效。