Search in sources :

Example 1 with Adapter

use of com.sun.xml.ws.api.server.Adapter in project Payara by payara.

the class JAXWSAdapterRegistryTest method testAddAdapter.

/**
 * Test of addAdapter method, of class JAXWSAdapterRegistry.
 *
 * http://java.net/jira/browse/GLASSFISH-17836
 * Putting load on freshly-started Glassfish web-app messes up its initialization process
 */
@Test
public void testAddAdapter() {
    final String contextRoot = "/cr";
    final String urlPattern = "/up";
    final JAXWSAdapterRegistry registry = JAXWSAdapterRegistry.getInstance();
    int size = 25;
    Thread[] ts = new Thread[size];
    for (int i = 0; i < size; i++) {
        final int j = i;
        ts[i] = new Thread(new Runnable() {

            @Override
            public void run() {
                registry.addAdapter(contextRoot, urlPattern + j, new A(j));
            }
        });
    }
    for (int i = 0; i < size; i++) ts[i].start();
    for (int i = 0; i < size; i++) {
        try {
            ts[i].join();
        } catch (InterruptedException ex) {
        }
    }
    for (int i = 0; i < size; i++) {
        Adapter a = registry.getAdapter(contextRoot, urlPattern + i, urlPattern + i);
        Assert.assertNotNull("No adapter for '" + contextRoot + urlPattern + i + "'", a);
        Assert.assertEquals(i, ((A) a).getX());
    }
}
Also used : Adapter(com.sun.xml.ws.api.server.Adapter) WSEndpoint(com.sun.xml.ws.api.server.WSEndpoint) Test(org.junit.Test)

Example 2 with Adapter

use of com.sun.xml.ws.api.server.Adapter in project Payara by payara.

the class WSTCPAdapterRegistryImpl method createWSAdapter.

private TCPAdapter createWSAdapter(@NotNull final String wsPath, @NotNull final WSEndpointDescriptor wsEndpointDescriptor) throws Exception {
    if (wsEndpointDescriptor.isEJB()) {
        final EjbRuntimeEndpointInfo ejbEndPtInfo = (EjbRuntimeEndpointInfo) V3Module.getWSEjbEndpointRegistry().getEjbWebServiceEndpoint(wsEndpointDescriptor.getURI(), "POST", null);
        final AdapterInvocationInfo adapterInfo = (AdapterInvocationInfo) ejbEndPtInfo.prepareInvocation(true);
        return new Ejb109Adapter(wsEndpointDescriptor.getWSServiceName().toString(), wsPath, adapterInfo.getAdapter().getEndpoint(), new ServletFakeArtifactSet(wsEndpointDescriptor.getRequestURL(), wsEndpointDescriptor.getUrlPattern()), ejbEndPtInfo, adapterInfo);
    } else {
        final String uri = wsEndpointDescriptor.getURI();
        final Adapter adapter = JAXWSAdapterRegistry.getInstance().getAdapter(wsEndpointDescriptor.getContextRoot(), uri, uri);
        final WebModule webModule = AppServRegistry.getWebModule(wsEndpointDescriptor.getWSServiceEndpoint());
        final ComponentInvocation invocation = new WebComponentInvocation(webModule);
        return new Web109Adapter(wsEndpointDescriptor.getWSServiceName().toString(), wsPath, adapter.getEndpoint(), new ServletFakeArtifactSet(wsEndpointDescriptor.getRequestURL(), wsEndpointDescriptor.getUrlPattern()), invocation);
    }
}
Also used : WebComponentInvocation(com.sun.enterprise.web.WebComponentInvocation) EjbRuntimeEndpointInfo(org.glassfish.webservices.EjbRuntimeEndpointInfo) WebComponentInvocation(com.sun.enterprise.web.WebComponentInvocation) ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation) AdapterInvocationInfo(org.glassfish.webservices.AdapterInvocationInfo) TCPAdapter(com.sun.xml.ws.transport.tcp.server.TCPAdapter) Adapter(com.sun.xml.ws.api.server.Adapter) WebModule(com.sun.enterprise.web.WebModule)

Aggregations

Adapter (com.sun.xml.ws.api.server.Adapter)2 WebComponentInvocation (com.sun.enterprise.web.WebComponentInvocation)1 WebModule (com.sun.enterprise.web.WebModule)1 WSEndpoint (com.sun.xml.ws.api.server.WSEndpoint)1 TCPAdapter (com.sun.xml.ws.transport.tcp.server.TCPAdapter)1 ComponentInvocation (org.glassfish.api.invocation.ComponentInvocation)1 AdapterInvocationInfo (org.glassfish.webservices.AdapterInvocationInfo)1 EjbRuntimeEndpointInfo (org.glassfish.webservices.EjbRuntimeEndpointInfo)1 Test (org.junit.Test)1