0

I am trying to implement a code in our application which needs to monitor the existing registered resources in Jersey and then make decisions accordingly. I know that Jersey provides an application.wadl file which consists of all its resources at runtime.

My question is there a way to look at this file physically? Does Jersey create this file and store it somewhere in the app directory or is it in memory?

Is it possible to call any Jersey api internally on server to get the same info if this particular file is not available like that?

We are using the application class or runtimeconfig. Jersey auto discovers our resources marked with @Path annotation and we are running on Weblogic and Jersey 2.6.

Any help would be appreciated.

Thanks

  • There is no file. There is an internal model that get's processed by JAXB on request. – Paul Samsotha Jan 27 '16 at 02:56
  • Thanks for the reply. Is there an internal api which Jersey exposes to get this same info on the server run time without having to make a request ? – AnkitPatel29 Jan 27 '16 at 19:02
  • Here is the [resource class](https://github.com/jersey/jersey/blob/master/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlResource.java) that serves up the wadl information. You can see that injects a `WadlApplicationContext` and that is where it gets the `Application`. which is that class that holds all the wadl info. to be serialized. I would try and inject the `WadlApplicationContext` and try to get the `Application`. – Paul Samsotha Jan 28 '16 at 00:23
  • Not sure your complete use case, but aside from the wadl, [this](https://jersey.java.net/documentation/latest/resource-builder.html#d0e11315), [this](http://stackoverflow.com/q/29654883/2587435), and [this](http://stackoverflow.com/a/34990765/2587435) might interest you, if you are trying to get information about registered resources – Paul Samsotha Jan 28 '16 at 14:58

1 Answers1

1

No WADL file is created on disk. It is created dynamically upon URL request.

http://[host]:[port]/[context_root]/[resource]/application.wadl

E.g.:

http://localhost:8080/rest-jersey/rest/application.wadl

Also, I've found it very useful to inspect the WADL with the SoapUI tool, which can read your WADL from a URL and parse the resources into a tree format. See pic below.

enter image description here

Peter Tarlos
  • 731
  • 10
  • 13