Author: alessio.soldano(a)jboss.com
Date: 2010-06-11 05:28:02 -0400 (Fri, 11 Jun 2010)
New Revision: 12469
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
Log:
- No need to associate the bus to every endpoint of the deployment
- No need to keep a reference to the registry in the CXFServlet once the endpoint has been
looked-up
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2010-06-11
08:18:26 UTC (rev 12468)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2010-06-11
09:28:02 UTC (rev 12469)
@@ -63,7 +63,6 @@
public static final String ENABLE_CXF_MANAGEMENT = "enable.cxf.management";
protected Endpoint endpoint;
- protected EndpointRegistry epRegistry;
@Override
public ServletController createServletController(ServletConfig servletConfig)
@@ -91,7 +90,7 @@
private void updateAvailableBusWithServletInfo(ServletConfig servletConfig)
{
- BusHolder holder = endpoint.getAttachment(BusHolder.class);
+ BusHolder holder =
endpoint.getService().getDeployment().getAttachment(BusHolder.class);
//set the bus from deployment into the CXF servlet and assign it to the current
thread
bus = holder.getBus();
BusFactory.possiblySetDefaultBus(bus);
@@ -108,11 +107,11 @@
private void initEndpoint(ServletConfig servletConfig)
{
SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- epRegistry =
spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
+ EndpointRegistry epRegistry =
spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
ServletContext context = servletConfig.getServletContext();
String contextPath = context.getContextPath();
- endpoint = initServiceEndpoint(contextPath);
+ endpoint = initServiceEndpoint(epRegistry, contextPath);
}
@Override
@@ -121,6 +120,11 @@
try
{
BusFactory.setThreadDefaultBus(getBus());
+ //set the current endpoint into the threadlocal association that is later
+ //used by the EndpointAssociationInterceptor for linking the message exchange
+ //related to this invocation to the proper endpoint serving it (the bus, and
+ //hence the interceptor, can span multiple invocation related to multiple
+ //endpoints)
EndpointAssociation.setEndpoint(endpoint);
RequestHandler requestHandler = (RequestHandler)endpoint.getRequestHandler();
requestHandler.handleHttpRequest(endpoint, req, res, getServletContext());
@@ -138,7 +142,7 @@
/** Initialize the service endpoint
*/
- private Endpoint initServiceEndpoint(String contextPath)
+ private Endpoint initServiceEndpoint(EndpointRegistry epRegistry, String contextPath)
{
if (contextPath.startsWith("/"))
contextPath = contextPath.substring(1);
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2010-06-11
08:18:26 UTC (rev 12468)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2010-06-11
09:28:02 UTC (rev 12469)
@@ -32,7 +32,6 @@
import org.jboss.wsf.spi.binding.BindingCustomization;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.ResourceResolver;
import org.jboss.wsf.stack.cxf.configuration.BusHolder;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
@@ -93,24 +92,12 @@
SecurityActions.setContextClassLoader(origClassLoader);
}
- for (Endpoint endpoint : dep.getService().getEndpoints())
- {
- endpoint.addAttachment(BusHolder.class, holder);
- }
dep.addAttachment(BusHolder.class, holder);
}
@Override
public void stop(Deployment dep)
{
- for (Endpoint endpoint : dep.getService().getEndpoints())
- {
- BusHolder holder = endpoint.removeAttachment(BusHolder.class);
- if (holder != null)
- {
- holder.close();
- }
- }
BusHolder holder = dep.removeAttachment(BusHolder.class);
if (holder != null)
{
Show replies by date