javax.xml.bind.Unmarshaller#setAttachmentUnmarshaller ( )源码实例Demo

下面列出了javax.xml.bind.Unmarshaller#setAttachmentUnmarshaller ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk9   文件: DOMMessage.java
public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
    if(hasAttachments())
        unmarshaller.setAttachmentUnmarshaller(new AttachmentUnmarshallerImpl(getAttachments()));
    try {
        return (T)unmarshaller.unmarshal(payload);
    } finally{
        unmarshaller.setAttachmentUnmarshaller(null);
    }
}
 
源代码2 项目: freehealth-connector   文件: MarshallerHelper.java
private Unmarshaller getUnMarshaller() throws JAXBException {
   AttachmentUnmarshallerImpl attachmentUnmarshaller = new AttachmentUnmarshallerImpl(true);
   attachmentUnmarshaller.getAttachmentPartMap().putAll(this.attachmentParts);
   Unmarshaller unmarshaller = JaxbContextFactory.getJaxbContextForClass(this.unmarshallClass).createUnmarshaller();
   unmarshaller.setAttachmentUnmarshaller(attachmentUnmarshaller);
   return unmarshaller;
}
 
源代码3 项目: hottub   文件: SAAJMessage.java
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;
}
 
源代码4 项目: openjdk-8   文件: SAAJMessage.java
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;
}
 
源代码5 项目: openjdk-8   文件: DOMMessage.java
public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
    if(hasAttachments())
        unmarshaller.setAttachmentUnmarshaller(new AttachmentUnmarshallerImpl(getAttachments()));
    try {
        return (T)unmarshaller.unmarshal(payload);
    } finally{
        unmarshaller.setAttachmentUnmarshaller(null);
    }
}
 
源代码6 项目: jdk8u60   文件: OldBridge.java
/**
 * @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);
}
 
源代码7 项目: hottub   文件: Bridge.java
/**
 * @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);
}
 
源代码8 项目: TencentKona-8   文件: OldBridge.java
private T exit(T r, Unmarshaller u) {
    u.setAttachmentUnmarshaller(null);
    context.unmarshallerPool.recycle(u);
    return r;
}
 
源代码9 项目: TencentKona-8   文件: OldBridge.java
/**
 * @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);
}
 
源代码10 项目: openjdk-jdk8u-backup   文件: OldBridge.java
/**
 * @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);
}
 
源代码11 项目: jdk8u60   文件: Bridge.java
/**
 * @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);
}
 
源代码12 项目: openjdk-jdk8u   文件: OldBridge.java
/**
 * @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);
}
 
源代码13 项目: hottub   文件: OldBridge.java
/**
 * @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);
}
 
源代码14 项目: openjdk-jdk8u-backup   文件: Bridge.java
/**
 * @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);
}
 
源代码15 项目: openjdk-jdk8u   文件: OldBridge.java
/**
 * @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);
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: Bridge.java
private T exit(T r, Unmarshaller u) {
    u.setAttachmentUnmarshaller(null);
    context.unmarshallerPool.recycle(u);
    return r;
}
 
源代码17 项目: openjdk-jdk8u   文件: Bridge.java
/**
 * @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);
}
 
源代码18 项目: hottub   文件: OldBridge.java
/**
 * @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);
}
 
源代码19 项目: j-road   文件: AbstractXTeeJAXBEndpoint.java
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void invokeInternal(final XTeeMessage<Document> request, final XTeeMessage<Element> response)
    throws Exception {
  if (getParingKehaClass() == null) {
    throw new IllegalStateException("Query body class ('requestClass') is unset/unspecified!");
  }

  JAXBContext requestJc = getJAXBContextInstance();
  Unmarshaller requestUnmarshaller = requestJc.createUnmarshaller();
  requestUnmarshaller.setAttachmentUnmarshaller(new XTeeAttachmentUnmarshaller(request));

  updateUnmarshaller(requestUnmarshaller);

  Document requestOnly = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  if (XRoadProtocolVersion.V2_0 == version) {
    requestOnly.appendChild(requestOnly.importNode((Node) XPathFactory.newInstance().newXPath().evaluate("//*[local-name()='keha']",
                                                                                                         request.getContent(),
                                                                                                         XPathConstants.NODE),
                                                   true));
  } else {
    requestOnly.appendChild(requestOnly.importNode(SOAPUtil.getFirstNonTextChild(request.getContent()), true));
  }

  XTeeMessage<T> jaxbRequestMessage = new BeanXTeeMessage<T>(request.getHeader(),
                                                             requestUnmarshaller.unmarshal(requestOnly.getDocumentElement(),
                                                                                           getParingKehaClass()).getValue(),
                                                             request.getAttachments());
  XTeeMessage<Object> jaxbResponseMessage =
      new BeanXTeeMessage<Object>(response.getHeader(), null, new ArrayList<XTeeAttachment>());

  invoke(jaxbRequestMessage, jaxbResponseMessage);
  Object bean = jaxbResponseMessage.getContent();
  if (bean != null) { // If you do not need to send an object as response, <keha /> is sufficient.
    Node parent = response.getContent().getParentNode();
    Node child = parent.removeChild(response.getContent());
    JAXBContext responseJc = getJAXBContextInstance();
    Marshaller responseMarshaller = responseJc.createMarshaller();
    responseMarshaller.setAttachmentMarshaller(new XTeeAttachmentMarshaller(response));
    updateMarshaller(responseMarshaller);
    // TODO Lauri: some namespace hacking might be needed if existing service schema is changed according to new
    // standard while upgrading. J-road clients do not mind tho :)
    if (XRoadProtocolVersion.V2_0 == version) {
      responseMarshaller.marshal(new JAXBElement(new QName("keha"), bean.getClass(), bean), parent);
    } else {
      responseMarshaller.marshal(new JAXBElement(new QName(response.getContent().getNamespaceURI(),
                                                           child.getLocalName(),
                                                           response.getContent().getPrefix()),
                                                 bean.getClass(),
                                                 bean),
                                 parent);
    }
  }
}
 
源代码20 项目: openjdk-jdk9   文件: OldBridge.java
/**
 * @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);
}