/** * Determines if the current message has no response content. * The message has no response content if either: * - the request is oneway and the current message is no partial * response or an empty partial response. * - the request is not oneway but the current message is an empty partial * response. * @param message * @return */ private boolean hasNoResponseContent(Message message) { final boolean ow = isOneWay(message); final boolean pr = MessageUtils.isPartialResponse(message); final boolean epr = MessageUtils.isEmptyPartialResponse(message); //REVISIT may need to provide an option to choose other behavior? // old behavior not suppressing any responses => ow && !pr // suppress empty responses for oneway calls => ow && (!pr || epr) // suppress additionally empty responses for decoupled twoway calls => return (ow && !pr) || epr; }
/** * Determines if the current message has no response content. * The message has no response content if either: * - the request is oneway and the current message is no partial * response or an empty partial response. * - the request is not oneway but the current message is an empty partial * response. * @param message * @return */ private boolean hasNoResponseContent(Message message) { final boolean ow = isOneWay(message); final boolean pr = MessageUtils.isPartialResponse(message); final boolean epr = MessageUtils.isEmptyPartialResponse(message); //REVISIT may need to provide an option to choose other behavior? // old behavior not suppressing any responses => ow && !pr // suppress empty responses for oneway calls => ow && (!pr || epr) // suppress additionally empty responses for decoupled twoway calls => return (ow && !pr) || epr; }
/** * Determines if the current message has no response content. * The message has no response content if either: * - the request is oneway and the current message is no partial * response or an empty partial response. * - the request is not oneway but the current message is an empty partial * response. * @param message * @return */ private boolean hasNoResponseContent(Message message) { final boolean ow = isOneWay(message); final boolean pr = MessageUtils.isPartialResponse(message); final boolean epr = MessageUtils.isEmptyPartialResponse(message); //REVISIT may need to provide an option to choose other behavior? // old behavior not suppressing any responses => ow && !pr // suppress empty responses for oneway calls => ow && (!pr || epr) // suppress additionally empty responses for decoupled twoway calls => return (ow && !pr) || epr; }
@Override public void close(Message message) throws IOException { // set the pseudo status code if not set (REVISIT add this method in MessageUtils to be reused elsewhere?) Integer i = (Integer)message.get(Message.RESPONSE_CODE); if (i == null) { int code = ((message.getExchange().isOneWay() && !MessageUtils.isPartialResponse(message)) || MessageUtils.isEmptyPartialResponse(message)) ? 202 : 200; message.put(Message.RESPONSE_CODE, code); } if (Boolean.TRUE.equals(message.getExchange().get(LocalConduit.DIRECT_DISPATCH))) { final Exchange exchange = (Exchange)message.getExchange().get(LocalConduit.IN_EXCHANGE); MessageImpl copy = new MessageImpl(); copy.putAll(message); message.getContent(OutputStream.class).close(); CachedOutputStream stream = message.getContent(CachedOutputStream.class); message.setContent(OutputStream.class, stream); MessageImpl.copyContent(message, copy); copy.setContent(InputStream.class, stream.getInputStream()); stream.releaseTempFileHold(); if (exchange != null && exchange.getInMessage() == null) { exchange.setInMessage(copy); } conduit.getMessageObserver().onMessage(copy); return; } super.close(message); }
@Override public void close(Message message) throws IOException { // set the pseudo status code if not set (REVISIT add this method in MessageUtils to be reused elsewhere?) Integer i = (Integer)message.get(Message.RESPONSE_CODE); if (i == null) { int code = ((message.getExchange().isOneWay() && !MessageUtils.isPartialResponse(message)) || MessageUtils.isEmptyPartialResponse(message)) ? 202 : 200; message.put(Message.RESPONSE_CODE, code); } if (Boolean.TRUE.equals(message.getExchange().get(LocalConduit.DIRECT_DISPATCH))) { final Exchange exchange = (Exchange)message.getExchange().get(LocalConduit.IN_EXCHANGE); MessageImpl copy = new MessageImpl(); copy.putAll(message); message.getContent(OutputStream.class).close(); CachedOutputStream stream = message.getContent(CachedOutputStream.class); message.setContent(OutputStream.class, stream); MessageImpl.copyContent(message, copy); copy.setContent(InputStream.class, stream.getInputStream()); stream.releaseTempFileHold(); if (exchange != null && exchange.getInMessage() == null) { exchange.setInMessage(copy); } conduit.getMessageObserver().onMessage(copy); return; } super.close(message); }