Hi,
I read http://docs.huihoo.com/apache/cxf/2.2.4/jax-rs.html here (under the
"Dealing With Parameters" section) that you can use types like the following
as parameters in a JAX-RS method...
public class SomeClass {
public static SomeClass valueOf(String str) {
SomeClass someClass = new SomeClass();
. . .
return someClass;
}
}
For example...
public class MyService implements MyServiceImpl {
public void doSomething(SomeClass somethingToDo) {
. . .
}
}
I can call this fine - the "valueOf" method gets called and the desired
object is passed in to the service method.
However, when I generate the WADL for such a service, it does not list my
"somethingToDo" parameter in the "<request>" section.
I traced through the WadlGenerator code and it appears that this case is not
being caught...
(line 455)
private void doWriteBeanParam(StringBuilder sb, Class<?> type, Parameter
pm, String parentName) {
Map<Parameter, Class<?>> pms =
InjectionUtils.getParametersFromBeanClass(type, pm.getType(), true);
for (Map.Entry<Parameter, Class<?>> entry : pms.entrySet()) {
String name = entry.getKey().getName();
if (parentName != null) {
name = parentName + "." + name;
}
if (*InjectionUtils.isPrimitive(entry.getValue())*) {
doWriteParam(sb, entry.getKey(), entry.getValue(), name, new
Annotation[]{});
} else {
doWriteBeanParam(sb, entry.getValue(), entry.getKey(),
name);
}
}
}
It seems to me that this method should treat the parameter type as a string
primitive if it has such a method.
As all of these methods are marked as private, I cannot override this
behaviour to fix the problem.
Has anyone else found another way around this?
I may resort to copying the entire class and making this modification
myself.
Thanks in advance
--
View this message in context:
http://cxf.547215.n5.nabble.com/WADL-Generation-Misses-parameters-of-Bean-types-that-have-a-static-valueOf-String-tp5553328p5553328.html
Sent from the cxf-user mailing list archive at Nabble.com.