Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Apache Wink 1.2.1条件调用服务方法_Java_Web Services_Rest_Apache Wink - Fatal编程技术网

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类已注册。