com.sun.xml.ws.server.provider.SyncProviderInvokerTube Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rt Show documentation
Show all versions of rt Show documentation
JAX-WS Reference Implementation Runtime
The newest version!
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.xml.ws.server.provider;
import com.sun.istack.NotNull;
import com.sun.xml.ws.api.WSBinding;
import com.sun.xml.ws.api.message.Packet;
import com.sun.xml.ws.api.model.wsdl.WSDLPort;
import com.sun.xml.ws.api.pipe.NextAction;
import com.sun.xml.ws.api.pipe.ThrowableContainerPropertySet;
import com.sun.xml.ws.api.server.Invoker;
import jakarta.xml.ws.Provider;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* This tube is used to invoke the {@link Provider} endpoints.
*
* @author Jitendra Kotamraju
*/
public // TODO needed by factory
class SyncProviderInvokerTube extends ProviderInvokerTube {
private static final Logger LOGGER = Logger.getLogger(
com.sun.xml.ws.util.Constants.LoggingDomain + ".server.SyncProviderInvokerTube");
public SyncProviderInvokerTube(Invoker invoker, ProviderArgumentsBuilder argsBuilder) {
super(invoker, argsBuilder);
}
/*
* This binds the parameter for Provider endpoints and invokes the
* invoke() method of {@linke Provider} endpoint. The return value from
* invoke() is used to create a new {@link Message} that traverses
* through the Pipeline to transport.
*/
@Override
public NextAction processRequest(Packet request) {
WSDLPort port = getEndpoint().getPort();
WSBinding binding = getEndpoint().getBinding();
T param = argsBuilder.getParameter(request);
LOGGER.fine("Invoking Provider Endpoint");
T returnValue;
try {
returnValue = getInvoker(request).invokeProvider(request, param);
} catch(Exception e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
Packet response = argsBuilder.getResponse(request,e,port,binding);
return doReturnWith(response);
}
if (returnValue == null) {
// Oneway. Send response code immediately for transports(like HTTP)
// Don't do this above, since close() may generate some exceptions
if (request.transportBackChannel != null) {
request.transportBackChannel.close();
}
}
Packet response = argsBuilder.getResponse(request,returnValue,port,binding);
// Only used by Provider
// Implementation may pass Packet containing throwable; use both
ThrowableContainerPropertySet tc = response.getSatellite(ThrowableContainerPropertySet.class);
Throwable t = (tc != null) ? tc.getThrowable() : null;
return t != null ? doThrow(response, t) : doReturnWith(response);
}
@Override
public @NotNull NextAction processResponse(@NotNull Packet response) {
return doReturnWith(response);
}
@Override
public @NotNull NextAction processException(@NotNull Throwable t) {
return doThrow(t);
}
}