Search code examples
springurirestlet

restlet URI mapping issue, how to map "others" path


I used restlet with spring to provide RESTful service.

I want to complete the following function:

for my URI, I will have a Resource to handle it.

for other URI, I have a simple Resource to forward it to another system to handle it.

My problem is "how to config "other" URI in applicationContext.xml?", I define the resource in applicationContext.xml.

<bean id="test1" name="/myuri"  class="MyResource"></bean>
<bean id="test2" name="other_uri_except_myuri"  class="ForwardResource"></bean>

How to config it? Now I don't use the Application, and maybe can't define Router.

Thank you~


Solution

  • Maybe there isn't a better way for the question.

    you may add these sentenses in the application.xml

    <bean id="test3" name="/{aaa}" class="ForwardResource"></bean>
    
    <bean id="test4" name="/{aaa}/{bbb}" class="ForwardResource"></bean>
    
    <bean id="test5" name="/{aaa}/{bbb}/{ccc}" class="ForwardResource"></bean>
    
    ...
    

    and so on, according the variable in your path...

    Anyway, it works.