當前位置: 首頁>>代碼示例>>Java>>正文


Java MimeHeaders.getAllHeaders方法代碼示例

本文整理匯總了Java中javax.xml.soap.MimeHeaders.getAllHeaders方法的典型用法代碼示例。如果您正苦於以下問題:Java MimeHeaders.getAllHeaders方法的具體用法?Java MimeHeaders.getAllHeaders怎麽用?Java MimeHeaders.getAllHeaders使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.soap.MimeHeaders的用法示例。


在下文中一共展示了MimeHeaders.getAllHeaders方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getResponse

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
@Override
protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) {
    Packet response = super.getResponse(request, returnValue, port, binding);
    // Populate SOAPMessage's transport headers
    if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) {
        MimeHeaders hdrs = returnValue.getMimeHeaders();
        Map<String, List<String>> headers = new HashMap<String, List<String>>();
        Iterator i = hdrs.getAllHeaders();
        while(i.hasNext()) {
            MimeHeader header = (MimeHeader)i.next();
            if(header.getName().equalsIgnoreCase("SOAPAction"))
                // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS.
                // so ignore this header.
                continue;

            List<String> list = headers.get(header.getName());
            if (list == null) {
                list = new ArrayList<String>();
                headers.put(header.getName(), list);
            }
            list.add(header.getValue());
        }
        response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers);
    }
    return response;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:27,代碼來源:SOAPProviderArgumentBuilder.java

示例2: matches

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
/**
 * Check whether at least one of the headers of this object matches a provided header
 *
 * @param headers
 * @return <b>true</b> if at least one header of this AttachmentPart matches a header in the
 *         provided <code>headers</code> parameter, <b>false</b> if none of the headers of this
 *         AttachmentPart matches at least one of the header in the provided
 *         <code>headers</code> parameter
 */
public boolean matches(MimeHeaders headers) {
    for (Iterator i = headers.getAllHeaders(); i.hasNext();) {
        MimeHeader hdr = (javax.xml.soap.MimeHeader)i.next();
        String values[] = mimeHeaders.getHeader(hdr.getName());
        boolean found = false;
        if (values != null) {
            for (int j = 0; j < values.length; j++) {
                if (!hdr.getValue().equalsIgnoreCase(values[j])) {
                    continue;
                }
                found = true;
                break;
            }
        }
        if (!found) {
            return false;
        }
    }
    return true;
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:30,代碼來源:AttachmentPartImpl.java

示例3: removeAttachments

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
/**
 * Removes all the AttachmentPart objects that have header entries that match the specified
 * headers. Note that the removed attachment could have headers in addition to those specified.
 *
 * @param headers - a MimeHeaders object containing the MIME headers for which to search
 * @since SAAJ 1.3
 */
public void removeAttachments(MimeHeaders headers) {
    Collection<AttachmentPart> newAttachmentParts = new ArrayList<AttachmentPart>();
    for (AttachmentPart attachmentPart : attachmentParts) {
        //Get all the headers
        for (Iterator iterator = headers.getAllHeaders(); iterator.hasNext();) {
            MimeHeader mimeHeader = (MimeHeader)iterator.next();
            String[] headerValues = attachmentPart.getMimeHeader(mimeHeader.getName());
            //if values for this header name, do not remove it
            if (headerValues.length != 0) {
                if (!(headerValues[0].equals(mimeHeader.getValue()))) {
                    newAttachmentParts.add(attachmentPart);
                }
            }
        }
    }
    attachmentParts.clear();
    this.attachmentParts = newAttachmentParts;
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:26,代碼來源:SOAPMessageImpl.java

示例4: toMap

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
static Map<String, List<String>> toMap(MimeHeaders headers) {
    HashMap<String, List<String>> map = new HashMap<String, List<String>>();
    for (Iterator<MimeHeader> i = headers.getAllHeaders(); i.hasNext();) {
        MimeHeader mh = i.next();
        List<String> values = map.get(mh.getName());
        if (values == null) {
            values = new ArrayList<String>();
            map.put(mh.getName(), values);
        }
        values.add(mh.getValue());
    }
    return map;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:14,代碼來源:MessageContextFactory.java

示例5: copy

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
public static MimeHeaders copy(MimeHeaders headers) {
    MimeHeaders newHeaders = new MimeHeaders();
    Iterator eachHeader = headers.getAllHeaders();
    while (eachHeader.hasNext()) {
        MimeHeader currentHeader = (MimeHeader) eachHeader.next();

        newHeaders.addHeader(
            currentHeader.getName(),
            currentHeader.getValue());
    }
    return newHeaders;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:MimeHeadersUtil.java

示例6: putHeaders

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
/**
 * Adds the given MIME headers into the HTTP response object.
 *
 * @param headers MIME headers to be added
 * @param res the Http servlet response
 */
public static void putHeaders(MimeHeaders headers, HttpServletResponse res) {
    for (Iterator it = headers.getAllHeaders(); it.hasNext();) {
        MimeHeader header = (MimeHeader) it.next();
        String[] values = headers.getHeader(header.getName());
        res.setHeader(header.getName(), buildHeaderValue(header, values));
    }
}
 
開發者ID:vrk-kpa,項目名稱:xrd4j,代碼行數:14,代碼來源:AdapterUtils.java

示例7: putHeaders

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
/**
 * Puts the mime headers into a mime message.
 * 
 * @param mimeHeaders the mime headers.
 * @param message the mime message.
 * @throws MessagingException if error occurred when adding the headers.
 */
private void putHeaders(MimeHeaders mimeHeaders,
        MimeMessage message) throws MessagingException {
    for (Iterator iterator = mimeHeaders.getAllHeaders(); iterator
            .hasNext();) {
        MimeHeader mimeHeader = (MimeHeader) iterator.next();
        String[] mimeValues = mimeHeaders.getHeader(mimeHeader.getName());
        for (int i = 0; i < mimeValues.length;) {
            String value = mimeValues[i++];
            message.addHeader(mimeHeader.getName(), value);
        }
    }
}
 
開發者ID:cecid,項目名稱:hermes,代碼行數:20,代碼來源:SOAPMailSender.java

示例8: printWebMessage

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
private ByteArrayOutputStream printWebMessage(SOAPMessage message, String headerType, ByteArrayOutputStream bye) throws IOException, SOAPException {
    
    PrintStream printStream = new PrintStream(bye);
    bye.reset();
    
    printStream.println("\n************************************************");
    if (message != null) {
        //get the mime headers and print them
        printStream.println("\n\nHeader: " + headerType);
        if (message.saveRequired()) {
            message.saveChanges();
        }
        MimeHeaders headers = message.getMimeHeaders();
        Iterator iter = headers.getAllHeaders();
        while (iter.hasNext()) {
            MimeHeader header = (MimeHeader)iter.next();
            System.out.println("the header is " + header.getValue());
            printStream.println("\t" + header.getName() + " : " + header.getValue());
        }
        
        //print the message itself
        
        printStream.println("\n\nMessage: " + headerType);
        message.writeTo(bye);
    }
    return bye;
}
 
開發者ID:jembi,項目名稱:openxds,代碼行數:28,代碼來源:SoapRequestBean.java

示例9: createFrom

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
public Message createFrom(SOAPMessage message) throws XMLStreamException, WebServiceException {
    try {
        // Create a Message with an XMLPart from the SOAPEnvelope
        Message m = new MessageImpl(message.getSOAPPart().getEnvelope());

        MimeHeaders mimeHeaders = message.getMimeHeaders();
        HashMap map = new HashMap();
        Iterator iterator = mimeHeaders.getAllHeaders();
        while (iterator.hasNext()) {
            MimeHeader mimeHeader = (MimeHeader)iterator.next();
            String key = mimeHeader.getName();
            String value = mimeHeader.getValue();
            if(key != null && value != null) {
                if(!HTTPConstants.HEADER_CONTENT_TYPE.equalsIgnoreCase(key)) {
                    map.put(key, value);
                }
            }
        }
        m.setMimeHeaders(map);

        if (message.countAttachments() > 0) {
            Iterator it = message.getAttachments();
            m.setDoingSWA(true);
            while (it.hasNext()) {
                AttachmentPart ap = (AttachmentPart)it.next();
                m.addDataHandler(new WrappedDataHandler(ap.getDataHandler(), ap.getContentType()), ap.getContentId());
            }
        }
        return m;
    } catch (Exception e) {
        throw ExceptionFactory.makeWebServiceException(e);
    }
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:34,代碼來源:MessageFactoryImpl.java

示例10: copyMimeHeaders

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
/**
 * Create a copy of an existing {@link MimeHeaders} object.
 * 
 * @param headers the object to copy
 * @return a copy of the {@link MimeHeaders} object
 */
public static MimeHeaders copyMimeHeaders(MimeHeaders headers) {
    MimeHeaders result = new MimeHeaders();
    Iterator iterator = headers.getAllHeaders();
    while (iterator.hasNext()) {
        MimeHeader hdr = (MimeHeader)iterator.next();
        result.addHeader(hdr.getName(), hdr.getValue());
    }
    return result;
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:16,代碼來源:SAAJUtil.java

示例11: extractHeaderDataSOAP

import javax.xml.soap.MimeHeaders; //導入方法依賴的package包/類
private void extractHeaderDataSOAP(SOAPMessage response, HttpResponseBean responseBean) throws SOAPException
{
	//extract MimeHeaders
	MimeHeaders mime = response.getMimeHeaders();
	Iterator<MimeHeader> iter = mime.getAllHeaders();

	while(iter.hasNext())
	{
		MimeHeader mimeH = iter.next();
		responseBean.addEntryToResponseHeaders(mimeH.getName(),mimeH.getValue());

	}

	//extract SOAPHeaders from the envelope and a them to the mimeHeaders
	if(response.getSOAPHeader()!=null)
	{
		javax.xml.soap.SOAPHeader header = response.getSOAPHeader();

		NodeList nodes = header.getChildNodes();


		for(int x=0; x<nodes.getLength();x++)
		{
			//if the header entry contains child nodes - write them with the node names
			if(nodes.item(x).hasChildNodes()){
				NodeList childnodes = nodes.item(x).getChildNodes();
				for(int y = 0; y<childnodes.getLength();y++){
                       responseBean.addEntryToResponseHeaders(nodes.item(x).getLocalName(),childnodes.item(y).getLocalName()+":"+childnodes.item(y).getTextContent());
                   }
			}
			else{
				responseBean.addEntryToResponseHeaders(nodes.item(x).getLocalName(), nodes.item(x).getTextContent());
			}
		}
	}
}
 
開發者ID:betfair,項目名稱:cougar,代碼行數:37,代碼來源:CougarHelpers.java


注:本文中的javax.xml.soap.MimeHeaders.getAllHeaders方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。