本文整理汇总了Java中com.sun.xml.internal.ws.api.message.Header类的典型用法代码示例。如果您正苦于以下问题:Java Header类的具体用法?Java Header怎么用?Java Header使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Header类属于com.sun.xml.internal.ws.api.message包,在下文中一共展示了Header类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeTo
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
/**
* Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
*/
@Override
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
String soapNsUri = soapVersion.nsUri;
w.writeStartDocument();
w.writeStartElement("S","Envelope",soapNsUri);
w.writeNamespace("S",soapNsUri);
if(hasHeaders()) {
w.writeStartElement("S","Header",soapNsUri);
MessageHeaders headers = getHeaders();
for (Header h : headers.asList()) {
h.writeTo(w);
}
w.writeEndElement();
}
// write the body
w.writeStartElement("S","Body",soapNsUri);
writePayloadTo(w);
w.writeEndElement();
w.writeEndElement();
w.writeEndDocument();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:AbstractMessageImpl.java
示例2: readEnvelope
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
public XMLStreamReader readEnvelope() {
if (envelopeReader == null) {
List<XMLStreamReader> hReaders = new java.util.ArrayList<XMLStreamReader>();
ElemInfo envElem = new ElemInfo(envelopeTag, null);
ElemInfo hdrElem = (headerTag != null) ? new ElemInfo(headerTag, envElem) : null;
ElemInfo bdyElem = new ElemInfo(bodyTag, envElem);
for (Header h : getHeaders().asList()) {
try {
hReaders.add(h.readHeader());
} catch (XMLStreamException e) {
throw new RuntimeException(e);
}
}
XMLStreamReader soapHeader = (hdrElem != null) ? new XMLReaderComposite(hdrElem, hReaders.toArray(new XMLStreamReader[hReaders.size()])) : null;
XMLStreamReader[] payload = {readPayload()};
XMLStreamReader soapBody = new XMLReaderComposite(bdyElem, payload);
XMLStreamReader[] soapContent = (soapHeader != null) ? new XMLStreamReader[]{soapHeader, soapBody} : new XMLStreamReader[]{soapBody};
return new XMLReaderComposite(envElem, soapContent);
}
return envelopeReader;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:StreamMessage.java
示例3: add
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
@Override
public boolean add(Header header) {
try {
header.writeTo(sm);
} catch (SOAPException e) {
//TODO log exception
return false;
}
//the newly added header is not understood by default
notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart()));
//track non saaj headers so that they can be retrieved later
if (isNonSAAJHeader(header)) {
//TODO assumes only one header with that name?
addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()),
header);
}
return true;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:SAAJMessageHeaders.java
示例4: getHeaders
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
public Object[] getHeaders(QName header, JAXBContext jaxbContext, boolean allRoles) {
SOAPVersion soapVersion = binding.getSOAPVersion();
List<Object> beanList = new ArrayList<Object>();
try {
Iterator<Header> itr = packet.getMessage().getHeaders().getHeaders(header,false);
if(allRoles) {
while(itr.hasNext()) {
beanList.add(itr.next().readAsJAXB(jaxbContext.createUnmarshaller()));
}
} else {
while(itr.hasNext()) {
Header soapHeader = itr.next();
//Check if the role is one of the roles on this Binding
String role = soapHeader.getRole(soapVersion);
if(getRoles().contains(role)) {
beanList.add(soapHeader.readAsJAXB(jaxbContext.createUnmarshaller()));
}
}
}
return beanList.toArray();
} catch(Exception e) {
throw new WebServiceException(e);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:SOAPMessageContextImpl.java
示例5: writeToBodyStart
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
public void writeToBodyStart(XMLStreamWriter w) throws XMLStreamException {
String soapNsUri = soapVersion.nsUri;
w.writeStartDocument();
w.writeStartElement("S","Envelope",soapNsUri);
w.writeNamespace("S",soapNsUri);
if(hasHeaders()) {
w.writeStartElement("S","Header",soapNsUri);
MessageHeaders headers = getHeaders();
for (Header h : headers.asList()) {
h.writeTo(w);
}
w.writeEndElement();
}
// write the body
w.writeStartElement("S","Body",soapNsUri);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:AbstractMessageImpl.java
示例6: writeTo
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
/**
* Writes the whole envelope as SAX events.
*/
@Override
public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException {
String soapNsUri = soapVersion.nsUri;
contentHandler.setDocumentLocator(NULL_LOCATOR);
contentHandler.startDocument();
contentHandler.startPrefixMapping("S",soapNsUri);
contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS);
if(hasHeaders()) {
contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS);
MessageHeaders headers = getHeaders();
for (Header h : headers.asList()) {
h.writeTo(contentHandler,errorHandler);
}
contentHandler.endElement(soapNsUri,"Header","S:Header");
}
// write the body
contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS);
writePayloadTo(contentHandler,errorHandler, true);
contentHandler.endElement(soapNsUri,"Body","S:Body");
contentHandler.endElement(soapNsUri,"Envelope","S:Envelope");
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:AbstractMessageImpl.java
示例7: readToBodyStarTag
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
public XMLStreamReader readToBodyStarTag() {
if ( envelopeReader != null ) readEnvelope(this);
List<XMLStreamReader> hReaders = new java.util.ArrayList<XMLStreamReader>();
ElemInfo envElem = new ElemInfo(envelopeTag, null);
ElemInfo hdrElem = (headerTag != null) ? new ElemInfo(headerTag, envElem) : null;
ElemInfo bdyElem = new ElemInfo(bodyTag, envElem);
for (Header h : getHeaders().asList()) {
try {
hReaders.add(h.readHeader());
} catch (XMLStreamException e) {
throw new RuntimeException(e);
}
}
XMLStreamReader soapHeader = (hdrElem != null) ? new XMLReaderComposite(hdrElem, hReaders.toArray(new XMLStreamReader[hReaders.size()])) : null;
XMLStreamReader[] payload = {};
XMLStreamReader soapBody = new XMLReaderComposite(bdyElem, payload);
XMLStreamReader[] soapContent = (soapHeader != null) ? new XMLStreamReader[]{soapHeader, soapBody} : new XMLStreamReader[]{soapBody};
return new XMLReaderComposite(envElem, soapContent);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:StreamMessage.java
示例8: writeEnvelope
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
/**
* This method should be called when the StreamMessage is created with a payload
* @param writer
*/
private void writeEnvelope(XMLStreamWriter writer) throws XMLStreamException {
writer.writeStartDocument();
envelopeTag.writeStart(writer);
//write headers
HeaderList hl = getHeaders();
if(hl.size() > 0){
headerTag.writeStart(writer);
for(Header h:hl){
h.writeTo(writer);
}
writer.writeEndElement();
}
bodyTag.writeStart(writer);
if(hasPayload())
writePayloadTo(writer);
writer.writeEndElement();
writer.writeEndElement();
writer.writeEndDocument();
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:25,代码来源:StreamMessage.java
示例9: getMisUnderstoodHeaders
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
/**
* @param headers HeaderList that needs MU processing
* @param roles Roles configured on the Binding. Required Roles supposed to be assumbed a by a
* SOAP Binding implementation are added.
* @param handlerKnownHeaders Set of headers that the handlerchain associated with the binding understands
* @return returns the headers that have mustUnderstand attribute and are not understood
* by the binding.
*/
public final Set<QName> getMisUnderstoodHeaders(HeaderList headers, Set<String> roles,
Set<QName> handlerKnownHeaders) {
Set<QName> notUnderstoodHeaders = null;
for (int i = 0; i < headers.size(); i++) {
if (!headers.isUnderstood(i)) {
Header header = headers.get(i);
if (!header.isIgnorable(soapVersion, roles)) {
QName qName = new QName(header.getNamespaceURI(), header.getLocalPart());
// see if the binding can understand it
if (!binding.understandsHeader(qName)) {
if (!handlerKnownHeaders.contains(qName)) {
logger.info("Element not understood=" + qName);
if (notUnderstoodHeaders == null)
notUnderstoodHeaders = new HashSet<QName>();
notUnderstoodHeaders.add(qName);
}
}
}
}
}
return notUnderstoodHeaders;
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:31,代码来源:MUTube.java
示例10: configureRequestPacket
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
private void configureRequestPacket(Packet packet, RequestContext requestContext) {
// fill in Packet
packet.proxy = this;
packet.handlerConfig = binding.getHandlerConfig();
requestContext.fill(packet,(binding.getAddressingVersion() != null));
if (wsdlProperties != null) {
packet.addSatellite(wsdlProperties);
}
if (addrVersion != null) {
// populate request WS-Addressing headers
HeaderList headerList = packet.getMessage().getHeaders();
headerList.fillRequestAddressingHeaders(wsdlPort, binding, packet);
// Spec is not clear on if ReferenceParameters are to be added when addressing is not enabled,
// but the EPR has ReferenceParameters.
// Current approach: Add ReferenceParameters only if addressing enabled.
if (endpointReference != null)
endpointReference.addReferenceParameters(packet.getMessage().getHeaders());
}
// to make it multi-thread safe we need to first get a stable snapshot
Header[] hl = userOutboundHeaders;
if(hl!=null)
packet.getMessage().getHeaders().addAll(hl);
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:27,代码来源:Stub.java
示例11: addHeader
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
private static void addHeader(Message m, Set<QName> notUnderstoodHeaders) throws SOAPException {
for (QName qname : notUnderstoodHeaders) {
SOAPElement soapEl = SOAP_12.getSOAPFactory().createElement(MU_HEADER_DETAIL);
soapEl.addNamespaceDeclaration("abc", qname.getNamespaceURI());
soapEl.setAttribute("qname", "abc:" + qname.getLocalPart());
Header header = new DOMHeader<Element>(soapEl);
m.getHeaders().add(header);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:MUTube.java
示例12: get
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
@Override
public Header get(String nsUri, String localName, boolean markAsUnderstood) {
SOAPHeaderElement h = find(nsUri, localName);
if (h != null) {
if (markAsUnderstood) {
understood(nsUri, localName);
}
return new SAAJHeader(h);
}
return null;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:SAAJMessageHeaders.java
示例13: getHeaders
import com.sun.xml.internal.ws.api.message.Header; //导入依赖的package包/类
@Override
public Iterator<Header> getHeaders(final String nsUri, final String localName,
final boolean markAsUnderstood) {
SOAPHeader soapHeader = ensureSOAPHeader();
if (soapHeader == null) {
return null;
}
Iterator allHeaders = soapHeader.examineAllHeaderElements();
if (markAsUnderstood) {
//mark all the matchingheaders as understood up front
//make an iterator while we're doing that
List<Header> headers = new ArrayList<Header>();
while (allHeaders.hasNext()) {
SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
if (nextHdr != null &&
nextHdr.getNamespaceURI().equals(nsUri)) {
if (localName == null ||
nextHdr.getLocalName().equals(localName)) {
understood(nextHdr.getNamespaceURI(), nextHdr.getLocalName());
headers.add(new SAAJHeader(nextHdr));
}
}
}
return headers.iterator();
}
//if we got here markAsUnderstood is false - return a lazy iterator rather
//than traverse the entire list of headers now
return new HeaderReadIterator(allHeaders, nsUri, localName);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:SAAJMessageHeaders.java
注:本文中的com.sun.xml.internal.ws.api.message.Header类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论