javax.ws.rs.client.CompletionStageRxInvoker Java Examples
The following examples show how to use
javax.ws.rs.client.CompletionStageRxInvoker.
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: RequestForwarder.java From component-runtime with Apache License 2.0 | 6 votes |
public CompletionStage<Response> forward(final InputStream payload, final Function<Response, Response> customizer) { WebTarget target = client.path(uriInfo.getPath()); for (final Map.Entry<String, List<String>> query : uriInfo.getQueryParameters().entrySet()) { target = target.queryParam(query.getKey(), query.getValue().toArray(emptyObjectsArray)); } final MultivaluedMap<String, String> requestHeaders = headers.getRequestHeaders(); final MediaType[] types = headers.getAcceptableMediaTypes().toArray(emptyMediaTypesArray); final CompletionStageRxInvoker invoker = target.request(types).headers(MultivaluedMap.class.cast(requestHeaders)).rx(); final CompletionStage<Response> response; if (payload != null) { response = invoker.method(request.getMethod(), entity(payload, MediaType.APPLICATION_JSON_TYPE)); } else { response = invoker.method(request.getMethod()); } final CompletionStage<Response> decorated = decorate(response); if (customizer != null) { return decorated.thenApply(customizer); } return decorated; }
Example #2
Source File: UniInvokerProvider.java From quarkus with Apache License 2.0 | 5 votes |
@Override public UniRxInvoker getRxInvoker(SyncInvoker syncInvoker, ExecutorService executorService) { if (syncInvoker instanceof ClientInvocationBuilder) { ClientInvocationBuilder builder = (ClientInvocationBuilder) syncInvoker; CompletionStageRxInvoker completionStageRxInvoker = builder.rx(); return new UniRxInvokerImpl(completionStageRxInvoker); } else { throw new ProcessingException("Expected a ClientInvocationBuilder"); } }
Example #3
Source File: SelfKeymasterOps.java From syncope with Apache License 2.0 | 5 votes |
protected CompletionStageRxInvoker rx(final String path) { synchronized (clientFactory) { String original = clientFactory.getAddress(); clientFactory.setAddress(StringUtils.removeEnd(original, "/") + StringUtils.prependIfMissing(path, "/")); try { WebClient client = clientFactory.createWebClient(). type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON); return client.rx(); } finally { clientFactory.setAddress(original); } } }
Example #4
Source File: WebClient.java From cxf with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) public <T extends RxInvoker> T rx(Class<T> rxCls, ExecutorService executorService) { if (CompletionStageRxInvoker.class.isAssignableFrom(rxCls)) { return (T)rx(executorService); } ClientProviderFactory pf = ClientProviderFactory.getInstance(WebClient.getConfig(this).getEndpoint()); RxInvokerProvider rxProvider = pf.getRxInvokerProvider(); if (rxProvider != null && rxProvider.isProviderFor(rxCls)) { return (T)rxProvider.getRxInvoker(sync(), executorService); } throw new IllegalStateException("Provider for " + rxCls.getName() + " is not available"); }
Example #5
Source File: UniRxInvokerImpl.java From quarkus with Apache License 2.0 | 4 votes |
public UniRxInvokerImpl(final CompletionStageRxInvoker completionStageRxInvoker) { this.completionStageRxInvoker = completionStageRxInvoker; this.UniProvider = new UniProvider(); }
Example #6
Source File: WebClient.java From cxf with Apache License 2.0 | 4 votes |
public CompletionStageRxInvoker rx() { return rx(lookUpExecutorService()); }
Example #7
Source File: WebClient.java From cxf with Apache License 2.0 | 4 votes |
public CompletionStageRxInvoker rx(ExecutorService ex) { return new CompletionStageRxInvokerImpl(this, ex); }
Example #8
Source File: InvocationBuilderImpl.java From cxf with Apache License 2.0 | 4 votes |
@Override public CompletionStageRxInvoker rx() { return webClient.rx(getConfiguredExecutorService()); }