|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.xml.bind.attachment Class AttachmentUnmarshaller
java.lang.Object javax.xml.bind.attachment.AttachmentUnmarshaller
public abstract class AttachmentUnmarshaller
- extends Object
启用包含优化的二进制数据格式的根文档的 JAXB 解组。
此 API 支持 JAXB 2.0 实现与基于 MIME 的包处理器(MTOM/XOP 和 WS-I AP 1.0)之间的协作,有效地处理优化的二进制数据格式。JAXB 解组包的正文,把理解将使用的打包格式这项任务委托给实现此抽象类的基于 MIME 的包处理器。
此抽象类标识包是否需要 XOP 处理(#isXOPPackage()
),并提供对使用内容 id 存储为附件的二进制内容的检索。
标识要传递给 getAttachment*(String cid)
的内容 id(即 cid)。
- 对于 XOP 处理,cid 的信息集表示形式在 3.2 节 Interpreting XOP Packages 步骤 2a 中描述。
-
对于 WS-I AP 1.0,cid 被标识为一个元素,或者 4.4 节 Referencing Attachments from the SOAP Envelope 中指定的类型
ref:swaRef
的属性。
since | JAXB 2.0 |
See also | setAttachmentUnmarshaller(AttachmentUnmarshaller), XML-binary Optimized Packaging, WS-I Attachments Profile Version 1.0., Describing Media Content of Binary Data in XML |
Enables JAXB unmarshalling of a root document containing optimized binary data formats.
This API enables an efficient cooperative processing of optimized binary data formats between a JAXB 2.0 implementation and MIME-based package processor (MTOM/XOP and WS-I AP 1.0). JAXB unmarshals the body of a package, delegating the understanding of the packaging format being used to a MIME-based package processor that implements this abstract class.
This abstract class identifies if a package requires XOP processing, isXOPPackage()
and provides retrieval of binary content stored as attachments by content-id.
Identifying the content-id, cid, to pass to getAttachment*(String cid)
- For XOP processing, the infoset representation of the cid is described in step 2a in Section 3.2 Interpreting XOP Packages
-
For WS-I AP 1.0, the cid is identified as an element or attribute of
type
ref:swaRef
specified in Section 4.4 Referencing Attachments from the SOAP Envelope
- Since:
- JAXB 2.0
- Author:
- Marc Hadley, Kohsuke Kawaguchi, Joseph Fialli
- See Also:
Unmarshaller.setAttachmentUnmarshaller(AttachmentUnmarshaller)
, XML-binary Optimized Packaging, WS-I Attachments Profile Version 1.0., Describing Media Content of Binary Data in XML
Constructor Summary | |
---|---|
AttachmentUnmarshaller()
|
Method Summary | |
---|---|
abstract byte[] |
getAttachmentAsByteArray(String cid)
Retrieve the attachment identified by content-id, cid , as a byte[]. |
abstract DataHandler |
getAttachmentAsDataHandler(String cid)
Lookup MIME content by content-id, cid , and return as a DataHandler . |
boolean |
isXOPPackage()
Read-only property that returns true if JAXB unmarshaller needs to perform XOP processing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public
AttachmentUnmarshaller()
英文文档:
AttachmentUnmarshaller
public AttachmentUnmarshaller()
Method Detail |
---|
abstract public DataHandler
getAttachmentAsDataHandler(String cid)
通过内容 id(即 cid
)查找 MIME 内容,并作为 DataHandler
返回。
返回的 DataHandler
实例必须配置为满足以下必需的映射关系约束条件。
MIME 和 Java 类型之间的必需的映射关系 | |
---|---|
MIME 类型 | Java 类型 |
DataHandler.getContentType()
instanceof DataHandler.getContent()
image/gif
java.awt.Image
image/jpeg
java.awt.Image
text/xml or application/xml
javax.xml.transform.Source
注意,允许支持其他映射关系。
cid |
需要它是 XML 模式 xs:anyURI 数据类型的有效词法形式。如果
#isXOPPackage() ==true,则对于每个 cid: URI 模式,它都必须是有效的 URI(参见 RFC 2387)。 |
return |
表示 MIME 附件的 DataHandler 。 |
Throws | IllegalArgumentException: 如果未找到给定 cid 的附件。 |
getAttachmentAsDataHandler
public abstract DataHandler getAttachmentAsDataHandler(String cid)
Lookup MIME content by content-id,
cid
, and return as aDataHandler
.The returned
DataHandler
instance must be configured to meet the following required mapping constaint.Required Mappings between MIME and Java Types MIME Type Java Type DataHandler.getContentType()
instanceof DataHandler.getContent()
image/gif java.awt.Image image/jpeg java.awt.Image text/xml or application/xml javax.xml.transform.Source - Parameters:
cid
- It is expected to be a valid lexical form of the XML Schemaxs:anyURI
datatype. IfisXOPPackage()
==true, it must be a valid URI per thecid:
URI scheme (see RFC 2387)- Returns:
- a
DataHandler
that represents the MIME attachment. - Throws:
IllegalArgumentException
- if the attachment for the given cid is not found.
abstract public byte[]
getAttachmentAsByteArray(String cid)
以 byte[] 形式检索由内容 id(即 cid
)标识的附件。
cid |
需要它是 XML 模式 xs:anyURI 数据类型的有效词法形式。如果
#isXOPPackage() ==true,则对于每个 cid: URI 模式,它都必须是有效的 URI(参见 RFC 2387)。 |
return | 由 cid 所标识的附件的 byte[] 表示形式。 |
Throws | IllegalArgumentException: 如果未找到给定 cid 的附件。 |
getAttachmentAsByteArray
public abstract byte[] getAttachmentAsByteArray(String cid)
Retrieve the attachment identified by content-id,
.cid
, as a byte[]- Parameters:
cid
- It is expected to be a valid lexical form of the XML Schemaxs:anyURI
datatype. IfisXOPPackage()
==true, it must be a valid URI per thecid:
URI scheme (see RFC 2387)- Returns:
- byte[] representation of attachment identified by cid.
- Throws:
IllegalArgumentException
- if the attachment for the given cid is not found.
public boolean
isXOPPackage()
只读属性,如果 JAXB 解组程序需要执行 XOP 处理,则返回 true。
当满足 Identifying XOP Documents 中指定的约束条件时,此方法返回 true
。解组过程中此值不得更改。
return | 当 MIME 上下文是一个 XOP 文档时,返回 true。 |
isXOPPackage
public boolean isXOPPackage()
Read-only property that returns true if JAXB unmarshaller needs to perform XOP processing.
This method returns
true
when the constraints specified in Identifying XOP Documents are met. This value must not change during the unmarshalling process.- Returns:
- true when MIME context is a XOP Document.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!