RE: Re: Is it possible to override the Accept HTTP headers using a URL decorator?

2011-12-08 Thread Mark Kharitonov
 an application has a dedicated service called TunnelService that copes with
 these kinds of limitations.
 By default, it handles query parameters such as media that allows you to
 override the accept header. You can discover the other service by having
 a look at the javadocs :
 http://www.restlet.org/documentation/2.1/jse/api/org/restlet/service/TunnelService.html
I will certainly do so - thank you very much.

 It also offers this service, by default. But please, please, please, don't
 send a GET request in order to update the resource's state. Use the POST
 request instead.
Absolutely, GET is a GET and POST is a POST. I just wanted to know if it was 
possible. Again, thanks.

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


Re: Is it possible to override the Accept HTTP headers using a URL decorator?

2011-12-07 Thread Thierry Boileau
Hello Mark,

an application has a dedicated service called TunnelService that copes with
these kinds of limitations.
By default, it handles query parameters such as media that allows you to
override the accept header. You can discover the other service by having
a look at the javadocs :
http://www.restlet.org/documentation/2.1/jse/api/org/restlet/service/TunnelService.html
.

By turning on the extensionsTunnel flag, you can use .json extension
instead of media=json query parameter.

The URL decoration concept can also be used to override the HTTP method.
Like adding !DELETE at the end makes the GET request treated as DELETE on
the server side (useful for client supporting only GET and POST requests).
It also offers this service, by default. But please, please, please, don't
send a GET request in order to update the resource's state. Use the POST
request instead.

Best regards,
Thierry Boileau

Let us assume the following:
  - there is a resource at http://bla-bla/res/{id}
  - the server can serve different representations of the resource, say xml
 or json
  - GETting the request from the browser returns the respective XML
 representation, because the browser never adds application/json to the
 Accept header value

 I would like to GET the JSON representation anyway. One option is to use
 some REST client plugin for the browser and specify the Accept header
 explicitly asking for application/json.

 But I am interested to know whether there is support for another option -
 override the Accept header using a dedicated URL decoration. For instance,
 adding the .json extension to the URL indicates that one wishes to GET
 the json representation. Adding .xml asks for the xml representation,
 etc...

 The URL decoration concept can also be used to override the HTTP method.
 Like adding !DELETE at the end makes the GET request treated as DELETE on
 the server side (useful for client supporting only GET and POST requests).

 Is there any support for this in Restlet?

 Thanks.

 --

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


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

Is it possible to override the Accept HTTP headers using a URL decorator?

2011-12-04 Thread Mark Kharitonov
Let us assume the following:
 - there is a resource at http://bla-bla/res/{id}
 - the server can serve different representations of the resource, say xml or 
json
 - GETting the request from the browser returns the respective XML 
representation, because the browser never adds application/json to the Accept 
header value

I would like to GET the JSON representation anyway. One option is to use some 
REST client plugin for the browser and specify the Accept header explicitly 
asking for application/json.

But I am interested to know whether there is support for another option - 
override the Accept header using a dedicated URL decoration. For instance, 
adding the .json extension to the URL indicates that one wishes to GET the 
json representation. Adding .xml asks for the xml representation, etc...

The URL decoration concept can also be used to override the HTTP method. Like 
adding !DELETE at the end makes the GET request treated as DELETE on the 
server side (useful for client supporting only GET and POST requests).

Is there any support for this in Restlet?

Thanks.

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


RE: Ignoring incomplete HTTP headers

2010-08-27 Thread Thierry Boileau
Hello Nicolas,

this is not supported at this time. I think this could take place in this issue 
(http://restlet.tigris.org/issues/show_bug.cgi?id=1061). If not, I will create 
another one.

Best regards,
Thierry Boileau

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


Ignoring incomplete HTTP headers

2010-08-26 Thread Nicolas Rinaudo
I was wondering whether it was possible to configure Restlet to ignore 
incomplete HTTP headers when performing a request on a remote URI.

While using Restlet to crawl some sites, I've come across a fair amount of URIs 
that declared an empty Pragma header (Pragma:). This causes the query to 
fail, while it could simply be logged as a warning and ignored.

Is there any way to configure this behaviour, or is it impossible for Restlet 
to access remote resources who don't adhere to the HTTP specifications to the 
letter ?

Nicolas

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


Problem with HTTP headers from GWT client in rc1

2010-03-17 Thread Kelly McLaughlin
I just updated from 2.0m6 to rc1 and I noticed that many of the HTTP headers
in requests from my GWT client to the server contain what looks to output
from calling toString on the writer objects. Here's some examples from my
wireshark output:

Accept: org.restlet.client.engine.http.header.preferencewri...@6
Cache-Control: org.restlet.client.engine.http.header.cachedirectivewri...@3
If-Match: org.restlet.client.engine.http.header.tagwri...@7
If-None-Match: org.restlet.client.engine.http.header.tagwri...@8


My code was working fine with m6 so I'm trying to determine if there are
some code adjustments I need to make or if this is a bug. Thanks.

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

Re: Problem with HTTP headers from GWT client in rc1

2010-03-17 Thread Thierry Boileau
Hello Kelly,

could you provide some sample code? I've just tried and it works for me 
(for example regarding the accept header):
 ClientResource r = new 
ClientResource(http://localhost:/test;);
 r.getClientInfo().getAcceptedMediaTypes().add(new 
PreferenceMediaType(MediaType.APPLICATION_ATOM));


Best regards,
Thierry Boileau


 I just updated from 2.0m6 to rc1 and I noticed that many of the HTTP 
 headers in requests from my GWT client to the server contain what 
 looks to output from calling toString on the writer objects. Here's 
 some examples from my wireshark output:

 Accept: org.restlet.client.engine.http.header.preferencewri...@6
 Cache-Control: 
 org.restlet.client.engine.http.header.cachedirectivewri...@3
 If-Match: org.restlet.client.engine.http.header.tagwri...@7
 If-None-Match: org.restlet.client.engine.http.header.tagwri...@8


 My code was working fine with m6 so I'm trying to determine if there 
 are some code adjustments I need to make or if this is a bug. Thanks.


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

Re: Problem with HTTP headers from GWT client in rc1

2010-03-17 Thread Kelly McLaughlin
Sure. Here's the relevant GWT restlet code that is responsible for a request
that I'm seeing the problem with:

*ClientResource clientResource = new ClientResource(Method.GET,
url);

//Set the Accept header
clientResource.getClientInfo().getAcceptedMediaTypes().add(new
PreferenceMediaType(MediaType.APPLICATION_JSON));

//Set up the callback
clientResource.setOnResponse(new Uniform() {
public void handle(Request request, Response response) {
if (response.getStatus().equals(Status.SUCCESS_OK)){
   ...
}
}
});

//Perform the GET request
clientResource.get();
*
I have not been able to reproduce the problem using development mode. I see
the problem when I deploy to tomcat-6.0.20. I have used both Firefox and
Chrome as a client and seen the problem with requests from both browsers.
I'll continue to look into this and try to provide you more details if I
can.

Kelly



On Wed, Mar 17, 2010 at 5:17 AM, Thierry Boileau 
thierry.boil...@noelios.com wrote:

  Hello Kelly,

 could you provide some sample code? I've just tried and it works for me
 (for example regarding the accept header):
 ClientResource r = new ClientResource(
 http://localhost:/test; http://localhost:/test);
 r.getClientInfo().getAcceptedMediaTypes().add(new
 PreferenceMediaType(MediaType.APPLICATION_ATOM));


 Best regards,
 Thierry Boileau


 I just updated from 2.0m6 to rc1 and I noticed that many of the HTTP
 headers in requests from my GWT client to the server contain what looks to
 output from calling toString on the writer objects. Here's some examples
 from my wireshark output:

 Accept: org.restlet.client.engine.http.header.preferencewri...@6
 Cache-Control: org.restlet.client.engine.http.header.cachedirectivewri...@3
 If-Match: org.restlet.client.engine.http.header.tagwri...@7
 If-None-Match: org.restlet.client.engine.http.header.tagwri...@8


 My code was working fine with m6 so I'm trying to determine if there are
 some code adjustments I need to make or if this is a bug. Thanks.



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

Re: Problem with HTTP headers from GWT client in rc1

2010-03-17 Thread Thierry Boileau
Hi Kelly,

thanks for your report, the fix is now available in the current svn 
repository.
As I was testing in developement mode also, I missed this bug...

Best regards,
Thierry Boileau

 Sure. Here's the relevant GWT restlet code that is responsible for a 
 request that I'm seeing the problem with:

 /ClientResource clientResource = new ClientResource(Method.GET, url);

 //Set the Accept header
 clientResource.getClientInfo().getAcceptedMediaTypes().add(new 
 PreferenceMediaType(MediaType.APPLICATION_JSON));

 //Set up the callback
 clientResource.setOnResponse(new Uniform() {
 public void handle(Request request, Response response) {
 if (response.getStatus().equals(Status.SUCCESS_OK)){
...
 }
 }
 });

 //Perform the GET request
 clientResource.get();
 /
 I have not been able to reproduce the problem using development mode. 
 I see the problem when I deploy to tomcat-6.0.20. I have used both 
 Firefox and Chrome as a client and seen the problem with requests from 
 both browsers. I'll continue to look into this and try to provide you 
 more details if I can.

 Kelly



 On Wed, Mar 17, 2010 at 5:17 AM, Thierry Boileau 
 thierry.boil...@noelios.com mailto:thierry.boil...@noelios.com wrote:

 Hello Kelly,

 could you provide some sample code? I've just tried and it works
 for me (for example regarding the accept header):
 ClientResource r = new
 ClientResource(http://localhost:/test;
 http://localhost:/test);
 r.getClientInfo().getAcceptedMediaTypes().add(new
 PreferenceMediaType(MediaType.APPLICATION_ATOM));


 Best regards,
 Thierry Boileau


 I just updated from 2.0m6 to rc1 and I noticed that many of the
 HTTP headers in requests from my GWT client to the server contain
 what looks to output from calling toString on the writer objects.
 Here's some examples from my wireshark output:

 Accept: org.restlet.client.engine.http.header.preferencewri...@6
 Cache-Control:
 org.restlet.client.engine.http.header.cachedirectivewri...@3
 If-Match: org.restlet.client.engine.http.header.tagwri...@7
 If-None-Match: org.restlet.client.engine.http.header.tagwri...@8


 My code was working fine with m6 so I'm trying to determine if
 there are some code adjustments I need to make or if this is a
 bug. Thanks.



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

RE: Setting HTTP Headers without using a Representation

2009-12-28 Thread Jerome Louvel
Hi again,

No need to post twice the same question... See my reply in the previous
thread:
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=24332
93

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




-Message d'origine-
De : webp...@tigris.org [mailto:webp...@tigris.org] 
Envoyé : mercredi 25 novembre 2009 21:18
À : discuss@restlet.tigris.org
Objet : Setting HTTP Headers without using a Representation

I want to set the Expires Header in a Response WITHOUT a
representation.(because after conditional GET with
Status.REDIRECTION_NOT_MODIFIED (304) there is no Representation. Setting
the header with getResponseAttributes.put(...) gives me a WARNING, that
Expires Header must be set with Restlet Function, but this is only possible
with a representation, but i don't have one!)

how can i set the expires header???

Thank you.

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

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


Re: CacheDirective.maxAge(int) adds a quoted string to http headers

2009-12-08 Thread Thierry Boileau
Hi Guido,

a fix has been provided in the svn repository.

Best regards,
Thierry Boileau
 Hello Guido,

 I had a look at the http rfc, and I notice that some cache directives 
 such as max-age specify *unquoted* values. This could have an impact...
 I'll fix that tomorrow.

 Best regards,
 Thierry Boileau

 Hi,

 thanks for making the CacheDirective stuff available, now.

 When setting max-age via the new mechanisms a line as follows is added:

 Cache-Control:max-age=3600

 I'm absolutely no http expert. But with respect to RFC2616 14.6 age 
 values
 are non-negative integers. Can it be confirmed than every popular 
 browser
 will interpret this value correctly and behave accordingly?

 I'm writing this as I started playing with this directives to enhance
 caching (eg. cache ldap user information for one hour, cache listgrid
 layouts for one day etc.). But on Safari (4.0.4) it has no effect. I 
 did not
 find the time to test other browsers or provide a simple scenario. 
 But maybe
 my concerns about the string value are void, anyway.

 Regards,
 Guido Schmidt

   


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


Re: CacheDirective.maxAge(int) adds a quoted string to http headers

2009-12-08 Thread weltermann17
Hi Thierry,

thanks for fixing this so quickly. I'll have a look at my scenarios when
it's in the latest snapshot. Is there by any chance already a scheduled date
for this?

Regards,
Guido Schmidt.


-- 
View this message in context: 
http://n2.nabble.com/CacheDirective-maxAge-int-adds-a-quoted-string-to-http-headers-tp4126400p4131286.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: CacheDirective.maxAge(int) adds a quoted string to http headers

2009-12-08 Thread Thierry Boileau
Hi Guido,

the build is normally planned three times every day.
It has been refreshed since half an hour.

Best regards,
Thierry Boileau

 Hi Thierry,

 thanks for fixing this so quickly. I'll have a look at my scenarios when
 it's in the latest snapshot. Is there by any chance already a scheduled date
 for this?

 Regards,
 Guido Schmidt.




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


Re: CacheDirective.maxAge(int) adds a quoted string to http headers

2009-12-07 Thread Thierry Boileau
Hello Guido,

I had a look at the http rfc, and I notice that some cache directives 
such as max-age specify *unquoted* values. This could have an impact...
I'll fix that tomorrow.

Best regards,
Thierry Boileau

 Hi,

 thanks for making the CacheDirective stuff available, now.

 When setting max-age via the new mechanisms a line as follows is added:

 Cache-Control:max-age=3600

 I'm absolutely no http expert. But with respect to RFC2616 14.6 age values
 are non-negative integers. Can it be confirmed than every popular browser
 will interpret this value correctly and behave accordingly?

 I'm writing this as I started playing with this directives to enhance
 caching (eg. cache ldap user information for one hour, cache listgrid
 layouts for one day etc.). But on Safari (4.0.4) it has no effect. I did not
 find the time to test other browsers or provide a simple scenario. But maybe
 my concerns about the string value are void, anyway.

 Regards,
 Guido Schmidt



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


Setting HTTP Headers without using a Representation

2009-11-25 Thread webpost
I want to set the Expires Header in a Response WITHOUT a 
representation.(because after conditional GET with 
Status.REDIRECTION_NOT_MODIFIED (304) there is no Representation. Setting the 
header with getResponseAttributes.put(...) gives me a WARNING, that Expires 
Header must be set with Restlet Function, but this is only possible with a 
representation, but i don't have one!)

how can i set the expires header???

Thank you.

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


RE: Setting custom HTTP headers and ATOM feeds

2009-10-08 Thread Jerome Louvel
Hi Jatin,

It is possible to access raw HTTP headers and to specify additional ones.
See this FAQ for guidance:
http://www.restlet.org/documentation/1.1/faq#01

You will have to create a Request object instead of directly invoking
Client#post. If you are using Restlet 2.0, I suggest using ClientResource
instead.

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




-Message d'origine-
De : jatincqu [mailto:jatin_gu...@persistent.co.in] 
Envoyé : lundi 21 septembre 2009 16:32
À : discuss@restlet.tigris.org
Objet : RE: Setting custom HTTP headers and ATOM feeds

Hi Jerome, 

We are trying to create a restlet webservice client to call webservice. I
like to add some custom headers with my request. But I am confused how to
get request object. My code goes like :

private static String empXML = ?xml version=\1.0\ encoding=\UTF-8\?
+
employees\n +
 employee fname='Jatin' lname='Gupta' doj='04-07-2009'\n +
 /employee\n +
/employees;

public void post() throws Exception{
Form form = new Form();
form.add(data, this.empXML);

Representation rep = form.getWebRepresentation();
Client client = new Client(Protocol.HTTP);

Response response =
client.post(http://localhost:8085/restlet/rest;,
rep);

System.out.println(Status of post
request+response.getStatus());
System.out.println(response.getEntity().getText());
 }

Thanks 
Jatin

-- 
View this message in context:
http://n2.nabble.com/Setting-custom-HTTP-headers-and-ATOM-feeds-tp3287425p36
85685.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

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


RE: Setting custom HTTP headers and ATOM feeds

2009-09-22 Thread jatincqu
Hi Jerome, 

We are trying to create a restlet webservice client to call webservice. I
like to add some custom headers with my request. But I am confused how to
get request object. My code goes like :

private static String empXML = ?xml version=\1.0\ encoding=\UTF-8\?
+
employees\n +
 employee fname='Jatin' lname='Gupta' doj='04-07-2009'\n +
 /employee\n +
/employees;

public void post() throws Exception{
Form form = new Form();
form.add(data, this.empXML);

Representation rep = form.getWebRepresentation();
Client client = new Client(Protocol.HTTP);

Response response = 
client.post(http://localhost:8085/restlet/rest;,
rep);

System.out.println(Status of post 
request+response.getStatus());
System.out.println(response.getEntity().getText());
 }

Thanks 
Jatin

-- 
View this message in context: 
http://n2.nabble.com/Setting-custom-HTTP-headers-and-ATOM-feeds-tp3287425p3685685.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


RE: Setting custom HTTP headers and ATOM feeds

2009-07-21 Thread Jerome Louvel
Hi Dyaa,

Regarding the Atom issue, we have recently fixed them. I suggest trying
again with a Restlet 2.0 snapshot (unstable) until we release 2.0 M4.

Regarding the additional HTTP headers, it is possible to define them. See
this method on Request/Response:
http://www.restlet.org/documentation/2.0/api/org/restlet/data/Message.html#g
etAttributes%28%29

You just need to use the org.restlet.http.headers key like this:

Form extraHeaders = new Form();
extraHeaders.add(myHeaderName, myHeaderValue);
request.getAttributes().put(org.restlet.http.headers,
extraHeaders);

Let us know if anything is missing.

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


-Message d'origine-
De : Dyaa Albakour [mailto:dyaa.albak...@aws.net] 
Envoyé : vendredi 17 juillet 2009 17:24
À : discuss@restlet.tigris.org
Objet : Setting custom HTTP headers and ATOM feeds

Dear all,

I am trying to use a Restlet HTTP client to connect to the Azure Storage
service. Restlet seems to be the best options as it implements the Micosoft
shared key authentication scheme.

However I got stuck for two reasons. Restlet doesn't allow you to add custom
HTTP request headers which is necessary for some of the Azure services. Also
the ATOM feed extension doesn't support XML content. It will always treat
the content as text(that's what I found when I looked into the source code,
please see org.restlet.ext.atom.Content.java#writeElement)

Is that 100% correct? Any ideas/thoughts?

Many Thanks

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

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


Setting custom HTTP headers and ATOM feeds

2009-07-20 Thread Dyaa Albakour
Dear all,

I am trying to use a Restlet HTTP client to connect to the Azure Storage 
service. Restlet seems to be the best options as it implements the Micosoft 
shared key authentication scheme.

However I got stuck for two reasons. Restlet doesn't allow you to add custom 
HTTP request headers which is necessary for some of the Azure services. Also 
the ATOM feed extension doesn't support XML content. It will always treat the 
content as text(that's what I found when I looked into the source code, please 
see org.restlet.ext.atom.Content.java#writeElement)

Is that 100% correct? Any ideas/thoughts?

Many Thanks

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


RE: Overriding HTTP headers

2009-02-03 Thread Jerome Louvel
Hi Jean-Philippe,
 
I've just looked at the TunnelFilter code and couldn't see why it wouldn't 
work. See this excerpt from the 
org.restlet.engine.application.TunnelFilter#processQuery method:
if (resourceRef.hasQuery()) {
final Form query = resourceRef.getQueryAsForm(null);

// Tunnel the request method
final Method method = request.getMethod();

if (tunnelService.isMethodTunnel()) {
final String methodName = 
query.getFirstValue(tunnelService.getMethodParameter());
Method tunnelledMethod = Method.valueOf(methodName);

// The OPTIONS method can be tunnelled via GET requests.
if (tunnelledMethod != null  (Method.POST.equals(method) || 
Method.OPTIONS.equals(tunnelledMethod))) {
request.setMethod(tunnelledMethod);
query.removeFirst(tunnelService.getMethodParameter());
queryModified = true;
}
}

If you are using Restlet 1.1, the package is com.noelios.restlet.application 
instead. 

So, I would suggest that you put a break point in this method and try to 
understand when it is called and why it wouldn't work. Are you sure you never 
change the method somewhere else? 

Final suggestion: try to isolate the issue in a small reproducible sample code 
and send it to us.

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

 
  _  

De : Jean-Philippe Steinmetz [mailto:caskate...@gmail.com] 
Envoyé : lundi 2 février 2009 23:41
À : discuss@restlet.tigris.org
Objet : Re: Overriding HTTP headers


So I removed the code that initialized a new instance of the TunnelService as 
apparently it was enabled by default already. I have successfully tested the 
request POST http://host/app/resource/15?method=UPDATE. However performing a 
DELETE operation the same way results in a GET. The tomcat logs do not give any 
stack traces or other output that would indicate something is wrong. I also 
have logger messages set to display when the removeRepresentation method is 
called but am seeing nothing in the logs. Lastly, I can confirm DELETE 
http://host/app/resource/15 works using a restlet java client for testing.

This seems quite strange.

Jean-Philippe



On Sat, Jan 31, 2009 at 4:27 AM, Jerome Louvel jerome.lou...@noelios.com 
wrote:


Hello,
 
This should really work... The tunnel service is enabled by default, so the 
first line shouldn't even be necessary. What is displayed in the logs? If the 
tunnel service works as expected, you should see DELETE as the invoked method.
 
Otherwise, I would suggest to send us a small reproducible sample or to debug 
the TunnelFilter code if you are willing to dig into Restlet code :)
 


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

  _  


De : Jean-Philippe Steinmetz [mailto:caskate...@gmail.com] 

Envoy� : samedi 31 janvier 2009 00:39 

� : discuss@restlet.tigris.org
Objet : Re: Overriding HTTP headers


Ok. I've added the following to my Application's constructor.

getTunnelService().setEnabled(true);

But when I try and perform the following:

POST http://host/resource/1?method=DELETE

All it does is retrieve the resource.

Am I missing something?


On Fri, Jan 30, 2009 at 12:01 AM, Karel Vervaeke ka...@outerthought.org wrote:


Just scanning your mail diagonally I think you need to add the method
parameter to your query string (in combination with POST requests):

http://host/path?method=PUT
http://host/path?method=DELETE

(You should have the tunnel service enabled)

HTH,
Karel


On Fri, Jan 30, 2009 at 8:00 AM, Jean-Philippe Steinmetz
caskate...@gmail.com wrote:
 Hello again,

 One of my REST clients will be a Flash application. As some or all of you
 are aware Flash's URLRequest is a bit broken in that it doesn't fully
 support the HTTP protocol. I have tried using arc90restlib that Jerome
 suggested at http://lab.arc90.com/2008/03/restservice.php but unfortunately
 all I get are IOErrors when a request is sent anywhere. It could be that i'm
 loading in a Flex library into a Flash app but it's a bit hard too difficult
 to debug at this point. I can only assume there is an issue with the
 library. Short of writing my own HTTP socket library I was given a tip on
 using Flash's built-in URLRequest method and utilizing override headers to
 perform the PUT and DELETE operations. Specifically I am adding the header
 X-HTTP-Method-Override with the correct action I desire. Now to the point;
 does RESTlet support these headers? Does anyone else have any suggestions on
 how to make this Flash client talk?

 Jean-Philippe



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

Re: Overriding HTTP headers

2009-02-02 Thread Jean-Philippe Steinmetz
So I removed the code that initialized a new instance of the TunnelService
as apparently it was enabled by default already. I have successfully tested
the request POST http://host/app/resource/15?method=UPDATE. However
performing a DELETE operation the same way results in a GET. The tomcat logs
do not give any stack traces or other output that would indicate something
is wrong. I also have logger messages set to display when the
removeRepresentation method is called but am seeing nothing in the logs.
Lastly, I can confirm DELETE http://host/app/resource/15 works using a
restlet java client for testing.

This seems quite strange.

Jean-Philippe


On Sat, Jan 31, 2009 at 4:27 AM, Jerome Louvel jerome.lou...@noelios.comwrote:

  Hello,

 This should really work... The tunnel service is enabled by default, so the
 first line shouldn't even be necessary. What is displayed in the logs? If
 the tunnel service works as expected, you should see DELETE as the invoked
 method.

 Otherwise, I would suggest to send us a small reproducible sample or to
 debug the TunnelFilter code if you are willing to dig into Restlet code :)

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

  --
 *De :* Jean-Philippe Steinmetz [mailto:caskate...@gmail.com]
 *Envoyé :* samedi 31 janvier 2009 00:39
 *À :* discuss@restlet.tigris.org
 *Objet :* Re: Overriding HTTP headers

 Ok. I've added the following to my Application's constructor.

 getTunnelService().setEnabled(true);

 But when I try and perform the following:

 POST http://host/resource/1?method=DELETE

 All it does is retrieve the resource.

 Am I missing something?

 On Fri, Jan 30, 2009 at 12:01 AM, Karel Vervaeke 
 ka...@outerthought.orgwrote:

 Just scanning your mail diagonally I think you need to add the method
 parameter to your query string (in combination with POST requests):

 http://host/path?method=PUT
 http://host/path?method=DELETE

 (You should have the tunnel service enabled)

 HTH,
 Karel

 On Fri, Jan 30, 2009 at 8:00 AM, Jean-Philippe Steinmetz
 caskate...@gmail.com wrote:
  Hello again,
 
  One of my REST clients will be a Flash application. As some or all of
 you
  are aware Flash's URLRequest is a bit broken in that it doesn't fully
  support the HTTP protocol. I have tried using arc90restlib that Jerome
  suggested at http://lab.arc90.com/2008/03/restservice.php but
 unfortunately
  all I get are IOErrors when a request is sent anywhere. It could be that
 i'm
  loading in a Flex library into a Flash app but it's a bit hard too
 difficult
  to debug at this point. I can only assume there is an issue with the
  library. Short of writing my own HTTP socket library I was given a tip
 on
  using Flash's built-in URLRequest method and utilizing override headers
 to
  perform the PUT and DELETE operations. Specifically I am adding the
 header
  X-HTTP-Method-Override with the correct action I desire. Now to the
 point;
  does RESTlet support these headers? Does anyone else have any
 suggestions on
  how to make this Flash client talk?
 
  Jean-Philippe
 

 --

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




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

RE: Overriding HTTP headers

2009-01-31 Thread Jerome Louvel
Hello,
 
This should really work... The tunnel service is enabled by default, so the 
first line shouldn't even be necessary. What is
displayed in the logs? If the tunnel service works as expected, you should see 
DELETE as the invoked method.
 
Otherwise, I would suggest to send us a small reproducible sample or to debug 
the TunnelFilter code if you are willing to dig into
Restlet code :)
 
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~  http://www.restlet.org/ 
http://www.restlet.org
Noelios Technologies ~ Co-founder ~  http://www.noelios.com/ 
http://www.noelios.com

  _  

De : Jean-Philippe Steinmetz [mailto:caskate...@gmail.com] 
Envoye : samedi 31 janvier 2009 00:39
A : discuss@restlet.tigris.org
Objet : Re: Overriding HTTP headers


Ok. I've added the following to my Application's constructor.

getTunnelService().setEnabled(true);

But when I try and perform the following:

POST http://host/resource/1?method=DELETE

All it does is retrieve the resource.

Am I missing something?


On Fri, Jan 30, 2009 at 12:01 AM, Karel Vervaeke ka...@outerthought.org wrote:


Just scanning your mail diagonally I think you need to add the method
parameter to your query string (in combination with POST requests):

http://host/path?method=PUT
http://host/path?method=DELETE

(You should have the tunnel service enabled)

HTH,
Karel


On Fri, Jan 30, 2009 at 8:00 AM, Jean-Philippe Steinmetz
caskate...@gmail.com wrote:
 Hello again,

 One of my REST clients will be a Flash application. As some or all of you
 are aware Flash's URLRequest is a bit broken in that it doesn't fully
 support the HTTP protocol. I have tried using arc90restlib that Jerome
 suggested at http://lab.arc90.com/2008/03/restservice.php but unfortunately
 all I get are IOErrors when a request is sent anywhere. It could be that i'm
 loading in a Flex library into a Flash app but it's a bit hard too difficult
 to debug at this point. I can only assume there is an issue with the
 library. Short of writing my own HTTP socket library I was given a tip on
 using Flash's built-in URLRequest method and utilizing override headers to
 perform the PUT and DELETE operations. Specifically I am adding the header
 X-HTTP-Method-Override with the correct action I desire. Now to the point;
 does RESTlet support these headers? Does anyone else have any suggestions on
 how to make this Flash client talk?

 Jean-Philippe



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

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

Re: Overriding HTTP headers

2009-01-30 Thread Karel Vervaeke
Just scanning your mail diagonally I think you need to add the method
parameter to your query string (in combination with POST requests):

http://host/path?method=PUT
http://host/path?method=DELETE

(You should have the tunnel service enabled)

HTH,
Karel

On Fri, Jan 30, 2009 at 8:00 AM, Jean-Philippe Steinmetz
caskate...@gmail.com wrote:
 Hello again,

 One of my REST clients will be a Flash application. As some or all of you
 are aware Flash's URLRequest is a bit broken in that it doesn't fully
 support the HTTP protocol. I have tried using arc90restlib that Jerome
 suggested at http://lab.arc90.com/2008/03/restservice.php but unfortunately
 all I get are IOErrors when a request is sent anywhere. It could be that i'm
 loading in a Flex library into a Flash app but it's a bit hard too difficult
 to debug at this point. I can only assume there is an issue with the
 library. Short of writing my own HTTP socket library I was given a tip on
 using Flash's built-in URLRequest method and utilizing override headers to
 perform the PUT and DELETE operations. Specifically I am adding the header
 X-HTTP-Method-Override with the correct action I desire. Now to the point;
 does RESTlet support these headers? Does anyone else have any suggestions on
 how to make this Flash client talk?

 Jean-Philippe


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


RE: Overriding HTTP headers

2009-01-30 Thread Jerome Louvel
Hi Jean-Philippe,

In addition to the current workaround described by Karel, we are planning to 
support the X-HTTP-Method-Override header in Restlet
1.2:

Support method tunneling via header
http://restlet.tigris.org/issues/show_bug.cgi?id=297

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


-Message d'origine-
De : Karel Vervaeke [mailto:ka...@outerthought.org] 
Envoye : vendredi 30 janvier 2009 09:02
A : discuss@restlet.tigris.org
Objet : Re: Overriding HTTP headers

Just scanning your mail diagonally I think you need to add the method
parameter to your query string (in combination with POST requests):

http://host/path?method=PUT
http://host/path?method=DELETE

(You should have the tunnel service enabled)

HTH,
Karel

On Fri, Jan 30, 2009 at 8:00 AM, Jean-Philippe Steinmetz
caskate...@gmail.com wrote:
 Hello again,

 One of my REST clients will be a Flash application. As some or all of you
 are aware Flash's URLRequest is a bit broken in that it doesn't fully
 support the HTTP protocol. I have tried using arc90restlib that Jerome
 suggested at http://lab.arc90.com/2008/03/restservice.php but unfortunately
 all I get are IOErrors when a request is sent anywhere. It could be that i'm
 loading in a Flex library into a Flash app but it's a bit hard too difficult
 to debug at this point. I can only assume there is an issue with the
 library. Short of writing my own HTTP socket library I was given a tip on
 using Flash's built-in URLRequest method and utilizing override headers to
 perform the PUT and DELETE operations. Specifically I am adding the header
 X-HTTP-Method-Override with the correct action I desire. Now to the point;
 does RESTlet support these headers? Does anyone else have any suggestions on
 how to make this Flash client talk?

 Jean-Philippe


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

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


Re: Overriding HTTP headers

2009-01-30 Thread Jean-Philippe Steinmetz
Excellent. The current workaround should work just nicely for now. I would
be more than happy to implement the header override feature if no one else
is currently working on it.

Jean-Philippe

On Fri, Jan 30, 2009 at 12:40 AM, Jerome Louvel
jerome.lou...@noelios.comwrote:

 Hi Jean-Philippe,

 In addition to the current workaround described by Karel, we are planning
 to support the X-HTTP-Method-Override header in Restlet
 1.2:

 Support method tunneling via header
 http://restlet.tigris.org/issues/show_bug.cgi?id=297

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


 -Message d'origine-
 De : Karel Vervaeke [mailto:ka...@outerthought.org]
 Envoye : vendredi 30 janvier 2009 09:02
 A : discuss@restlet.tigris.org
 Objet : Re: Overriding HTTP headers

 Just scanning your mail diagonally I think you need to add the method
 parameter to your query string (in combination with POST requests):

 http://host/path?method=PUT
 http://host/path?method=DELETE

 (You should have the tunnel service enabled)

 HTH,
 Karel

 On Fri, Jan 30, 2009 at 8:00 AM, Jean-Philippe Steinmetz
 caskate...@gmail.com wrote:
  Hello again,
 
  One of my REST clients will be a Flash application. As some or all of you
  are aware Flash's URLRequest is a bit broken in that it doesn't fully
  support the HTTP protocol. I have tried using arc90restlib that Jerome
  suggested at http://lab.arc90.com/2008/03/restservice.php but
 unfortunately
  all I get are IOErrors when a request is sent anywhere. It could be that
 i'm
  loading in a Flex library into a Flash app but it's a bit hard too
 difficult
  to debug at this point. I can only assume there is an issue with the
  library. Short of writing my own HTTP socket library I was given a tip on
  using Flash's built-in URLRequest method and utilizing override headers
 to
  perform the PUT and DELETE operations. Specifically I am adding the
 header
  X-HTTP-Method-Override with the correct action I desire. Now to the
 point;
  does RESTlet support these headers? Does anyone else have any suggestions
 on
  how to make this Flash client talk?
 
  Jean-Philippe
 

 --

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

 --

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


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

RE: Overriding HTTP headers

2009-01-30 Thread Jerome Louvel
Jean-Philippe,
 
Nice idea! I suggest that you add the following methods to TunnelService:

*   

isHeaderTunnel() : boolean
*   

setHeaderTunnel(boolean)

Then, if both the methodTunnel and the headerTunnel are 'true', then you 
should look for the X-HTTP-Method-Override extension
header.
 
If also need to be careful about priority between tunnelling mechanisms. If 
both the extension header and the 'method' query
parameters are specified, then the query parameter should 'win'.
 
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~  http://www.restlet.org/ 
http://www.restlet.org
Noelios Technologies ~ Co-founder ~  http://www.noelios.com/ 
http://www.noelios.com
 
  _  

De : Jean-Philippe Steinmetz [mailto:caskate...@gmail.com] 
Envoye : vendredi 30 janvier 2009 09:51
A : discuss@restlet.tigris.org
Objet : Re: Overriding HTTP headers


Excellent. The current workaround should work just nicely for now. I would be 
more than happy to implement the header override
feature if no one else is currently working on it.

Jean-Philippe


On Fri, Jan 30, 2009 at 12:40 AM, Jerome Louvel jerome.lou...@noelios.com 
wrote:


Hi Jean-Philippe,

In addition to the current workaround described by Karel, we are planning to 
support the X-HTTP-Method-Override header in Restlet
1.2:

Support method tunneling via header
http://restlet.tigris.org/issues/show_bug.cgi?id=297

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


-Message d'origine-
De : Karel Vervaeke [mailto:ka...@outerthought.org]
Envoye : vendredi 30 janvier 2009 09:02
A : discuss@restlet.tigris.org
Objet : Re: Overriding HTTP headers


Just scanning your mail diagonally I think you need to add the method
parameter to your query string (in combination with POST requests):

http://host/path?method=PUT
http://host/path?method=DELETE

(You should have the tunnel service enabled)

HTH,
Karel

On Fri, Jan 30, 2009 at 8:00 AM, Jean-Philippe Steinmetz
caskate...@gmail.com wrote:
 Hello again,

 One of my REST clients will be a Flash application. As some or all of you
 are aware Flash's URLRequest is a bit broken in that it doesn't fully
 support the HTTP protocol. I have tried using arc90restlib that Jerome
 suggested at http://lab.arc90.com/2008/03/restservice.php but unfortunately
 all I get are IOErrors when a request is sent anywhere. It could be that i'm
 loading in a Flex library into a Flash app but it's a bit hard too difficult
 to debug at this point. I can only assume there is an issue with the
 library. Short of writing my own HTTP socket library I was given a tip on
 using Flash's built-in URLRequest method and utilizing override headers to
 perform the PUT and DELETE operations. Specifically I am adding the header
 X-HTTP-Method-Override with the correct action I desire. Now to the point;
 does RESTlet support these headers? Does anyone else have any suggestions on
 how to make this Flash client talk?

 Jean-Philippe


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

--

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

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

Re: Overriding HTTP headers

2009-01-30 Thread Jean-Philippe Steinmetz
Ok. I've added the following to my Application's constructor.

getTunnelService().setEnabled(true);

But when I try and perform the following:

POST http://host/resource/1?method=DELETE

All it does is retrieve the resource.

Am I missing something?

On Fri, Jan 30, 2009 at 12:01 AM, Karel Vervaeke ka...@outerthought.orgwrote:

 Just scanning your mail diagonally I think you need to add the method
 parameter to your query string (in combination with POST requests):

 http://host/path?method=PUT
 http://host/path?method=DELETE

 (You should have the tunnel service enabled)

 HTH,
 Karel

 On Fri, Jan 30, 2009 at 8:00 AM, Jean-Philippe Steinmetz
 caskate...@gmail.com wrote:
  Hello again,
 
  One of my REST clients will be a Flash application. As some or all of you
  are aware Flash's URLRequest is a bit broken in that it doesn't fully
  support the HTTP protocol. I have tried using arc90restlib that Jerome
  suggested at http://lab.arc90.com/2008/03/restservice.php but
 unfortunately
  all I get are IOErrors when a request is sent anywhere. It could be that
 i'm
  loading in a Flex library into a Flash app but it's a bit hard too
 difficult
  to debug at this point. I can only assume there is an issue with the
  library. Short of writing my own HTTP socket library I was given a tip on
  using Flash's built-in URLRequest method and utilizing override headers
 to
  perform the PUT and DELETE operations. Specifically I am adding the
 header
  X-HTTP-Method-Override with the correct action I desire. Now to the
 point;
  does RESTlet support these headers? Does anyone else have any suggestions
 on
  how to make this Flash client talk?
 
  Jean-Philippe
 

 --

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


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

Overriding HTTP headers

2009-01-29 Thread Jean-Philippe Steinmetz
Hello again,

One of my REST clients will be a Flash application. As some or all of you
are aware Flash's URLRequest is a bit broken in that it doesn't fully
support the HTTP protocol. I have tried using arc90restlib that Jerome
suggested at http://lab.arc90.com/2008/03/restservice.php but unfortunately
all I get are IOErrors when a request is sent anywhere. It could be that i'm
loading in a Flex library into a Flash app but it's a bit hard too difficult
to debug at this point. I can only assume there is an issue with the
library. Short of writing my own HTTP socket library I was given a tip on
using Flash's built-in URLRequest method and utilizing override headers to
perform the PUT and DELETE operations. Specifically I am adding the header
X-HTTP-Method-Override with the correct action I desire. Now to the point;
does RESTlet support these headers? Does anyone else have any suggestions on
how to make this Flash client talk?

Jean-Philippe

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

Re: HTTP Headers missing from Request to Response

2007-12-07 Thread Jerome Louvel
Hi Ben,

You can also try with different Restlet HTTP client connector. Otherwise, a
reproducible test case would help us to pinpoint the issue. Feel free to
open a defect report in the tracker.

Best regards,
Jerome


2007/12/6, Stephan Koops [EMAIL PROTECTED]:

 Hello Ben,

 do you checked, if the header reaches the server, for example with the
 ethereal (http://www.ethereal.com/
 http://www.ethereal.com/distribution/win32/). On windows you need to
 install an API called Wincap, if I remember right. Look at the web page
 of ethereal.

 regards
Stephan

 Ben schrieb:
  I'm writing a small REST client to use for testing my REST server app.
 The
  relevant code looks something like this:
 
  Client client = new Client(Protocol.HTTP);
  Request request = new Request();
 
  // build request from UI input
  // ...
  // add any header fields defined by user
  // one of these is X-Target-Location
  request.getAttributes().put(headerName, headerValue);
 
  // Send request to server
  Response response = client.handle(request);
 
 
  My problem:
  In the server code, when the request arrives, and my custom Resource is
 invoked
  to handle it, not all of the HTTP headers from the request are present.
 I
  expected the following Form to include all headers added in the client
 above:
 
  (Form) getRequest().getAttributes().get(org.restlet.http.headers);
 
  It includes various standard HTTP headers, but not the custom
  X-Target-Location header. I also stepped through everything in
  getRequest().getAttributes() but don't see it hiding anywhere else ...
 
  What happens to custom HTTP headers, and where can I find them?
 
  Note, please, that I tested the server using a different client and the
 custom
  header came through fine there. This leads me to believe that my error
 is in the
  client Request code, but I don't know where?
 
  Thank you,
  Ben.
 
 



Re: HTTP Headers missing from Request to Response

2007-12-06 Thread Stephan Koops

Hello Ben,

do you checked, if the header reaches the server, for example with the 
ethereal (http://www.ethereal.com/ 
http://www.ethereal.com/distribution/win32/). On windows you need to 
install an API called Wincap, if I remember right. Look at the web page 
of ethereal.


regards
  Stephan

Ben schrieb:

I'm writing a small REST client to use for testing my REST server app. The
relevant code looks something like this:

Client client = new Client(Protocol.HTTP);
Request request = new Request();

// build request from UI input
// ...
// add any header fields defined by user
// one of these is X-Target-Location
request.getAttributes().put(headerName, headerValue);

// Send request to server
Response response = client.handle(request);


My problem: 
In the server code, when the request arrives, and my custom Resource is invoked

to handle it, not all of the HTTP headers from the request are present. I
expected the following Form to include all headers added in the client above:

(Form) getRequest().getAttributes().get(org.restlet.http.headers);

It includes various standard HTTP headers, but not the custom
X-Target-Location header. I also stepped through everything in
getRequest().getAttributes() but don't see it hiding anywhere else ...

What happens to custom HTTP headers, and where can I find them?

Note, please, that I tested the server using a different client and the custom
header came through fine there. This leads me to believe that my error is in the
client Request code, but I don't know where?

Thank you,
Ben.

  


Re: HTTP Headers

2007-04-13 Thread Dig

Jerome Louvel contact at noelios.com writes:

 Hi Dig,
 
 Complete caching support is not available in the API yet. It is planned for
 a future release, see: http://restlet.tigris.org/issues/show_bug.cgi?id=25
 
 You are touching a sensitive point. I have relaxed the usage of the standard
 HTTP headers that are not yet supported in the API. You will still get a
 message in the logs (INFO level instead of WARNING), but it will work.
 Checked in SVN.
 
 Also, I have entered a new issue to keep track of all unsupported standard
 HTTP headers:
 http://restlet.tigris.org/issues/show_bug.cgi?id=282
 
 Best regards,
 Jerome  


Hi Jerome,

Thanks for the response - very helpful. I'll implement these 
headers once I upgrade.

Best regards,

Dig.



Getting HTTP Headers - Case sensitive?

2007-04-04 Thread Alex Milowski

If I need to get a Slug header, I can do:

Form headers =
getRequest().getAttributes().get(org.restlet.http.headers);
String slug = headers.getValues(Slug);

but is that Slug or slug or does it not matter?  For a header, it
should be case-insensitive.

--Alex Milowski


RE: Getting HTTP Headers - Case sensitive?

2007-04-04 Thread Jerome Louvel

Hi Alex,

No problem, the getValues(String name) method is case insensitive. There
is also getValues(String, String, boolean) method which lets you control the
case sensitivity. 

Best regards,
Jerome  

 -Message d'origine-
 De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la 
 part de Alex Milowski
 Envoyé : mercredi 4 avril 2007 08:14
 À : discuss@restlet.tigris.org
 Objet : Getting HTTP Headers - Case sensitive?
 
 If I need to get a Slug header, I can do:
 
  Form headers =
 getRequest().getAttributes().get(org.restlet.http.headers);
  String slug = headers.getValues(Slug);
 
 but is that Slug or slug or does it not matter?  For a header, it
 should be case-insensitive.
 
 --Alex Milowski


HTTP Headers

2007-04-04 Thread Dig

Hi,

I would like to set the following HTTP headers in the response:

Cache-Control: no-cache
Pragma: no-cache
Expires: 0

I can't set this directly as Restlet prevents me from setting standard HTTP
headers. I've read the FAQ and the documentation and I understand that instead
of trying to set standard HTTP headers directly I should be using the API, which
is fine.

However, I can't seem to find any reference to the headers above apart from the
constants in HttpConstants.

What should I be doing?

Many thanks in advance,

Dig.


Re: Adding http headers to a Request

2007-01-05 Thread Thierry Boileau

Hello Alex,

I think that the component must not take directly in charge the request. 
You need to create a real HTTP client, such as follow :


   Client client = new Client(Protocol.HTTP);
   client.handle(request, response);


Best regards,
Thierry

Alex Combs a écrit :

I am trying to run a test wherein I create a String that contains 5*1024 bytes
of data, add it to a Request as an http header, feed that request to a 
Component that is running an http server(like this

http://www.restlet.org/tutorial#part06), and have it fail because the default
size of a header buffer is should only 4*1024 bytes (detailed here
www.restlet.org/docs/ext/com/noelios/restlet/ext/jetty/JettyServerHelper.html

However, I must be adding the String to the Request wrongly, because when I run
my current code it ignores the extra large header and successfully finds the
file.  Here is what I am doing currently(using beta 20, if that makes a 
difference):


...//Setting up a component as detailed at 
http://www.restlet.org/tutorial#part06

Request request = new Request(Method.GET, http://localhost:8182/testfile;);
Response response = new Response(request);

//This is where I am trying to add the header, which could be wrong
ParameterList parameterList = new ParameterList();
parameterList.add(x-header-name, hugeStringName);
request.getAttributes().put(org.restlet.http.headers,parameterList);
// www.restlet.org/docs/api/org/restlet/data/Message.html#getAttributes()

request.setProtocol(Protocol.HTTP);
response.getServerInfo().setDomain(localhost);
response.getServerInfo().setPort(8182);

component.handle(request,response);

When run, hugeString should be larger than the header buffer, thus causing the
handle to fail, but it doesn't, it finds testfile and returns it.  I know it
should fail because when I do a wget on the command line with the huge header 
it does fail.  So how am I supposed to be adding headers to an Http Request?  
Thank you