当我尝试调用服务方法并在此之前检查某些条件时,我遇到了问题
@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
我没有找到调用此方法服务的响应,甚至没有打印带有 * 注释的行。
我该如何解决这个问题?