@Override public void handleMessage(Message message) throws Fault { ThrottleResponse rsp = manager.getThrottleResponse(getPhase(), message); if (rsp == null) { return; } message.getExchange().put(ThrottleResponse.class, rsp); if (rsp.getResponseCode() >= 300) { createOutMessage(message); message.getInterceptorChain().doInterceptStartingAt(message, OutgoingChainInterceptor.class.getName()); return; } long l = rsp.getDelay(); if (l > 0) { ContinuationProvider cp = message.get(ContinuationProvider.class); if (cp == null) { LOG.warning("No ContinuationProvider available, sleeping on current thread"); try { Thread.sleep(l); } catch (InterruptedException e) { //ignore } return; } Continuation c = cp.getContinuation(); c.suspend(l); } } private Message createOutMessage(Message inMessage) {
@Override public void handleMessage(Message message) throws Fault { ThrottleResponse rsp = manager.getThrottleResponse(getPhase(), message); if (rsp == null) { return; } message.getExchange().put(ThrottleResponse.class, rsp); if (rsp.getResponseCode() >= 300) { createOutMessage(message); message.getInterceptorChain().doInterceptStartingAt(message, OutgoingChainInterceptor.class.getName()); return; } long l = rsp.getDelay(); if (l > 0) { ContinuationProvider cp = message.get(ContinuationProvider.class); if (cp == null) { LOG.warning("No ContinuationProvider available, sleeping on current thread"); try { Thread.sleep(l); } catch (InterruptedException e) { //ignore } return; } Continuation c = cp.getContinuation(); c.suspend(l); } } private Message createOutMessage(Message inMessage) {
public void handleMessage(Message message) { if (message.getExchange().get(OperationResourceInfo.class) != null) { // it's a suspended invocation; return; } message.getExchange().put(Message.REST_MESSAGE, Boolean.TRUE); try { processRequest(message); } catch (Fault ex) { convertExceptionToResponseIfPossible(ex.getCause(), message); } catch (RuntimeException ex) { convertExceptionToResponseIfPossible(ex, message); } Response r = message.getExchange().get(Response.class); if (r != null) { createOutMessage(message, r); message.getInterceptorChain().doInterceptStartingAt(message, OutgoingChainInterceptor.class.getName()); } }
message.getInterceptorChain().doInterceptStartingAt(message, JAXRSOutInterceptor.class.getName()); return;
public void handleMessage(Message message) { final Exchange exchange = message.getExchange(); exchange.put(Message.REST_MESSAGE, Boolean.TRUE); Response response = exchange.get(Response.class); if (response == null) { try { processRequest(message, exchange); if (exchange.isOneWay()) { ServerProviderFactory.getInstance(message).clearThreadLocalProxies(); } } catch (Fault ex) { convertExceptionToResponseIfPossible(ex.getCause(), message); } catch (RuntimeException ex) { convertExceptionToResponseIfPossible(ex, message); } catch (IOException ex) { convertExceptionToResponseIfPossible(ex, message); } } response = exchange.get(Response.class); if (response != null) { createOutMessage(message, response); message.getInterceptorChain().doInterceptStartingAt(message, OutgoingChainInterceptor.class.getName()); } }
message.getInterceptorChain().doInterceptStartingAt( message, OutgoingChainInterceptor.class.getName());
message.getInterceptorChain().doInterceptStartingAt( message, OutgoingChainInterceptor.class.getName());
message.getInterceptorChain().doInterceptStartingAt( message, OutgoingChainInterceptor.class.getName());