2

I want to accomplish the same thing as this question: Disable automatic Wadl Generation for OPTIONS request, but we don't have a web.xml file. We also make use of ResourceConfig, where the getProperties method is final, so I cannot override that as suggested in other questions. I've tried calling property("com.sun.jersey.config.feature.DisableWADL", "true"); in our class that extends ResourceConfig, but that didn't work.

How can I disable WADL?

We're using Jersey 2.25.1. I tried reading the Jersey docs on WADL, but was unable to read the page because of a popup error message saying something about syntaxhighlightingerror/xml brush.

L42
  • 3,052
  • 4
  • 28
  • 49

1 Answers1

7

You're using the wrong property. Anything you see with com.sun.jersey is going to be for Jersey 1.x. The one you want is jersey.config.server.wadl.disableWadl, or better yet just use the constant.

ServerProperties.WADL_FEATURE_DISABLE

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
  • Thank you! Would you happen to know how I can get the response type to be `application/json` (as a default for everything, really)? Right now, after disabling WADL, it's set to `text/plain`. – L42 Nov 03 '17 at 14:59
  • I don't know. I have never done it. One thing you can try is to use a [response filter](https://jersey.github.io/documentation/latest/filters-and-interceptors.html) and cast the ContainerResponseContext to ContainerResponse and use it's setMediaType. But that will probably be more than just a "default" but actually a hard override of any existing media type. – Paul Samsotha Nov 03 '17 at 15:32