24 Jun 18:40
Hierarchical URI routing w/ Spring
<webpost <at> tigris.org>
2009-06-24 16:40:02 GMT
2009-06-24 16:40:02 GMT
I have a hierarchy of container type objects that I want to be able to use.
ex:
/branch/{branch_id}/
/branch/{branch_id}/branch/{branch_id}/
/branch/{branch_id}/branch/{branch_id}/branch/{branch_id}/
etc.
This structure can be arbitrarily deep, and each branch can have other items attached.
ex:
/branch/{branch_id}/
/branch/{branch_id}/branch/{branch_id}/leaves/{leaf_id}/
/branch/{branch_id}/branch/{branch_id}/buds/{bud_id}/
etc.
I want to be able to configure this using the Spring integration. I have this:
<bean name="root" class="org.restlet.ext.spring.SpringRouter">
<constructor-arg ref="application" />
<property name="attachments">
<map>
<entry key="/branch/{branch_id}"
value="com.example.api.resource.BranchResource"/>
<entry key="/branch/{branch_id}/leaves/{leaf_id}/"
value="com.example.api.resource.LeafResource"/>
<entry key="/branch/{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>
which handles the root cases, but does not handle nested branches. Is there a way to construct the URI
patterns to look at this arbitrarily deep hierarchy, but still get teh correct leaf and bud resources?
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2365026
RSS Feed