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;
}
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();
}
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());
}
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());
}
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);
}
}
Aggregations