Author: ningjiang Date: Mon Oct 22 09:45:41 2012 New Revision: 1400817 URL: http://svn.apache.org/viewvc?rev=1400817&view=rev Log: Merged revisions 1400813 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
................ r1400813 | ningjiang | 2012-10-22 17:35:02 +0800 (Mon, 22 Oct 2012) | 9 lines Merged revisions 1400798 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1400798 | ningjiang | 2012-10-22 16:42:26 +0800 (Mon, 22 Oct 2012) | 1 line CXF-4583 Fixed the Empty soap response issue When the logical handler return false processing the outbound message. ........ ................ Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/trunk:r1400798 Merged /cxf/branches/2.6.x-fixes:r1400813 Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java?rev=1400817&r1=1400816&r2=1400817&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java (original) +++ cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java Mon Oct 22 09:45:41 2012 @@ -158,12 +158,13 @@ public class LogicalHandlerOutIntercepto LogicalHandlerInInterceptor.class.getName()); observer.onMessage(responseMsg); } + return; } } else { // server side - abort - //System.out.println("Logical handler server side aborting"); + // Even return false, also should try to set the XMLStreamWriter using + // reader or domWriter, or the SOAPMessage's body maybe empty. } - return; } if (origMessage != null) { message.setContent(SOAPMessage.class, origMessage); @@ -182,8 +183,6 @@ public class LogicalHandlerOutIntercepto throw new Fault(e); } } - } - } Modified: cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=1400817&r1=1400816&r2=1400817&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java Mon Oct 22 09:45:41 2012 @@ -426,6 +426,21 @@ public class HandlerInvocationTest exten } @Test + public void testLogicHandlerHandleMessageReturnFalseServerOutbound() throws PingException { + String[] expectedHandlers = {"server handler1 outbound stop", "soapHandler4", + "soapHandler3", "handler2", "handler1", "handler1"}; + + List<String> resp = handlerTest.pingWithArgs("server handler1 outbound stop"); + + assertEquals(expectedHandlers.length, resp.size()); + + int i = 0; + for (String expected : expectedHandlers) { + assertEquals(expected, resp.get(i++)); + } + } + + @Test public void testSOAPHandlerHandleMessageReturnsFalseServerInbound() throws PingException { String[] expectedHandlers = {"soapHandler4", "soapHandler3", "soapHandler4"}; List<String> resp = handlerTest.pingWithArgs("soapHandler3 inbound stop"); Modified: cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java?rev=1400817&r1=1400816&r2=1400817&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java Mon Oct 22 09:45:41 2012 @@ -167,12 +167,33 @@ public class TestHandler<T extends Logic return ret; } - private boolean handlePingMessage(boolean outbound, T ctx) { + private boolean checkServerOutBindStopHandler(boolean outbound, T ctx) { + if (outbound) { + LogicalMessage msg = ctx.getMessage(); + Object obj = msg.getPayload(jaxbCtx); + if (obj instanceof PingResponse) { + // only check if we need call for the server response handler false + PingResponse origResp = (PingResponse)obj; + for (String handler : origResp.getHandlersInfo()) { + if (handler.indexOf("server") == 0 && handler.indexOf(getHandlerId()) > 0 + && handler.indexOf("stop") > 0) { + return true; + } + } + } + } + return false; + } + private boolean handlePingMessage(boolean outbound, T ctx) { LogicalMessage msg = ctx.getMessage(); addHandlerId(msg, ctx, outbound); - return getHandleMessageRet(); - } + if (checkServerOutBindStopHandler(outbound, ctx)) { + return false; + } else { + return getHandleMessageRet(); + } + } private void addHandlerId(LogicalMessage msg, T ctx, boolean outbound) {
