Hi Matthew,
The TunnelFilter worls correctly only in the context of a Restlet
application. We kindly encourage you to use application wich provides
some built-in services such as filtering.
However, if you don't want to be in such case, you can create your own
filter with the code of the "beforeHandle" method.
Having done that, you can add your filter in front of your Router:
**********
// create the converter
this.converter = new ServletConverter(getServletContext());
//create the filter
MyFilter myFilter = new MyFilter();
// create the router and attach a default router
Router router = new Router();
myFilter.setNext(router);
this.converter.setTarget(myFilter);
***********
This way, all requests will transit by your filter that will update the
request object.
I hope it wil help you. Feel free to ask any question.
Best regards,
Thierry Boileau
ps: are you working with Spring?
Thanks for all that. It doesn't seem to work using the
ServletConverter though. I can't work out how I am supposed to hook it
up, my servlet init code looks pretty much like this:
// create the converter
this.converter = new ServletConverter(getServletContext());
// create the router and attach a default router
Router router = new Router();
this.converter.setTarget(router);
I have no Application and so nohting to associate the TunnelFilter with?
As you can see my knowledge is very limited, any help appreciated
Matthew
On 23/05/2007, at 11:48 PM, Thierry Boileau wrote:
Hello Matthew,
I suppose you think about this issue [1] and this discussion [2].
So, these web pages [3], [4] wait for you!
>Also does this work with the ServletConverter style of Restlet ?
It should, I think, because this had been implemented at the
application level, in the TunnelFilter class.
Best regards,
Thierry Boileau
[1] http://restlet.tigris.org/issues/show_bug.cgi?id=147
[2] http://restlet.tigris.org/servlets/ReadMsg?list=discuss&msgNo=559
[3]
http://www.restlet.org/documentation/1.0/api/org/restlet/service/TunnelService.html
[4]
http://www.restlet.org/documentation/1.0/nre/com/noelios/restlet/application/TunnelFilter.html
In previous discussions I had sen somethign about being able to
"coerce" particular content type by specifying a parameter in the
incoming URL, something like http://host.com/resource?media=json
But I can't turn up anything in the documenation. Can someone please
point me in the right place. Also does this work with the
ServletConverter style of reslet ?
Thanks,
Matthew