I am answering my own question to share what I learned.
Define a subclass of WadlGeneratorConfig,
where you define a WadlGenerator grammar that does nothing.
package com.try1234;
import java.util.List;
import com.sun.jersey.api.wadl.config.WadlGeneratorConfig;
import com.sun.jersey.api.wadl.config.WadlGeneratorDescription;
import com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport;
public class PlughWadlGeneratorConfig extends WadlGeneratorConfig
{
@Override
public List<WadlGeneratorDescription> configure()
{
return
generator(WadlGeneratorGrammarsSupport.class)
.prop("grammarsStream", "application-grammars.xml")
.prop("overrideGrammars", true)
.descriptions();
}
}
Define an empty application-grammars.xml
<grammars xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xi="http://www.w3.org/1999/XML/xinclude">
</grammars>
Make sure it is on the classpath for the webapp, e.g., in a Maven-style directory structure, the file resides in target/classes.
Modify your web.xml to use the subclass of WadlGeneratorConfig. Add these lines:
<init-param>
<param-name>com.sun.jersey.config.property.WadlGeneratorConfig</param-name>
<param-value>com.try1234.PlughWadlGeneratorConfig</param-value>
</init-param>
Load your web application, the following GET on this URL should work:
https://localhost/plugh/application.wadl
This solution works for Jersey 1.18.
Note: The rationale for the empty grammars element is that
I had run into https://java.net/jira/browse/JAXB-411 ; by not producing any , I was able to avoid the IllegalArgumentException.
References:
http://razvancaraghin.blogspot.com/2014/01/html-documentation-for-your-rest.html
Troubles with WADL / generated XSD using Jersey with a contract-first approach