Package javax.ws.rs.container

Examples of javax.ws.rs.container.AsyncResponse


   }

   @GET
   @Path("registerclassesthrows2")
   public String registerClassesThrowsNpe2(@QueryParam("stage") String stage) {
      AsyncResponse async = takeAsyncResponse(stage);
      try {
         Class<SecondSettingCompletionCallback> callback = null;
         async.register(SettingCompletionCallback.class, callback);
      } catch (NullPointerException e) {
         return TRUE;
      } catch (Exception e) {
         return "Threw " + e.getClass().getName();
      }
View Full Code Here


   @GET
   @Path("exception")
   public String throwExceptionOnAsyncResponse(
           @QueryParam("stage") String stage) {
      System.out.println("********throwExceptionOnAsyncResponse");
      AsyncResponse async = takeAsyncResponse(stage);
      System.out.println("*****async is not null: " + async);
      boolean b = async.resume(new ExceptionThrowingStringBean(
              "throw exception"));
      addResponse(async, stage);
      return b ? TRUE : FALSE;
   }
View Full Code Here

   }

   @GET
   @Path("cancelvoid")
   public String cancel(@QueryParam("stage") String stage) {
      AsyncResponse response = takeAsyncResponse(stage);
      boolean ret = response.cancel();
      // Invoking a cancel(...) method multiple times to cancel request
      // processing has the same effect as canceling the request processing
      // only once.
      ret &= response.cancel();
      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));
      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

   }

   @POST
   @Path("resume")
   public String resume(@QueryParam("stage") String stage, String response) {
      AsyncResponse async = takeAsyncResponse(stage);
      boolean b = resume(async, response);
      addResponse(async, stage);
      return b ? TRUE : FALSE;
   }
View Full Code Here

   }

   @GET
   @Path("resumechecked")
   public String resumeWithCheckedException(@QueryParam("stage") String stage) {
      AsyncResponse async = takeAsyncResponse(stage);
      boolean b = async.resume(new IOException(RESUMED));
      addResponse(async, stage);
      return b ? 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.