我有它的方法看起来像球衣Web服务方法无法识别为有效的资源方法
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getString(@QueryParam("path") path) {
return "got the string " + path
}
当我运行此我得到一个错误信息
SEVERE: Missing dependency for method public java.lang.String com.example.getString(java.lang.Object) at parameter at index 0
SEVERE: Method, public java.lang.String com.example.getString(java.lang.Object), annotated with GET of resource, class com.example.MyServiceClass, is not recognized as valid resource method.
这是什么错误消息的Web服务意思?如果我没有参数运行服务,那么它就可以工作。
你有'@ Path'注释吗? – Srinivas
我在课堂上有'@ Path'作为一个整体。如果服务中只有一个“@ GET”方法,我是否也需要使用单个方法? –
你能说出你使用的@Path是什么吗?确保@Path(“/ url/{path}”)是这种形式。 – Srinivas