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 di...@apache.org on 2007/03/07 18:14:02 UTC

svn commit: r515653 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http: AxisServlet.java ListingAgent.java

Author: dims
Date: Wed Mar  7 09:13:59 2007
New Revision: 515653

URL: http://svn.apache.org/viewvc?view=rev&rev=515653
Log:
Make the Schema's present in myService/META-INF available. Especially useful when one has a wsdl with bunch of schemas and would like to use "useOriginalWSDL" flag.


Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=515653&r1=515652&r2=515653
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Wed Mar  7 09:13:59 2007
@@ -223,6 +223,8 @@
                 query.indexOf("policy") >= 0)) {
             // handling meta data exchange stuff
             agent.processListService(request, response);
+        } else if (requestURI.endsWith(".xsd")) {
+            agent.processExplicitSchemas(request, response);
         } else if (requestURI.endsWith(LIST_SERVICES_SUFIX) ||
                 requestURI.endsWith(LIST_FAUKT_SERVICES_SUFIX)) {
             // handling list services request

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java?view=diff&rev=515653&r1=515652&r2=515653
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java Wed Mar  7 09:13:59 2007
@@ -154,6 +154,43 @@
         return ip;
     }
 
+    public void processExplicitSchemas(HttpServletRequest req,
+                                       HttpServletResponse res)
+            throws IOException, ServletException {
+        HashMap services = configContext.getAxisConfiguration().getServices();
+        String filePart = req.getRequestURL().toString();
+        String schema = filePart.substring(filePart.lastIndexOf("/") + 1,
+                filePart.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/" + schema);
+                if (stream != null) {
+                    OutputStream out = res.getOutputStream();
+                    res.setContentType("text/xml");
+                    copy(stream, out);
+                    out.flush();
+                    out.close();
+                    return;
+                }
+            }
+        }
+    }
+
+    /**
+     * Copies the input stream to the output stream
+     *
+     * @param stream the <code>InputStream</code>
+     * @param ostream the <code>OutputStream</code>
+     */
+    public static void copy(InputStream stream, OutputStream ostream) throws IOException {
+        int nextValue = stream.read();
+        while (-1 != nextValue) {
+            ostream.write(nextValue);
+            nextValue = stream.read();
+        }
+    }
 
     public void processListService(HttpServletRequest req,
                                    HttpServletResponse res)



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