Re: Restlet client and setting the request header date
Hello Garry, I'm sorry for the delay of my answer. At this moment, we need some to support the EXPECT header (see http://restlet.tigris.org/issues/show_bug.cgi?id=413) which is planned for the 2.0 RC. Some pieces are needed in order to make the Request#onResponse() able to catch such intermediary responses. Regarding the support S3 scheme, the client side of this scheme is available and is working (via the crypto extension). I see that it is based on the Date header (or the current Date). I've fixed the report issue regarding the DATE header. Thus, you will be able to set your own date. Best regards, Thierry Boileau Hi Thierry, Thanks for this response, even if it does make my life more complicated! What I'm building is basically a clone of Amazon's S3. On the server side this has been more or less fine using Restlet -- modulo the issues I've previously raised re the AuthenticationHelper and support for Expect/CONTINUE -- but it looks like I'll not be able to build a Restlet-based client. Which makes me ask what the point is of the support for the S3 scheme in ChallengeResponse? The values in that scheme are dependent on being able to read and sign actual header values such as Date. I read the Javadoc for onContinue and when it said it was called before the entity was sent I wasn't sure just how literal that was. Not sure about that use case but for my purposes a callback prior to the dispatch of the entire request that would allow examination and modification of the actual request (both headers and entity) to be sent would be really useful. Cheers, Garry On Thu, 14 Jan 2010, Thierry Boileau wrote: Hi Garry, I'm afraid not. This value is set with a new Date() value just before the header is written... The onContinue was thought to be called before the entity is sent, after the headers were written. I say was, because it has been removed since no clear use case emerged. Best regards, Thierry Boileau Hi, I too hit this problem as I wanted to set a specific value for the Date header. In absence of this ability -- I've seen issue 1001 -- can I get the value of the header client side before the request is sent in any way? I want to set another header based on the date. I thought that setting a Uniform instance as the oncontinue handler of the ClientResource would allow this but the handle() method in Uniform doesn't seem to be called before the request is actually sent? Thanks, Garry -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2436971 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2437281 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2440023
Re: Restlet client and setting the request header date
Hi Garry, I'm afraid not. This value is set with a new Date() value just before the header is written... The onContinue was thought to be called before the entity is sent, after the headers were written. I say was, because it has been removed since no clear use case emerged. Best regards, Thierry Boileau Hi, I too hit this problem as I wanted to set a specific value for the Date header. In absence of this ability -- I've seen issue 1001 -- can I get the value of the header client side before the request is sent in any way? I want to set another header based on the date. I thought that setting a Uniform instance as the oncontinue handler of the ClientResource would allow this but the handle() method in Uniform doesn't seem to be called before the request is actually sent? Thanks, Garry -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2436971 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2437281
Re: Restlet client and setting the request header date
Hi again Thierry, One other question re the removal of the onContinue callbacks. In the snapshot code I was trying to use the interim response code to support an Expect/CONTINUE interaction. I wasn't getting the behaviour I expected though on reflection I wasn't convinced the client I had was doing the right thing. So if onContinue has gone away what is the client-side mechanism for receiving and responding to an interim response? My use case is the client sending the headers of a PUT request and the server sending a CONTINUE only if the stated size of the entity is acceptable. Thanks, Garry On Thu, 14 Jan 2010, Thierry Boileau wrote: Hi Garry, I'm afraid not. This value is set with a new Date() value just before the header is written... The onContinue was thought to be called before the entity is sent, after the headers were written. I say was, because it has been removed since no clear use case emerged. Best regards, Thierry Boileau Hi, I too hit this problem as I wanted to set a specific value for the Date header. In absence of this ability -- I've seen issue 1001 -- can I get the value of the header client side before the request is sent in any way? I want to set another header based on the date. I thought that setting a Uniform instance as the oncontinue handler of the ClientResource would allow this but the handle() method in Uniform doesn't seem to be called before the request is actually sent? Thanks, Garry -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2436971 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2437281 -- Garry Turkington garry.turking...@gmail.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2437399
Re: Restlet client and setting the request header date
Hi Thierry, Thanks for this response, even if it does make my life more complicated! What I'm building is basically a clone of Amazon's S3. On the server side this has been more or less fine using Restlet -- modulo the issues I've previously raised re the AuthenticationHelper and support for Expect/CONTINUE -- but it looks like I'll not be able to build a Restlet-based client. Which makes me ask what the point is of the support for the S3 scheme in ChallengeResponse? The values in that scheme are dependent on being able to read and sign actual header values such as Date. I read the Javadoc for onContinue and when it said it was called before the entity was sent I wasn't sure just how literal that was. Not sure about that use case but for my purposes a callback prior to the dispatch of the entire request that would allow examination and modification of the actual request (both headers and entity) to be sent would be really useful. Cheers, Garry On Thu, 14 Jan 2010, Thierry Boileau wrote: Hi Garry, I'm afraid not. This value is set with a new Date() value just before the header is written... The onContinue was thought to be called before the entity is sent, after the headers were written. I say was, because it has been removed since no clear use case emerged. Best regards, Thierry Boileau Hi, I too hit this problem as I wanted to set a specific value for the Date header. In absence of this ability -- I've seen issue 1001 -- can I get the value of the header client side before the request is sent in any way? I want to set another header based on the date. I thought that setting a Uniform instance as the oncontinue handler of the ClientResource would allow this but the handle() method in Uniform doesn't seem to be called before the request is actually sent? Thanks, Garry -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2436971 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2437281 -- Garry Turkington garry.turking...@gmail.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2437392
RE: Restlet client and setting the request header date
Hi, I too hit this problem as I wanted to set a specific value for the Date header. In absence of this ability -- I've seen issue 1001 -- can I get the value of the header client side before the request is sent in any way? I want to set another header based on the date. I thought that setting a Uniform instance as the oncontinue handler of the ClientResource would allow this but the handle() method in Uniform doesn't seem to be called before the request is actually sent? Thanks, Garry -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2436971
Re: Restlet client and setting the request header date
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
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
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
RE: Re: Restlet client and setting the request header date
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
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 client and setting the request header date
Anyone have an answer to this? -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2433923