Author: nthaker
Date: Fri Aug 20 18:32:09 2010
New Revision: 987597
URL: http://svn.apache.org/viewvc?rev=987597&view=rev
Log:
This change restrict exposure of static methods as webservice operations when
legacy webmethod is turned on and jaxws.runtime.restrictStaticWebmethod system
property is set.
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/LegacyMethodRetrieverImpl.java
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java?rev=987597&r1=987596&r2=987597&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
Fri Aug 20 18:32:09 2010
@@ -692,4 +692,31 @@ public class DescriptionUtils {
return "Cannot dump DescriptionBuilderComposite due to : " + t;
}
}
+
+ /**
+ * Utility method for converting a String value into a boolean.
+ * Case-insensitive forms of true, yes, and 1 correspond to true.
+ * Case-insensitive forms of false, no, and 0 correspond to false.
+ * Anything else will result in a false being returned.
+ *
+ * @param value
+ * the property's value
+ * @return
+ * true or false or null if neither
+ */
+ public static Boolean getBooleanValue(String value) {
+ Boolean b = null;
+
+ if (value.equalsIgnoreCase("true") ||
+ value.equalsIgnoreCase("yes") ||
+ value.equals("1")) {
+ b = Boolean.TRUE;
+ } else if (value.equalsIgnoreCase("false") ||
+ value.equalsIgnoreCase("no") ||
+ value.equals("0")) {
+ b = Boolean.FALSE;
+ }
+ // Anything else will result in false
+ return b;
+ }
}
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/LegacyMethodRetrieverImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/LegacyMethodRetrieverImpl.java?rev=987597&r1=987596&r2=987597&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/LegacyMethodRetrieverImpl.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/LegacyMethodRetrieverImpl.java
Fri Aug 20 18:32:09 2010
@@ -19,6 +19,8 @@
package org.apache.axis2.jaxws.description.impl;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.MethodRetriever;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
@@ -151,7 +153,8 @@ public class LegacyMethodRetrieverImpl e
*/
private ArrayList<MethodDescriptionComposite> retrieveImplicitSEIMethods(
DescriptionBuilderComposite dbc) {
-
+ final String restrictStaticWebmethod =
"jaxws.runtime.restrictStaticWebmethod";
+
ArrayList<MethodDescriptionComposite> retrieveList =
new ArrayList<MethodDescriptionComposite>();
@@ -164,20 +167,36 @@ public class LegacyMethodRetrieverImpl e
if (retrieveList == null || retrieveList.size() == 0) {
Iterator<MethodDescriptionComposite> iter = null;
List<MethodDescriptionComposite> mdcList =
dbc.getMethodDescriptionsList();
-
+ AxisConfiguration ac =
eid.getEndpointDescription().getServiceDescription().getAxisConfigContext().getAxisConfiguration();
+ Parameter p =ac.getParameter(restrictStaticWebmethod);
+
+ Boolean isRestrictStaticOperation=Boolean.FALSE;
+ if(p!=null){
+ isRestrictStaticOperation =
DescriptionUtils.getBooleanValue((String)p.getValue());
+ if(log.isDebugEnabled()){
+ log.debug("System property
jaxws.runtime.restrictStaticWebmethod is set to :"+isRestrictStaticOperation);
+ }
+ }
if (mdcList != null) {
iter = dbc.getMethodDescriptionsList().iterator();
while (iter.hasNext()) {
MethodDescriptionComposite mdc = iter.next();
-
- if (!DescriptionUtils.isExcludeTrue(mdc)) {
- mdc.setDeclaringClass(dbc.getClassName());
- retrieveList.add(mdc);
+ if(isRestrictStaticOperation){
+ //all operation with legacy jaxws tooling excluding
static operations will be exposed.
+ if (!mdc.isStatic() &&
!DescriptionUtils.isExcludeTrue(mdc)) {
+ mdc.setDeclaringClass(dbc.getClassName());
+ retrieveList.add(mdc);
+ }
+ }else{
+ //all operation with legacy jaxws tooling including
static operations will be exposed.
+ if (!DescriptionUtils.isExcludeTrue(mdc)) {
+ mdc.setDeclaringClass(dbc.getClassName());
+ retrieveList.add(mdc);
+ }
}
}
}
}
-
return retrieveList;
}