org.jboss.resteasy.spi.ApplicationException Java Examples
The following examples show how to use
org.jboss.resteasy.spi.ApplicationException.
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 |
/** * 启动前钩子 * * @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: QuarkusConstructorInjector.java From quarkus with Apache License 2.0 | 5 votes |
@Override public Object construct(HttpRequest request, HttpResponse response, boolean unwrapAsync) throws Failure, WebApplicationException, ApplicationException { if (QuarkusInjectorFactory.CONTAINER == null) { return delegate.construct(request, response, unwrapAsync); } if (factory == null) { factory = QuarkusInjectorFactory.CONTAINER.instanceFactory(this.ctor.getDeclaringClass()); } if (factory == null) { return delegate.construct(request, response, unwrapAsync); } return factory.create().get(); }
Example #3
Source File: QuarkusInjectorFactory.java From quarkus with Apache License 2.0 | 4 votes |
@Override public CompletionStage<Void> inject(HttpRequest request, HttpResponse response, Object target, boolean unwrapAsync) throws Failure, WebApplicationException, ApplicationException { return delegate.inject(request, response, PROXY_UNWRAPPER.apply(target), unwrapAsync); }
Example #4
Source File: ApplicationExceptionMapper.java From hawkular-metrics with Apache License 2.0 | 4 votes |
@Override public Response toResponse(ApplicationException exception) { return ExceptionMapperUtils.buildResponse(exception, Status.INTERNAL_SERVER_ERROR); }