Hi,

I'm getting 404 error when I hit a URL containing query string parameter. 

My requirement is to 
1. enable the REST URI containing the root or root?querystring.
2. I want to do it for a specific resource defined in the configuration file.

Can somebody suggest how to achieve the same using the configuration file 
instead of the code and creating a TemplateRoute in the code.

Scenario is explained below.

Prerequisites:
1. Using Restlet with Spring.
2. Using configuration xml beans file to configure my multiple REST resources. 
e.g.

<bean id="root" class="org.restlet.ext.spring.SpringRouter">
     <property name="attachments">
                        <map>
                                <entry key="/resource">
                                        <bean 
class="org.restlet.ext.spring.SpringFinder">
                                                <lookup-method name="create" 
bean="testResource" />
                                        </bean>
                                </entry>
                                <entry key="/resource1">
                                        <bean 
class="org.restlet.ext.spring.SpringFinder">
                                                <lookup-method name="create" 
bean="resource1" />
                                        </bean>
                                </entry>
                                <entry key="/users/{id}/resource2?{query}">
                <bean class="org.restlet.ext.spring.SpringFinder">
                                                <lookup-method name="create" 
bean="resource3" />
                                        </bean>
                                </entry>
        <property name="routes[0].template.variables[URI]">
                        <bean class="org.restlet.routing.Variable">
                                <constructor-arg 
ref="org.restlet.routing.Variable.TYPE_URI_ALL" />
                        </bean>
                </property>
</bean>

Problem:
Whenever I hit the URL for 3rd resource http://localhost:8088/users/1/resource2
http://localhost:8088/users/1/resource2?view=default, I get 404 because restlet 
is not able to find the resource to handle the request.

Solutions already tried:
I have gone through the documentation and figured out that enable 
defaultMatchingQuery will resolve the problem but I do not know how to 
configure it as part of the bean.

I added property defaultMatchingQuery as first property and set the value to 
true and it worked. But I think this is not the best way to achieve the same.
 
<bean id="root" class="org.restlet.ext.spring.SpringRouter">
<property name="defaultMatchingQuery" value="true" />
<property name="attachments">
.....
.....
....
</bean>

Thanks
Nitin

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2765410

Reply via email to