public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream, final MultipartRelatedInput xopPackage) throws IOException { try { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); InputPart rootPart = xopPackage.getRootPart(); JAXBContext jaxb = findJAXBContext(type, annotations, rootPart .getMediaType(), true); Unmarshaller unmarshaller = jaxb.createUnmarshaller(); unmarshaller .setAttachmentUnmarshaller(new XopAttachmentUnmarshaller( xopPackage)); return unmarshaller.unmarshal(new StreamSource(rootPart.getBody( InputStream.class, null))); } catch (JAXBException e) { Response response = Response.serverError().build(); throw new WebApplicationException(e, response); } }
public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream, final MultipartRelatedInput xopPackage) throws IOException { try { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); InputPart rootPart = xopPackage.getRootPart(); JAXBContext jaxb = findJAXBContext(type, annotations, rootPart .getMediaType(), true); Unmarshaller unmarshaller = jaxb.createUnmarshaller(); unmarshaller .setAttachmentUnmarshaller(new XopAttachmentUnmarshaller( xopPackage)); return unmarshaller.unmarshal(new StreamSource(rootPart.getBody( InputStream.class, null))); } catch (JAXBException e) { Response response = Response.serverError().build(); throw new WebApplicationException(e, response); } }