public Object readFrom(Class<Object> cls, Type type, Annotation[] anns, MediaType mt, MultivaluedMap<String, String> headers, InputStream is) throws IOException, WebApplicationException { boolean isFeed = isFeedRequested(mt); if (isFeed) { return readFromFeedOrEntry(cls, mt, headers, is); } AtomEntryProvider p = new AtomEntryProvider(); p.setAutodetectCharset(autodetectCharset); Entry entry = p.readFrom(Entry.class, Entry.class, new Annotation[]{}, mt, headers, is); return readFromEntry(entry, cls); }
public Object readFrom(Class<Object> cls, Type type, Annotation[] anns, MediaType mt, MultivaluedMap<String, String> headers, InputStream is) throws IOException, WebApplicationException { boolean isFeed = isFeedRequested(mt); if (isFeed) { return readFromFeedOrEntry(cls, mt, headers, is); } AtomEntryProvider p = new AtomEntryProvider(); p.setAutodetectCharset(autodetectCharset); Entry entry = p.readFrom(Entry.class, Entry.class, new Annotation[]{}, mt, headers, is); return readFromEntry(entry, cls); }
public Object readFrom(Class<Object> cls, Type type, Annotation[] anns, MediaType mt, MultivaluedMap<String, String> headers, InputStream is) throws IOException, WebApplicationException { boolean isFeed = isFeedRequested(mt); if (isFeed) { return readFromFeedOrEntry(cls, mt, headers, is); } else { AtomEntryProvider p = new AtomEntryProvider(); p.setAutodetectCharset(autodetectCharset); Entry entry = p.readFrom(Entry.class, Entry.class, new Annotation[]{}, mt, headers, is); return readFromEntry(entry, cls); } }
public void writeTo(Object o, Class<?> cls, Type genericType, Annotation[] annotations, MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os) throws IOException { boolean isFeed = isFeedRequested(mt); boolean isCollection = InjectionUtils.isSupportedCollectionOrArray(cls); if (isFeed && isCollection) { reportError("Atom feed can only be created from a collection wrapper", null); } else if (!isFeed && isCollection) { reportError("Atom entry can only be created from a single object", null); } Factory factory = Abdera.getNewFactory(); Element atomElement = null; try { if (isFeed && !isCollection) { atomElement = createFeedFromCollectionWrapper(factory, o, cls); } else if (!isFeed && !isCollection) { atomElement = createEntryFromObject(factory, o, cls); } } catch (Exception ex) { throw ExceptionUtils.toInternalServerErrorException(ex, null); } try { writeAtomElement(atomElement, os); } catch (IOException ex) { reportError("Atom element can not be serialized", ex); } }
public void writeTo(Object o, Class<?> cls, Type genericType, Annotation[] annotations, MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os) throws IOException { boolean isFeed = isFeedRequested(mt); boolean isCollection = InjectionUtils.isSupportedCollectionOrArray(cls); if (isFeed && isCollection) { reportError("Atom feed can only be created from a collection wrapper", null); } else if (!isFeed && isCollection) { reportError("Atom entry can only be created from a single object", null); } Factory factory = Abdera.getNewFactory(); Element atomElement = null; try { if (isFeed && !isCollection) { atomElement = createFeedFromCollectionWrapper(factory, o, cls); } else if (!isFeed && !isCollection) { atomElement = createEntryFromObject(factory, o, cls); } } catch (Exception ex) { throw ExceptionUtils.toInternalServerErrorException(ex, null); } try { writeAtomElement(atomElement, os); } catch (IOException ex) { reportError("Atom element can not be serialized", ex); } }
public void writeTo(Object o, Class<?> cls, Type genericType, Annotation[] annotations, MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os) throws IOException { boolean isFeed = isFeedRequested(mt); boolean isCollection = InjectionUtils.isSupportedCollectionOrArray(cls);