You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by nt...@apache.org on 2007/02/07 22:31:26 UTC
svn commit: r504702 - in
/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl:
EndpointDescriptionImpl.java URIResolverImpl.java
Author: nthaker
Date: Wed Feb 7 13:31:25 2007
New Revision: 504702
URL: http://svn.apache.org/viewvc?view=rev&rev=504702
Log:
Axis2-2115
Contributor - Dustin Amrhein
Modified:
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=504702&r1=504701&r2=504702
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Wed Feb 7 13:31:25 2007
@@ -16,6 +16,7 @@
*/
package org.apache.axis2.jaxws.description.impl;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -53,6 +54,7 @@
import org.apache.axis2.description.Parameter;
import org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder;
import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
@@ -681,6 +683,16 @@
//this.class.getClass().getClassLoader();
URIResolverImpl uriResolver =
new URIResolverImpl(composite.getClassLoader());
+ serviceBuilder.setCustomResolver(uriResolver);
+ }
+ else {
+ ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged(new
+ PrivilegedAction() {
+ public Object run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ URIResolverImpl uriResolver = new URIResolverImpl(classLoader);
serviceBuilder.setCustomResolver(uriResolver);
}
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=504702&r1=504701&r2=504702
==============================================================================
--- 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 Wed Feb 7 13:31:25 2007
@@ -50,16 +50,30 @@
try {
// if the location is an absolute path, build a URL directly
// from it
+
if (isAbsolute(schemaLocation)) {
is = getInputStreamForURI(schemaLocation);
}
// Try baseURI + relavtive schema path combo
else {
- pathURI = new URI(baseUri);
- pathURI = pathURI.resolve(schemaLocation);
- String pathURIStr = pathURI.toString();
-
+ pathURI = new URI(baseUri);
+ String pathURIStr = schemaLocation;
+ // If this is absolute we need to resolve the path without the
+ // scheme information
+ if(pathURI.isAbsolute()) {
+ URL url = new URL(baseUri);
+ if(url != null) {
+ URI tempURI = new URI(url.getPath());
+ URI resolvedURI = tempURI.resolve(schemaLocation);
+ // Add back the scheme to the resolved path
+ pathURIStr = pathURI.getScheme() + ":" + resolvedURI.toString();
+ }
+ }
+ else {
+ pathURI = pathURI.resolve(schemaLocation);
+ pathURIStr = pathURI.toString();
+ }
// If path is absolute, build URL directly from it
if (isAbsolute(pathURIStr)) {
is = getInputStreamForURI(pathURIStr);
@@ -71,34 +85,14 @@
// stream
// because the URI will still be relative to the module
else {
- // is = loadStrategy.getInputStream(pathURI.toString());
is = classLoader
.getResourceAsStream(pathURI.toString());
}
}
} catch (Exception e) {
- // TODO: RAS
-// Object[] inserts = { schemaLocation, e };
+
}
}
-
- // if(is == null){
- // Object[] inserts = { schemaLocation };
- // String msg = NLSProvider.getNLS().getFormattedMessage(
- // "fileNotFound00", inserts,
- // "File {0} could not be found.");
- // throw new RuntimeException(msg);
- // }
- //
- // if(_tc.isDebugEnabled()){
- // Tr.debug(_tc, "Loaded file: " + schemaLocation + ", base URI: " +
- // baseUri);
- // }
- //
- // if (_tc.isEntryEnabled()) {
- // Tr.exit(_tc, "resolveEntity");
- // }
-
return new InputSource(is);
}
@@ -116,6 +110,9 @@
} else if (location.indexOf(":\\") != -1) {
absolute = true;
}
+ else if(location.indexOf("file:") != -1) {
+ absolute = true;
+ }
return absolute;
}
@@ -135,7 +132,7 @@
streamURL = new URL(uri);
is = streamURL.openStream();
} catch (Throwable t) {
- //No FFDC required
+ //Exception handling not needed
}
if (is == null) {
@@ -144,7 +141,7 @@
streamURL = pathURI.toURL();
is = streamURL.openStream();
} catch (Throwable t) {
- //No FFDC required
+ //Exception handling not needed
}
}
@@ -154,10 +151,9 @@
streamURL = file.toURL();
is = streamURL.openStream();
} catch (Throwable t) {
- //No FFDC required
+ //Exception handling not needed
}
}
-
return is;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org