Java Code Examples for javax.xml.soap.MimeHeaders#getAllHeaders()

The following examples show how to use javax.xml.soap.MimeHeaders#getAllHeaders() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SOAPProviderArgumentBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example 2
Source File: HarFileHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private JsonArray handleHeaders(MimeHeaders headers) throws IOException {
   JsonArray response = new JsonArray();
   if (headers != null) {
      Iterator headersIterator = headers.getAllHeaders();

      while(headersIterator.hasNext()) {
         MimeHeader mimheader = (MimeHeader)headersIterator.next();
         JsonObject header = new JsonObject();
         header.addProperty("name", mimheader.getName());
         header.addProperty("value", mimheader.getValue());
         response.add(header);
      }
   }

   return response;
}
 
Example 3
Source File: HarFileHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private JsonArray handleHeaders(MimeHeaders headers) throws IOException {
   JsonArray response = new JsonArray();
   if (headers != null) {
      Iterator headersIterator = headers.getAllHeaders();

      while(headersIterator.hasNext()) {
         MimeHeader mimheader = (MimeHeader)headersIterator.next();
         JsonObject header = new JsonObject();
         header.addProperty("name", mimheader.getName());
         header.addProperty("value", mimheader.getValue());
         response.add(header);
      }
   }

   return response;
}
 
Example 4
Source File: SOAPProviderArgumentBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example 5
Source File: HarFileHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private JsonArray handleHeaders(MimeHeaders headers) throws IOException {
   JsonArray response = new JsonArray();
   if (headers != null) {
      Iterator headersIterator = headers.getAllHeaders();

      while(headersIterator.hasNext()) {
         MimeHeader mimheader = (MimeHeader)headersIterator.next();
         JsonObject header = new JsonObject();
         header.addProperty("name", mimheader.getName());
         header.addProperty("value", mimheader.getValue());
         response.add(header);
      }
   }

   return response;
}
 
Example 6
Source File: SOAPProviderArgumentBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example 7
Source File: SOAPProviderArgumentBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example 8
Source File: SOAPProviderArgumentBuilder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example 9
Source File: MimeHeadersUtil.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 10
Source File: MessageContextFactory.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 11
Source File: CougarHelpers.java    From cougar with Apache License 2.0 5 votes vote down vote up
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());
			}
		}
	}
}
 
Example 12
Source File: MessageContextFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 13
Source File: MimeHeadersUtil.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 14
Source File: MessageContextFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 15
Source File: MimeHeadersUtil.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 16
Source File: MessageContextFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 17
Source File: MimeHeadersUtil.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 18
Source File: MessageContextFactory.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 19
Source File: MessageContextFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 20
Source File: MimeHeadersUtil.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}