Source:
<code>public void populateProxyResteasyRequestAndExecute(String uri, Exchange exchange, Map<String, String> parameters) { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(uri); <START> if (parameters.get("username") != null && parameters.get("password") != null) { <END> target.register(new BasicAuthentication(parameters.get("username"), parameters.get("password"))); } if (LOG.isTraceEnabled()) { LOG.trace("Basic authentication was applied"); } Class realClazz; Object object = null; try { realClazz = Class.forName(parameters.get("proxyClassName")); Object simple = ObjectHelper.cast(ResteasyWebTarget.class, target).proxy(realClazz); ArrayList headerParams = exchange.getIn().getHeader(ResteasyConstants.RESTEASY_PROXY_METHOD_PARAMS, ArrayList.class); if (headerParams != null) { Object[] args = new Object[headerParams.size()]; Class[] paramsClasses = new Class[headerParams.size()]; for (int i = 0; i < headerParams.size(); i++) { LOG.debug(headerParams.get(i).getClass().toString()); paramsClasses[i] = headerParams.get(i).getClass(); args[i] = headerParams.get(i); } Method m = simple.getClass().getMethod(parameters.get("proxyMethodName"), paramsClasses); object = m.invoke(simple, args); } else { Method m = simple.getClass().getMethod(parameters.get("proxyMethodName")); object = m.invoke(simple); } if (object instanceof Response) { populateExchangeFromResteasyResponse(exchange, (Response) object); ((Response) object).close(); } else { exchange.getMessage().setBody(object); MessageHelper.copyHeaders(exchange.getIn(), exchange.getMessage(), false); } } catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { exchange.getMessage().getHeaders().put(ResteasyConstants.RESTEASY_PROXY_PRODUCER_EXCEPTION, ExceptionUtils.getStackTrace(e)); exchange.getMessage().setBody(e); LOG.error("Camel RESTEasy proxy exception", e); } }</code><technical_language>Hmm I surprise, a autoMethod=Basic configure endpoint component</technical_language>

Target:
public void populateProxyResteasyRequestAndExecute(String uri, Exchange exchange, Map<String, String> parameters) { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(uri); if (parameters.get("basicAuth") != null && Boolean.TRUE.equals(ObjectHelper.cast(Boolean.class, parameters.get("basicAuth")))) { if (parameters.get("username") != null && parameters.get("password") != null) { target.register(new BasicAuthentication(parameters.get("username"), parameters.get("password"))); if (LOG.isTraceEnabled()) { LOG.trace("Basic authentication was applied"); } } } Class realClazz; Object object = null; try { realClazz = Class.forName(parameters.get("proxyClassName")); Object simple = ObjectHelper.cast(ResteasyWebTarget.class, target).proxy(realClazz); ArrayList headerParams = exchange.getIn().getHeader(ResteasyConstants.RESTEASY_PROXY_METHOD_PARAMS, ArrayList.class); if (headerParams != null) { Object[] args = new Object[headerParams.size()]; Class[] paramsClasses = new Class[headerParams.size()]; for (int i = 0; i < headerParams.size(); i++) { paramsClasses[i] = headerParams.get(i).getClass(); args[i] = headerParams.get(i); } Method m = simple.getClass().getMethod(parameters.get("proxyMethodName"), paramsClasses); object = m.invoke(simple, args); } else { Method m = simple.getClass().getMethod(parameters.get("proxyMethodName")); object = m.invoke(simple); } if (object instanceof Response) { populateExchangeFromResteasyResponse(exchange, (Response) object); ((Response) object).close(); } else { exchange.getMessage().setBody(object); MessageHelper.copyHeaders(exchange.getIn(), exchange.getMessage(), false); } } catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { exchange.getMessage().getHeaders().put(ResteasyConstants.RESTEASY_PROXY_PRODUCER_EXCEPTION, e); exchange.getMessage().setBody(e); LOG.error("Camel RESTEasy proxy exception: {}", e); } }