@Override public URI apply(String value) { try { return value == null ? null : URI.create(value); } catch (IllegalArgumentException ex) { throw new ProcessingException(ex); } } }, false);
@Override public URI apply(String value) { try { return URI.create(value); } catch (IllegalArgumentException ex) { throw new ProcessingException(ex); } } }, false);
@Override public URI apply(String value) { try { return value == null ? null : URI.create(value); } catch (IllegalArgumentException ex) { throw new ProcessingException(ex); } } }, false);
@Override public Integer apply(String input) { try { return (input != null && !input.isEmpty()) ? Integer.parseInt(input) : -1; } catch (NumberFormatException ex) { throw new ProcessingException(ex); } } }, true);
@Override public void close() { try { client.stop(); } catch (final Exception e) { throw new ProcessingException("Failed to stop the client.", e); } } }
@SuppressWarnings("ChainOfInstanceofChecks") private static URI getProxyUri(final Object proxy) { if (proxy instanceof URI) { return (URI) proxy; } else if (proxy instanceof String) { return URI.create((String) proxy); } else { throw new ProcessingException(LocalizationMessages.WRONG_PROXY_URI_TYPE(ClientProperties.PROXY_URI)); } }
@Override public ClientResponse apply(ClientRequest request) { try { return _apply(request); } catch (IOException ex) { throw new ProcessingException(ex); } }
@Override public EntityTag apply(String value) { try { return value == null ? null : EntityTag.valueOf(value); } catch (IllegalArgumentException ex) { throw new ProcessingException(ex); } } }, false);
@Override public Date apply(String input) { try { return HttpHeaderReader.readDate(input); } catch (ParseException e) { throw new ProcessingException(e); } } }, false);
@Override public Date apply(String input) { try { return HttpHeaderReader.readDate(input); } catch (ParseException ex) { throw new ProcessingException(ex); } } }, false);
@Override public Date apply(String input) { try { return HttpHeaderReader.readDate(input); } catch (ParseException ex) { throw new ProcessingException(ex); } } }, false);
@Override public ClientResponse apply(ClientRequest request) { try { return _apply(request); } catch (IOException ex) { throw new ProcessingException(ex); } }
@Override public void onThrowable(Throwable t) { entityStream.closeQueue(t); if (callbackInvoked.compareAndSet(false, true)) { t = t instanceof IOException ? new ProcessingException(t.getMessage(), t) : t; callback.failure(t); } } });
private BufferedJerseyRequestHttpEntity(ClientRequest clientRequest) { final ByteArrayOutputStream stream = new ByteArrayOutputStream(BUFFER_INITIAL_SIZE); clientRequest.setStreamProvider(contentLength -> stream); try { clientRequest.writeEntity(); } catch (IOException e) { throw new ProcessingException(LocalizationMessages.ERROR_BUFFERING_ENTITY(), e); } buffer = stream.toByteArray(); setChunked(false); }
@Override public Locale apply(String input) { try { return new LanguageTag(input).getAsLocale(); } catch (ParseException e) { throw new ProcessingException(e); } } }, false);
private void validateSubResource(final ResourceModel subResourceModel) { if (subResourceModel.getResources().size() != 1) { throw new ProcessingException(LocalizationMessages.ERROR_SUB_RESOURCE_LOCATOR_MORE_RESOURCES(subResourceModel .getResources().size())); } }
private void validateSubResource(final ResourceModel subResourceModel) { if (subResourceModel.getResources().size() != 1) { throw new ProcessingException(LocalizationMessages.ERROR_SUB_RESOURCE_LOCATOR_MORE_RESOURCES(subResourceModel .getResources().size())); } }
@Override public Future<?> apply(final ClientRequest request, final AsyncConnectorCallback callback) { try { callback.response(_apply(request)); } catch (IOException ex) { callback.failure(new ProcessingException(ex)); } catch (Throwable t) { callback.failure(t); } return CompletableFuture.completedFuture(null); }
@Override public Future<?> apply(final ClientRequest request, final AsyncConnectorCallback callback) { try { callback.response(_apply(request)); } catch (IOException ex) { callback.failure(new ProcessingException(ex)); } catch (Throwable t) { callback.failure(t); } return CompletableFuture.completedFuture(null); }
private List<Response> generateResponses(org.glassfish.jersey.server.model.Resource r, final ResourceMethod m) { try { if (m.getInvocable().getRawResponseType() == void.class) { return null; } return _wadlGenerator.createResponses(r, m); } catch (Exception e) { throw new ProcessingException(LocalizationMessages.ERROR_WADL_BUILDER_GENERATION_RESPONSE(m, r), e); } } }