Author: sagara
Date: Mon Feb 20 09:33:32 2012
New Revision: 1291160
URL: http://svn.apache.org/viewvc?rev=1291160&view=rev
Log:
Merged r1291158 to the 1.6 branch.
Added:
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/rest/
- copied from r1291158,
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/rest/
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/rest/RESTfulServiceTest.java
- copied unchanged from r1291158,
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/rest/RESTfulServiceTest.java
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/rest/Stock.java
- copied unchanged from r1291158,
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/rest/Stock.java
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/rest/StockService.java
- copied unchanged from r1291158,
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/rest/StockService.java
Modified:
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/namespace/Constants.java
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
Modified:
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java?rev=1291160&r1=1291159&r2=1291160&view=diff
==============================================================================
---
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
(original)
+++
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
Mon Feb 20 09:33:32 2012
@@ -109,6 +109,7 @@ public interface WSDL2Constants {
String ATTR_WHTTP_LOCATION = "whttp:location";
String ATTR_WHTTP_HEADER = "whttp:header";
String ATTR_WHTTP_METHOD = "whttp:method";
+ String ATTR_WHTTP_METHOD_DEFAULT = "whttp:methodDefault";
String ATTR_WHTTP_CODE = "whttp:code";
String ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR =
"whttp:queryParameterSeparator";
String ATTR_WHTTP_IGNORE_UNCITED = "whttp:ignoreUncited";
Modified:
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java?rev=1291160&r1=1291159&r2=1291160&view=diff
==============================================================================
---
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java
(original)
+++
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java
Mon Feb 20 09:33:32 2012
@@ -24,12 +24,15 @@ import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisEndpoint;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.description.WSDL2Constants;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.util.LoggingControl;
import org.apache.axis2.util.Utils;
+import org.apache.axis2.wsdl.WSDLUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -104,9 +107,17 @@ public class RequestURIBasedServiceDispa
messageContext.setProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME,
endpoints.get(endpointName));
}
- }
- }
- }
+ String endpointName =
temp[0].substring(temp[0].indexOf(".") + 1);
+ AxisEndpoint endpoint = (AxisEndpoint)
endpoints.get(endpointName);
+ if (endpoint != null) {
+
messageContext.setProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME,
+ endpoint);
+ } else {
+ inferEndpoint(messageContext, axisService);
+ }
+ }
+ }
+ }
return axisService;
} else {
@@ -128,4 +139,29 @@ public class RequestURIBasedServiceDispa
public void initDispatcher() {
init(new HandlerDescription(NAME));
}
+
+ private void inferEndpoint(MessageContext msgCtx, AxisService service) {
+ if (!msgCtx.isServerSide()) {
+ return;
+ }
+ String transport = null;
+ TransportInDescription transportIn = msgCtx.getTransportIn();
+ if (transportIn != null) {
+ transport = transportIn.getName();
+ if (transport == null) {
+ return;
+ }
+ }
+ AxisEndpoint endpoint = null;
+ Map endpointMapping = service.getEndpoints();
+ String serviceName = service.getName();
+
+ if (msgCtx.isDoingREST()) {
+ endpoint = (AxisEndpoint) endpointMapping.get(WSDLUtil.
+ getEndpointName(serviceName, transport));
+ }
+ if (endpoint != null) {
+ msgCtx.setProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME, endpoint);
+ }
+ }
}
Modified:
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/namespace/Constants.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/namespace/Constants.java?rev=1291160&r1=1291159&r2=1291160&view=diff
==============================================================================
---
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/namespace/Constants.java
(original)
+++
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/namespace/Constants.java
Mon Feb 20 09:33:32 2012
@@ -364,6 +364,7 @@ public class Constants {
public static final String MIME_CT_IMAGE_GIF = "image/gif";
public static final String MIME_CT_TEXT_XML = "text/xml";
public static final String MIME_CT_APPLICATION_XML = "application/xml";
+ public static final String MIME_CT_APPLICATION_URL_ENCODED =
"application/x-www-form-urlencoded";
public static final String MIME_CT_MULTIPART_PREFIX = "multipart/";
public static final QName BASE_64_CONTENT_QNAME =
Modified:
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java?rev=1291160&r1=1291159&r2=1291160&view=diff
==============================================================================
---
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
(original)
+++
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
Mon Feb 20 09:33:32 2012
@@ -90,4 +90,22 @@ public class WSDLUtil {
return httpMethod + httpLocation;
}
+ /**
+ * This method will return the EndPointName for a service with give
transport protocol
+ * ex : StudentServiceHttpEndpoint
+ *
+ * @param serviceName
+ * @param protocol transport protocol
+ * @return
+ */
+ public static String getEndpointName(String serviceName, String protocol) {
+
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(serviceName);
+ buffer.append(protocol.substring(0, 1).toUpperCase());
+ buffer.append(protocol.substring(1, protocol.length()).toLowerCase());
+ buffer.append("Endpoint");
+ return buffer.toString();
+ }
+
}