[jboss-svn-commits] JBL Code SVN: r35160 - in labs/jbossesb/branches/JBESB_4_9_CP/product: services/soap/src/main/java/org/jboss/soa/esb/actions/soap and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 16 01:46:09 EDT 2010
Author: mageshbk at jboss.com
Date: 2010-09-16 01:46:09 -0400 (Thu, 16 Sep 2010)
New Revision: 35160
Modified:
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java
Log:
[JBESB-3470] - Removed dummy ENC and provided ENC from JBossWebMetaData only for AS5 runtime
Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java 2010-09-15 17:11:23 UTC (rev 35159)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java 2010-09-16 05:46:09 UTC (rev 35160)
@@ -53,6 +53,7 @@
import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.mx.util.ObjectNameConverter;
import org.jboss.soa.esb.Service;
import org.jboss.soa.esb.listeners.config.WebserviceInfo;
@@ -92,10 +93,11 @@
public static final String WSIMPL_NATIVE = "Native";
public static final String WSIMPL_UNKNOWN = "Unknown";
private static String WSIMPL;
+ private static Boolean WEB_META_DATA_PRESENT;
private JBossDeployerUtil() { }
- public static String getWSImpl()
+ public static synchronized String getWSImpl()
{
if (WSIMPL == null)
{
@@ -124,6 +126,23 @@
}
return WSIMPL;
}
+
+ public static synchronized boolean isWebMetaDataPresent()
+ {
+ if (WEB_META_DATA_PRESENT == null)
+ {
+ try
+ {
+ Class metaData = JBossWebMetaData.class;
+ WEB_META_DATA_PRESENT = true ;
+ }
+ catch (final Throwable th)
+ {
+ WEB_META_DATA_PRESENT = false ;
+ }
+ }
+ return WEB_META_DATA_PRESENT;
+ }
public static String getHandlers(final ESBServiceEndpointInfo serviceInfo)
{
Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java 2010-09-15 17:11:23 UTC (rev 35159)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java 2010-09-16 05:46:09 UTC (rev 35160)
@@ -26,14 +26,12 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
import javax.servlet.ServletContext;
import org.jboss.internal.soa.esb.publish.Publish;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
import org.jboss.soa.esb.actions.ActionProcessingException;
@@ -49,8 +47,7 @@
import org.jboss.soa.esb.message.ResponseHeader;
import org.jboss.soa.esb.message.ResponseStatus;
import org.jboss.soa.esb.message.body.content.BytesBody;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.invocation.EndpointAssociation;
import org.jboss.wsf.spi.invocation.RequestHandler;
@@ -220,12 +217,7 @@
final ClassLoader old = Thread.currentThread().getContextClassLoader();
try
{
- // Use the WS deloyment's initial classloader because there could be resources within it
- final ClassLoader initCL = endpoint.getService().getDeployment().getInitialClassLoader();
- Thread.currentThread().setContextClassLoader(initCL);
-
- // Provide ENC for newer versions of JBossWS
- setENC();
+ initialiseContextClassLoader(endpoint);
requestHandler.handleHttpRequest(endpoint, servletRequest, servletResponse, servletContext) ;
}
finally
@@ -280,6 +272,27 @@
return message;
}
+ private void initialiseContextClassLoader(final Endpoint endpoint)
+ throws ActionProcessingException
+ {
+ if (JBossDeployerUtil.isWebMetaDataPresent())
+ {
+ final Deployment deployment = endpoint.getService().getDeployment();
+ final JBossWebMetaData attachment = deployment.getAttachment(JBossWebMetaData.class);
+
+ if (attachment != null)
+ {
+ final ClassLoader tccl = attachment.getENCLoader() ;
+ if (tccl != null)
+ {
+ Thread.currentThread().setContextClassLoader(tccl);
+ return ;
+ }
+ }
+ throw new ActionProcessingException("Could not locate ENC ClassLoader for service endpoint '" + jbossws_endpoint + "'.");
+ }
+ }
+
private String getHeaderValue(final Map<String, List<String>> headers,
final String header)
{
@@ -314,25 +327,6 @@
}
return soapMessage;
}
-
- /**
- * Checks to see if the java:comp and java:comp/env names have been bound
- * in JNDI. The ENC is anchored to the TCCL, which in SOAPProcessor is
- * shared by multiple threads during request dispatch, so this method
- * must be synchronized to prevent duplicate binding of java:comp/env.
- * @throws javax.naming.NamingException failed to access naming context
- */
- private synchronized void setENC() throws javax.naming.NamingException {
- Context enc = (Context)new InitialContext().lookup("java:comp");
-
- try {
- enc.lookup("env");
- }
- catch (javax.naming.NameNotFoundException nnfEx) {
- enc.createSubcontext("env");
- }
- }
-
/**
* Set the {@link org.jboss.soa.esb.message.Message} instance for this invocation context.
More information about the jboss-svn-commits
mailing list