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/08/05 21:26:13 UTC
svn commit: r562939 -
/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
Author: dims
Date: Sun Aug 5 12:26:13 2007
New Revision: 562939
URL: http://svn.apache.org/viewvc?view=rev&rev=562939
Log:
Fix for AXIS2-2698 - ListingAgent should support service name with composite paths
Modified:
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/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=562939&r1=562938&r2=562939
==============================================================================
--- 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 Sun Aug 5 12:26:13 2007
@@ -28,14 +28,18 @@
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.SessionContext;
import org.apache.axis2.deployment.DeploymentConstants;
-import org.apache.axis2.description.*;
+import org.apache.axis2.description.AxisDescription;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.PolicyInclude;
+import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.transport.TransportListener;
import org.apache.axis2.util.ExternalPolicySerializer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.neethi.Policy;
import org.apache.neethi.PolicyRegistry;
import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -48,7 +52,11 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
public class ListingAgent extends AbstractAgent {
@@ -201,13 +209,28 @@
}
}
+ public String extractServiceName(String urlString) {
+ int n = urlString.indexOf(configContext.getServiceContextPath());
+ if (n != -1) {
+ String serviceName = urlString.substring(n + configContext.getServiceContextPath().length(),
+ urlString.length());
+ if (serviceName.length() > 0) {
+ if(serviceName.charAt(0)=='/'){
+ serviceName = serviceName.substring(1);
+ }
+ return serviceName;
+ }
+ }
+ return urlString.substring(urlString.lastIndexOf("/") + 1,
+ urlString.length());
+ }
+
public void processListService(HttpServletRequest req,
HttpServletResponse res)
throws IOException, ServletException {
- String filePart = req.getRequestURL().toString();
- String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1,
- filePart.length());
+ String url = req.getRequestURL().toString();
+ String serviceName = extractServiceName(url);
HashMap services = configContext.getAxisConfiguration().getServices();
String query = req.getQueryString();
int wsdl2 = query.indexOf("wsdl2");
@@ -221,7 +244,7 @@
boolean isHttp = "http".equals(req.getScheme());
if (wsdl2 >= 0) {
res.setContentType("text/xml");
- String ip = extractHostAndPort(filePart, isHttp);
+ String ip = extractHostAndPort(url, isHttp);
String wsdlName = req.getParameter("wsdl2");
if (wsdlName != null && wsdlName.length()>0) {
InputStream in = ((AxisService) serviceObj).getClassLoader()
@@ -245,7 +268,7 @@
} else if (wsdl >= 0) {
OutputStream out = res.getOutputStream();
res.setContentType("text/xml");
- String ip = extractHostAndPort(filePart, isHttp);
+ String ip = extractHostAndPort(url, isHttp);
String wsdlName = req.getParameter("wsdl");
if (wsdlName != null && wsdlName.length()>0) {
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org