Package javax.ws.rs.container

Examples of javax.ws.rs.container.AsyncResponse


   }

   @GET
   @Path("resumeruntime")
   public String resumeWithRuntimeException(@QueryParam("stage") String stage) {
      AsyncResponse async = takeAsyncResponse(stage);
      boolean b = async.resume(new RuntimeException(RESUMED));
      addResponse(async, stage);
      return b ? TRUE : FALSE;
   }
View Full Code Here


   }

   @POST
   @Path("settimeout")
   public void setTimeOut(@QueryParam("stage") String stage, String milis) {
      AsyncResponse async = takeAsyncResponse(stage);
      async.setTimeout(Long.parseLong(milis), TimeUnit.MILLISECONDS);
      addResponse(async, stage);
   }
View Full Code Here

   @POST
   @Path("timeouthandler")
   public void setTimeoutHandler(@QueryParam("stage") String stage, int handlerValue){
      MyTimeoutHandler handler = new MyTimeoutHandler(handlerValue);
      AsyncResponse async = takeAsyncResponse(stage);
      async.setTimeoutHandler(handler);
      async.setTimeout(200L, TimeUnit.MILLISECONDS);
      addResponse(async, stage);
   }
View Full Code Here

      return takeAsyncResponse(Integer.parseInt(stageId));
   }

   protected static AsyncResponse takeAsyncResponse(int stageId) {
      final ResponseBuilder error = createErrorResponseBuilder();
      AsyncResponse asyncResponse = null;
      try {
         asyncResponse = stage[stageId].take();
      } catch (InterruptedException e) {
         throw new WebApplicationException(error.entity(
                 "ArrayBlockingQueue#take").build());
View Full Code Here

   @GET
   @Path("cancelvoid")
   public String cancel(@QueryParam("stage") String stage)
   {
      AsyncResponse response = takeAsyncResponse(stage);
      boolean ret = response.cancel();
      System.out.println("*** response.cancel() 1 " + ret);
      // Invoking a cancel(...) method multiple times to cancel request
      // processing has the same effect as canceling the request processing
      // only once.
      ret &= response.cancel();
      System.out.println("*** response.cancel() 2 " + ret);
      addResponse(response, stage);
      return ret ? TRUE : FALSE;
   }
View Full Code Here

   @POST
   @Path("cancelretry")
   public String cancelretry(@QueryParam("stage") String stage,
                             String sRetryAfter)
   {
      AsyncResponse response = takeAsyncResponse(stage);
      int retryAfter = Integer.parseInt(sRetryAfter);
      boolean b = response.cancel(retryAfter);
      // Invoking a cancel(...) method multiple times to cancel request
      // processing has the same effect as canceling the request processing
      // only once.
      b &= response.cancel(retryAfter * 2);
      addResponse(response, stage);
      return b ? TRUE : FALSE;
   }
View Full Code Here

   @POST
   @Path("canceldate")
   public String cancelDate(@QueryParam("stage") String stage, String sRetryAfter)
   {
      AsyncResponse response = takeAsyncResponse(stage);
      long retryAfter = Long.parseLong(sRetryAfter);
      boolean b = response.cancel(new Date(retryAfter));
      // Invoking a cancel(...) method multiple times to cancel request
      // processing has the same effect as canceling the request processing
      // only once.
      b &= response.cancel(new Date(retryAfter + 20000));
      addResponse(response, stage);
      return b ? TRUE : FALSE;
   }
View Full Code Here

   @GET
   @Path("iscanceled")
   public String isCanceled(@QueryParam("stage") String stage)
   {
      AsyncResponse response = takeAsyncResponse(stage);
      boolean is = response.isCancelled();
      addResponse(response, stage);
      return is ? TRUE : FALSE;
   }
View Full Code Here

   @GET
   @Path("isdone")
   public String isDone(@QueryParam("stage") String stage)
   {
      AsyncResponse response = takeAsyncResponse(stage);
      boolean is = response.isDone();
      addResponse(response, stage);
      return is ? TRUE : FALSE;
   }
View Full Code Here

   @GET
   @Path("issuspended")
   public String isSuspended(@QueryParam("stage") String stage)
   {
      AsyncResponse response = takeAsyncResponse(stage);
      boolean is = response.isSuspended();
      addResponse(response, stage);
      return is ? TRUE : FALSE;
   }
View Full Code Here

TOP

Related Classes of javax.ws.rs.container.AsyncResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.