Question

The resource class is defined like this:

@Path("v1")
@Produces({MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class RestApi {

And I have a method defined like this:

@GET
@Path("patients")
public String patients(

When I run the maven command to run the enunciate doc goal, the generated wadl looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<wadl:application xmlns:wadl="http://wadl.dev.java.net/2009/02" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <wadl:doc xmlns:enunciate="http://enunciate.codehaus.org/" enunciate:generatedBy="Enunciate-1.27"/>
  <wadl:grammars>
    <wadl:include href="ns0.xsd"/>
  </wadl:grammars>
  <wadl:resources base="http://localhost:8888/app/api">
...
    <wadl:resource path="/rest/v1/patients">
      <wadl:method name="GET">

Where is this "/rest/" coming from in the resource path? I've searched everywhere in my project and there's no reference to it.

Here's my enunciate.xml config file:

<enunciate label="Rest API"
           xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.28.xsd"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <deployment host="localhost:8888" context="/app/api"/>

</enunciate>
Was it helpful?

Solution

Apparently "/rest" is just a default value. You can change it to nothing by adding this to your enunciate.xml file:

<services>
     <rest defaultRestSubcontext="/" />
</services>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top