Java Code Examples for com.sun.xml.internal.ws.api.message.Packet#supports()

The following examples show how to use com.sun.xml.internal.ws.api.message.Packet#supports() . 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 hottub 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: SOAPProviderArgumentBuilder.java    From openjdk-jdk9 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 3
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 4
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 5
Source File: SOAPProviderArgumentBuilder.java    From openjdk-jdk8u 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 6
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 7
Source File: XMLProviderArgumentBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Packet getResponse(Packet request, Exception e, WSDLPort port, WSBinding binding) {
    Packet response = super.getResponse(request, e, port, binding);
    if (e instanceof HTTPException) {
        if (response.supports(MessageContext.HTTP_RESPONSE_CODE)) {
            response.put(MessageContext.HTTP_RESPONSE_CODE, ((HTTPException)e).getStatusCode());
        }
    }
    return response;
}
 
Example 8
Source File: XMLProviderArgumentBuilder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Packet getResponse(Packet request, Exception e, WSDLPort port, WSBinding binding) {
    Packet response = super.getResponse(request, e, port, binding);
    if (e instanceof HTTPException) {
        if (response.supports(MessageContext.HTTP_RESPONSE_CODE)) {
            response.put(MessageContext.HTTP_RESPONSE_CODE, ((HTTPException)e).getStatusCode());
        }
    }
    return response;
}
 
Example 9
Source File: XMLProviderArgumentBuilder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Packet getResponse(Packet request, Exception e, WSDLPort port, WSBinding binding) {
    Packet response = super.getResponse(request, e, port, binding);
    if (e instanceof HTTPException) {
        if (response.supports(MessageContext.HTTP_RESPONSE_CODE)) {
            response.put(MessageContext.HTTP_RESPONSE_CODE, ((HTTPException)e).getStatusCode());
        }
    }
    return response;
}
 
Example 10
Source File: XMLProviderArgumentBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Packet getResponse(Packet request, Exception e, WSDLPort port, WSBinding binding) {
    Packet response = super.getResponse(request, e, port, binding);
    if (e instanceof HTTPException) {
        if (response.supports(MessageContext.HTTP_RESPONSE_CODE)) {
            response.put(MessageContext.HTTP_RESPONSE_CODE, ((HTTPException)e).getStatusCode());
        }
    }
    return response;
}
 
Example 11
Source File: XMLProviderArgumentBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Packet getResponse(Packet request, Exception e, WSDLPort port, WSBinding binding) {
    Packet response = super.getResponse(request, e, port, binding);
    if (e instanceof HTTPException) {
        if (response.supports(MessageContext.HTTP_RESPONSE_CODE)) {
            response.put(MessageContext.HTTP_RESPONSE_CODE, ((HTTPException)e).getStatusCode());
        }
    }
    return response;
}
 
Example 12
Source File: XMLProviderArgumentBuilder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Packet getResponse(Packet request, Exception e, WSDLPort port, WSBinding binding) {
    Packet response = super.getResponse(request, e, port, binding);
    if (e instanceof HTTPException) {
        if (response.supports(MessageContext.HTTP_RESPONSE_CODE)) {
            response.put(MessageContext.HTTP_RESPONSE_CODE, ((HTTPException)e).getStatusCode());
        }
    }
    return response;
}
 
Example 13
Source File: XMLProviderArgumentBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Packet getResponse(Packet request, Exception e, WSDLPort port, WSBinding binding) {
    Packet response = super.getResponse(request, e, port, binding);
    if (e instanceof HTTPException) {
        if (response.supports(MessageContext.HTTP_RESPONSE_CODE)) {
            response.put(MessageContext.HTTP_RESPONSE_CODE, ((HTTPException)e).getStatusCode());
        }
    }
    return response;
}
 
Example 14
Source File: RequestContext.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fill a {@link Packet} with values of this {@link RequestContext}.
 *
 * @param packet              to be filled with context values
 * @param isAddressingEnabled flag if addressing enabled (to provide warning if necessary)
 */
@SuppressWarnings("unchecked")
public void fill(Packet packet, boolean isAddressingEnabled) {

    // handling as many properties as possible (all in propMap.keySet())
    // to avoid slow Packet.put()
    if (endpointAddress != null) {
        packet.endpointAddress = endpointAddress;
    }
    packet.contentNegotiation = contentNegotiation;
    fillSOAPAction(packet, isAddressingEnabled);
    mergeRequestHeaders(packet);

    Set<String> handlerScopeNames = new HashSet<String>();

    copySatelliteInto(packet);

    // extending properties ...
    for (String key : asMapLocal().keySet()) {

        //if it is not standard property it defaults to Scope.HANDLER
        if (!supportsLocal(key)) {
            handlerScopeNames.add(key);
        }

        // to avoid slow Packet.put(), handle as small number of props as possible
        // => only properties not from RequestContext object
        if (!propMap.containsKey(key)) {
            Object value = asMapLocal().get(key);
            if (packet.supports(key)) {
                // very slow operation - try to avoid it!
                packet.put(key, value);
            } else {
                packet.invocationProperties.put(key, value);
            }
        }
    }

    if (!handlerScopeNames.isEmpty()) {
        packet.getHandlerScopePropertyNames(false).addAll(handlerScopeNames);
    }
}
 
Example 15
Source File: RequestContext.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fill a {@link Packet} with values of this {@link RequestContext}.
 *
 * @param packet              to be filled with context values
 * @param isAddressingEnabled flag if addressing enabled (to provide warning if necessary)
 */
@SuppressWarnings("unchecked")
public void fill(Packet packet, boolean isAddressingEnabled) {

    // handling as many properties as possible (all in propMap.keySet())
    // to avoid slow Packet.put()
    if (endpointAddress != null) {
        packet.endpointAddress = endpointAddress;
    }
    packet.contentNegotiation = contentNegotiation;
    fillSOAPAction(packet, isAddressingEnabled);
    mergeRequestHeaders(packet);

    Set<String> handlerScopeNames = new HashSet<String>();

    copySatelliteInto(packet);

    // extending properties ...
    for (String key : asMapLocal().keySet()) {

        //if it is not standard property it defaults to Scope.HANDLER
        if (!supportsLocal(key)) {
            handlerScopeNames.add(key);
        }

        // to avoid slow Packet.put(), handle as small number of props as possible
        // => only properties not from RequestContext object
        if (!propMap.containsKey(key)) {
            Object value = asMapLocal().get(key);
            if (packet.supports(key)) {
                // very slow operation - try to avoid it!
                packet.put(key, value);
            } else {
                packet.invocationProperties.put(key, value);
            }
        }
    }

    if (!handlerScopeNames.isEmpty()) {
        packet.getHandlerScopePropertyNames(false).addAll(handlerScopeNames);
    }
}
 
Example 16
Source File: RequestContext.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fill a {@link Packet} with values of this {@link RequestContext}.
 *
 * @param packet              to be filled with context values
 * @param isAddressingEnabled flag if addressing enabled (to provide warning if necessary)
 */
@SuppressWarnings("unchecked")
public void fill(Packet packet, boolean isAddressingEnabled) {

    // handling as many properties as possible (all in propMap.keySet())
    // to avoid slow Packet.put()
    if (endpointAddress != null) {
        packet.endpointAddress = endpointAddress;
    }
    packet.contentNegotiation = contentNegotiation;
    fillSOAPAction(packet, isAddressingEnabled);
    mergeRequestHeaders(packet);

    Set<String> handlerScopeNames = new HashSet<String>();

    copySatelliteInto(packet);

    // extending properties ...
    for (String key : asMapLocal().keySet()) {

        //if it is not standard property it defaults to Scope.HANDLER
        if (!supportsLocal(key)) {
            handlerScopeNames.add(key);
        }

        // to avoid slow Packet.put(), handle as small number of props as possible
        // => only properties not from RequestContext object
        if (!propMap.containsKey(key)) {
            Object value = asMapLocal().get(key);
            if (packet.supports(key)) {
                // very slow operation - try to avoid it!
                packet.put(key, value);
            } else {
                packet.invocationProperties.put(key, value);
            }
        }
    }

    if (!handlerScopeNames.isEmpty()) {
        packet.getHandlerScopePropertyNames(false).addAll(handlerScopeNames);
    }
}
 
Example 17
Source File: RequestContext.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fill a {@link Packet} with values of this {@link RequestContext}.
 *
 * @param packet              to be filled with context values
 * @param isAddressingEnabled flag if addressing enabled (to provide warning if necessary)
 */
@SuppressWarnings("unchecked")
public void fill(Packet packet, boolean isAddressingEnabled) {

    // handling as many properties as possible (all in propMap.keySet())
    // to avoid slow Packet.put()
    if (endpointAddress != null) {
        packet.endpointAddress = endpointAddress;
    }
    packet.contentNegotiation = contentNegotiation;
    fillSOAPAction(packet, isAddressingEnabled);
    mergeRequestHeaders(packet);

    Set<String> handlerScopeNames = new HashSet<String>();

    copySatelliteInto(packet);

    // extending properties ...
    for (String key : asMapLocal().keySet()) {

        //if it is not standard property it defaults to Scope.HANDLER
        if (!supportsLocal(key)) {
            handlerScopeNames.add(key);
        }

        // to avoid slow Packet.put(), handle as small number of props as possible
        // => only properties not from RequestContext object
        if (!propMap.containsKey(key)) {
            Object value = asMapLocal().get(key);
            if (packet.supports(key)) {
                // very slow operation - try to avoid it!
                packet.put(key, value);
            } else {
                packet.invocationProperties.put(key, value);
            }
        }
    }

    if (!handlerScopeNames.isEmpty()) {
        packet.getHandlerScopePropertyNames(false).addAll(handlerScopeNames);
    }
}
 
Example 18
Source File: RequestContext.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fill a {@link Packet} with values of this {@link RequestContext}.
 *
 * @param packet              to be filled with context values
 * @param isAddressingEnabled flag if addressing enabled (to provide warning if necessary)
 */
@SuppressWarnings("unchecked")
public void fill(Packet packet, boolean isAddressingEnabled) {

    // handling as many properties as possible (all in propMap.keySet())
    // to avoid slow Packet.put()
    if (endpointAddress != null) {
        packet.endpointAddress = endpointAddress;
    }
    packet.contentNegotiation = contentNegotiation;
    fillSOAPAction(packet, isAddressingEnabled);
    mergeRequestHeaders(packet);

    Set<String> handlerScopeNames = new HashSet<String>();

    copySatelliteInto(packet);

    // extending properties ...
    for (String key : asMapLocal().keySet()) {

        //if it is not standard property it defaults to Scope.HANDLER
        if (!supportsLocal(key)) {
            handlerScopeNames.add(key);
        }

        // to avoid slow Packet.put(), handle as small number of props as possible
        // => only properties not from RequestContext object
        if (!propMap.containsKey(key)) {
            Object value = asMapLocal().get(key);
            if (packet.supports(key)) {
                // very slow operation - try to avoid it!
                packet.put(key, value);
            } else {
                packet.invocationProperties.put(key, value);
            }
        }
    }

    if (!handlerScopeNames.isEmpty()) {
        packet.getHandlerScopePropertyNames(false).addAll(handlerScopeNames);
    }
}
 
Example 19
Source File: RequestContext.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fill a {@link Packet} with values of this {@link RequestContext}.
 *
 * @param packet              to be filled with context values
 * @param isAddressingEnabled flag if addressing enabled (to provide warning if necessary)
 */
@SuppressWarnings("unchecked")
public void fill(Packet packet, boolean isAddressingEnabled) {

    // handling as many properties as possible (all in propMap.keySet())
    // to avoid slow Packet.put()
    if (endpointAddress != null) {
        packet.endpointAddress = endpointAddress;
    }
    packet.contentNegotiation = contentNegotiation;
    fillSOAPAction(packet, isAddressingEnabled);
    mergeRequestHeaders(packet);

    Set<String> handlerScopeNames = new HashSet<String>();

    copySatelliteInto(packet);

    // extending properties ...
    for (String key : asMapLocal().keySet()) {

        //if it is not standard property it defaults to Scope.HANDLER
        if (!supportsLocal(key)) {
            handlerScopeNames.add(key);
        }

        // to avoid slow Packet.put(), handle as small number of props as possible
        // => only properties not from RequestContext object
        if (!propMap.containsKey(key)) {
            Object value = asMapLocal().get(key);
            if (packet.supports(key)) {
                // very slow operation - try to avoid it!
                packet.put(key, value);
            } else {
                packet.invocationProperties.put(key, value);
            }
        }
    }

    if (!handlerScopeNames.isEmpty()) {
        packet.getHandlerScopePropertyNames(false).addAll(handlerScopeNames);
    }
}
 
Example 20
Source File: RequestContext.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fill a {@link Packet} with values of this {@link RequestContext}.
 *
 * @param packet              to be filled with context values
 * @param isAddressingEnabled flag if addressing enabled (to provide warning if necessary)
 */
@SuppressWarnings("unchecked")
public void fill(Packet packet, boolean isAddressingEnabled) {

    // handling as many properties as possible (all in propMap.keySet())
    // to avoid slow Packet.put()
    if (endpointAddress != null) {
        packet.endpointAddress = endpointAddress;
    }
    packet.contentNegotiation = contentNegotiation;
    fillSOAPAction(packet, isAddressingEnabled);
    mergeRequestHeaders(packet);

    Set<String> handlerScopeNames = new HashSet<String>();

    copySatelliteInto(packet);

    // extending properties ...
    for (String key : asMapLocal().keySet()) {

        //if it is not standard property it defaults to Scope.HANDLER
        if (!supportsLocal(key)) {
            handlerScopeNames.add(key);
        }

        // to avoid slow Packet.put(), handle as small number of props as possible
        // => only properties not from RequestContext object
        if (!propMap.containsKey(key)) {
            Object value = asMapLocal().get(key);
            if (packet.supports(key)) {
                // very slow operation - try to avoid it!
                packet.put(key, value);
            } else {
                packet.invocationProperties.put(key, value);
            }
        }
    }

    if (!handlerScopeNames.isEmpty()) {
        packet.getHandlerScopePropertyNames(false).addAll(handlerScopeNames);
    }
}