axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r507030 - in /webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws: description/impl/URIResolverImpl.java i18n/resource.properties
Date Tue, 13 Feb 2007 14:52:13 GMT
Author: scheu
Date: Tue Feb 13 06:52:13 2007
New Revision: 507030

URL: http://svn.apache.org/viewvc?view=rev&rev=507030
Log:
AXIS2-2146
Contributor:Dustin Amrhein
Improvement to URIResolver in the metadata module

Modified:
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java?view=diff&rev=507030&r1=507029&r2=507030
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java
Tue Feb 13 06:52:13 2007
@@ -20,9 +20,12 @@
 
 import java.io.File;
 import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
 
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.ws.commons.schema.resolver.URIResolver;
 import org.xml.sax.InputSource;
 
@@ -31,6 +34,10 @@
  * 
  */
 public class URIResolverImpl implements URIResolver {
+	
+	private final String HTTP_PROTOCOL = "http";
+	
+	private final String FILE_PROTOCOL = "file";
 
     private ClassLoader classLoader;
 
@@ -67,7 +74,7 @@
                     		URI tempURI = new URI(url.getPath());
                         	URI resolvedURI = tempURI.resolve(schemaLocation);
                         	// Add back the scheme to the resolved path
-                        	pathURIStr = pathURI.getScheme() + ":" + resolvedURI.toString();
+                        	pathURIStr = constructPath(url, resolvedURI);
                     	}
                     }
                     else {
@@ -156,4 +163,29 @@
         }
         return is;
     }
+    
+    private String constructPath(URL baseURL, URI resolvedURI) {
+    	String importLocation = null;
+    	URL url = null;
+    	try {
+    		if(baseURL.getProtocol() != null && baseURL.getProtocol().equals(HTTP_PROTOCOL))
{
+        		url = new URL(baseURL.getProtocol(), baseURL.getHost(), baseURL.getPort(),
+        				resolvedURI.toString());
+        	}
+    		else if(baseURL.getProtocol()!= null && baseURL.getProtocol().equals(FILE_PROTOCOL))
{
+        		url = new URL(baseURL.getProtocol(), baseURL.getHost(), resolvedURI.toString());
+        	}
+    	}
+    	catch(MalformedURLException e) {
+    		throw ExceptionFactory.makeWebServiceException(Messages.getMessage("schemaImportError",

+    				resolvedURI.toString(), baseURL.toString()), e);
+    	}
+    	if(url == null) {
+    		throw ExceptionFactory.makeWebServiceException(Messages.getMessage("schemaImportError",

+    				resolvedURI.toString(), baseURL.toString()));
+    	}
+    	importLocation = url.toString();
+    	return importLocation;
+    }
+    
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties?view=diff&rev=507030&r1=507029&r2=507030
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties
(original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties
Tue Feb 13 06:52:13 2007
@@ -148,3 +148,4 @@
 unknownHost=The host specified by the URL is unknown.
 connectionRefused=An attempt to connect to the URL was refused.
 mimeBodyPartError=Error: Problem creating mime parts.
+schemaImportError=An internal error occurred resolving imported schema {0} relative to parent
document {1}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message