org.glassfish.jersey.server.AsyncContext Java Examples

The following examples show how to use org.glassfish.jersey.server.AsyncContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GuiceBindingsModule.java    From dropwizard-guicey with MIT License 6 votes vote down vote up
@Override
protected void configure() {
    jerseyToGuiceGlobal(MultivaluedParameterExtractorProvider.class);
    jerseyToGuiceGlobal(Application.class);
    jerseyToGuiceGlobal(Providers.class);

    // request scoped objects
    jerseyToGuice(UriInfo.class);
    jerseyToGuice(ResourceInfo.class);
    jerseyToGuice(HttpHeaders.class);
    jerseyToGuice(SecurityContext.class);
    jerseyToGuice(Request.class);
    jerseyToGuice(ContainerRequest.class);
    jerseyToGuice(AsyncContext.class);

    if (!guiceServletSupport) {
        // bind request and response objects when guice servlet module not registered
        // but this will work only for resources
        jerseyToGuice(HttpServletRequest.class);
        jerseyToGuice(HttpServletResponse.class);
    }
}
 
Example #2
Source File: RxInvocationHandler.java    From rx-jersey with MIT License 5 votes vote down vote up
/**
 * Uses {@link AsyncContext} to suspend current request
 *
 * @return obtained {@link AsyncContext} or throws error
 */
protected AsyncContext suspend() {
    final AsyncContext asyncContext = asyncContextProvider.get();

    if (!asyncContext.suspend()) {
        throw new ProcessingException(LocalizationMessages.ERROR_SUSPENDING_ASYNC_REQUEST());
    }

    return asyncContext;
}