Hi, and thanks for your help. I think I'm finally starting to get a
grip on how an application is supposed to be organized. The solution
looks like this:

>From web.xml:

<servlet>
        <servlet-name>restservice</servlet-name>
        
<servlet-class>com.noelios.restlet.ext.spring.RestletFrameworkServlet</servlet-class>
        <init-param>
                <param-name>targetRestletBeanName</param-name>
                <param-value>guard</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
</servlet>

And then in my spring context file (restservice-servlet.xml):

<beans>

        <bean id="guard" class="com.example.rest.MyGuardFilter">
                <constructor-arg ref="someUserDao"/>
                <property name="next" ref="root"/>
        </bean>
        
        <bean id="root" class="org.restlet.ext.spring.SpringRouter">
                <property name="attachments">
                        <map>
                                ...
                        </map>
                </property>
        </bean>

        ...other beans...

</beans>

I realise that I could name the change the bean IDs so that I don't
have to override the default of the RestletFrameworkServlet but I like
that the guard is pointed at explicitly.

Best Regards
Gabriel Falkenberg


On Tue, Oct 21, 2008 at 2:36 PM, Kevin Conaway <[EMAIL PROTECTED]> wrote:
> Both the Application class and SpringRouter classes are instances of Restlet
> so I don't believe you need an Application instance.
>
> Wherever you have injected your SpringRouter, simply inject your Guard class
> with the SpringRouter as the "next" property.
>
> Kevin
>
> On Mon, Oct 20, 2008 at 8:19 AM, Gabriel Falkenberg
> <[EMAIL PROTECTED]> wrote:
>>
>> Hi
>>
>> I wonder if there is a special way to add guards/filters to a Restlet
>> application when using the Spring extension. My application does not
>> seem to have a separate Application class, only a SpringRouter. Is an
>> Application class required for this?
>>
>> Best Regards
>> Gabriel Falkenberg
>
>

Reply via email to