Hi. I've a working app that serve a REST API where the compoenent is
configured like
<bean id="component" class="org.restlet.ext.spring.SpringComponent"
init-method="start" destroy-method="stop">
<property name="server" ref="server" />
<property name="defaultTarget" ref="apiApplication" />
</bean>
This works, apiApplication is a Application bean with a SpringBeanRouter as
inboundRoot property. Now I changed with
<bean id="component" class="org.restlet.ext.spring.SpringComponent"
init-method="start" destroy-method="stop">
<property name="server" ref="server" />
<!-- <property name="defaultTarget" ref="apiApplication" /> -->
<property name="defaultHost" ref="virtualHost"></property>
</bean>
This is because I want to serve under /api the api and under /console a
browsable interface.
So I comment the defaultTarget and add a property to define a custom
defaultHost. That is defined as
<bean id="virtualHost" class="org.restlet.ext.spring.SpringHost">
<constructor-arg ref="component" />
<property name="attachments">
<map>
<entry key="/">
<ref bean="apiApplication" />
</entry>
</map>
</property>
</bean>
Now I expect this config to be identical to the old one. But it is not. In
my test, I get a 404 where before there was a correct answer.
I see that Component.getDefaultHost() indeed returns my bean, but on / I
still get a 404.
What can be the problem? Is this a right way to do this?
I expect my final config to be with two entries like:
<map>
<entry key="/api">
<ref bean="apiApplication" />
</entry>
<entry key="/console">
<ref bean="consoleApplication" />
</entry>
</map>
both of them are fifferend restlet Application, with a different
inboundRouter and a specific Authenticator (first one is HTTP, second is
based on cookies).
--
Daniele Dellafiore
http://danieledellafiore.net
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2725072