2 Replies Latest reply: Apr 11, 2011 11:41 AM by Randall Hauch RSS

Usage of resteasy.servlet.mapping.prefix

Tom Seidel Newbie

Hi,

 

If you want the REST interface is handling only requests on a special URL, you have to specify a the resteasy.servlet.mapping.prefix in your web.xml, for example:

 

web.xml

<context-param>

     <param-name>resteasy.servlet.mapping.prefix</param-name>

     <param-value>/rest</param-value>

  </context-param>

...

<servlet-mapping>

    <servlet-name>Resteasy</servlet-name>

    <url-pattern>/rest/*</url-pattern>

  </servlet-mapping>

...

  <security-constraint>

    <display-name>ModeShape REST</display-name>

    <web-resource-collection>

      <web-resource-name>RestEasy</web-resource-name>

      <url-pattern>/rest/*</url-pattern>

    </web-resource-collection>

...

 

The result is that a GET on http://localhost:8080/ModeShapeRest/rest/ is handled by Resteasy, while http://localhost:8080/ModeShapeRest/myOwnServlet/ is not. If I GET now the URL http://localhost:8080/ModeShapeRest/rest/my-repository I get the following response:

 

{"tomcat":{"workspace":{"name":"tomcat","resources":{"query":"\/ModeShapeRest\/my-repository\/tomcat\/query","items":"\/ModeShapeRest\/my-repository\/tomcat\/items"}}}}

 

Is this response correct? - I expected that the query and items properties can be reused to build the path to items within the repository, so I'm missing the "rest"-segment in the items and query properties. Or is this the wrong way to limit all Resteasy processing to the /rest segment?

 

Any ideas?

 

Thanks,

Tom