Java Apache Wink 1.2.1条件调用服务方法
当我试图调用服务方法并在某个条件出现之前进行检查时,我遇到了一个问题Java Apache Wink 1.2.1条件调用服务方法,java,web-services,rest,apache-wink,Java,Web Services,Rest,Apache Wink,当我试图调用服务方法并在某个条件出现之前进行检查时,我遇到了一个问题 @Path("service") public class MyService { @POST @Path("process") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.TEXT_PLAIN) public static Response process(@Context HttpServ
@Path("service")
public class MyService {
@POST
@Path("process")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.TEXT_PLAIN)
public static Response process(@Context HttpServletRequest request, @FormParam("text") final String text) throws JSONException, IOException {
boolean someCondition = true; // for example
System.out.println("I'm here"); //*
if (!someCondition) {
return MyClass1.process(request, text);
} else {
return MyClass2.process(request, text);
}
}
在MyClass1和MyClass2类中,我有下一个方法签名
public static Response process(@Context HttpServletRequest request, @FormParam("text") final String text) throws JSONException, IOException
调用此方法服务时,我没有得到响应,甚至没有打印带有*注释的行
如何解决这个问题?我犯了一个非常愚蠢的错误静态方法:
public static Response process(@Context HttpServletRequest request, @FormParam("text") final String text) throws JSONException, IOException {
您的服务可能尚未注册。您需要在启动服务器时检查日志,以确保您的MyService类已注册。