Using RegistryStatsResource
With RESTEasy (supplied with WildFly) you can add the following to web.xml :
<context-param> <param-name>resteasy.resources</param-name> <param-value>org.jboss.resteasy.plugins.stats.RegistryStatsResource</param-value> </context-param>
And then request the following url:
http://[hostname]:[port]/[context]/[api-path]/resteasy/registry
Such an endpoint can create XML and JSON content. Just add the Accept header to the request with the desired media type:
application/xmlapplication/json
Source code verification
If you're interested in source code to create your own implementation, check out the RegistryStatsResource class in GitHub .
Below is the most significant part of the source code (it is specific to RESTEasy):
ResourceMethodRegistry registry = (ResourceMethodRegistry) ResteasyProviderFactory.getContextData(Registry.class); for (String key : registry.getBounded().keySet()){ List<ResourceInvoker> invokers = registry.getBounded().get(key); for (ResourceInvoker invoker : invokers) { if (invoker instanceof ResourceMethodInvoker) { ResourceMethodInvoker rm = (ResourceMethodInvoker) invoker;
Swagger may be an alternative
Depending on your requirements, you can use Swagger to document your API. It comes with a set of annotations to describe your REST endpoints.
Then use the Swagger UI to provide live documentation for your API.
Note: As of February 2017, it looks like the RegistryStatsResource class is completely undocumented. Sometimes I discovered this when I was digging into the RESTEasy source code for debugging purposes. Also, I found this JBoss EAP issue that tracks missing documentation for this class.
source share