Hello Sersan,

at this time, the content negotiation algorithm makes all the possible
efforts to return a representation, and let the client to decide if it can
deal with it.
There is an RFE for this topic:
http://restlet.tigris.org/issues/show_bug.cgi?id=244
As a workaround, you can add a filter on server side, which test the
returned entity (in case of GET requests), and decide it the entity is fine
or not (in this case "406-not acceptable" status,
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7)
Please, feel free to ask for more details.

Best regards,
Thierry Boileau

Hi,
>
> I'm developing a restlet application and I have a ServerResource with only
> one Get:
>
> @GET("xml")
> public DomRepresentation responseToXML(){}
>
> The GET works, I receive the xml document. However, when I set the Accept
> Header to anything different, The ServerResource still sends me the xml.
> Here's an example:
>
> curl -H "Accept: application/json" "http://site/users/2";
> then I receive the xml, but I should have received nothing or a 404 error.
>
> Am I missing something here?
> Is there a way to restrict the response if the Accept Header sent by the
> client is not available in the ServerResource?
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2713325
>

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

Reply via email to