*
* @throws RestXqServiceException
*/
protected void serializeBody(final Sequence result, final HttpResponse response, final Map<SerializationProperty, String> serializationProperties) throws RestXqServiceException {
SupportedMethod method = null;
try {
final String methodProp = serializationProperties.get(SerializationProperty.METHOD);
method = (methodProp == null ? SupportedMethod.xml : SupportedMethod.valueOf(methodProp));
} catch(final IllegalArgumentException iae) {
//do nothing
//TODO debugging
System.out.println(iae.getMessage());
}
//set the media-type
final String mediaType = serializationProperties.get(SerializationProperty.MEDIA_TYPE);
if(mediaType != null && !mediaType.isEmpty()) {
response.setContentType(mediaType);
}
if(method != null && method.equals(SupportedMethod.binary)) {
serializeBinaryBody(result, response);
} else {
serializeNodeBody(result, response, serializationProperties);
}
}