Hello Mark,
As far as I understand, I feel that you're talking about how to respond
to a POST request. You may have a look at this [1], which says that:
If a resource has been created on the origin server, the response
SHOULD be 201 (Created) and contain an entity which describes the status
of the request and refers to the new resource, and a Location header
(see section 14.30).
In your case, you don't want to send an entity but still want to set the
Location header. Thus, don't set the response's entity but call the
Response#setLocationRef method (see also this link [2] for more details
about the mapping HTTP headers/Restlet API).
I hope I answer your question.
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5
[2] http://wiki.restlet.org/docs_1.1/13-restlet/27-restlet/130-restlet.html
Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
Good day.
The First Resource app has code similar to this for setting the location
of created resource:
String entity = Items created;
Representation rep = new StringRepresentation(entity,
MediaType.TEXT_PLAIN);
rep.setIdentifier(getRequest().getResourceRef().getIdentifier() + / +
so.getId().toString());
getResponse().setEntity(rep);
...
However, my app, that does something similar, has no need to set an
actual entity value. So I set entity=, but which results in this
warning on the server side when the response is returned:
WARNING: A response with an unavailable entity was returned. Ignoring
the entity for resource http://localhost:8182/log/AVal
I'd rather not return an entity with nonzero length if no agent will use
it - and no agent of mine does.
How should I handle this, all the while avoiding the warning in the
server log?
Thanks.