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 ke...@apache.org on 2009/02/18 08:20:58 UTC
svn commit: r745397 - in /webservices/axis2/trunk/java/modules:
kernel/src/org/apache/axis2/ kernel/src/org/apache/axis2/JAXRS/
kernel/src/org/apache/axis2/deployment/util/
kernel/src/org/apache/axis2/description/java2wsdl/
kernel/src/org/apache/axis2/...
Author: keithc
Date: Wed Feb 18 07:20:58 2009
New Revision: 745397
URL: http://svn.apache.org/viewvc?rev=745397&view=rev
Log:
Applying patch given in AXIS2-4194 by Pradeep. This enables us to annotate RESTfull properties of a service
Added:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSModel.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSUtils.java
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java
webservices/axis2/trunk/java/modules/osgi/pom.xml
webservices/axis2/trunk/java/modules/parent/pom.xml
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java?rev=745397&r1=745396&r2=745397&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java Wed Feb 18 07:20:58 2009
@@ -306,7 +306,8 @@
public static final String TRANSACTION_MANAGER = "TransactionManager";
public static final String SUSPENDED_TRANSACTION = "SuspendedTransaction";
-
+ public static final String JSR311_ANNOTATIONS="JAXRSAnnotaion";
+
public static interface Configuration {
public static final String ENABLE_REST = "enableREST";
public static final String ENABLE_HTTP_CONTENT_NEGOTIATION = "httpContentNegotiation";
@@ -335,6 +336,7 @@
public static final String HTTP_METHOD_PUT = "PUT";
public static final String HTTP_METHOD = "HTTP_METHOD";
public static final String HTTP_METHOD_POST = "POST";
+ public static final String HTTP_METHOD_HEAD="HEAD";
public static final String CONTENT_TYPE = "ContentType";
@@ -428,7 +430,14 @@
public static final String GENERATE_ABSOLUTE_LOCATION_URIS = "generateAbsoluteLocationURIs";
-
-
+ /*
+ * These are the parameters introduced to Services XML in order flexible usage of REST support
+ * available in AXIS2
+ */
+ public static final String REST_LOCATION_PARAM="RESTLocation";
+ public static final String REST_METHOD_PARAM="RESTMethod";
+ public static final String REST_INPUTSERIALIZE_PARAM="RESTInputSerialization";
+ public static final String REST_OUTPUTSERIALIZE_PARAM="RESTOutputSerialization";
+
}
}
Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSModel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSModel.java?rev=745397&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSModel.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSModel.java Wed Feb 18 07:20:58 2009
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.JAXRS;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class JAXRSModel {
+
+ private String Path;
+
+ private String Produces;
+
+ private String Consumes;
+
+ private String HttpMethod;
+
+ private static Log log = LogFactory.getLog(JAXRSModel.class);
+ /*
+ *
+ * Setter methods
+ */
+ public void setPath(String path) {
+ this.Path = path;
+ }
+
+ public void setConsumes(String consumes) {
+ this.Consumes = consumes;
+ }
+
+ public void setProduces(String produces) {
+ this.Produces = produces;
+ }
+
+ public void setHTTPMethod(String httpmethod) {
+ this.HttpMethod = httpmethod;
+
+ }
+
+ /**
+ * getter methods
+ */
+ public String getPath() {
+
+ return ((this.Path != null) && (!this.Path.equals(""))) ? this.Path : null;
+ }
+
+ public String getConsumes() {
+ if((this.Consumes != null) && (!this.Consumes.equals(""))){
+ String[] array=this.Consumes.split(",");
+ if(array.length > 1) {
+ log.warn("WSDL2 supports only one input serialization-considering only the first one ");
+ return array[0];
+ } else{
+ return array[0];
+ }
+ }else{
+ return null;
+ }
+
+ }
+
+ public String getProduces() {
+ if((this.Produces != null) && (!this.Produces.equals(""))){
+ String[] array=this.Produces.split(",");
+ if(array.length > 1) {
+ log.warn("WSDL2 supports only one output-serialization");
+ return array[0];
+ } else{
+ return array[0];
+ }
+ }else{
+ return null;
+ }
+
+ }
+
+ public String getHTTPMethod() {
+ return ((this.HttpMethod != null) && (!this.HttpMethod.equals(""))) ? this.HttpMethod :
+ null;
+ }
+}
Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSUtils.java?rev=745397&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSUtils.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSUtils.java Wed Feb 18 07:20:58 2009
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.JAXRS;
+
+
+import org.apache.axis2.Constants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import java.lang.reflect.Method;
+import java.lang.annotation.Annotation;
+
+public class JAXRSUtils {
+ private static Log log = LogFactory.getLog(JAXRSModel.class);
+
+ public static JAXRSModel getClassModel(Class serviceClass) {
+ JAXRSModel model = new JAXRSModel();
+ Annotation[] annotation = serviceClass.getAnnotations();
+ for (Annotation a : annotation) {
+ if (a != null) {
+ if (a instanceof Produces) {
+ addProducesToClassModel((Produces) a, model);
+ } else if (a instanceof Consumes) {
+ addConsumesToClassModel((Consumes) a, model);
+ } else if (a instanceof Path) {
+ addPathToClassModel((Path) a, model);
+ } else {
+ System.out.println("Could not identify the Annotation....");
+ }
+
+ }
+
+ }
+
+ return model;
+ }
+
+ public static JAXRSModel getMethodModel(JAXRSModel classModel, Method serviceMethod) {
+ JAXRSModel model=new JAXRSModel();
+ addProducesToMethodModel(classModel,model);
+ addConsumesToMethodModel(classModel,model);
+ addPathToMethodModel(classModel,model);
+ Annotation[] annotation=serviceMethod.getAnnotations();
+ for(Annotation a:annotation){
+ if(a!=null){
+ if(a instanceof Produces){
+ addProducesToMethodModel((Produces)a,model);
+ }else if(a instanceof Consumes){
+ addConsumesToMethodModel((Consumes)a,model);
+ }else if(a instanceof Path){
+ addPathToMethodModel((Path)a,model);
+ } else{
+ addHTTPMethodToMethodModel(a,model);
+ }
+
+ }
+ }
+ return model;
+ }
+
+ private static void addProducesToClassModel(Produces produces, JAXRSModel classModel) {
+
+
+ String[] array = null;
+ String value = null;
+ array = produces.value();
+ for (String s : array) {
+ if (value == null) {
+ value = s;
+ } else {
+ value = value + "," + s;
+ }
+ }
+
+ classModel.setProduces(value);
+
+ }
+
+ private static void addConsumesToClassModel(Consumes consumes, JAXRSModel classModel) {
+
+
+ String[] array = null;
+ String value = null;
+ array = consumes.value();
+ for (String s : array) {
+ if (value == null) {
+ value = s;
+ } else {
+ value = value + "," + s;
+ }
+ }
+ classModel.setConsumes(value);
+
+ }
+
+
+ private static void addPathToClassModel(Path path, JAXRSModel classModel) {
+
+
+ String value = null;
+ value = path.value();
+ if(value!=null){
+ if(value.startsWith("/")){
+ value=value.substring(1);
+ }
+ if(value.endsWith("/")){
+ value= value.substring(0,(value.length()-1));
+ }
+ }
+
+ classModel.setPath(value);
+
+ }
+ private static void addProducesToMethodModel(Produces produces,JAXRSModel methodModel){
+
+ String value = null;
+ for (String s : produces.value()) {
+ if (value != null) {
+ value = value + s;
+ } else {
+ value = s;
+ }
+ methodModel.setProduces(value);
+ }
+
+ }
+
+ private static void addProducesToMethodModel(JAXRSModel classModel,JAXRSModel methodModel){
+ String value=classModel.getProduces();
+ if(value!=null){
+ methodModel.setProduces(value);
+ }
+ }
+ private static void addConsumesToMethodModel(Consumes consumes,JAXRSModel methodModel){
+ String value = null;
+ for (String s : consumes.value()) {
+ if (value != null) {
+ value = value + s;
+ } else {
+ value = s;
+ }
+ methodModel.setProduces(value);
+ }
+
+ }
+
+ private static void addConsumesToMethodModel(JAXRSModel classModel,JAXRSModel methodModel){
+ String value=classModel.getConsumes();
+ if(value!=null){
+ methodModel.setConsumes(value);
+ }
+ }
+
+ private static void addHTTPMethodToMethodModel(Annotation annotation,JAXRSModel methodModel){
+
+
+ if (annotation instanceof POST) {
+ methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_POST);
+ } else if (annotation instanceof GET) {
+ methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_GET);
+ } else if (annotation instanceof PUT) {
+ methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_PUT);
+ } else if (annotation instanceof DELETE) {
+ methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_DELETE);
+ } else if (annotation instanceof HEAD) {
+ log.warn("HTTP Method HEAD is not supported by AXIS2");
+ }
+
+ }
+
+ private static void addPathToMethodModel(Path path,JAXRSModel methodModel){
+ String value = path.value();
+ if(value!=null){
+ if(value.startsWith("/")){
+ value=value.substring(1);
+ }
+ if(value.endsWith("/")){
+ value= value.substring(0,(value.length()-1));
+ }
+ }
+ if (methodModel.getPath()!=null ) {
+
+ methodModel.setPath(methodModel.getPath() +"/"+ value);
+ } else{
+
+ methodModel.setPath(value);
+ }
+ }
+
+ private static void addPathToMethodModel(JAXRSModel classModel,JAXRSModel methodModel){
+ String value=classModel.getPath();
+ if(value!=null){
+ methodModel.setPath(value);
+ }
+ }
+
+}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?rev=745397&r1=745396&r2=745397&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Wed Feb 18 07:20:58 2009
@@ -27,6 +27,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.classloader.JarFileClassLoader;
import org.apache.axis2.Constants;
+import org.apache.axis2.JAXRS.JAXRSModel;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.DeploymentClassLoader;
import org.apache.axis2.deployment.DeploymentConstants;
@@ -222,7 +223,7 @@
byte data[] = new byte[2048];
int count;
File f = TempFileManager.createTempFile("axis2", suffix);
-
+
// if (tmpDir == null) {
// String directory = (String)org.apache.axis2.java.security.AccessController
// .doPrivileged(new PrivilegedAction() {
@@ -370,7 +371,7 @@
}
return useJarFileClassLoader;
}
-
+
private static boolean addFiles(ArrayList urls, final File libfiles)
throws MalformedURLException {
Boolean exists = (Boolean)org.apache.axis2.java.security.AccessController
@@ -1404,6 +1405,13 @@
axisBinding.setType(WSDL2Constants.URI_WSDL2_HTTP);
axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_METHOD, "POST");
+
+ Map httpLocationMap = new TreeMap<String, AxisOperation>(new Comparator() {
+ public int compare(Object o1, Object o2) {
+ return (-1 * ((Comparable) o1).compareTo(o2));
+ }
+ });
+
for (Iterator iterator = axisService.getChildren(); iterator
.hasNext();) {
AxisOperation operation = (AxisOperation)iterator.next();
@@ -1413,13 +1421,116 @@
axisBindingOperation.setName(operationQName);
axisBindingOperation.setAxisOperation(operation);
String httpLocation = operationQName.getLocalPart();
- axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocation);
+ String tempParam=null;
+ String tempHTTPMethodParam=null;
+ String tempHTTPLocationParam=null;
+ // dealing with the REST data specified in Service.xml @ service class itself(using annotations)
+ Parameter parameter = operation.getParameter(Constants.JSR311_ANNOTATIONS);
+ JAXRSModel methodModel = (parameter != null && (parameter.getValue() instanceof
+ JAXRSModel)) ? (JAXRSModel) parameter.getValue() : null;
+
+ // Setting the Produces value in the operation
+ if ( (tempParam=Utils.getHTTPOutputSerializationFromservicesXML(operation)) != null) { // first we get produce from services xml if available
+
+ axisBindingOperation.setProperty(
+ WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION,
+ tempParam);
+
+
+ } else if (methodModel != null && methodModel.getProduces() !=
+ null) { // then get it from the JAX-RS if available
+ axisBindingOperation.setProperty(
+ WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION,
+ methodModel.getProduces());
+
+ }
+
+ //Setting the Consumes value in the operation
+ if ((tempParam=Utils.getHTTPInputSerializationFromServicesXML(operation)) != null) { // first we get Consumes from services xml if available
+ axisBindingOperation.setProperty(
+ WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION,
+ tempParam);
+
+ } else if (methodModel != null && methodModel.getConsumes() !=
+ null) { // then get it from the JAX-RS if available
+
+ axisBindingOperation.setProperty(
+ WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION,
+ methodModel.getConsumes());
+
+ }
+
+
+
+ //Setting the HttpMethod in the operation
+ if ((tempHTTPMethodParam=Utils.getHTTPMethodFromServicesXML(operation))!=null) { // first we get Consumes from services xml if available
+
+ axisBindingOperation.setProperty(
+ WSDL2Constants.ATTR_WHTTP_METHOD,
+ tempHTTPMethodParam);
+
+ } else if (methodModel != null && (tempHTTPMethodParam=methodModel.getHTTPMethod()) !=
+ null) { // then get it from the JAX-RS if available
+
+ if (tempHTTPMethodParam.equals(Constants.Configuration.HTTP_METHOD_HEAD)) {
+ log.warn("[JAXRS] http method HEAD is not supported by AXIS2 " +
+ operation.getName());
+ tempHTTPMethodParam=null; // resetting the HTTP Method if it is head
+ } else {
+
+ axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_METHOD,
+ tempHTTPMethodParam);
+ }
+
+ }
+
+
+
+ //setting the Http Location in the operation
+ if((tempHTTPLocationParam=Utils.getHTTPLoacationFromServicesXML(operation) )==null){
+ tempHTTPLocationParam=(methodModel!=null)?methodModel.getPath():null;
+ }
+
+
+ if (tempHTTPLocationParam!=null && tempHTTPMethodParam != null ){
+ axisBindingOperation
+ .setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, tempHTTPLocationParam);
+ httpLocationMap.put(WSDLUtil.getConstantFromHTTPLocation(tempHTTPLocationParam,
+ tempHTTPMethodParam),operation);
+
+ }else if(tempHTTPLocationParam != null && tempHTTPMethodParam == null){
+ axisBindingOperation
+ .setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, tempHTTPLocationParam);
+ httpLocationMap.put(WSDLUtil.getConstantFromHTTPLocation(tempHTTPLocationParam,
+ Constants.Configuration.HTTP_METHOD_POST),operation);
+ } else if(tempHTTPLocationParam == null && tempHTTPMethodParam != null){
+ axisBindingOperation
+ .setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocation);
+ httpLocationMap.put(WSDLUtil.getConstantFromHTTPLocation(httpLocation,
+ tempHTTPMethodParam),operation);
+ } else{ // default scenario : No REST related params in services XML or source file
+ axisBindingOperation
+ .setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocation);
+ }
+
+
axisBinding.addChild(axisBindingOperation.getName(),
axisBindingOperation);
populateBindingOperation(axisBinding,
axisBindingOperation);
+
+ // resetting my temperory parameters
+ tempParam=null;
+ tempHTTPMethodParam=null;
+ tempHTTPLocationParam=null;
+
}
+
+ if (!httpLocationMap.isEmpty()) {
+ axisBinding.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE, httpLocationMap);
+ }
+
if (bindingCache != null) {
bindingCache.put(name, axisBinding);
}
@@ -1635,4 +1746,96 @@
}
return null;
}
+
+
+ // here we are trying to validate the param and return it as a trimmed String.
+ public static String getHTTPLoacationFromServicesXML(AxisOperation operation) {
+
+ Parameter locationParam = operation.getParameter(Constants.Configuration.REST_LOCATION_PARAM);
+ if (locationParam != null && locationParam.getValue() != null &&
+ locationParam.getValue() instanceof String) {
+ String location = ((String) locationParam.getValue()).trim();
+ if (location.equals("")) {
+ return null;
+ } else{
+ if(location.startsWith("/")){
+ location= location.substring(1);
+ }
+
+ return location;
+
+ }
+ } else
+ return null;
+
+ }
+
+ public static String getHTTPMethodFromServicesXML(AxisOperation operation) {
+ Parameter methodParam = operation.getParameter(Constants.Configuration.REST_METHOD_PARAM);
+ if (methodParam != null && methodParam.getValue() != null &&
+ methodParam.getValue() instanceof String) {
+ String method = ((String) methodParam.getValue()).trim();
+ if (method.equals("")) {
+ return null;
+ } else if (method.equals(Constants.Configuration.HTTP_METHOD_GET) || method.equals(Constants.Configuration.HTTP_METHOD_POST) ||
+ method.equals(Constants.Configuration.HTTP_METHOD_PUT) || method.equals(Constants.Configuration.HTTP_METHOD_DELETE)) {
+ return method;
+ } else if (method.equals(Constants.Configuration.HTTP_METHOD_HEAD)) {
+ log.warn("Axis2 doesn't support httpMethod HEAD ");
+ return null;
+ } else {
+ log.warn("cannot identify the HTTP method");
+ return null;
+ }
+ } else
+ return null;
+ }
+
+ public static String getHTTPInputSerializationFromServicesXML(AxisOperation operation) {
+ Parameter inputSerializationParam = operation.getParameter(Constants.Configuration.REST_INPUTSERIALIZE_PARAM);
+ if (inputSerializationParam != null && inputSerializationParam.getValue() != null
+ && inputSerializationParam.getValue() instanceof String) {
+ String inputSerialization = ((String) inputSerializationParam.getValue()).trim();
+
+ if (inputSerialization.equals("")) {
+ return null;
+ } else {
+ String[] array = inputSerialization.split(",");
+ if (array.length > 1) {
+ log.warn("WSDL2 supports only one input-serialization");
+ return array[0];
+ } else {
+ return array[0];
+ }
+ }
+
+ } else
+ return null;
+
+
+ }
+
+ public static String getHTTPOutputSerializationFromservicesXML(AxisOperation operation) {
+ Parameter outputSerializationParam = operation.getParameter(Constants.Configuration.REST_OUTPUTSERIALIZE_PARAM);
+ if (outputSerializationParam != null && outputSerializationParam.getValue() != null
+ && outputSerializationParam.getValue() instanceof String) {
+ String outputSerialization = ((String) outputSerializationParam.getValue()).trim();
+
+ if (outputSerialization.equals("")) {
+ return null;
+ } else {
+ String[] array = outputSerialization.split(",");
+ if (array.length > 1) {
+ log.warn("WSDL2 supports only one input-serialization");
+ return array[0];
+ } else {
+ return array[0];
+ }
+ }
+ } else
+ return null;
+
+ }
+
+
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=745397&r1=745396&r2=745397&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Wed Feb 18 07:20:58 2009
@@ -20,6 +20,8 @@
package org.apache.axis2.description.java2wsdl;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.JAXRS.JAXRSUtils;
+import org.apache.axis2.JAXRS.JAXRSModel;
import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.deployment.util.BeanExcludeInfo;
import org.apache.axis2.deployment.util.Utils;
@@ -57,6 +59,8 @@
private static int prefixCount = 1;
+ private JAXRSModel classModel;
+
protected Map targetNamespacePrefixMap = new Hashtable();
protected Map schemaMap = new Hashtable();
@@ -249,6 +253,7 @@
}
service.setName(Utils.getAnnotatedServiceName(serviceClass, webervice));
}
+ classModel= JAXRSUtils.getClassModel(serviceClass);
methods = processMethods(serviceClass.getDeclaredMethods());
return schemaMap.values();
}
@@ -302,6 +307,10 @@
// }
addToService = true;
}
+// by now axis operation should be assigned but we better recheck & add the paramether
+ if(axisOperation != null){
+ axisOperation.addParameter("JAXRSAnnotaion", JAXRSUtils.getMethodModel(this.classModel,jMethod));
+ }
// Maintain a list of methods we actually work with
list.add(jMethod);
@@ -1235,7 +1244,7 @@
String parameterName = null;
if (parameterAnnotation.length > 0) {
Annotation[] tempAnnon = parameterAnnotation[j];
- if (tempAnnon.length > 0) {
+ if ((tempAnnon.length > 0) && (tempAnnon[0] instanceof WebParam)) {
WebParam para = (WebParam) tempAnnon[0];
if (para != null) {
parameterName = para.name();
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java?rev=745397&r1=745396&r2=745397&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java Wed Feb 18 07:20:58 2009
@@ -60,6 +60,9 @@
if (httpLocation != null) {
httpLocation = httpMethod + httpLocation;
+ if(! httpLocation.endsWith("/")){
+ httpLocation=httpLocation.concat("/");
+ }
AxisEndpoint axisEndpoint = (AxisEndpoint) messageContext
.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
// Here we check whether the request was dispatched to the correct endpoint. If it
Modified: webservices/axis2/trunk/java/modules/osgi/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/pom.xml?rev=745397&r1=745396&r2=745397&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/osgi/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/osgi/pom.xml Wed Feb 18 07:20:58 2009
@@ -64,6 +64,7 @@
<Import-Package>
!javax.xml.namespace,
!org.apache.axis2.*,
+ javax.ws.rs; version=1.0,
javax.xml.namespace; version=0.0.0,
javax.servlet; version=2.4.0,
javax.servlet.http; version=2.4.0,
Modified: webservices/axis2/trunk/java/modules/parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/parent/pom.xml?rev=745397&r1=745396&r2=745397&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/parent/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/parent/pom.xml Wed Feb 18 07:20:58 2009
@@ -1024,11 +1024,15 @@
<version>${geronimo-spec.jta.version}</version>
</dependency>
-
</dependencies>
</dependencyManagement>
<!-- Top level dependencies that will be needed in all sub mvn modules -->
<dependencies>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.0</version>
+ </dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>