Re: Restlet client and setting the request header date

2010-01-04 Thread Thierry Boileau
Le 29.12.2009 17:52, webp...@tigris.org a écrit : Hello,

I've just tried, and it works for me with the internam client connector:
using ClientResource
 ClientResource r = new 
ClientResource(http://localhost:8182/hello;);
 r.getRequest().setDate(new Date());
 r.get();
or directly the Client connector:
 Client c = new Client(Protocol.HTTP);
 Request request = new Request(Method.GET,
 http://localhost:8182/hello;);
 request.setDate(new Date());
 c.handle(request);

What kind of client connector are you using?

Best regards and happy new year,
Thierry Boileau

 Hi Guys,

 I'm having trouble setting the header date when using the restlet client.

 I thought it was just a simple matter of setting the request's date.. i.e.

  // Set the request date
  request.setDate(cal.getTime());

 but that didnt seem to work.

 Neither does:

 extraHeaders.add(HttpConstants.HEADER_DATE , DateUtils.format(cal.getTime(), 
 DateUtils.FORMAT_RFC_1123.get(0)));

 which the current reslet implementation (currently using m6) prohibits. Could 
 someone give me a clue as to what i'm doing wrong?

 Regards,
 --KD

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



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


RE: Re: Restlet client and setting the request header date

2010-01-04 Thread webpost
Hi Thierry,

Compliments of the season..

The problem isnt that a date is not passed through in the header. 

Its that it always the current date/time and not the date/time i specify. I'm 
using the internal connector to do this test. It is part of my security tests 
to test for request expiry, hence the need to look at the date header.

Regards,
--KD

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


Re: Restlet client and setting the request header date

2010-01-04 Thread Thierry Boileau
Hi,

 Its that it always the current date/time and not the date/time i specify.
yes, and I notice the message's date is always set with the current date 
(see HeaderUtils#addGeneralHeaders). I've entered an issue = 
http://restlet.tigris.org/issues/show_bug.cgi?id=1001.
We will have a look at it as soon as Jerome will be back.

Best regards,
Thierry Boileau

 Hi Thierry,

 Compliments of the season..

 The problem isnt that a date is not passed through in the header.

 Its that it always the current date/time and not the date/time i specify. I'm 
 using the internal connector to do this test. It is part of my security tests 
 to test for request expiry, hence the need to look at the date header.

 Regards,
 --KD

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



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


How to pass String into Request

2010-01-04 Thread Murugesan
Hi,
I am new to Restlet and restful webservices. I want to pass a String(XML 
format) into request and invoke the Restful webservices. 

Below code is working for normal call.

import java.io.IOException;

import org.restlet.Client;
import org.restlet.data.Protocol;

public class SimpleClient {
  public static void main(String [] args) throws IOException {
String uri =  
http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemoquery=financesformat=pdf;
 ;
Client client = new Client(Protocol.HTTP);
client.get(uri).getEntity().write(System.out);
  }
}

But i need to pass String as XML format into requset. How to do that?

Thanks in advance.

Regards,
Murugesan

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


Re: How to pass String into Request

2010-01-04 Thread Thierry Boileau
Hello Murugesan,

you seem to have the remote resource (the one identified by the uri 
variable) on one hand, but what method do you want to invoke on this 
resource?
You must refer to the Yahoo search API, in order to know how you can 
pass this data.
As I suppose you want to POST some data, you can use the following code:

ClientResource demoResource = new ClientResource(uri);
// Create the representation to send
StringRepresentation rep = new StringRepresentation(ab/a, 
MediaType.APPLICATION_XML);
// POST the representation
demoResource.post(rep).write(System.out);

or the following:

Client client = new Client(Protocol.HTTP);
// Create the representation to send
StringRepresentation rep = new StringRepresentation(ab/a, 
MediaType.APPLICATION_XML);
// POST the representation
client.post(uri, rep).getEntity().write(System.out);

You can find other kinds of representations (instead of 
StringRepresentation) inside the org.restlet.xml extension.

Best regards,
Thierry Boileau


 Hi,
 I am new to Restlet and restful webservices. I want to pass a String(XML 
 format) into request and invoke the Restful webservices.

 Below code is working for normal call.

 import java.io.IOException;

 import org.restlet.Client;
 import org.restlet.data.Protocol;

 public class SimpleClient {
public static void main(String [] args) throws IOException {
  String uri =  
 http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemoquery=financesformat=pdf;
  ;
  Client client = new Client(Protocol.HTTP);
  client.get(uri).getEntity().write(System.out);
}
 }

 But i need to pass String as XML format into requset. How to do that?

 Thanks in advance.

 Regards,
 Murugesan

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



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


Re: How to pass String into Request

2010-01-04 Thread Thierry Boileau
Hi Murugesan,

one part of the question is located in the yahoo API (you seem to target 
a yahoo resource). If the API says that you can send the XML text using 
the post method (which is certain), you can use the code I sent you in 
my last email.
You can have a look at the tutorial or the first sample applications 
(http://www.restlet.org/documentation/2.0/). It will help you to see how 
to expose your own set of resources or developping a client application 
using Restlet.

Best regards,
Thierry Boileau

 Thx for your quick reply. Actually I want to pass XML into request and update 
 DB and get response using RESTful webservices.

 My Request parameter in XM format and sample code is below,

 ForumPost Id=3
Endpoint=http://localhost/cs/api/forums.ashx/forums/5/threads/3/posts/3;
PostTracking
   HasReadfalse/HasRead
   IsTrackedfalse/IsTracked
/PostTracking
Bodypsample forum post content/p/Body
SiteUrlhttp://localhost/cs/forums/p/3/3.aspx#3/SiteUrl
SubjectSample Forum Post/Subject
Date2008-01-15T05:37:58.793/Date
Keywords
   KeywordSample Forum Posts/Keyword
/Keywords
RenderedBody
  br /psample forum post content/pbr /
/RenderedBody
 /ForumPost

 How to pass above XML request value?

 Thanks in advance.

 Regards,
 Murugesan.



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


how to add username password in Request?

2010-01-04 Thread Murugesan
Hi,
I am new to Restlet and restful webservices. I want to pass a authentication 
details for Restful webservices into request and invoke the Restful 
webservices. 



import java.io.IOException;

import org.restlet.Client;
import org.restlet.data.Protocol;

public class SimpleClient {
  public static void main(String [] args) throws IOException {
String uri =  
http://localhost/cs/api/forums.ashx/forums/5/threads/3/posts/3; ;
Client client = new Client(Protocol.HTTP);
client.get(uri).getEntity().write(System.out);
  }
}

How to pass username and password for RESTful webservices api call?

Thanks in advance.

Regards,
Murugesan

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


RE: Re: How to pass String into Request

2010-01-04 Thread Murugesan
Thx for your quick reply. Actually I want to pass XML into request and update 
DB and get response using RESTful webservices.

My Request parameter in XM format and sample code is below,

ForumPost Id=3 
  Endpoint=http://localhost/cs/api/forums.ashx/forums/5/threads/3/posts/3;
  PostTracking
  HasReadfalse/HasRead
  IsTrackedfalse/IsTracked
  /PostTracking
  Bodypsample forum post content/p/Body  
  SiteUrlhttp://localhost/cs/forums/p/3/3.aspx#3/SiteUrl  
  SubjectSample Forum Post/Subject  
  Date2008-01-15T05:37:58.793/Date
  Keywords
KeywordSample Forum Posts/Keyword  
  /Keywords  
  RenderedBody
br /psample forum post content/pbr /
  /RenderedBody
/ForumPost

How to pass above XML request value?

Thanks in advance.

Regards,
Murugesan.

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


RE: Re: Restlet client and setting the request header date

2010-01-04 Thread webpost
Great... at least i'm not completely nuts :)

Will follow the issue.
Thank you for confirming the problem.

Regards,
--KD

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


Re: Restlet client and setting the request header date

2010-01-04 Thread Thierry Boileau

 Great... at least i'm not completely nuts :)

unfortunately, there is no workaround yet...
thanks for your report.

Best regards,
Thierry Boileau

 Will follow the issue.
 Thank you for confirming the problem.

 Regards,
 --KD

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



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


RE: Restlet and Spring bean scope in v2.0m

2010-01-04 Thread Rhett Sutphin
 Anyone have any experience in scoping Spring beans using Session or 
 Singleton? I'm extending ServerResource and I am wondering how concurrency is 
 handled since none of the annotated methods are synchronized.

Resource instances are not intended to be thread-safe.  You should use 
prototype scope for spring-managed resources.

Rhett

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


Re: SpringServerServlet 404 - newb

2010-01-04 Thread Rhett Sutphin
Hi,

On Dec 29, 2009, at 1:22 PM, webp...@tigris.org wrote:

 I'm new to Restlet and I'm getting 404 errors, so I'm guessing the 
 SpringServerServlet isn't being invoked in Tomcat 6.  I'm trying out the 
 Spring extension in Restlet 2.0-M6.  See attachment's web.xml and 
 spring-beans.xml.  I think something basic is wrong, but not sure what.  
 Thx.spring-beans.xmlweb.xml

What URL are you invoking that's giving you 404?  With this configuration, 
you've defined one:  /restlet/exampleResource .

Rhett

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


Re: How to REST in SpringFramework

2010-01-04 Thread Rhett Sutphin
Hi,

On Dec 31, 2009, at 1:59 PM, gozfidan wrote:

 Hi,
 I am new to REST and trying to integrate with my Spring application. I have
 done
 some searching bu got stuck. I have changed the web.xml and add
 RestletServlet-servlet.xml
 but not sure how to implement Resource?
 
 
 web.xml
   servlet
servlet-nameRestletServlet/servlet-name
 
 servlet-classorg.restlet.ext.spring.RestletFrameworkServlet/servlet-class
/servlet
   
   
 RestletServlet-servlet.xml
 
 ?xml version=1.0 encoding=UTF-8?
 beans xmlns=http://www.springframework.org/schema/beans;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xsi:schemaLocation=http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd;
 
   bean id=root class=org.restlet.ext.spring.SpringRouter
property name=attachments
map
entry key=/poll
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=createResource
 bean=pollSystemResource /
/bean
/entry
/map
/property
/bean
 
bean id=pollSystemResource
 class=com.smartcrop.webapp.service.PollSystemResource autowire=byName/
 /beans
 
 
 and I have this PollSystemResource if I extend it with SpringResource
 I get an error for  [cannot find symbol constructor SpringResource()]

You don't want to use SpringResource here.  From the javadoc:  Spring Resource 
based on a Restlet Representation. DON'T GET CONFUSED, Spring's notion of 
Resource is different from Restlet's one, actually it's closer to Restlet's 
Representations.

Base PollSystemResource on org.restlet.resource.Resource (under 1.1) or 
org.restlet.resource.ServerResource (under 2.0).

Rhett

 
 If my steps are correct, how do I implement my Resources
 thanks.
 -- 
 View this message in context: 
 http://n2.nabble.com/How-to-REST-in-SpringFramework-tp4237720p4237720.html
 Sent from the Restlet Discuss mailing list archive at Nabble.com.
 
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2434026

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


migration from 1.x to 2.0

2010-01-04 Thread webpost
Hello,

I see that the restlet framework in version 2.0m6 has certainly more and better 
features than the old 1.1 version I am using. I wonder how difficult it is, to 
migrate to restlet 2.0 as it seems some API changes have taken place?

best regards
Tobias

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


Re: Support for Expect and 100 Continue, or ways of faking it

2010-01-04 Thread Jerome Louvel
Hi Garry,

In the latest snapshots, we added support for provisional responses.
This is only supported by the new default HTTP connector, not the
extension connectors like Jetty, Netty, Simple, at least for now.
However, you should try those connectors if you haven't as they might
automatically return a 100 status if they receive a Expects header.

To use provisional responses, you need to do this inside your
ServerResource subclass:

Response provisionalResponse = new Response(getRequest());
provisionalResponse.setStatus(Status.INFO_CONTINUE);
provisionalResponse.commit();

Then, you go on with your regular code. However, there isn't support
for the Expect header yet, even though you should be able to retrieve
its raw value via the Request#getAttributes() property.

Let us know if you manage to get it working.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com



2010/1/2 webp...@tigris.org

 Hi,

 I'm writing an application to support some existing clients which use the 
 Expect and 100 Continue HTTP mechanics to ensure a data PUT will be allowed 
 before sending the data.

 Looking around the site and archives I see this isn't currently supported in 
 Restlet 2.0 and issue 413 has no identified milestone.

 So first, am I missing something and is this supported somewhere in the 
 current development branch?  I'm pretty tolerant to use bleeding edge code.

 If though as I suspect this functionality isn't supported is there currently 
 any way to bluff this at all via a custom connector or filter?  I really 
 didn't see any mechanism to send back a response to the client at the point 
 its pausing after sending the Expect header.

 Any thoughts much welcomed.

 Thanks,
 Garry

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

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


Re: Video streaming ressource

2010-01-04 Thread Jerome Louvel
Hi Xavier,

Happy new year as well !

Good question again :) Beside HTTP chunked encoding, we don't support
other protocols, we this is an area of high interest for us in Restlet
2.1. We have related RFEs that you can track:

Add RTSP support
http://restlet.tigris.org/issues/show_bug.cgi?id=972

Add RTMPT server connector
http://restlet.tigris.org/issues/show_bug.cgi?id=562

Finally, a remotely related RFE:

Add support for server-sent events
http://restlet.tigris.org/issues/show_bug.cgi?id=825

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com




2010/1/3 Xavier Méhaut xavier.meh...@free.fr:
 Happy new year to everyone (Bloavez mad deoc'h in breton),

 I would like to know if there exists something as restlet extension to deal
 with the video streaming concern, because of it is in fine a ressource as
 others, even if it is a continuous resource.
 We could consider a ressource as for instance H264 stream and its
 representation as a video container like MOV, AVI, FLV and so on... The
 protocol used could also be chosen among RTSP, Sockets, HTPP, 

 best regards
 Xavier


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


Re: How to pass and encode UTF-8 characters

2010-01-04 Thread Jerome Louvel
Hi Muthu,

Have a look at the Reference#encode() method.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com



Le 30/12/2009 09:43, Muthu Kumar a écrit :
 I need to send an organization name through address bar which contains 
 UTF-8 characters. i.e, *http://host_name/service_name?orgName=**マイクロ 
 ソフト*
 
 
 while i read the value and print it inside the resource. It displays 
 some thing like '?? '
 
 how to pass and encode UTF-8 characters in restlet?
 
 Thanks,
 Muthu.R


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