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/27 10:05:12 UTC
svn commit: r748447 [2/2] - in /webservices/axis2/trunk/java/modules:
integration/ integration/test-resources/jaxrs/
integration/test-resources/jaxrs/archiveTestModule/
integration/test-resources/jaxrs/archiveTestModule/META-INF/
integration/test-resou...
Modified: 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=748447&r1=748446&r2=748447&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSUtils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSUtils.java Fri Feb 27 09:05:11 2009
@@ -38,6 +38,13 @@
public class JAXRSUtils {
private static Log log = LogFactory.getLog(JAXRSModel.class);
+
+
+ /**
+ * returns a jaxrs class model reading class level annotation given the service class
+ * @param serviceClass
+ * @return
+ */
public static JAXRSModel getClassModel(Class serviceClass) {
JAXRSModel model = new JAXRSModel();
Annotation[] annotation = serviceClass.getAnnotations();
@@ -60,6 +67,14 @@
return model;
}
+
+ /**
+ * given a jaxrs class model & java method , construct a jaxrs model associated with
+ * method , reading the method level annotations.
+ * @param classModel
+ * @param serviceMethod
+ * @return
+ */
public static JAXRSModel getMethodModel(JAXRSModel classModel, Method serviceMethod) {
JAXRSModel model=new JAXRSModel();
addProducesToMethodModel(classModel,model);
@@ -83,6 +98,13 @@
return model;
}
+
+ /**
+ * add value of the produces annotation to the given jaxrs-class model.method breaks the
+ * input String & convert it to a String[] before adding.
+ * @param produces
+ * @param classModel
+ */
private static void addProducesToClassModel(Produces produces, JAXRSModel classModel) {
@@ -101,6 +123,13 @@
}
+
+ /**
+ * add value of the consumes annotaiton to the given jaxrs-class model. breaks the input String
+ * & convert it to a string[] before adding.
+ * @param consumes
+ * @param classModel
+ */
private static void addConsumesToClassModel(Consumes consumes, JAXRSModel classModel) {
@@ -119,6 +148,11 @@
}
+ /**
+ * adding value of the path annotation to the class model
+ * @param path
+ * @param classModel
+ */
private static void addPathToClassModel(Path path, JAXRSModel classModel) {
@@ -156,6 +190,9 @@
methodModel.setProduces(value);
}
}
+
+
+
private static void addConsumesToMethodModel(Consumes consumes,JAXRSModel methodModel){
String value = null;
for (String s : consumes.value()) {
@@ -164,11 +201,18 @@
} else {
value = s;
}
- methodModel.setProduces(value);
+ methodModel.setConsumes(value);
}
}
+
+
+ /**
+ * copies class level Consumes value to method level model
+ * @param classModel
+ * @param methodModel
+ */
private static void addConsumesToMethodModel(JAXRSModel classModel,JAXRSModel methodModel){
String value=classModel.getConsumes();
if(value!=null){
@@ -176,6 +220,14 @@
}
}
+
+ /**
+ * add value of the HTTPMethod to the jaxrs-method model. axis2 only supports POST,GET,PUT,DELETE.
+ * it doesnt support HEAD. if HEAD is given it resolves to the default method (POST)
+ * @param annotation
+ * @param methodModel
+ */
+
private static void addHTTPMethodToMethodModel(Annotation annotation,JAXRSModel methodModel){
@@ -193,6 +245,12 @@
}
+ /**
+ * add http location to jaxrs method model. if service level location is already available
+ * it concatanates two.
+ * @param path
+ * @param methodModel
+ */
private static void addPathToMethodModel(Path path,JAXRSModel methodModel){
String value = path.value();
if(value!=null){
@@ -212,6 +270,12 @@
}
}
+
+ /**
+ * this copies the class service level path to method level
+ * @param classModel
+ * @param methodModel
+ */
private static void addPathToMethodModel(JAXRSModel classModel,JAXRSModel methodModel){
String value=classModel.getPath();
if(value!=null){
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=748447&r1=748446&r2=748447&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 Fri Feb 27 09:05:11 2009
@@ -1748,7 +1748,11 @@
}
- // here we are trying to validate the param and return it as a trimmed String.
+ /**
+ * extract the http location from services xml related to given operation
+ * @param operation
+ * @return
+ */
public static String getHTTPLoacationFromServicesXML(AxisOperation operation) {
Parameter locationParam = operation.getParameter(Constants.Configuration.REST_LOCATION_PARAM);
@@ -1770,6 +1774,11 @@
}
+ /**
+ * extract the http method from services xml related to given operation
+ * @param operation
+ * @return
+ */
public static String getHTTPMethodFromServicesXML(AxisOperation operation) {
Parameter methodParam = operation.getParameter(Constants.Configuration.REST_METHOD_PARAM);
if (methodParam != null && methodParam.getValue() != null &&
@@ -1791,6 +1800,11 @@
return null;
}
+ /**
+ * get http input mime type from the services xml
+ * @param operation
+ * @return
+ */
public static String getHTTPInputSerializationFromServicesXML(AxisOperation operation) {
Parameter inputSerializationParam = operation.getParameter(Constants.Configuration.REST_INPUTSERIALIZE_PARAM);
if (inputSerializationParam != null && inputSerializationParam.getValue() != null
@@ -1815,6 +1829,11 @@
}
+ /**
+ * get http output mime type from the services xml
+ * @param operation
+ * @return
+ */
public static String getHTTPOutputSerializationFromservicesXML(AxisOperation operation) {
Parameter outputSerializationParam = operation.getParameter(Constants.Configuration.REST_OUTPUTSERIALIZE_PARAM);
if (outputSerializationParam != null && outputSerializationParam.getValue() != null