org.jboss.resteasy.core.SynchronousDispatcher Java Examples

The following examples show how to use org.jboss.resteasy.core.SynchronousDispatcher. 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: RestServer.java    From joyrpc with Apache License 2.0 6 votes vote down vote up
/**
 * 启动前钩子
 *
 * @param transport
 * @return
 */
protected CompletableFuture<Void> beforeOpen(final ServerTransport transport) {
    CompletableFuture<Void> result = new CompletableFuture<>();
    try {
        deployment.start();
        ResteasyProviderFactory providerFactory = deployment.getProviderFactory();
        String root = url.getString(REST_ROOT);
        root = REST_ROOT.getValue().equals(root) ? "" : root;
        Map<Class<?>, ExceptionMapper> mapperMap = providerFactory.getExceptionMappers();
        mapperMap.put(ApplicationException.class, ApplicationExceptionMapper.mapper);
        mapperMap.put(ClientErrorException.class, ClientErrorExceptionMapper.mapper);
        mapperMap.put(IllegalArgumentException.class, IllegalArgumentExceptionMapper.mapper);
        transport.setCodec(new ResteasyCodec(root,
                new RequestDispatcher((SynchronousDispatcher) deployment.getDispatcher(), providerFactory, null)));
        result.complete(null);
    } catch (Throwable e) {
        result.completeExceptionally(e);
    }
    return result;
}
 
Example #2
Source File: VertxHttpRequest.java    From quarkus with Apache License 2.0 6 votes vote down vote up
public VertxHttpRequest(Context context,
        RoutingContext routingContext,
        ResteasyHttpHeaders httpHeaders,
        ResteasyUriInfo uri,
        String httpMethod,
        LazyHostSupplier remoteHost,
        SynchronousDispatcher dispatcher,
        VertxHttpResponse response, ManagedContext requestContext) {
    super(uri);
    this.context = context;
    this.response = response;
    this.httpHeaders = httpHeaders;
    this.httpMethod = httpMethod;
    this.remoteHost = remoteHost;
    this.executionContext = new VertxExecutionContext(this, response, dispatcher);
    this.requestContext = requestContext;
    this.requestContextState = requestContext.getState();
    this.routingContext = routingContext;
}
 
Example #3
Source File: VertxRequestHandler.java    From quarkus with Apache License 2.0 6 votes vote down vote up
public VertxRequestHandler(Vertx vertx,
        BeanContainer beanContainer,
        ResteasyDeployment deployment,
        String rootPath,
        BufferAllocator allocator, Executor executor, long readTimeout) {
    this.vertx = vertx;
    this.beanContainer = beanContainer;
    this.dispatcher = new RequestDispatcher((SynchronousDispatcher) deployment.getDispatcher(),
            deployment.getProviderFactory(), null, Thread.currentThread().getContextClassLoader());
    this.rootPath = rootPath;
    this.allocator = allocator;
    this.executor = executor;
    this.readTimeout = readTimeout;
    Instance<CurrentIdentityAssociation> association = CDI.current().select(CurrentIdentityAssociation.class);
    this.association = association.isResolvable() ? association.get() : null;
    currentVertxRequest = CDI.current().select(CurrentVertxRequest.class).get();
}
 
Example #4
Source File: VertxHttpRequest.java    From quarkus with Apache License 2.0 5 votes vote down vote up
VertxExecutionContext(final VertxHttpRequest request, final VertxHttpResponse response,
        final SynchronousDispatcher dispatcher) {
    super(dispatcher, request, response);
    this.request = request;
    this.response = response;
    this.asyncResponse = new VertxHttpAsyncResponse(dispatcher, request, response);
}
 
Example #5
Source File: RequestDispatcher.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public RequestDispatcher(final SynchronousDispatcher dispatcher, final ResteasyProviderFactory providerFactory,
        final SecurityDomain domain, ClassLoader classLoader) {
    this.dispatcher = dispatcher;
    this.providerFactory = providerFactory;
    this.domain = domain;
    this.classLoader = classLoader;
}
 
Example #6
Source File: VertxPluginRequestHandler.java    From redpipe with Apache License 2.0 5 votes vote down vote up
public VertxPluginRequestHandler(Vertx vertx, ResteasyDeployment deployment, String servletMappingPrefix, SecurityDomain domain, List<Plugin> plugins)
{
   this.vertx = vertx;
   this.dispatcher = new PluginRequestDispatcher((SynchronousDispatcher) deployment.getDispatcher(), deployment.getProviderFactory(), domain, plugins);
   this.servletMappingPrefix = servletMappingPrefix;
   appGlobals = AppGlobals.get();
}
 
Example #7
Source File: SiestaResourceMethodFinder.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
public ResourceMethodInvoker getResourceMethod(final HttpServletRequest request,
                                               final HttpServletResponse response)
{
  HttpRequest httpRequest = new HttpServletInputMessage(
      request,
      response,
      request.getServletContext(),
      null,
      extractHttpHeaders(request),
      extractUriInfo(request, MOUNT_POINT),
      request.getMethod(),
      (SynchronousDispatcher) this.componentContainer.getDispatcher());

  return (ResourceMethodInvoker) deployment.getRegistry().getResourceInvoker(httpRequest);
}
 
Example #8
Source File: VertxHttpRequest.java    From quarkus with Apache License 2.0 4 votes vote down vote up
VertxHttpAsyncResponse(final SynchronousDispatcher dispatcher, final VertxHttpRequest request,
        final VertxHttpResponse response) {
    super(dispatcher, request, response);
    this.vertxResponse = response;
}
 
Example #9
Source File: RequestDispatcher.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public SynchronousDispatcher getDispatcher() {
    return dispatcher;
}
 
Example #10
Source File: SofaNettyJaxrsServer.java    From sofa-rpc with Apache License 2.0 4 votes vote down vote up
protected RequestDispatcher createRequestDispatcher() {
    return new RequestDispatcher((SynchronousDispatcher) deployment.getDispatcher(),
        deployment.getProviderFactory(), domain);
}
 
Example #11
Source File: PluginRequestDispatcher.java    From redpipe with Apache License 2.0 4 votes vote down vote up
public PluginRequestDispatcher(SynchronousDispatcher dispatcher, ResteasyProviderFactory providerFactory,
		SecurityDomain domain, List<Plugin> plugins) {
	super(dispatcher, providerFactory, domain);
	this.plugins = plugins;
}