public Object getJAXBObject(JAXBContextFinder finder, MediaType mediaType, Class<?> clazz, Element element) throws JAXBException { JAXBContext ctx = finder.findCachedContext(clazz, mediaType, null); return ctx.createUnmarshaller().unmarshal(element); }
public Object getJAXBObject(JAXBContextFinder finder, MediaType mediaType, Class<?> clazz, Element element) throws JAXBException { JAXBContext ctx = finder.findCachedContext(clazz, mediaType, null); return ctx.createUnmarshaller().unmarshal(element); }
public Entry readFrom(Class<Entry> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); JAXBContextFinder finder = getFinder(mediaType); if (finder == null) { throw new JAXBUnmarshalException(Messages.MESSAGES.unableToFindJAXBContext(mediaType)); } try { JAXBContext ctx = finder.findCachedContext(Entry.class, mediaType, annotations); Entry entry = (Entry) ctx.createUnmarshaller().unmarshal(entityStream); if (entry.getContent() != null) entry.getContent().setFinder(finder); entry.setFinder(finder); return entry; } catch (JAXBException e) { throw new JAXBUnmarshalException(Messages.MESSAGES.unableToUnmarshal(mediaType), e); } }
JAXBContext ctx = finder.findCachedContext(JaxbCollection.class, mediaType, annotations); Unmarshaller unmarshaller = ctx.createUnmarshaller(); unmarshaller = new SecureUnmarshaller(unmarshaller, disableExternalEntities, enableSecureProcessingFeature, disableDTDs); JAXBContext ctx = finder.findCachedContext(JaxbCollection.class, mediaType, annotations); ele = ctx.createUnmarshaller().unmarshal(source, JaxbCollection.class); ctx = finder.findCachedContext(adaptedType, mediaType, null); ctx = finder.findCachedContext(baseType, mediaType, null);
public JAXBContext findJAXBContext(Class<?> type, Annotation[] annotations, MediaType mediaType, boolean reader) throws JAXBException { ContextResolver<JAXBContextFinder> resolver = providers.getContextResolver(JAXBContextFinder.class, mediaType); JAXBContextFinder finder = resolver.getContext(type); if (finder == null) { if (reader) throw new JAXBUnmarshalException(Messages.MESSAGES.couldNotFindJAXBContextFinder(mediaType)); else throw new JAXBMarshalException(Messages.MESSAGES.couldNotFindJAXBContextFinder(mediaType)); } return finder.findCachedContext(type, mediaType, annotations); }
public Feed readFrom(Class<Feed> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); JAXBContextFinder finder = getFinder(mediaType); if (finder == null) { throw new JAXBUnmarshalException(Messages.MESSAGES.unableToFindJAXBContext(mediaType)); } try { JAXBContext ctx = finder.findCachedContext(Feed.class, mediaType, annotations); Feed feed = (Feed) ctx.createUnmarshaller().unmarshal(entityStream); for (Entry entry : feed.getEntries()) { entry.setFinder(finder); if (entry.getContent() != null) entry.getContent().setFinder(finder); } return feed; } catch (JAXBException e) { throw new JAXBUnmarshalException(Messages.MESSAGES.unableToUnmarshal(mediaType), e); } }
try JAXBContext ctx = finder.findCachedContext(baseType, mediaType, annotations); Marshaller marshaller = ctx.createMarshaller(); marshaller = AbstractJAXBProvider.decorateMarshaller(baseType, annotations, mediaType, marshaller);
public Entry readFrom(Class<Entry> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { JAXBContextFinder finder = getFinder(mediaType); if (finder == null) { throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType); } try { JAXBContext ctx = finder.findCachedContext(Entry.class, mediaType, annotations); Entry entry = (Entry) ctx.createUnmarshaller().unmarshal(entityStream); if (entry.getContent() != null) entry.getContent().setFinder(finder); entry.setFinder(finder); return entry; } catch (JAXBException e) { throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e); } }
public Feed readFrom(Class<Feed> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { JAXBContextFinder finder = getFinder(mediaType); if (finder == null) { throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType); } try { JAXBContext ctx = finder.findCachedContext(Feed.class, mediaType, annotations); Feed feed = (Feed) ctx.createUnmarshaller().unmarshal(entityStream); for (Entry entry : feed.getEntries()) { if (entry.getContent() != null) entry.getContent().setFinder(finder); } return feed; } catch (JAXBException e) { throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e); } }
public Entry readFrom(Class<Entry> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); JAXBContextFinder finder = getFinder(mediaType); if (finder == null) { throw new JAXBUnmarshalException(Messages.MESSAGES.unableToFindJAXBContext(mediaType)); } try { JAXBContext ctx = finder.findCachedContext(Entry.class, mediaType, annotations); Entry entry = (Entry) ctx.createUnmarshaller().unmarshal(entityStream); if (entry.getContent() != null) entry.getContent().setFinder(finder); entry.setFinder(finder); return entry; } catch (JAXBException e) { throw new JAXBUnmarshalException(Messages.MESSAGES.unableToUnmarshal(mediaType), e); } }
public Feed readFrom(Class<Feed> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); JAXBContextFinder finder = getFinder(mediaType); if (finder == null) { throw new JAXBUnmarshalException(Messages.MESSAGES.unableToFindJAXBContext(mediaType)); } try { JAXBContext ctx = finder.findCachedContext(Feed.class, mediaType, annotations); Feed feed = (Feed) ctx.createUnmarshaller().unmarshal(entityStream); for (Entry entry : feed.getEntries()) { entry.setFinder(finder); if (entry.getContent() != null) entry.getContent().setFinder(finder); } return feed; } catch (JAXBException e) { throw new JAXBUnmarshalException(Messages.MESSAGES.unableToUnmarshal(mediaType), e); } }