Author: dims Date: Thu Jun 7 18:11:16 2007 New Revision: 545358 URL: http://svn.apache.org/viewvc?view=rev&rev=545358 Log: Fix for AXIS2-2736 - Allow to address own xsd from own wsdl
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?view=diff&rev=545358&r1=545357&r2=545358 ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java Thu Jun 7 18:11:16 2007 @@ -22,6 +22,7 @@ import java.net.URI; import java.util.HashMap; import java.util.Map; +import java.util.Iterator; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; @@ -86,15 +87,36 @@ } if (uri.indexOf("?") < 0) { if (!uri.endsWith(contextPath)) { - String serviceName = uri.replaceAll(contextPath, ""); - if (serviceName.indexOf("/") < 0) { - String s = HTTPTransportReceiver - .printServiceHTML(serviceName, configurationContext); - response.setStatus(HttpStatus.SC_OK); - response.setContentType("text/html"); - OutputStream out = response.getOutputStream(); - out.write(EncodingUtils.getBytes(s, HTTP.ISO_8859_1)); - return; + if (uri.endsWith(".xsd") || uri.endsWith(".wsdl")) { + HashMap services = configurationContext.getAxisConfiguration().getServices(); + String file = uri.substring(uri.lastIndexOf("/") + 1, + uri.length()); + if ((services != null) && !services.isEmpty()) { + Iterator i = services.values().iterator(); + while (i.hasNext()) { + AxisService service = (AxisService) i.next(); + InputStream stream = service.getClassLoader().getResourceAsStream("META-INF/" + file); + if (stream != null) { + OutputStream out = response.getOutputStream(); + response.setContentType("text/xml"); + ListingAgent.copy(stream, out); + out.flush(); + out.close(); + return; + } + } + } + } else { + String serviceName = uri.replaceAll(contextPath, ""); + if (serviceName.indexOf("/") < 0) { + String s = HTTPTransportReceiver + .printServiceHTML(serviceName, configurationContext); + response.setStatus(HttpStatus.SC_OK); + response.setContentType("text/html"); + OutputStream out = response.getOutputStream(); + out.write(EncodingUtils.getBytes(s, HTTP.ISO_8859_1)); + return; + } } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]