Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable WADL generation on Jersey 1.19.1

Tags:

java

jersey

wadl

I'm using Jersey 1.19.1 on a Web project with Java+Jboss.

Everytime I request something from the Webservice, it shows this entry on the server.log:

ERROR [STDERR] com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class java.lang.String

Searching on how to disable it, I've found this:

    <init-param>
        <param-name>com.sun.jersey.config.server.wadl.DisableWADL</param-name>
        <param-value>true</param-value>
    </init-param>

But it didn't changed a thing for me.

How can I disable WADL so this annoying message doesn't show up anymore?

Here's the full entry for the 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>
like image 963
doughaase Avatar asked Sep 11 '25 19:09

doughaase


2 Answers

Figured it out: on version 1.19.x, the param name needs to be like this:

com.sun.jersey.config.feature.DisableWADL
like image 103
doughaase Avatar answered Sep 14 '25 08:09

doughaase


Using ApplicationConfig disable using below property

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;
        }
}

Can you check may be instead of DisableWADL disableWadl will work.

like image 40
gladiator Avatar answered Sep 14 '25 08:09

gladiator