すべての構成が XML ファイルに保存されているプロジェクトに取り組んでいます。このプロジェクトの小さな部分から始めようとしています。そのために Restlet を使用します。基本的に、私がやりたいことは、 のサブクラスをいくつか作成することですServerResource
。
アノテーションを使用して、どのクラス メソッドがどの HTTP メソッドを受け入れるかを指定することもできますが、それ以外のすべてに XML を使用しているため、少し気が進まないのです。HTTP メソッドを Restlet リソースのクラス メソッドにマップする方法はありますか?
Spring と Restlet の実際の統合は XML のみ (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" />
上記の構成に追加して、HTTP メソッドをクラス メソッドにマップする方法はありますか?