Hi,

I want to implement a Restlet that basically does the same as content 
negotiation just instead of returning the appropriate representation, it should 
redirect the client (using 303) to the URI of the specific resource which 
fulfils the clients preferences. The reason is that the specific resources are 
on different (unrelated) domains and I don't want to republish the other 
domain's data but instead tell the client where it is. Using conneg would also 
mean that the representations have certain properties in common with the 
generic resource (the one I'm doing the conneg from) but I don't want this 
relatedness, it would lead to copyright problems and whatnot.

Anyway, I'm having difficulties implementing that. My idea so far is that I 
have a Restlet for the generic resource which, in the handle method, inspects 
the different accept values available in the ClientInfo object 
(Restlet.getClientInfo()), decides which resource is most appropriate, gets the 
URI for that resource and then calls response.redirectSeeOther(uri);
Then I would attach the Restlet for the generic resource as well as the 
specific Resource classes to a router and would be done.

The problem is the deciding bit. I don't want to re-implement all the conneg 
logic. Is there a way to use what's there already? I'd rather use a Resource 
class than a raw Restlet. And if not, where would I find the code for how the 
conneg logic is implemented at the moment? Resource.getPreferredVariant()? 
Maybe I can copy the needed bits from there before starting from scratch. :-)

Thanks,
 Simon

Reply via email to