2 Replies Latest reply on Dec 21, 2009 12:14 PM by Bharat Joshi

    Need help adding an Annotated field.

    Bharat Joshi Newbie

      Hi,

       

      I am trying to utilize Javassist to add an annotated field to my class. The snippet of what I am trying to accomplish is listed below.

       

       

      //I am trying to add the line below as a new field.

      @Context HttpServletRequest request;

       

      @POST
      @Path("restMethod")
      public String testMethod()
      {
          //request should be injected with information needed by

          //the container at this point.

       

          String remoteAddr = request.getRemoteAddr();
          return remoteAddr;
      }

       

       

      Basically I am trying to get an existing function that uses JSR 311 Jersey and add a new @Context field

      so that the container will inject HttpServletRequest, which I can use by instrumenting the testMethod function.

       

      Thanks in advance for your help.

       

      Sincerely,

       

      Bharat Joshi