【发布时间】:2015-06-16 19:39:29
【问题描述】:
在使用 jaxrs 插件开发其余 api 时,我需要创建一些我在“src/groovy”中创建的通用类。下面是类
class ValidateToken {
String validate(String token){
println(token)
return "test"
}
//...
在资源文件(jaxrs)中,这就是我正在做的事情
def instance=ValidateToken.validate("test")
这会在运行时引发错误
The RuntimeException could not be mapped to a response, re- throwing to the HTTP container
Message: No signature of method: static com.dogmasystems.touroperatorportal.Vali
dateToken.validate() is applicable for argument types: () values: []
Possible solutions: validate(java.lang.String), wait()
我无法理解为什么会这样?虽然我正在发送一个字符串值,但它是作为一个列表发送的。此外,如果该方法被复制到同一个资源文件,那么它可以正常工作并将传递的参数视为字符串。
另外请让我知道将用于不同 Jax-RS 资源的通用类/代码保存在哪里。
谢谢。
【问题讨论】: