responseMediaType = getContentTypeNormaliser().getNormalisedResponseMediaType(request);
} catch (CougarValidationException e) {
responseMediaType = MediaType.APPLICATION_XML_TYPE;
}
response.setContentType(responseMediaType.toString());
DataBindingFactory dataBindingFactory = DataBindingManager.getInstance().getFactory(responseMediaType);
FaultMarshaller marshaller = dataBindingFactory.getFaultMarshaller();
ByteCountingOutputStream out = null;
try {
out = new ByteCountingOutputStream(response.getOutputStream());
marshaller.marshallFault(out, error.getFault(), getContentTypeNormaliser().getNormalisedEncoding(request));
bytesWritten = out.getCount();