Spring Framework HttpMessageNotWritableException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework HttpMessageNotWritableException class.

This code example shows how to use the following methods:
			Marshaller marshaller = createMarshaller(clazz);
			setCharset(headers.getContentType(), marshaller);
			marshaller.marshal(o, result);
		} 
		catch (MarshalException ex) {
			throw new HttpMessageNotWritableException("Could not marshal [" + o + "]: " + ex.getMessage(), ex);
		} 
		catch (JAXBException ex) {
			throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
		} 
	} 
 
	private void setCharset(MediaType contentType, Marshaller marshaller) throws PropertyException {
		if (contentType != null && contentType.getCharSet() != null) {
			marshaller.setProperty(Marshaller.JAXB_ENCODING, contentType.getCharSet().name());
		} 
	} 
 
 
	private static final EntityResolver NO_OP_ENTITY_RESOLVER = new EntityResolver() {
5
CodeRank
This code example shows how to use the following methods:
            setCharset(headers.getContentType(), marshaller);
            marshaller.marshal(o, result);
        } 
        catch (MarshalException ex)
        { 
            throw new HttpMessageNotWritableException("Could not marshal [" + o + "]: " + ex.getMessage(), ex);
        } 
        catch (JAXBException ex)
        { 
            throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
        } 
    } 
 
    private void setCharset(MediaType contentType, Marshaller marshaller) throws PropertyException
    { 
        if (contentType != null && contentType.getCharSet() != null)
        { 
            marshaller.setProperty(Marshaller.JAXB_ENCODING, contentType.getCharSet().name());
        } 
    } 
4
CodeRank