I'm working on a project where all configurations are kept in XML files. I'm about to begin on a smaller part of this project, and I'll be using Restlet for that. Basically, what I'd like to do is to create a few subclasses of ServerResource
.
I could use annotations to specify which class methods accepts which HTTP methods, but since I'm using XML for everything else I'm a bit reluctant. Is there a way to map HTTP methods to class methods for Restlet resources?
The actual integration between Spring and Restlet is XML only (webcontext.xml) :
<bean id="apiComponent" class="org.restlet.ext.spring.SpringComponent">
<property name="defaultTarget" ref="apiAppliction" />
</bean>
<bean id="apiAppliction" class="com.company.api.ApiApplication">
<property name="inboundRoot" ref="router" />
</bean>
<!-- Define the router -->
<bean name="router" class="org.restlet.ext.spring.SpringBeanRouter" />
<!-- Define all the routes -->
<bean name="/track/{trackId}" class="com.company.api.resource.TrackResource" scope="prototype" autowire="byName">
<constructor-arg index="0" ref="serviceFactory"/>
</bean>
<bean name="/album" class="com.company.api.resource.AlbumResource" scope="prototype" autowire="byName"/>
<bean name="/album/{albumId}/tracks" class="com.company.api.resource.AlbumTracksResource" scope="prototype" autowire="byName" />
Is there a way I can add to the above configuration and map HTTP methods to class methods?