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:[email protected]]
Envoyé : lundi 2 février 2009 23:41
À : [email protected]
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 <[email protected]>
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:[email protected]]
Envoy� : samedi 31 janvier 2009 00:39
� : [email protected]
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 <[email protected]> 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
<[email protected]> 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=4447&dsMessageId=1072845>
&dsMessageId=1072845
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1096445