Package javax.ws.rs.container

Examples of javax.ws.rs.container.AsyncResponse.resume()


            public void run() {
                try {
                    final AsyncResponse suspendedResponse = suspended.take();
                    LOGGER.log(DEBUG, "Resuming GET context {0} with a message <{1}> on thread {2}.",
                            new Object[] {suspendedResponse.toString(), message, Thread.currentThread().getName()});
                    suspendedResponse.resume(message);
                } catch (InterruptedException ex) {
                    LOGGER.log(Level.SEVERE,
                            "Waiting for a sending a message <" + message + "> has been interrupted.", ex);
                }
            }
View Full Code Here


                final boolean timeout2 = asyncResponse.setTimeout(millis, TimeUnit.MILLISECONDS);
                asyncResponse.setTimeoutHandler(new TimeoutHandler() {

                    @Override
                    public void handleTimeout(final AsyncResponse asyncResponse) {
                        asyncResponse.resume("timeout1=" + timeout1 + "_timeout2=" + timeout2 + "_handled");
                    }
                });
            }
        });
    }
View Full Code Here

                final boolean timeout2 = asyncResponse.setTimeout(millis, TimeUnit.MILLISECONDS);
                asyncResponse.setTimeoutHandler(new TimeoutHandler() {

                    @Override
                    public void handleTimeout(final AsyncResponse asyncResponse) {
                        asyncResponse.resume("timeout1=" + timeout1 + "_timeout2=" + timeout2 + "_handled");
                        asyncResponse.cancel();
                    }
                });
            }
        });
View Full Code Here

            public void run() {
                try {
                    final AsyncResponse suspendedResponse = suspended.take();
                    LOGGER.log(DEBUG, "Resuming GET context {0} with a message <{1}> on thread {2}.",
                            new Object[] {suspendedResponse.toString(), message, Thread.currentThread().getName()});
                    suspendedResponse.resume(message);
                } catch (InterruptedException ex) {
                    LOGGER.log(Level.SEVERE,
                            "Waiting for a sending a message <" + message + "> has been interrupted.", ex);
                }
            }
View Full Code Here

            URI uri = getUriBuilder().segment("locationAsyncFinish").build();
            Response result = Response.created(uri).build();
            boolean wasEqual = result.getLocation().equals(uriInfo.getAbsolutePath());

            asyncResponse.resume(result);
            return wasEqual;
        }

        /**
         * Resource method for testing URI absolutization after the abortion in the post-matching filter.
View Full Code Here

    @POST
    @ManagedAsync
    public String postMessage(final Message message) throws InterruptedException {
        final AsyncResponse asyncResponse = suspended.take();
        asyncResponse.resume(message);
        return "Sent!";
    }
}
View Full Code Here

   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("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;
   }

   @GET
View Full Code Here

   @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;
   }

   @POST
View Full Code Here

   @Path("resumechecked")
   public String resumeWithCheckedException(@QueryParam("stage") String stage)
   {
      AsyncResponse async = takeAsyncResponse(stage);
      System.out.println("Before resourceWithCheckedException.resume()");
      boolean b = async.resume(new IOException(RESUMED));
      addResponse(async, stage);
      System.out.println("returning resourceWithCheckedException()");
      return b ? TRUE : FALSE;
   }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.