0

サービスメソッドを呼び出して、その前にいくつかの条件を確認しようとしているときに問題に直面しました

@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 

このメソッド サービスを呼び出すと応答が見つからず、* コメントの行でさえ出力されませんでした。

この問題を解決するにはどうすればよいですか?

4

1 に答える 1

0

私は非常に愚かな間違いを犯しました静的メソッド:

 public static Response process(@Context HttpServletRequest request, @FormParam("text") final String text) throws JSONException, IOException {
于 2014-02-18T09:48:59.520 に答える