Content type - Restlet
- by DutrowLLC
How do you set the content type in Restlet (version 2.0 for google app engine)? In this case, I'd like to set the content type to ""text/xml".
I have:
public class SubResource extends ServerResource {
@Get
public Representation get(Representation representation){
setStatus(Status.SUCCESS_OK);
StringRepresentation sr = new StringRepresentation(getSomeXml());
return sr;
}
}
I'm unsure even if it is a value that is set in the Representation, or if it is set from the ServerResource class the same way that the return code is.
ANSWER:
StringRepresentation sr = new StringRepresentation(getSomeXml());
sr.setMediaType(MediaType.TEXT_XML);