@Override public void setAttachmentUnmarshaller(AttachmentUnmarshaller attachmentUnmarshaller) { this.jaxbUnmarshaller.setAttachmentUnmarshaller(attachmentUnmarshaller); }
private T exit(T r, Unmarshaller u) { u.setAttachmentUnmarshaller(null); context.unmarshallerPool.recycle(u); return r; }
@Override public Object unmarshal(Source source, @Nullable MimeContainer mimeContainer) throws XmlMappingException { source = processSource(source); try { Unmarshaller unmarshaller = createUnmarshaller(); if (this.mtomEnabled && mimeContainer != null) { unmarshaller.setAttachmentUnmarshaller(new Jaxb2AttachmentUnmarshaller(mimeContainer)); } if (StaxUtils.isStaxSource(source)) { return unmarshalStaxSource(unmarshaller, source); } else if (this.mappedClass != null) { return unmarshaller.unmarshal(source, this.mappedClass).getValue(); } else { return unmarshaller.unmarshal(source); } } catch (NullPointerException ex) { if (!isSupportDtd()) { throw new UnmarshallingFailureException("NPE while unmarshalling: " + "This can happen due to the presence of DTD declarations which are disabled.", ex); } throw ex; } catch (JAXBException ex) { throw convertJaxbException(ex); } }
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull Node n, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,n),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Node n) throws JAXBException {
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull XMLStreamReader in, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,in),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull XMLStreamReader in) throws JAXBException {
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull Source in, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,in),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Source in) throws JAXBException {
public void setAttachmentUnmarshaller(AttachmentUnmarshaller attachmentUnmarshaller) { unmarshaller.setAttachmentUnmarshaller(attachmentUnmarshaller); }
public void setAttachmentUnmarshaller(AttachmentUnmarshaller attachmentUnmarshaller) { this.jaxbUnmarshaller.setAttachmentUnmarshaller(attachmentUnmarshaller); }
public void setAttachmentUnmarshaller(AttachmentUnmarshaller au) { delegate.setAttachmentUnmarshaller(au); }
private T exit(T r, Unmarshaller u) { u.setAttachmentUnmarshaller(null); context.unmarshallerPool.recycle(u); return r; }
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); } }
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull XMLStreamReader in, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,in),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull XMLStreamReader in) throws JAXBException {
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull Source in, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,in),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Source in) throws JAXBException {
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull Node n, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,n),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Node n) throws JAXBException {
private T exit(T r, Unmarshaller u) { u.setAttachmentUnmarshaller(null); context.unmarshallerPool.recycle(u); return r; }
protected void addAttachmentUnmarshaller(Unmarshaller um) { Collection<Attachment> attachments = getAttachments(false); if (attachments != null) { um.setAttachmentUnmarshaller(new JAXBAttachmentUnmarshaller( attachments)); } }
public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException { access(); if (payload != null) { if(hasAttachments()) unmarshaller.setAttachmentUnmarshaller(new AttachmentUnmarshallerImpl(getAttachments())); return (T) unmarshaller.unmarshal(payload); } return null; }
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull Source in, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,in),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Source in) throws JAXBException {
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull Node n, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,n),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Node n) throws JAXBException {
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull XMLStreamReader in, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,in),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull XMLStreamReader in) throws JAXBException {