24 Jun 19:57
Nested resource routing
<webpost <at> tigris.org>
2009-06-24 17:57:28 GMT
2009-06-24 17:57:28 GMT
I want to be able to nest arbitrarily deep items in a hierarchical format, and route them based on URI
patterns in Spring. For example, I can have objects nested like:
/branches/{branch_id}/
/branches/{branch_id}/leaves/{leaf_id}/
/branches/{branch_id}/buds/{bud_id}/
However, the branches can alos be nested, like this:
/branches/{branch_id}/
/branches/{branch_id}/branches/{branch_id}/leaves/{leaf_id}/
/branches/{branch_id}//branches/{branch_id}/branches/{branch_id}/buds/{bud_id}/
etc.
I have my Spring application context set up like this to handle the root instances of "branches":
<bean name="root" class="org.restlet.ext.spring.SpringRouter">
<constructor-arg ref="application" />
<property name="attachments">
<map>
<entry key="/branches/{branch_id}"
value="com.example.api.resource.BranchResource"/>
<entry key="/branches/{branch_id}/leaves/{leaf_id}/"
value="com.example.api.resource.LeafResource"/>
<entry key="/branches/{branch_id}/buds/{bud_id}/"
value="com.example.api.resource.budResource"/>
</map>
</property>
</bean>
<!-- Spring Application -->
<bean id="application" class="org.restlet.Application">
<property name="name" value="exampleAPI"></property>
</bean>
I would like to be able to build my URI patterns so that I can handle the cases where the branches are nested. Is
this even possible?
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2365046
RSS Feed