I've faced with problem when I'm trying to call service method and check before that some condition
@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);
}
}
In class MyClass1 and MyClass2 I have next method signature
public static Response process(@Context HttpServletRequest request, @FormParam("text") final String text) throws JSONException, IOException
I get not found response on calling this method service, and even row with * comment wasn't printed.
How I can resolve this problem?