Author: heiko.braun(a)jboss.com
Date: 2007-07-03 10:56:52 -0400 (Tue, 03 Jul 2007)
New Revision: 3793
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java
Log:
The root file (UnifiedVirtualFile) for servlet service-ref clients didn't point to the
expanded war structure
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java 2007-07-03
14:44:20 UTC (rev 3792)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java 2007-07-03
14:56:52 UTC (rev 3793)
@@ -24,6 +24,12 @@
// $Id$
import java.lang.reflect.AnnotatedElement;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.File;
import javax.naming.Context;
import javax.naming.NamingException;
@@ -31,11 +37,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxrpc.client.ServiceRefHandlerJAXRPC;
import org.jboss.ws.core.jaxws.client.ServiceRefHandlerJAXWS;
-import org.jboss.ws.integration.ServiceRefElement;
-import org.jboss.ws.integration.ServiceRefHandler;
-import org.jboss.ws.integration.ServiceRefMetaData;
-import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.ws.integration.*;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.WSException;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
@@ -67,6 +71,35 @@
return;
}
+ // In case of an .war deployment the associated root file doesn't point to
+ // the expanded war file structure and thus breaks service-ref usage for servlet
clients.
+ // This needs to be fixed in org.jboss.web.AbstractWebDeployer (JBOSS_AS/server
module)
+ if(vfsRoot instanceof URLLoaderAdapter)
+ {
+ URLLoaderAdapter ula = (URLLoaderAdapter)vfsRoot;
+ URL rootURL = ula.toURL();
+ if("file".equals( rootURL.getProtocol()) &&
rootURL.getFile().endsWith(".war") )
+ {
+ String fileName = rootURL.getFile();
+ if( fileName.indexOf("-exp.war") == -1)
+ {
+ fileName = fileName.substring(0, fileName.indexOf(".war")) +
"-exp.war";
+ }
+
+ // check file existence
+ File f = new File(fileName);
+ if(!f.exists())
+ throw new WSException("Failed to bind service-ref, the deployment
root file doesn't exist: " + fileName);
+
+ // update the rootFile
+ try
+ {
+ vfsRoot = new URLLoaderAdapter(f.toURL());
+ }
+ catch (MalformedURLException e){}
+ }
+ }
+
UnifiedServiceRefMetaData serviceRef = (UnifiedServiceRefMetaData)sref;
serviceRef.setVfsRoot(vfsRoot);
try