cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1049436 - /cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestMustUnderstandHandler.java
Date Wed, 15 Dec 2010 05:46:25 GMT
Author: ema
Date: Wed Dec 15 05:46:24 2010
New Revision: 1049436

URL: http://svn.apache.org/viewvc?rev=1049436&view=rev
Log:
Merged revisions 1049434 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1049434 | ema | 2010-12-15 13:36:50 +0800 (Wed, 15 Dec 2010) | 1 line
  
  [CXF-3188]:Removed the wrong @Override annotation to fix the build
........
Also Added the missing TestMustUnderstandHandler.java in:

Merged revisions 1049341 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk


Added:
    cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestMustUnderstandHandler.java

Added: cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestMustUnderstandHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestMustUnderstandHandler.java?rev=1049436&view=auto
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestMustUnderstandHandler.java
(added)
+++ cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestMustUnderstandHandler.java
Wed Dec 15 05:46:24 2010
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.handlers;
+
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+public class TestMustUnderstandHandler<T extends SOAPMessageContext> extends TestHandlerBase
implements
+    SOAPHandler<T> {
+
+    public TestMustUnderstandHandler() {
+        super(true);
+    }
+
+    public boolean handleMessage(SOAPMessageContext ctx) {
+
+        boolean continueProcessing = true;
+
+        try {
+            Object b = ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+            boolean outbound = (Boolean)b;
+            SOAPMessage msg = ctx.getMessage();
+            if (isServerSideHandler()) {
+                if (outbound) {
+                    QName qname = new QName("http://cxf.apache.org/mu", "MU");
+                    SOAPPart soapPart = msg.getSOAPPart();
+                    SOAPEnvelope envelope = soapPart.getEnvelope();
+                    SOAPHeader header = envelope.getHeader();
+                    if (header == null) {
+                        header = envelope.addHeader();
+                    }
+
+                    SOAPHeaderElement headerElement = header.addHeaderElement(qname);
+
+                    // QName soapMustUnderstand = new QName("http://schemas.xmlsoap.org/soap/envelope/",
+                    // "mustUnderstand");
+                    Name name = SOAPFactory.newInstance()
+                        .createName("mustUnderstand", "soap", "http://schemas.xmlsoap.org/soap/envelope/");
+                    headerElement.addAttribute(name, "1");
+                } else {
+                    getHandlerInfoList(ctx).add(getHandlerId());
+                }
+            }
+        } catch (SOAPException e) {
+            e.printStackTrace();
+        }
+        return continueProcessing;
+    }
+
+    public String getHandlerId() {
+        return "TestMustUnderstandHandler";
+    }
+
+    public Set<QName> getHeaders() {
+        return null;
+    }
+
+    public void close(MessageContext messagecontext) {
+    }
+   
+    public boolean handleFault(T messagecontext) {
+        return true;
+    }
+
+}



Mime
View raw message