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 de...@apache.org on 2006/07/24 11:15:45 UTC
svn commit: r424972 -
/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java
Author: deepal
Date: Mon Jul 24 02:15:43 2006
New Revision: 424972
URL: http://svn.apache.org/viewvc?rev=424972&view=rev
Log:
fixing AXIS2-920
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java?rev=424972&r1=424971&r2=424972&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java Mon Jul 24 02:15:43 2006
@@ -1,6 +1,7 @@
package org.apache.axis2.deployment.resolver;
import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.ws.commons.schema.resolver.DefaultURIResolver;
import org.xml.sax.InputSource;
import javax.wsdl.xml.WSDLLocator;
@@ -31,7 +32,7 @@
* The logic here is that we only care about the import location
* all imports must be relative to the META-INF folder
*/
-public class AARBasedWSDLLocator implements WSDLLocator {
+public class AARBasedWSDLLocator extends DefaultURIResolver implements WSDLLocator {
private File aarFile;
private InputStream baseInputStream;
@@ -54,39 +55,44 @@
* @return
*/
public InputSource getImportInputSource(String parentLocation, String importLocation) {
- //we don't care about the parent location
- ZipInputStream zin = null;
- try {
-
- zin = new ZipInputStream(new FileInputStream(aarFile));
- ZipEntry entry;
- byte[] buf = new byte[1024];
- int read;
- ByteArrayOutputStream out;
- while ((entry = zin.getNextEntry()) != null) {
- String entryName = entry.getName();
- if ((entryName.startsWith(DeploymentConstants.META_INF.toLowerCase())
- || entryName.startsWith(DeploymentConstants.META_INF))
- && entryName.endsWith(importLocation)) {
- //read the item into a byte array to allow the
- //stream to be closed
- out = new ByteArrayOutputStream();
- while ((read = zin.read(buf)) > 0) {
- out.write(buf, 0, read);
+ if (isAbsolute(importLocation)) {
+ return super.resolveEntity(
+ null, importLocation, parentLocation);
+ } else {
+ //we don't care about the parent location
+ ZipInputStream zin = null;
+ try {
+
+ zin = new ZipInputStream(new FileInputStream(aarFile));
+ ZipEntry entry;
+ byte[] buf = new byte[1024];
+ int read;
+ ByteArrayOutputStream out;
+ while ((entry = zin.getNextEntry()) != null) {
+ String entryName = entry.getName();
+ if ((entryName.startsWith(DeploymentConstants.META_INF.toLowerCase())
+ || entryName.startsWith(DeploymentConstants.META_INF))
+ && entryName.endsWith(importLocation)) {
+ //read the item into a byte array to allow the
+ //stream to be closed
+ out = new ByteArrayOutputStream();
+ while ((read = zin.read(buf)) > 0) {
+ out.write(buf, 0, read);
+ }
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+ return new InputSource(in);
}
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
- return new InputSource(in);
}
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- try {
- if (zin != null) zin.close();
} catch (IOException e) {
- //log this error
+ throw new RuntimeException(e);
+ } finally {
+ try {
+ if (zin != null) zin.close();
+ } catch (IOException e) {
+ //log this error
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org