use of com.sun.xml.rpc.spi.runtime.SystemHandlerDelegate in project Payara by payara.
the class ServletWebServiceDelegate method postInit.
@Override
public void postInit(ServletConfig servletConfig) throws ServletException {
String servletName = "unknown";
try {
WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
ComponentEnvManager compEnvManager = wscImpl.getComponentEnvManager();
JndiNameEnvironment jndiNameEnv = compEnvManager.getCurrentJndiNameEnvironment();
WebBundleDescriptor webBundle = null;
if (jndiNameEnv != null && jndiNameEnv instanceof WebBundleDescriptor) {
webBundle = ((WebBundleDescriptor) jndiNameEnv);
} else {
throw new WebServiceException("Cannot intialize the JAXRPCServlet for " + jndiNameEnv);
}
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
servletName = servletConfig.getServletName();
WebComponentDescriptor webComponent = webBundle.getWebComponentByCanonicalName(servletName);
if (webComponent != null) {
WebServicesDescriptor webServices = webBundle.getWebServices();
Collection endpoints = webServices.getEndpointsImplementedBy(webComponent);
// Only 1 endpoint per servlet is supported, even though
// data structure implies otherwise.
endpoint_ = (WebServiceEndpoint) endpoints.iterator().next();
registerEndpoint(classLoader);
// security
if (secServ != null) {
SystemHandlerDelegate securityHandlerDelegate = secServ.getSecurityHandler(endpoint_);
if (securityHandlerDelegate != null) {
rpcDelegate_.setSystemHandlerDelegate(securityHandlerDelegate);
// need to invoke the endpoint lifecylcle
endpointImpl_ = JAXRPCEndpointImpl.class.cast(wsEngine_.createHandler(securityHandlerDelegate, endpoint_));
rpcDelegate_.setSystemHandlerDelegate(endpointImpl_);
}
}
} else {
throw new ServletException(servletName + " not found");
}
} catch (Throwable t) {
String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.SERVLET_ENDPOINT_FAILURE), servletName);
logger.log(Level.WARNING, msg, t);
throw new ServletException(t);
}
}
Aggregations