title: Jersey async request handling with programmatical resource registration
body: <p>We used 
  <code>org.glassfish.jersey.server.model.ResourceMethod$Builder</code></p>
  
  <p>to register the method and the handler.</p>
  
  <pre><code>ResourceMethod.Builder methodBuilder = resourceBuilder.addMethod(httpMethod);
  methodBuilder.produces(restContext.getProduceContent()).handledBy(inflector);
  methodBuilder.consumes(restContext.getConsumeContent()).handledBy(inflector);
  </code></pre>
  
  <p>The handler class implements the <code>org.glassfish.jersey.process.Inflector&lt;ContainerRequestContext, Response&gt;</code></p>
  
  <pre><code>public class CommonMethodInflector implements Inflector&lt;ContainerRequestContext, Response&gt;
  {
   @Override
      public Response apply(ContainerRequestContext request)
      {
        //sync bloc
        //using resqest object we do processing in different maner
          incRestFeRequestCounters(request.getMethod());
          Response response = processIncoming(request);`enter code here`
       }
  }
  </code></pre>
  
  <p>Could you please help us in creating the async handler.</p>
  
  <p>our requirement in short:</p>
  
  <ol>
  <li><p>At runtime only we know the http method and other resources to register.
  So, we can not use annotations for resource &amp; httpMethod registration.
  We need only programmatic resource registration.</p></li>
  <li><p>In handler We need the request object so that we can access what method and what json body in it.</p></li>
  <li><p>we need to make the async response as we are doing huge operation in the processing request. </p></li>
  </ol>