public JaxbContextResolver() throws Exception { this.types = new HashSet<Class<?>>(Arrays.asList(cTypes)); this.context = new JettisonJaxbContext(JettisonConfig.DEFAULT, cTypes); }
/** * Create a JSON unmarshaller. * * @return the JSON unmarshaller * * @throws javax.xml.bind.JAXBException if there is an error creating the unmarshaller. */ public org.glassfish.jersey.jettison.JettisonUnmarshaller createJsonUnmarshaller() throws JAXBException { return new JettisonJaxbUnmarshaller(this, getJSONConfiguration()); }
@Override protected final void writeTo(JAXBElement<?> t, MediaType mediaType, Charset c, Marshaller m, OutputStream entityStream) throws JAXBException { JettisonMarshaller jsonMarshaller = JettisonJaxbContext.getJSONMarshaller(m); if (isFormattedOutput()) { jsonMarshaller.setProperty(JettisonMarshaller.FORMATTED, true); } jsonMarshaller.marshallToJSON(t, new OutputStreamWriter(entityStream, c)); } }
@Override protected final JAXBElement<?> readFrom(Class<?> type, MediaType mediaType, Unmarshaller unmarshaller, InputStream entityStream) throws JAXBException { final Charset c = getCharset(mediaType); return JettisonJaxbContext.getJSONUnmarshaller(unmarshaller) .unmarshalJAXBElementFromJSON(new InputStreamReader(entityStream, c), type); }
@Override protected final Object readFrom(Class<Object> type, MediaType mediaType, Unmarshaller u, InputStream entityStream) throws JAXBException { final Charset c = getCharset(mediaType); return JettisonJaxbContext.getJSONUnmarshaller(u) .unmarshalFromJSON(new InputStreamReader(entityStream, c), type); }
/** * Overrides underlaying createMarshaller method and returns * a marshaller which is capable of JSON serialization. * * @return marshaller instance with JSON capabilities * @throws javax.xml.bind.JAXBException */ @Override public Marshaller createMarshaller() throws JAXBException { return new JettisonJaxbMarshaller(jaxbContext, getJSONConfiguration()); }
@Override protected final JAXBElement<?> readFrom(Class<?> type, MediaType mediaType, Unmarshaller unmarshaller, InputStream entityStream) throws JAXBException { final Charset c = getCharset(mediaType); return JettisonJaxbContext.getJSONUnmarshaller(unmarshaller) .unmarshalJAXBElementFromJSON(new InputStreamReader(entityStream, c), type); }
@Override protected void writeTo(Object t, MediaType mediaType, Charset c, Marshaller m, OutputStream entityStream) throws JAXBException { JettisonMarshaller jsonMarshaller = JettisonJaxbContext.getJSONMarshaller(m); if (isFormattedOutput()) { jsonMarshaller.setProperty(JettisonMarshaller.FORMATTED, true); } jsonMarshaller.marshallToJSON(t, new OutputStreamWriter(entityStream, c)); } }
/** * Create a JSON marshaller. * * @return the JSON marshaller. * * @throws javax.xml.bind.JAXBException if there is an error creating the marshaller. */ public org.glassfish.jersey.jettison.JettisonMarshaller createJsonMarshaller() throws JAXBException { return new JettisonJaxbMarshaller(this, getJSONConfiguration()); }
@Override protected final Object readFrom(Class<Object> type, MediaType mediaType, Unmarshaller u, InputStream entityStream) throws JAXBException { final Charset c = getCharset(mediaType); return JettisonJaxbContext.getJSONUnmarshaller(u) .unmarshalFromJSON(new InputStreamReader(entityStream, c), type); }
@Override protected void writeTo(Object t, MediaType mediaType, Charset c, Marshaller m, OutputStream entityStream) throws JAXBException { JettisonMarshaller jsonMarshaller = JettisonJaxbContext.getJSONMarshaller(m); if (isFormattedOutput()) { jsonMarshaller.setProperty(JettisonMarshaller.FORMATTED, true); } jsonMarshaller.marshallToJSON(t, new OutputStreamWriter(entityStream, c)); } }
/** * Overrides underlying createUnmarshaller method and returns * an unmarshaller which is capable of JSON deserialization. * * @return unmarshaller instance with JSON capabilities * @throws javax.xml.bind.JAXBException */ @Override public Unmarshaller createUnmarshaller() throws JAXBException { return new JettisonJaxbUnmarshaller(jaxbContext, getJSONConfiguration()); }
@Override protected final void writeTo(JAXBElement<?> t, MediaType mediaType, Charset c, Marshaller m, OutputStream entityStream) throws JAXBException { JettisonMarshaller jsonMarshaller = JettisonJaxbContext.getJSONMarshaller(m); if (isFormattedOutput()) { jsonMarshaller.setProperty(JettisonMarshaller.FORMATTED, true); } jsonMarshaller.marshallToJSON(t, new OutputStreamWriter(entityStream, c)); } }
/** * Create a JSON unmarshaller. * * @return the JSON unmarshaller * * @throws javax.xml.bind.JAXBException if there is an error creating the unmarshaller. */ public org.glassfish.jersey.jettison.JettisonUnmarshaller createJsonUnmarshaller() throws JAXBException { return new JettisonJaxbUnmarshaller(this, getJSONConfiguration()); }
/** * Create a JSON marshaller. * * @return the JSON marshaller. * * @throws javax.xml.bind.JAXBException if there is an error creating the marshaller. */ public org.glassfish.jersey.jettison.JettisonMarshaller createJsonMarshaller() throws JAXBException { return new JettisonJaxbMarshaller(this, getJSONConfiguration()); }
/** * Overrides underlying createUnmarshaller method and returns * an unmarshaller which is capable of JSON deserialization. * * @return unmarshaller instance with JSON capabilities * @throws javax.xml.bind.JAXBException */ @Override public Unmarshaller createUnmarshaller() throws JAXBException { return new JettisonJaxbUnmarshaller(jaxbContext, getJSONConfiguration()); }
/** * Overrides underlaying createMarshaller method and returns * a marshaller which is capable of JSON serialization. * * @return marshaller instance with JSON capabilities * @throws javax.xml.bind.JAXBException */ @Override public Marshaller createMarshaller() throws JAXBException { return new JettisonJaxbMarshaller(jaxbContext, getJSONConfiguration()); }