Hello Avi,

The 406 status is a bit special since the spec says that the list of available variants should be returned http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7).
This behaviour has been implemented for the Directory Restlet. In this case, let the status filter replaces the provided entity by the status page is a bit annoying.

If you have a look at the code of the com.noelios.restlet.StatusFilter#afterHandle method, you will see that the status page is sent only if the status is an error status and (the entity is null or the status service  allows to  overwrite it). By default, the status service does not allow to overwrite the provided entity.

So, at this time, if you set the overwrite property of the status service, you will get the status page but the client will not receive the list of available variants. If you want both, you have to design your own status filter.
I wonder if this kind of behaviour could be integrated... Any thought?

Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com



The 1.1 Tutorial states in section 8, Displaying Error Pages:

  
Maybe a resource was not found or an acceptable representation isn't available? In this case, or when
any unhandled exception is be intercepted, the Application or the Component will automatically provide
a default status page for you.
    

( http://www.restlet.org/documentation/1.1/tutorial#part08 )

I have a situation where a client is requesting a mediatype which my
resource doesn't support.

Restlet is correctly returning a 406 error, but it's not returning an
entity with a status page. It is logging a WARNING:

Aug 31, 2008 3:21:18 PM com.noelios.restlet.LogFilter afterHandle
INFO: 2008-08-31 15:21:18 127.0.0.1 - - 3000 GET /people - 406 0 - 7
http://slices:3000 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4;
en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2
Safari/525.20.1 http://slices:3000/people
Aug 31, 2008 3:21:18 PM com.noelios.restlet.http.HttpServerConverter commit
WARNING: A response with an unavailable entity was returned. Ignoring
the entity for resource "http://slices:3000/people.

In this case, shouldn't the default status service return an HTML
entity with a "status page"?

--
Avi Flax » Lead Technologist » Partner » Arc90 » http://arc90.com
  

Reply via email to