Paul Sandoz wrote:
> Hi Farrukh,
>
> Could you provide some example URI or URI templates? as that would 
> help me understand better ways to model things.
Here are some samples:
    * Get content of root folder of registry: /
    * Get an object in the root folder using its canonical path: /images
    * Get a leaf object in the folder containment using its canonical
      path: /images/summerVacation/2007/wellfleet/NewcombsHollowBeach.png
Above should seem fairly obvious and simple I hope.
>
> Below is a general approach to browsing directories or files:
>
> For example:
>
>   public class FileBrowser {
>     private String path;
>
>     public FileBrowser(String path) { this.path = path }
>
>     @GET public File getFile() {
>       String absolutePath = getAbsolutePath(path);
>       return new File(absolutePath);
>     }
>   }
>
>
>   @Path("/")
>   public class MyResource() {
>     @Path(value="browse/{path}", limited=false)
>     public FileBrowser fileBrowser(@UriParam("path") String path) {
>       return new FileBrowser(path);
>     }
>   }
>
> So GET request to /browse/a/b/c/d will create a FileBrowser to serve 
> state for "a/b/c/d". The limited=false means that all the URI path is 
> consumed, if you set it to true then only a path segment is consumed.
In my case I do not really have files and folders. The Registry uses 
that familiar metaphor but what it really has are RegistryObjects 
(files) and RegistryPackages (folders) which are stored in a database. 
But your example is helpful.
There are some additional complexities. I need to support option to 
return response in specified formats etc.
I am thinking of modelling all this with a RegistryObjectResource and a 
RegistryPackageResource which extends RegistryObjectResource.
Thanks again for getting me started and for being a very responsive team.
>
> Based on the path you can return different objects with different 
> behaviors e.g. you could return a DirBrowser or FileBrowser based on 
> if the path points to a file or directory. In general it allows for 
> very dynamic behavior based on the URI path hierarchy.
>
> Hope this helps,
> Paul.
>
> Farrukh Najmi wrote:
>>
>> Dear colleagues,
>>
>> I am new to Jersey and like what I see very much and plan to use it 
>> in my project's (ebXML RegRep 4.0 implementation) REST interface.
>>
>> My first REST interface needs to allow browsing of the content in the 
>> ebXML RegRep using a familiar file/folder hierarchy where the URL path
>> encodes the composition hierarchy structure of the objects in the 
>> registry.
>>
>> I see in archives a long thread about resources and sub-resources:
>>
>> <https://jersey.dev.java.net/servlets/BrowseList?list=users&by=thread&from=976123> 
>>
>>
>> Being new to Jersey I do not grok it all yet. However, I have found 
>> the Bookmarks example and looking at it
>> for inspiration. Are there any closer examples than the Bookmarks one 
>> for my use case? Thanks for sharing any samples
>> pointers or advice.
>>
>
-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com