RE: how to use conditional get in restlet ?

2011-06-16 Thread layal Al Ait
Thank you so much for your quick reply.

In this case the router will attach this uri to the people resource class.
Are there any functions that could parse the uri and get the needed request (in 
this example, age20) ? or should I write my own functions ?

Another issue, in this example, the query ( age20 ) is simple, so it could be 
included in the uri,
what if I have complex queries (union between two tables ..etc ) ?

Thank you in advance ! 


 Subject: Re: how to use conditional get in restlet ?
 From: stinkym...@gmail.com
 Date: Wed, 15 Jun 2011 21:22:12 -0400
 CC: l@hotmail.com
 To: discuss@restlet.tigris.org
 
 I'm moving this to the disc...@restlet.itgris.org, the code list is more for 
 the restlet codebase itself. 
 
 Anyhow, the answer to your question is two-fold:
 
 First, Conditional Get means something very specific in HTTP parlance and 
 it isn't what you describe.  A conditional get is a GET request that sends a 
 special header that tells the server to not bother to send a response if the 
 resource that is being requested hasn't been modified since the last time the 
 client made the request.  So it isn't really for what you're talking about.
 
 So, to do what you'd like to do, just use a query parameter.  For example:
 
 http://www.example.com/people?age=over20
 
 -Matt
 
 
 On Jun 15, 2011, at 4:08 PM, infoSyS wrote:
 
  I am currently designing an API using the restlet framework; Can anyone
  please give me a clue on how to use conditional GET requests in RESTlet ?
  what I mean is : lets say I have the name and date of birth of many persons
  and I want to GET the name of persons that are older than 20 years, how
  could this be done ? Thanks in advance.
  
  --
  View this message in context: 
  http://restlet-code.1609877.n2.nabble.com/how-to-use-conditional-get-in-restlet-tp6480367p6480367.html
  Sent from the Restlet Code mailing list archive at Nabble.com.
  
  --
  http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458dsMessageId=2766359


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

RE: Re: can not return description in put

2011-06-16 Thread Bram van der Waaij
Hi,

The put method is being called, so overriding is working i assume. Overriding 
the put (representation, variant) is not working, then the put call is not 
handled. Which i can understand because i do not use negotiation and therefore 
this version of the put method should not be called. 
I tried the apache http client library to call my server. That shows that het 
get acutually returns in the http statusline the reasonphrase i have set. By 
switching to the put, the reasonphrase replaces my msg with the default 
description of the status code. At least now i know for sure that it is the 
server which is not sending the correct reasonphrase. 

Still leaves the problem of how to pass my msg to the client from a put

I do not use the annotations, because i want to have more control over the 
processing flow. Mixing the two unfortunately does not work. It produces an 
internal server error ;-)

Any other ideas?

Bram

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


Re: POSTing to GAE

2011-06-16 Thread Thierry Boileau
Hello Bjorn,

this error is not due to the chunked encoding as curl send the form properly
using a correct content-length header.
However, I notice that the POST request is perfectly received using the
1.4.3 release of GAE.
It looks like that the 1.5.0 release of GAE introduces some crucial updates.

I've entered an issue :
http://restlet.tigris.org/issues/show_bug.cgi?id=1275


Best regards,
Thierry Boileau


Thank you for your response. I'm afraid I'm still a bit confused: the link
 you gave shows making this call in the android client, but as I said in my
 email I am testing with curl. Does this mean there is no server-side fix? I
 don't see anything in curl to prevent chunking. (in my version anyway. I see
 some discussion online suggesting they are working on a flag to force
 chunking, but I don't see anything to turn chunking off)

 If there is a server-side fix, where would I put this call? It seems it
 would have to go before the entity was retrieved, which is before the method
 gets called, so where would you recommend? How do I get a ClientResource
 object?

 thanks,

 bjorn

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2766028


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

RE: Where to download com.noelios.restlet.ext.servlet_2.5.jar for version 2 RC 3

2011-06-16 Thread Thierry Boileau
Hello,

actually it has been decided to merge both api (the former org.restlet 
package, and its implementation  (the former com.noelios.restlet package).
Therefore, using the 2.0.7 release, just use the org.restlet.jar, 
org.restlet.ext.servlet.jar, and the provided javax.servlet.jar.

I should add that the version number of libraries refers to their own number, 
not the Restlet one. I mean, in the case of the servlet library, 2.0.4 or 
2.0.5 refers to the version of the servlet spec.

Best regards,
Thierry Boileau

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


Instance variables in ServerResource

2011-06-16 Thread Chris Kaminski
When subclassing from ServerResource, is that Resource instance reused for 
multiple invocations, or is a new one created?  If the latter, then obviously 
I'd want to refrain from using instance variables.   

Regards
-Chris

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


Custom headers in restlet 1.1.1

2011-06-16 Thread coolvibh
Hi Folks,

I am newbie to restlet. I am using restlet 1.1.1  and i have to set some non
standard custom headers 

Request request = new Request(Method.POST, url, 
represent);
Maplt;String, Objectgt; requestAttrib = 
request.getAttributes();
Form headers =(Form) 
requestAttrib.get(RESTLET_HTTP_HEADERS);

if(headers == null){
headers = new Form();
requestAttrib.put(RESTLET_HTTP_HEADERS, 
headers);
}
headers.add(appID, abc);
headers.add(timestamp, timeStamp);
headers.add(accessKey, key);
Response response = new 
Client(Protocol.HTTP).handle(request);



when i test this i get java.lang.IllegalArgumentException: Only HTTP or
HTTPS resource URIs are allowed here
at
com.noelios.restlet.ext.httpclient.HttpMethodCall.init(HttpMethodCall.java:153)
at
com.noelios.restlet.ext.httpclient.HttpClientHelper.create(HttpClientHelper.java:150)
at
com.noelios.restlet.http.HttpClientConverter.toSpecific(HttpClientConverter.java:493)
at
com.noelios.restlet.http.HttpClientHelper.handle(HttpClientHelper.java:106)
at org.restlet.Client.handle(Client.java:157)
at org.restlet.Uniform.handle(Uniform.java:108)

please help me out

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Custom-headers-in-restlet-1-1-1-tp6484371p6484371.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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