Author: darran.lofthouse(a)jboss.com
Date: 2007-05-04 14:37:42 -0400 (Fri, 04 May 2007)
New Revision: 2963
Modified:
branches/jbossws-2.0/integration-jboss42/.classpath
branches/jbossws-2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java
branches/jbossws-2.0/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java
Log:
JBWS-1093 - Test if servlet class is a servlet or map it as an endpoint.
Modified: branches/jbossws-2.0/integration-jboss42/.classpath
===================================================================
--- branches/jbossws-2.0/integration-jboss42/.classpath 2007-05-04 15:08:18 UTC (rev
2962)
+++ branches/jbossws-2.0/integration-jboss42/.classpath 2007-05-04 18:37:42 UTC (rev
2963)
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/jboss-4.2.x"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/jboss-4-2-x"/>
<classpathentry combineaccessrules="false" kind="src"
path="/jbossws-core"/>
<classpathentry kind="lib" path="/build/thirdparty/ant.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/activation.jar"/>
Modified:
branches/jbossws-2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java
===================================================================
---
branches/jbossws-2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java 2007-05-04
15:08:18 UTC (rev 2962)
+++
branches/jbossws-2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java 2007-05-04
18:37:42 UTC (rev 2963)
@@ -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:
branches/jbossws-2.0/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
===================================================================
---
branches/jbossws-2.0/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-05-04
15:08:18 UTC (rev 2962)
+++
branches/jbossws-2.0/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-05-04
18:37:42 UTC (rev 2963)
@@ -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:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java 2007-05-04
15:08:18 UTC (rev 2962)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java 2007-05-04
18:37:42 UTC (rev 2963)
@@ -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