Disable WADL generation on Jersey 1.19.1
Asked Answered
G

3

4

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>
Granniah answered 10/4, 2017 at 16:12 Comment(0)
G
5

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

com.sun.jersey.config.feature.DisableWADL
Granniah answered 19/4, 2017 at 17:32 Comment(0)
V
3

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.

Vociferate answered 11/4, 2017 at 9:14 Comment(4)
Yes, partially correct! I only had to add "com." at the start of the parameter-name that you used (on web.xml), and it worked. Thanks.Granniah
That might be due to jersey version difference.Vociferate
Oops, my mistake: it didn't worked... I was looking at a different log file. I tried with com.sun.jersey.config.server.wadl.disableWadl and jersey.config.server.wadl.disableWadl, and both didn't worked...Granniah
This worked for anyone? Not working for me.Douty
T
1

to disable wadl generation disableWadl must be set to true. But also the property allowSystemPropertiesProvider should be set

jersey.config.allowSystemPropertiesProvider=true jersey.config.server.wadl.disableWadl=true 
Towner answered 31/5, 2023 at 11:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.