@SuppressWarnings("unchecked") protected Object[] retryInvoke(BindingOperationInfo oi, Object[] params, Map<String, Object> context, Exchange exchange) throws Exception { try { Object body = params.length == 0 ? null : params[0]; Map<String, Object> reqContext = CastUtils.cast((Map<?, ?>)context.get(REQUEST_CONTEXT)); MultivaluedMap<String, String> headers = (MultivaluedMap<String, String>)reqContext.get(Message.PROTOCOL_HEADERS); URI newRequestURI = calculateNewRequestURI(reqContext); // TODO: if failover conduit selector fails to find a failover target // then it will revert to the previous endpoint; that is not very likely // but possible - thus ideally we need to resert base and current URI only // if we get the same ConduitInitiatior endpoint instance before and after // retryInvoke. Object response = retryInvoke(newRequestURI, headers, body, exchange, context); exchange.put(List.class, getContentsList(response)); return new Object[]{response}; } catch (Throwable t) { Exception ex = t instanceof Exception ? (Exception)t : new Exception(t); exchange.put(Exception.class, ex); return null; } }
@SuppressWarnings("unchecked") protected Object[] retryInvoke(BindingOperationInfo oi, Object[] params, Map<String, Object> context, Exchange exchange) throws Exception { try { Object body = params.length == 0 ? null : params[0]; Map<String, Object> reqContext = CastUtils.cast((Map<?, ?>)context.get(REQUEST_CONTEXT)); MultivaluedMap<String, String> headers = (MultivaluedMap<String, String>)reqContext.get(Message.PROTOCOL_HEADERS); URI newRequestURI = calculateNewRequestURI(reqContext); // TODO: if failover conduit selector fails to find a failover target // then it will revert to the previous endpoint; that is not very likely // but possible - thus ideally we need to resert base and current URI only // if we get the same ConduitInitiatior endpoint instance before and after // retryInvoke. Object response = retryInvoke(newRequestURI, headers, body, exchange, context); exchange.put(List.class, getContentsList(response)); return new Object[]{response}; } catch (Throwable t) { Exception ex = t instanceof Exception ? (Exception)t : new Exception(t); exchange.put(Exception.class, ex); return null; } }
@SuppressWarnings("unchecked") public Object[] invoke(BindingOperationInfo oi, Object[] params, Map<String, Object> context, Exchange exchange) throws Exception { try { Object body = params.length == 0 ? null : params[0]; Map<String, Object> reqContext = CastUtils.cast((Map<?, ?>)context.get(REQUEST_CONTEXT)); MultivaluedMap<String, String> headers = (MultivaluedMap<String, String>)reqContext.get(Message.PROTOCOL_HEADERS); URI newRequestURI = calculateNewRequestURI(reqContext); // TODO: if failover conduit selector fails to find a failover target // then it will revert to the previous endpoint; that is not very likely // but possible - thus ideally we need to resert base and current URI only // if we get the same ConduitInitiatior endpoint instance before and after // retryInvoke. Object response = retryInvoke(newRequestURI, headers, body, exchange, context); exchange.put(List.class, getContentsList(response)); return new Object[]{response}; } catch (Throwable t) { Exception ex = t instanceof Exception ? (Exception)t : new Exception(t); exchange.put(Exception.class, ex); return null; } }
setEmptyRequestPropertyIfNeeded(m, body); m.setContent(List.class, getContentsList(body));
setEmptyRequestPropertyIfNeeded(m, body); m.setContent(List.class, getContentsList(body));
setEmptyRequestPropertyIfNeeded(m, body); m.setContent(List.class, getContentsList(body));