Author: darran.lofthouse(a)jboss.com
Date: 2007-04-23 17:07:04 -0400 (Mon, 23 Apr 2007)
New Revision: 2907
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java
Log:
JBWS-1093 - Deploying a war that also contains normal servlets the web.xml is modified as
if they are all endpoints.
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java 2007-04-23
19:30:09 UTC (rev 2906)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java 2007-04-23
21:07:04 UTC (rev 2907)
@@ -35,6 +35,7 @@
import org.jboss.metadata.web.Servlet;
import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
import org.jboss.ws.core.server.AbstractServiceEndpointPublisher.RewriteResults;
+import org.jboss.ws.core.utils.JavaUtils;
/**
* An abstract deployer for JSE Endpoints
@@ -60,15 +61,10 @@
// Call the super implementation
super.deployServiceEndpoint(unit);
- // FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
- InputStream stream =
unit.getDeploymentContext().getRoot().findChild("WEB-INF/web.xml").openStream();
- RewriteResults results = getServiceEndpointPublisher().rewriteWebXml(stream, null,
unit.getClassLoader());
-
- URL webXML = results.webXML;
- modifyWebMetaData(unit, webXML);
+ modifyWebMetaData(unit);
}
- private void modifyWebMetaData(DeploymentUnit unit, URL webXML) throws Exception
+ private void modifyWebMetaData(DeploymentUnit unit) throws Exception
{
Set<? extends WebMetaData> allMetaData =
unit.getAllMetaData(WebMetaData.class);
if (allMetaData.size() < 1)
@@ -88,19 +84,44 @@
continue;
// Nothing to do if we have an <init-param>
- if (isAlreadyModified(servlet) == false)
+ if (isAlreadyModified(servlet) == false && isAServlet(servletClassName,
unit.getClassLoader()) == false)
{
servlet.setServletClass(serviceEndpointServlet);
NameValuePair initParam = new
NameValuePair(AbstractServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL,
servletClassName);
servlet.addInitParam(initParam);
}
+
}
- // FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
- String webXmlPath = webXML.getPath();
- webMetaData.setAltDDPath(webXmlPath);
}
+ private boolean isAServlet(String servletClassName, ClassLoader cl)
+ {
+ boolean isAServlet = false;
+
+ if (cl != null)
+ {
+ try
+ {
+ Class servletClass = cl.loadClass(servletClassName);
+
+ isAServlet = JavaUtils.isAssignableFrom(javax.servlet.Servlet.class,
servletClass);
+
+ if (isAServlet == true)
+ {
+ log.info("Ignore servlet: " + servletClassName);
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.warn("Cannot load servlet class: " + servletClassName);
+ }
+
+ }
+
+ return isAServlet;
+ }
+
private boolean isAlreadyModified(Servlet servlet)
{
Iterator itParams = servlet.getInitParams().iterator();
Modified:
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
===================================================================
---
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-04-23
19:30:09 UTC (rev 2906)
+++
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-04-23
21:07:04 UTC (rev 2907)
@@ -70,6 +70,7 @@
UnifiedDeploymentInfo udi = new UnifiedDeploymentInfo(null);
udi.webappURL = tmpDir.toURL();
+ udi.classLoader = DeploymentLoader.newInstance(udi.webappURL);
TomcatServiceEndpointPublisher publisher = new TomcatServiceEndpointPublisher();
publisher.setServiceEndpointServlet(servletName);
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java 2007-04-23
19:30:09 UTC (rev 2906)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java 2007-04-23
21:07:04 UTC (rev 2907)
@@ -85,12 +85,6 @@
public void testAccessServlet() throws Exception
{
- if (true)
- {
- System.out.println("FIXME: [JBAS-4210] HTTP request dispatched to the wrong
servlet");
- return;
- }
-
URL servletURL = new URL("http://" + getServerHost() + ":8080"
+ "/jaxrpc-jbws1093/ServletTest");
InputStream is = servletURL.openStream();
Show replies by date