Fix has been committed to trunk and 1.5.x branch.
On Tue, Feb 3, 2009 at 6:00 PM, William Tam <[email protected]> wrote: > That would make sense. Will get it fixed. Thanks for your patch. > https://issues.apache.org/activemq/browse/CAMEL-1312 > > > On Tue, Feb 3, 2009 at 5:16 PM, nojonojo <[email protected]> wrote: >> >> I'll go so far as to suggest a change that would enable both of these. In >> the DefaultRestletBinding class, the populateRestletResponseFromExchange >> method could start like this: >> >> public void populateRestletResponseFromExchange(Exchange exchange, >> >> Response response) { >> >> Object body = exchange.getOut().getBody(); >> >> MediaType mediaType = null; >> >> String contentType = (String) exchange.getOut().getHeader( >> CONTENT_TYPE_HEADER); >> >> if (contentType != null) { >> mediaType = MediaType.valueOf(contentType); >> } >> >> if (mediaType == null) { >> if (body instanceof String) { >> >> mediaType = MediaType.TEXT_PLAIN; >> >> } else if (body instanceof StringSource || body instanceof >> DOMSource) >> { >> >> mediaType = MediaType.TEXT_XML; >> >> } >> } >> >> String responseCodeHeader = (String) >> exchange.getOut().getHeader( >> RESPONSE_STATUS_CODE_HEADER); >> >> if (responseCodeHeader != null) { >> response.setStatus(Status.valueOf(Integer >> .parseInt(responseCodeHeader))); >> } >> >> ... (rest of method is as before) >> >> In this case, headers could be set that would indicate what content type / >> status code to use, and the current behavior would be retained if not >> specified. >> >> >> nojonojo wrote: >>> >>> >>> Is there a way to set the content type and return code on the response >>> sent by the Restlet component? Looking at the code, it's clear that the >>> answer is "no" for the content type - you get either text/plain or >>> text/xml (no chance for application/JSON or anything else user-defined). >>> >>> Thanks. >>> >>> Nolan >>> >> >> -- >> View this message in context: >> http://www.nabble.com/restlet-response-content-type-and-return-code-tp21819209s22882p21820115.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> >
