@Override protected Object readFromSource(Class<?> clazz, HttpHeaders headers, Source source) throws Exception { try { source = processSource(source); Unmarshaller unmarshaller = createUnmarshaller(clazz); if (clazz.isAnnotationPresent(XmlRootElement.class)) { return unmarshaller.unmarshal(source); } else { JAXBElement<?> jaxbElement = unmarshaller.unmarshal(source, clazz); return jaxbElement.getValue(); } } catch (NullPointerException ex) { if (!isSupportDtd()) { throw new IllegalStateException("NPE while unmarshalling. " + "This can happen due to the presence of DTD declarations which are disabled.", ex); } throw ex; } catch (UnmarshalException ex) { throw ex; } catch (JAXBException ex) { throw new HttpMessageConversionException("Invalid JAXB setup: " + ex.getMessage(), ex); } }
@Override protected Object readFromSource(Class<?> clazz, HttpHeaders headers, Source source) throws Exception { try { source = processSource(source); Unmarshaller unmarshaller = createUnmarshaller(clazz); if (clazz.isAnnotationPresent(XmlRootElement.class)) { return unmarshaller.unmarshal(source); } else { JAXBElement<?> jaxbElement = unmarshaller.unmarshal(source, clazz); return jaxbElement.getValue(); } } catch (NullPointerException ex) { if (!isSupportDtd()) { throw new IllegalStateException("NPE while unmarshalling. " + "This can happen due to the presence of DTD declarations which are disabled.", ex); } throw ex; } catch (UnmarshalException ex) { throw ex; } catch (JAXBException ex) { throw new HttpMessageConversionException("Invalid JAXB setup: " + ex.getMessage(), ex); } }
@Override protected Object readFromSource(Class<?> clazz, HttpHeaders headers, Source source) throws IOException { try { source = processSource(source); Unmarshaller unmarshaller = createUnmarshaller(clazz); if (clazz.isAnnotationPresent(XmlRootElement.class)) { return unmarshaller.unmarshal(source); } else { JAXBElement<?> jaxbElement = unmarshaller.unmarshal(source, clazz); return jaxbElement.getValue(); } } catch (NullPointerException ex) { if (!isSupportDtd()) { throw new HttpMessageNotReadableException("NPE while unmarshalling. " + "This can happen due to the presence of DTD declarations which are disabled.", ex); } throw ex; } catch (UnmarshalException ex) { throw new HttpMessageNotReadableException("Could not unmarshal to [" + clazz + "]: " + ex.getMessage(), ex); } catch (JAXBException ex) { throw new HttpMessageConversionException("Invalid JAXB setup: " + ex.getMessage(), ex); } }
@Override protected Object readFromSource(Class<?> clazz, HttpHeaders headers, Source source) throws Exception { try { source = processSource(source); Unmarshaller unmarshaller = createUnmarshaller(clazz); if (clazz.isAnnotationPresent(XmlRootElement.class)) { return unmarshaller.unmarshal(source); } else { JAXBElement<?> jaxbElement = unmarshaller.unmarshal(source, clazz); return jaxbElement.getValue(); } } catch (NullPointerException ex) { if (!isSupportDtd()) { throw new IllegalStateException("NPE while unmarshalling. " + "This can happen due to the presence of DTD declarations which are disabled.", ex); } throw ex; } catch (UnmarshalException ex) { throw ex; } catch (JAXBException ex) { throw new HttpMessageConversionException("Invalid JAXB setup: " + ex.getMessage(), ex); } }