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

The following examples show how to use com.sun.xml.internal.ws.api.message.Packet#addSatellite() . 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: HttpAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example 2
Source File: HttpAdapter.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example 3
Source File: WsaServerTube.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public @NotNull NextAction processException(Throwable t) {
    final Packet response = Fiber.current().getPacket();
    ThrowableContainerPropertySet tc = response.getSatellite(ThrowableContainerPropertySet.class);
    if (tc == null) {
        tc = new ThrowableContainerPropertySet(t);
        response.addSatellite(tc);
    } else if (t != tc.getThrowable()) {
        // This is a pathological case where an exception happens after a previous exception.
        // Make sure you report the latest one.
        tc.setThrowable(t);
    }
    return processResponse(response.endpoint.createServiceResponseForException(tc, response, soapVersion, wsdlPort,
                                                                               response.endpoint.getSEIModel(),
                                                                               binding));
}
 
Example 4
Source File: HttpAdapter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example 5
Source File: HttpAdapter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example 6
Source File: WSEndpointImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public @NotNull
PipeHead createPipeHead() {
    return new PipeHead() {
        private final Tube tube = TubeCloner.clone(masterTubeline);

        public @NotNull
        Packet process(Packet request, WebServiceContextDelegate wscd,
                TransportBackChannel tbc) {
            Container old = ContainerResolver.getDefault().enterContainer(container);
            try {
                request.webServiceContextDelegate = wscd;
                request.transportBackChannel = tbc;
                request.endpoint = WSEndpointImpl.this;
                request.addSatellite(wsdlProperties);

                Fiber fiber = engine.createFiber();
                Packet response;
                try {
                    response = fiber.runSync(tube, request);
                } catch (RuntimeException re) {
                    // Catch all runtime exceptions so that transport
                    // doesn't
                    // have to worry about converting to wire message
                    // TODO XML/HTTP binding
                    Message faultMsg = SOAPFaultBuilder
                            .createSOAPFaultMessage(soapVersion, null, re);
                    response = request.createServerResponse(faultMsg,
                            request.endpoint.getPort(), null,
                            request.endpoint.getBinding());
                }
                return response;
            } finally {
                ContainerResolver.getDefault().exitContainer(old);
            }
        }
    };
}
 
Example 7
Source File: WsaClientTube.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public @NotNull NextAction processResponse(Packet response) {
    // if one-way then, no validation
    if (response.getMessage() != null) {
        response = validateInboundHeaders(response);
        response.addSatellite(new WsaPropertyBag(addressingVersion,soapVersion,response));
        String msgId = AddressingUtils.
          getMessageID(response.getMessage().getHeaders(),
                  addressingVersion, soapVersion);
        response.put(WsaPropertyBag.WSA_MSGID_FROM_REQUEST, msgId);
    }

    return doReturnWith(response);
}
 
Example 8
Source File: WsaClientTube.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public @NotNull NextAction processResponse(Packet response) {
    // if one-way then, no validation
    if (response.getMessage() != null) {
        response = validateInboundHeaders(response);
        response.addSatellite(new WsaPropertyBag(addressingVersion,soapVersion,response));
        String msgId = AddressingUtils.
          getMessageID(response.getMessage().getHeaders(),
                  addressingVersion, soapVersion);
        response.put(WsaPropertyBag.WSA_MSGID_FROM_REQUEST, msgId);
    }

    return doReturnWith(response);
}
 
Example 9
Source File: WsaClientTube.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public @NotNull NextAction processResponse(Packet response) {
    // if one-way then, no validation
    if (response.getMessage() != null) {
        response = validateInboundHeaders(response);
        response.addSatellite(new WsaPropertyBag(addressingVersion,soapVersion,response));
        String msgId = AddressingUtils.
          getMessageID(response.getMessage().getHeaders(),
                  addressingVersion, soapVersion);
        response.put(WsaPropertyBag.WSA_MSGID_FROM_REQUEST, msgId);
    }

    return doReturnWith(response);
}
 
Example 10
Source File: Stub.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void configureRequestPacket(Packet packet, RequestContext requestContext) {
    // fill in Packet
    packet.proxy = this;
    packet.handlerConfig = binding.getHandlerConfig();

    // to make it multi-thread safe we need to first get a stable snapshot
    Header[] hl = userOutboundHeaders;
    if (hl != null) {
        MessageHeaders mh = packet.getMessage().getHeaders();
        for (Header h : hl) {
            mh.add(h);
        }
    }

    requestContext.fill(packet, (binding.getAddressingVersion() != null));
    packet.addSatellite(wsdlProperties);

    if (addrVersion != null) {
        // populate request WS-Addressing headers
        MessageHeaders headerList = packet.getMessage().getHeaders();
        AddressingUtils.fillRequestAddressingHeaders(headerList, 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.addReferenceParametersToList(packet.getMessage().getHeaders());
        }
    }
}
 
Example 11
Source File: WSEndpointImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public @NotNull
PipeHead createPipeHead() {
    return new PipeHead() {
        private final Tube tube = TubeCloner.clone(masterTubeline);

        public @NotNull
        Packet process(Packet request, WebServiceContextDelegate wscd,
                TransportBackChannel tbc) {
            Container old = ContainerResolver.getDefault().enterContainer(container);
            try {
                request.webServiceContextDelegate = wscd;
                request.transportBackChannel = tbc;
                request.endpoint = WSEndpointImpl.this;
                request.addSatellite(wsdlProperties);

                Fiber fiber = engine.createFiber();
                Packet response;
                try {
                    response = fiber.runSync(tube, request);
                } catch (RuntimeException re) {
                    // Catch all runtime exceptions so that transport
                    // doesn't
                    // have to worry about converting to wire message
                    // TODO XML/HTTP binding
                    Message faultMsg = SOAPFaultBuilder
                            .createSOAPFaultMessage(soapVersion, null, re);
                    response = request.createServerResponse(faultMsg,
                            request.endpoint.getPort(), null,
                            request.endpoint.getBinding());
                }
                return response;
            } finally {
                ContainerResolver.getDefault().exitContainer(old);
            }
        }
    };
}
 
Example 12
Source File: Stub.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void configureRequestPacket(Packet packet, RequestContext requestContext) {
    // fill in Packet
    packet.proxy = this;
    packet.handlerConfig = binding.getHandlerConfig();

    // to make it multi-thread safe we need to first get a stable snapshot
    Header[] hl = userOutboundHeaders;
    if (hl != null) {
        MessageHeaders mh = packet.getMessage().getHeaders();
        for (Header h : hl) {
            mh.add(h);
        }
    }

    requestContext.fill(packet, (binding.getAddressingVersion() != null));
    packet.addSatellite(wsdlProperties);

    if (addrVersion != null) {
        // populate request WS-Addressing headers
        MessageHeaders headerList = packet.getMessage().getHeaders();
        AddressingUtils.fillRequestAddressingHeaders(headerList, 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.addReferenceParametersToList(packet.getMessage().getHeaders());
        }
    }
}
 
Example 13
Source File: WsaClientTube.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public @NotNull NextAction processResponse(Packet response) {
    // if one-way then, no validation
    if (response.getMessage() != null) {
        response = validateInboundHeaders(response);
        response.addSatellite(new WsaPropertyBag(addressingVersion,soapVersion,response));
        String msgId = AddressingUtils.
          getMessageID(response.getMessage().getHeaders(),
                  addressingVersion, soapVersion);
        response.put(WsaPropertyBag.WSA_MSGID_FROM_REQUEST, msgId);
    }

    return doReturnWith(response);
}
 
Example 14
Source File: WSEndpointImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void processAsync(final Packet request,
        final CompletionCallback callback,
        FiberContextSwitchInterceptor interceptor, boolean schedule) {
    Container old = ContainerResolver.getDefault().enterContainer(container);
    try {
        request.endpoint = WSEndpointImpl.this;
        request.addSatellite(wsdlProperties);

        Fiber fiber = engine.createFiber();
        fiber.setDeliverThrowableInPacket(true);
        if (interceptor != null) {
            fiber.addInterceptor(interceptor);
        }
        final Tube tube = tubePool.take();
        Fiber.CompletionCallback cbak = new Fiber.CompletionCallback() {
            public void onCompletion(@NotNull Packet response) {
                ThrowableContainerPropertySet tc = response.getSatellite(ThrowableContainerPropertySet.class);
                if (tc == null) {
                    // Only recycle tubes in non-exception path as some Tubes may be
                    // in invalid state following exception
                    tubePool.recycle(tube);
                }

                if (callback != null) {
                    if (tc != null) {
                        response = createServiceResponseForException(tc,
                                                                     response,
                                                                     soapVersion,
                                                                     request.endpoint.getPort(),
                                                                     null,
                                                                     request.endpoint.getBinding());
                    }
                    callback.onCompletion(response);
                }
            }

            public void onCompletion(@NotNull Throwable error) {
                // will never be called now that we are using
                // fiber.setDeliverThrowableInPacket(true);
                throw new IllegalStateException();
            }
        };

        fiber.start(tube, request, cbak,
                binding.isFeatureEnabled(SyncStartForAsyncFeature.class)
                        || !schedule);
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
}
 
Example 15
Source File: WSEndpointImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void processAsync(final Packet request,
        final CompletionCallback callback,
        FiberContextSwitchInterceptor interceptor, boolean schedule) {
    Container old = ContainerResolver.getDefault().enterContainer(container);
    try {
        request.endpoint = WSEndpointImpl.this;
        request.addSatellite(wsdlProperties);

        Fiber fiber = engine.createFiber();
        fiber.setDeliverThrowableInPacket(true);
        if (interceptor != null) {
            fiber.addInterceptor(interceptor);
        }
        final Tube tube = tubePool.take();
        Fiber.CompletionCallback cbak = new Fiber.CompletionCallback() {
            public void onCompletion(@NotNull Packet response) {
                ThrowableContainerPropertySet tc = response.getSatellite(ThrowableContainerPropertySet.class);
                if (tc == null) {
                    // Only recycle tubes in non-exception path as some Tubes may be
                    // in invalid state following exception
                    tubePool.recycle(tube);
                }

                if (callback != null) {
                    if (tc != null) {
                        response = createServiceResponseForException(tc,
                                                                     response,
                                                                     soapVersion,
                                                                     request.endpoint.getPort(),
                                                                     null,
                                                                     request.endpoint.getBinding());
                    }
                    callback.onCompletion(response);
                }
            }

            public void onCompletion(@NotNull Throwable error) {
                // will never be called now that we are using
                // fiber.setDeliverThrowableInPacket(true);
                throw new IllegalStateException();
            }
        };

        fiber.start(tube, request, cbak,
                binding.isFeatureEnabled(SyncStartForAsyncFeature.class)
                        || !schedule);
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
}
 
Example 16
Source File: WSEndpointImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void processAsync(final Packet request,
        final CompletionCallback callback,
        FiberContextSwitchInterceptor interceptor, boolean schedule) {
    Container old = ContainerResolver.getDefault().enterContainer(container);
    try {
        request.endpoint = WSEndpointImpl.this;
        request.addSatellite(wsdlProperties);

        Fiber fiber = engine.createFiber();
        fiber.setDeliverThrowableInPacket(true);
        if (interceptor != null) {
            fiber.addInterceptor(interceptor);
        }
        final Tube tube = tubePool.take();
        Fiber.CompletionCallback cbak = new Fiber.CompletionCallback() {
            public void onCompletion(@NotNull Packet response) {
                ThrowableContainerPropertySet tc = response.getSatellite(ThrowableContainerPropertySet.class);
                if (tc == null) {
                    // Only recycle tubes in non-exception path as some Tubes may be
                    // in invalid state following exception
                    tubePool.recycle(tube);
                }

                if (callback != null) {
                    if (tc != null) {
                        response = createServiceResponseForException(tc,
                                                                     response,
                                                                     soapVersion,
                                                                     request.endpoint.getPort(),
                                                                     null,
                                                                     request.endpoint.getBinding());
                    }
                    callback.onCompletion(response);
                }
            }

            public void onCompletion(@NotNull Throwable error) {
                // will never be called now that we are using
                // fiber.setDeliverThrowableInPacket(true);
                throw new IllegalStateException();
            }
        };

        fiber.start(tube, request, cbak,
                binding.isFeatureEnabled(SyncStartForAsyncFeature.class)
                        || !schedule);
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
}
 
Example 17
Source File: AbstractServerAsyncTransport.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * decodes the transport data to Packet
 *
 * @param connection that carries the web service request
 * @param codec for encoding/decoding {@link Message}
 * @return decoded {@link Packet}
 * @throws IOException if an i/o error happens while encoding/decoding
 */
protected Packet decodePacket(T connection, @NotNull Codec codec) throws IOException {
    Packet packet = new Packet();
    packet.acceptableMimeTypes = getAcceptableMimeTypes(connection);
    packet.addSatellite(getPropertySet(connection));
    packet.transportBackChannel = getTransportBackChannel(connection);
    return packet;
}
 
Example 18
Source File: AbstractServerAsyncTransport.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * decodes the transport data to Packet
 *
 * @param connection that carries the web service request
 * @param codec for encoding/decoding {@link Message}
 * @return decoded {@link Packet}
 * @throws IOException if an i/o error happens while encoding/decoding
 */
protected Packet decodePacket(T connection, @NotNull Codec codec) throws IOException {
    Packet packet = new Packet();
    packet.acceptableMimeTypes = getAcceptableMimeTypes(connection);
    packet.addSatellite(getPropertySet(connection));
    packet.transportBackChannel = getTransportBackChannel(connection);
    return packet;
}
 
Example 19
Source File: AbstractServerAsyncTransport.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * decodes the transport data to Packet
 *
 * @param connection that carries the web service request
 * @param codec for encoding/decoding {@link Message}
 * @return decoded {@link Packet}
 * @throws IOException if an i/o error happens while encoding/decoding
 */
protected Packet decodePacket(T connection, @NotNull Codec codec) throws IOException {
    Packet packet = new Packet();
    packet.acceptableMimeTypes = getAcceptableMimeTypes(connection);
    packet.addSatellite(getPropertySet(connection));
    packet.transportBackChannel = getTransportBackChannel(connection);
    return packet;
}
 
Example 20
Source File: AbstractServerAsyncTransport.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * decodes the transport data to Packet
 *
 * @param connection that carries the web service request
 * @param codec for encoding/decoding {@link Message}
 * @return decoded {@link Packet}
 * @throws IOException if an i/o error happens while encoding/decoding
 */
protected Packet decodePacket(T connection, @NotNull Codec codec) throws IOException {
    Packet packet = new Packet();
    packet.acceptableMimeTypes = getAcceptableMimeTypes(connection);
    packet.addSatellite(getPropertySet(connection));
    packet.transportBackChannel = getTransportBackChannel(connection);
    return packet;
}