Re: Re: How to allow Query Strings in REST URI - Spring & Restlet

2011-06-15 Thread gonzajg
I'm glad it worked for you :)

On Wed, Jun 15, 2011 at 3:38 PM, aronitin [via Restlet Discuss] <
ml-node+6480085-1989291684-197...@n2.nabble.com> wrote:

> Hi,
>
> I tried it and it worked. I did not think about that :-(, I was too much
> into the code.
>
> Thanks for the tip
>
> ~Nitin
>
> --
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2766308
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://restlet-discuss.1400322.n2.nabble.com/How-to-allow-Query-Strings-in-REST-URI-Spring-Restlet-tp6474960p6480085.html
>  To unsubscribe from How to allow Query Strings in REST URI - Spring &
> Restlet, click 
> here<http://restlet-discuss.1400322.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=6474960&code=Z29uemFAaXN0b2NrbWFuYWdlci5jb218NjQ3NDk2MHwtMzc3OTU5MzY0>.
>
>


--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/How-to-allow-Query-Strings-in-REST-URI-Spring-Restlet-tp6474960p6480246.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

RE: Re: How to allow Query Strings in REST URI - Spring & Restlet

2011-06-15 Thread Nitin Arora
Hi,

I tried it and it worked. I did not think about that :-(, I was too much into 
the code.

Thanks for the tip

~Nitin

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


RE: Re: How to allow Query Strings in REST URI - Spring & Restlet

2011-06-15 Thread gonzajg
In your route I see that you included this:

 

Try without declaring query like this:

 

I think there's no need to declare "{query}" to get the query from the URL.



aronitin wrote:
> 
> Hi,
> 
> I did not really get your point "You can include your routes without GET
> parameters"
> 
> What GET parameters you are talking about here? My Server Resource is
> being instantiated by the SpringRouter settings defined in the xml file.
> 
> I'm already fetching the query params as described below.
> 
> String view = getQuery().getFirstValue("view");
> 
> But the real problem is 404 is being thrown before the server resource is
> instantiated. Routers are not able to identify the incoming request
> "http://xyz:8080/resource2?view=filtered and hence throwing 404.
> 
> Nitin
> 
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2765509
> 


--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/How-to-allow-Query-Strings-in-REST-URI-Spring-Restlet-tp6474960p6478585.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


RE: Re: How to allow Query Strings in REST URI - Spring & Restlet

2011-06-14 Thread Nitin Arora
Hi,

I did not really get your point "You can include your routes without GET 
parameters"

What GET parameters you are talking about here? My Server Resource is being 
instantiated by the SpringRouter settings defined in the xml file.

I'm already fetching the query params as described below.

String view = getQuery().getFirstValue("view");

But the real problem is 404 is being thrown before the server resource is 
instantiated. Routers are not able to identify the incoming request 
"http://xyz:8080/resource2?view=filtered and hence throwing 404.

Nitin

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


Re: How to allow Query Strings in REST URI - Spring & Restlet

2011-06-14 Thread gonzajg
Hi!

You can include your routes without GET parameters. And then in your
resource class simply use:
Request.getCurrent().getResourceRef().getQueryAsForm();

You'll get a form with your GET parameters.

Hope it helps!

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/How-to-allow-Query-Strings-in-REST-URI-Spring-Restlet-tp6474960p6475138.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


How to allow Query Strings in REST URI - Spring & Restlet

2011-06-14 Thread Nitin Arora
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.


 























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.
 



.
.



Thanks
Nitin

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