Search in sources :

Example 1 with Deployment

use of org.jboss.wsf.spi.deployment.Deployment in project wildfly by wildfly.

the class EndpointDeployService method install.

public static DeploymentUnit install(final ServiceTarget serviceTarget, final String context, final ClassLoader loader, final String hostName, final Map<String, String> urlPatternToClassName, JBossWebMetaData jbwmd, WebservicesMetaData wsmd, JBossWebservicesMetaData jbwsmd, Map<Class<?>, Object> deploymentAttachments) {
    final DeploymentUnit unit = EndpointPublisherHelper.doPrepareStep(context, loader, urlPatternToClassName, jbwmd, wsmd, jbwsmd);
    if (deploymentAttachments != null) {
        Deployment dep = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
        for (Entry<Class<?>, Object> e : deploymentAttachments.entrySet()) {
            dep.addAttachment(e.getKey(), e.getValue());
        }
    }
    final EndpointDeployService service = new EndpointDeployService(context, unit);
    final ServiceBuilder<DeploymentUnit> builder = serviceTarget.addService(service.getName(), service);
    builder.addDependency(DependencyType.REQUIRED, WSServices.CONFIG_SERVICE);
    builder.setInitialMode(Mode.ACTIVE);
    builder.install();
    return unit;
}
Also used : Deployment(org.jboss.wsf.spi.deployment.Deployment) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 2 with Deployment

use of org.jboss.wsf.spi.deployment.Deployment in project jbossws-cxf by jbossws.

the class BusHolderLifeCycleTestCase method shutdownTestWithNoShutdown.

private static void shutdownTestWithNoShutdown(BusHolder holder) {
    Bus bus = holder.getBus();
    TestLifeCycleListener listener = new TestLifeCycleListener();
    bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(listener);
    Deployment dep = new DefaultDeploymentModelFactory().newDeployment("testDeployment", null, null);
    dep.addAttachment(SOAPAddressRewriteMetadata.class, new SOAPAddressRewriteMetadata(getTestServerConfig(), null));
    holder.configure(null, null, null, dep);
    assertEquals("preShutdown method on listener shouldn't be called before holder is closed: number of actual calls: " + listener.getCount(), 0, listener.getCount());
    holder.close();
}
Also used : Bus(org.apache.cxf.Bus) DefaultDeploymentModelFactory(org.jboss.ws.common.deployment.DefaultDeploymentModelFactory) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata) Deployment(org.jboss.wsf.spi.deployment.Deployment) BusLifeCycleManager(org.apache.cxf.buslifecycle.BusLifeCycleManager)

Example 3 with Deployment

use of org.jboss.wsf.spi.deployment.Deployment in project jbossws-cxf by jbossws.

the class BusHolderLifeCycleTestCase method shutdownTestWithInnerShutdown.

private static void shutdownTestWithInnerShutdown(BusHolder holder) {
    Bus bus = holder.getBus();
    TestLifeCycleListener listener = new TestLifeCycleListener();
    bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(listener);
    Deployment dep = new DefaultDeploymentModelFactory().newDeployment("testDeployment", null, null);
    dep.addAttachment(SOAPAddressRewriteMetadata.class, new SOAPAddressRewriteMetadata(getTestServerConfig(), null));
    holder.configure(null, null, null, dep);
    bus.shutdown(true);
    holder.close();
    assertEquals("preShutdown method on listener should be called exactly once; number of actual calls: " + listener.getCount(), 1, listener.getCount());
}
Also used : Bus(org.apache.cxf.Bus) DefaultDeploymentModelFactory(org.jboss.ws.common.deployment.DefaultDeploymentModelFactory) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata) Deployment(org.jboss.wsf.spi.deployment.Deployment) BusLifeCycleManager(org.apache.cxf.buslifecycle.BusLifeCycleManager)

Example 4 with Deployment

use of org.jboss.wsf.spi.deployment.Deployment in project jbossws-cxf by jbossws.

the class BusHolderLifeCycleTestCase method simpleShutdownTest.

private static void simpleShutdownTest(BusHolder holder) {
    Bus bus = holder.getBus();
    TestLifeCycleListener listener = new TestLifeCycleListener();
    bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(listener);
    Deployment dep = new DefaultDeploymentModelFactory().newDeployment("testDeployment", null, null);
    dep.addAttachment(SOAPAddressRewriteMetadata.class, new SOAPAddressRewriteMetadata(getTestServerConfig(), null));
    holder.configure(null, null, null, dep);
    holder.close();
    assertEquals("preShutdown method on listener should be called exactly once; number of actual calls: " + listener.getCount(), 1, listener.getCount());
}
Also used : Bus(org.apache.cxf.Bus) DefaultDeploymentModelFactory(org.jboss.ws.common.deployment.DefaultDeploymentModelFactory) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata) Deployment(org.jboss.wsf.spi.deployment.Deployment) BusLifeCycleManager(org.apache.cxf.buslifecycle.BusLifeCycleManager)

Example 5 with Deployment

use of org.jboss.wsf.spi.deployment.Deployment in project jbossws-cxf by jbossws.

the class RequestHandlerImpl method handleHttpRequest.

public void handleHttpRequest(Endpoint ep, HttpServletRequest req, HttpServletResponse res, ServletContext context) throws ServletException, IOException {
    final boolean isGet = "GET".equals(req.getMethod());
    final boolean isGetWithQueryString = isGet && hasQueryString(req);
    if (isGet && !isGetWithQueryString) {
        // reject HTTP GET without query string (only support messages sent w/ POST)
        res.setStatus(405);
        res.setContentType("text/plain");
        Writer out = res.getWriter();
        out.write("HTTP GET not supported");
        out.close();
        return;
    }
    final boolean statisticsEnabled = getServerConfig().isStatisticsEnabled();
    final Long beginTime = statisticsEnabled == true ? initRequestMetrics(ep) : 0;
    final Deployment dep = ep.getService().getDeployment();
    final AbstractHTTPDestination dest = findDestination(req, dep.getAttachment(BusHolder.class).getBus());
    final HttpServletResponseWrapper response = new HttpServletResponseWrapper(res);
    try {
        ServletConfig cfg = (ServletConfig) context.getAttribute(ServletConfig.class.getName());
        if (isGetWithQueryString) {
            final EndpointInfo endpointInfo = dest.getEndpointInfo();
            final boolean autoRewrite = SoapAddressRewriteHelper.isAutoRewriteOn(dep.getAttachment(SOAPAddressRewriteMetadata.class));
            endpointInfo.setProperty(WSDLGetUtils.AUTO_REWRITE_ADDRESS, autoRewrite);
            endpointInfo.setProperty(WSDLGetUtils.AUTO_REWRITE_ADDRESS_ALL, autoRewrite);
        }
        dest.invoke(cfg, context, req, response);
    } catch (IOException e) {
        throw new ServletException(e);
    }
    if (statisticsEnabled && response.getStatus() < 500) {
        processResponseMetrics(ep, beginTime);
    }
    if (statisticsEnabled && response.getStatus() >= 500) {
        processFaultMetrics(ep, beginTime);
    }
}
Also used : ServletException(javax.servlet.ServletException) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) AbstractHTTPDestination(org.apache.cxf.transport.http.AbstractHTTPDestination) HttpServletResponseWrapper(javax.servlet.http.HttpServletResponseWrapper) ServletConfig(javax.servlet.ServletConfig) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata) Deployment(org.jboss.wsf.spi.deployment.Deployment) IOException(java.io.IOException) Writer(java.io.Writer)

Aggregations

Deployment (org.jboss.wsf.spi.deployment.Deployment)16 SOAPAddressRewriteMetadata (org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata)6 DefaultDeploymentModelFactory (org.jboss.ws.common.deployment.DefaultDeploymentModelFactory)4 Bus (org.apache.cxf.Bus)3 BusLifeCycleManager (org.apache.cxf.buslifecycle.BusLifeCycleManager)3 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)3 Endpoint (org.jboss.wsf.spi.deployment.Endpoint)3 HashMap (java.util.HashMap)2 ServiceName (org.jboss.msc.service.ServiceName)2 IOException (java.io.IOException)1 Writer (java.io.Writer)1 ArrayList (java.util.ArrayList)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ServletConfig (javax.servlet.ServletConfig)1 ServletException (javax.servlet.ServletException)1 ServletRequest (javax.servlet.ServletRequest)1 HttpServletResponseWrapper (javax.servlet.http.HttpServletResponseWrapper)1 QName (javax.xml.namespace.QName)1 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)1 Header (org.apache.cxf.headers.Header)1