Your proposed refactoring sounds fine. It doesn't move the documentation very far away from the code, since the helper class can live in the same package as the two ServerResource impls. It might make even more sense to move the helper code into a common superclass of both ServerResource impls.
Trying to use one class for two different kinds of resource is a dicey proposition even without WadlApplication. It's the Restlet analogue of writing a switch statement instead of taking advantage of polymorphism. --tim On Fri, Feb 10, 2012 at 11:01 AM, Bjorn Roche <[email protected]> wrote: > hey there, > > I am trying to use the wadl extensions to document my restlet api, but I'm > ending up with some weird results. Here's why: > > several parts of my api look something like this: > > /object > /object/{objectid} > > and I use the same serverresource to handle both of them: > > router.attach( "/object", ObjectResource.class ); > router.attach( "/object/{objectid}", ObjectResource.class ); > > ObjectResource then handles the calls differently based on the > presence/absence of the objectid attribute, but I don't see a way to > document such behavior. In the docs, I end up with two entries, one for > /object and one for /object/{objectid} that are both identical, and I don't > see a way to distinguish in my describe* type calls. Is there some way > around this? The only thing I can think of is to refactor my code to > > ObjectResource -- which handles and documents /object > ObjectWithIdResource -- which handles and documents /object/{objectid} > ObjectResourceHelper -- which does the work > > But this goes contrary to keeping the documentation close to the code. > > Am I missing something? > > thanks, > > bjorn > > ------------------------------------------------------ > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2920673 > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2920674

