You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2016/05/26 21:45:29 UTC

[01/50] [abbrv] cxf git commit: Unignoring tests [Forced Update!]

Repository: cxf
Updated Branches:
  refs/heads/master-jaxrs-2.1 a5e944c2e -> 23d6d663f (forced update)


Unignoring tests


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c2a735b1
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c2a735b1
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c2a735b1

Branch: refs/heads/master-jaxrs-2.1
Commit: c2a735b15b8b69a1d23e45598d47fc33a1a073bb
Parents: 25b8c0e
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue May 17 16:03:23 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue May 17 16:03:23 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c2a735b1/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
index bf1f9c3..bd1b526 100644
--- a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
+++ b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
@@ -54,7 +54,6 @@ public class WSS4JFaultCodeTest extends AbstractSecurityTest {
      * Test for WSS4JInInterceptor when it receives a message with no security header. 
      */
     @Test
-    @org.junit.Ignore
     public void testNoSecurity() throws Exception {
         Document doc = readDocument("wsse-request-clean.xml");
 
@@ -104,7 +103,6 @@ public class WSS4JFaultCodeTest extends AbstractSecurityTest {
      * Test that an invalid Timestamp gets mapped to a proper fault code 
      */
     @Test
-    @org.junit.Ignore
     public void testInvalidTimestamp() throws Exception {
         Document doc = readDocument("wsse-request-clean.xml");
 
@@ -166,7 +164,6 @@ public class WSS4JFaultCodeTest extends AbstractSecurityTest {
      * Test that an action mismatch gets mapped to a proper fault code 
      */
     @Test
-    @org.junit.Ignore
     public void testActionMismatch() throws Exception {
         Document doc = readDocument("wsse-request-clean.xml");
 


[32/50] [abbrv] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java
new file mode 100644
index 0000000..c96eec5
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java
@@ -0,0 +1,47 @@
+/**
+ * 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.ws.transfer.validator;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.shared.faults.PutDenied;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceValidator;
+
+public class StudentPutResourceValidator implements ResourceValidator {
+
+    public static final String UID_NAMESPACE = "http://university.edu/student";
+    
+    public static final String UID_NAME = "uid";
+    
+    @Override
+    public boolean validate(Representation newRepresentation, Representation oldRepresentation) {
+        Element newRepresentationEl = (Element) newRepresentation.getAny();
+        Element oldRepresentationEl = (Element) oldRepresentation.getAny();
+        
+        String newUid = newRepresentationEl.getElementsByTagNameNS(UID_NAMESPACE, UID_NAME).item(0).getTextContent();
+        String oldUid = oldRepresentationEl.getElementsByTagNameNS(UID_NAMESPACE, UID_NAME).item(0).getTextContent();
+        
+        if (!newUid.equals(oldUid)) {
+            throw new PutDenied();
+        }
+        return true;
+    } 
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java
new file mode 100644
index 0000000..0371366
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java
@@ -0,0 +1,51 @@
+/**
+ * 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.ws.transfer.validator;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.shared.faults.PutDenied;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceValidator;
+
+public class TeacherResourceValidator implements ResourceValidator {
+    
+    public static final String UID_NAMESPACE = "http://university.edu/teacher";
+    
+    public static final String UID_NAME = "uid";
+    
+    @Override
+    public boolean validate(Representation newRepresentation, Representation oldRepresentation) {
+        if (oldRepresentation != null) {
+            Element newRepresentationEl = (Element) newRepresentation.getAny();
+            Element oldRepresentationEl = (Element) oldRepresentation.getAny();
+
+            String newUid = newRepresentationEl.getElementsByTagNameNS(
+                UID_NAMESPACE, UID_NAME).item(0).getTextContent();
+            String oldUid = oldRepresentationEl.getElementsByTagNameNS(
+                UID_NAMESPACE, UID_NAME).item(0).getTextContent();
+
+            if (!newUid.equals(oldUid)) {
+                throw new PutDenied();
+            }
+        }
+        return true;
+    } 
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd b/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd
new file mode 100644
index 0000000..1947c45
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+
+<!--
+  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.
+-->
+
+<xs:schema version="1.0"
+           targetNamespace="http://university.edu/student"
+           xmlns:ns="http://university.edu/student"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:complexType name="birthDateType">
+        <xs:sequence>
+            <xs:element name="day" type="xs:integer"/>
+            <xs:element name="month" type="xs:integer"/>
+            <xs:element name="year" type="xs:integer"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:element name="student">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="surname" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="birthdate" type="ns:birthDateType" minOccurs="0" maxOccurs="1" />
+                <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="1" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/studentPut.xsd
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/schema/studentPut.xsd b/systests/ws-transfer/src/test/resources/schema/studentPut.xsd
new file mode 100644
index 0000000..831ffce
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/schema/studentPut.xsd
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<!--
+  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.
+-->
+
+<xs:schema version="1.0"
+           targetNamespace="http://university.edu/student"
+           xmlns:ns="http://university.edu/student"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:complexType name="birthDateType">
+        <xs:sequence>
+            <xs:element name="day" type="xs:integer"/>
+            <xs:element name="month" type="xs:integer"/>
+            <xs:element name="year" type="xs:integer"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:element name="student">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="surname" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="birthdate" type="ns:birthDateType" minOccurs="0" maxOccurs="1" />
+                <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="uid" type="xs:integer" minOccurs="1" maxOccurs="1" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/teacher.xsd
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/schema/teacher.xsd b/systests/ws-transfer/src/test/resources/schema/teacher.xsd
new file mode 100644
index 0000000..8dab259
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/schema/teacher.xsd
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<!--
+  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.
+-->
+
+<xs:schema version="1.0"
+           targetNamespace="http://university.edu/teacher"
+           xmlns:ns="http://university.edu/teacher"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:complexType name="birthDateType">
+        <xs:sequence>
+            <xs:element name="day" type="xs:integer"/>
+            <xs:element name="month" type="xs:integer"/>
+            <xs:element name="year" type="xs:integer"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:element name="teacher">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="surname" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="birthdate" type="ns:birthDateType" minOccurs="0" maxOccurs="1" />
+                <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="uid" type="xs:integer" minOccurs="1" maxOccurs="1" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd b/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd
new file mode 100644
index 0000000..db1965f
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+  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.
+-->
+
+<xs:schema version="1.0"
+           targetNamespace="http://university.edu/teacher"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:element name="teacher">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createStudent.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createStudent.xml b/systests/ws-transfer/src/test/resources/xml/createStudent.xml
new file mode 100644
index 0000000..cb021af
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createStudent.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<student xmlns="http://university.edu/student">
+    <name>John</name>
+    <surname>Smith</surname>
+    <birthdate>
+        <day>14</day>
+        <month>3</month>
+        <year>1994</year>
+    </birthdate>
+    <address>Street 21</address>
+</student>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml b/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml
new file mode 100644
index 0000000..3c00e64
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<student xmlns="http://university.edu/student">
+    <name>John</name>
+    <birthdate>
+        <day>14</day>
+        <month>3</month>
+        <year>1994</year>
+    </birthdate>
+</student>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml b/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml
new file mode 100644
index 0000000..957af34
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<student xmlns="http://university.edu/student">
+    <name>John</name>
+    <surname>Smith</surname>
+    <birthdate>
+        <day>14</day>
+        <month>3</month>
+        <year>1994</year>
+    </birthdate>
+    <address>Street 21</address>
+    <school>Standford</school>
+</student>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createTeacher.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createTeacher.xml b/systests/ws-transfer/src/test/resources/xml/createTeacher.xml
new file mode 100644
index 0000000..0d6e18b
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createTeacher.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<teacher xmlns="http://university.edu/teacher">
+    <name>Bob</name>
+    <surname>Stuart</surname>
+    <birthdate>
+        <day>5</day>
+        <month>7</month>
+        <year>1971</year>
+    </birthdate>
+    <address>Street 526</address>
+</teacher>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml b/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml
new file mode 100644
index 0000000..f9025b2
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<teacher xmlns="http://university.edu/teacher">
+    <name>Bob</name>
+    <address>Street 526</address>
+</teacher>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml b/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml
new file mode 100644
index 0000000..31f86e6
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<teacher xmlns="http://university.edu/teacher">
+    <name>Bob</name>
+    <surname>Stuart</surname>
+    <birthdate>
+        <day>5</day>
+        <month>7</month>
+        <year>1971</year>
+    </birthdate>
+    <address>Street 526</address>
+    <school>Standford</school>
+</teacher>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/putStudent.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/putStudent.xml b/systests/ws-transfer/src/test/resources/xml/putStudent.xml
new file mode 100644
index 0000000..2112f8c
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/putStudent.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<student xmlns="http://university.edu/student">
+    <name>John</name>
+    <surname>Smith</surname>
+    <birthdate>
+        <day>14</day>
+        <month>3</month>
+        <year>1994</year>
+    </birthdate>
+    <address>Street 12</address>
+    <uid>1</uid>
+</student>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/putTeacher.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/putTeacher.xml b/systests/ws-transfer/src/test/resources/xml/putTeacher.xml
new file mode 100644
index 0000000..dda58a8
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/putTeacher.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<teacher xmlns="http://university.edu/teacher">
+    <name>Bob</name>
+    <surname>Stuart</surname>
+    <birthdate>
+        <day>5</day>
+        <month>7</month>
+        <year>1971</year>
+    </birthdate>
+    <address>Street 526</address>
+    <uid>1</uid>
+</teacher>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/random.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/random.xml b/systests/ws-transfer/src/test/resources/xml/random.xml
new file mode 100644
index 0000000..43aa6b7
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/random.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<foo>
+	<bar/>
+</foo>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl b/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl
new file mode 100644
index 0000000..e9255f9
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<xsl:stylesheet xmlns="http://university.edu/student"
+                xmlns:ns="http://university.edu/student"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:uid="org.apache.cxf.systest.ws.transfer.UIDManager"
+                exclude-result-prefixes="uid"
+                version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="/">
+        <xsl:element name="student">
+            <xsl:call-template name="name"/>
+            <xsl:call-template name="surname"/>
+            <xsl:call-template name="birthdate"/>
+            <xsl:call-template name="address"/>
+            <xsl:call-template name="uid"/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template name="name">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:name">
+                <xsl:element name="name">
+                    <xsl:value-of select="/ns:student/ns:name" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="name">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="surname">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:surname">
+                <xsl:element name="surname">
+                    <xsl:value-of select="/ns:student/ns:surname" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="surname">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="birthdate">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:birthdate">
+                <xsl:element name="date">
+                    <xsl:element name="day">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:day" />
+                    </xsl:element>
+                    <xsl:element name="month">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:month" />
+                    </xsl:element>
+                    <xsl:element name="year">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:year" />
+                    </xsl:element>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="date">
+                    <xsl:element name="day">Unspecified</xsl:element>
+                    <xsl:element name="month">Unspecified</xsl:element>
+                    <xsl:element name="year">Unspecified</xsl:element>
+                </xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="address">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:address">
+                <xsl:element name="address">
+                    <xsl:value-of select="/ns:student/ns:address" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="address">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="uid">
+        <xsl:element name="uid">
+            <xsl:value-of select="uid:getUID()" />
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl b/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl
new file mode 100644
index 0000000..2768e5e
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<xsl:stylesheet xmlns="http://university.edu/student"
+                xmlns:ns="http://university.edu/student"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="/">
+        <xsl:element name="student">
+            <xsl:call-template name="name"/>
+            <xsl:call-template name="surname"/>
+            <xsl:call-template name="birthdate"/>
+            <xsl:call-template name="address"/>
+            <xsl:call-template name="uid"/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template name="name">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:name">
+                <xsl:element name="name">
+                    <xsl:value-of select="/ns:student/ns:name" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="name">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="surname">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:surname">
+                <xsl:element name="surname">
+                    <xsl:value-of select="/ns:student/ns:surname" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="surname">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="birthdate">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:birthdate">
+                <xsl:element name="date">
+                    <xsl:element name="day">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:day" />
+                    </xsl:element>
+                    <xsl:element name="month">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:month" />
+                    </xsl:element>
+                    <xsl:element name="year">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:year" />
+                    </xsl:element>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="date">
+                    <xsl:element name="day">Unspecified</xsl:element>
+                    <xsl:element name="month">Unspecified</xsl:element>
+                    <xsl:element name="year">Unspecified</xsl:element>
+                </xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="address">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:address">
+                <xsl:element name="address">
+                    <xsl:value-of select="/ns:student/ns:address" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="address">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="uid">
+        <xsl:element name="uid">
+            <xsl:value-of select="ns:student/ns:uid" />
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl b/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl
new file mode 100644
index 0000000..25c0aac
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<xsl:stylesheet xmlns="http://university.edu/teacher"
+                xmlns:ns="http://university.edu/teacher"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:uid="org.apache.cxf.systest.ws.transfer.UIDManager"
+                exclude-result-prefixes="uid"
+                version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="@*|node()">
+        <xsl:copy>
+            <xsl:apply-templates select="@*|node()" />
+        </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template match="/ns:teacher">
+        <xsl:element name="teacher">
+            <xsl:apply-templates select="@*|node()" />
+            <xsl:element name="uid">
+                <xsl:value-of select="uid:getUID()" />
+            </xsl:element>
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl b/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl
new file mode 100644
index 0000000..6ab40d3
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<xsl:stylesheet xmlns="http://university.edu/teacher"
+                xmlns:ns="http://university.edu/teacher"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="/">
+        <xsl:element name="teacher">
+            <xsl:call-template name="name"/>
+            <xsl:call-template name="surname"/>
+            <xsl:call-template name="birthdate"/>
+            <xsl:call-template name="address"/>
+            <xsl:call-template name="uid" />
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template name="name">
+        <xsl:choose>
+            <xsl:when test="/ns:teacher/ns:name">
+                <xsl:element name="name">
+                    <xsl:value-of select="/ns:teacher/ns:name" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="name">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="surname">
+        <xsl:choose>
+            <xsl:when test="/ns:teacher/ns:surname">
+                <xsl:element name="surname">
+                    <xsl:value-of select="/ns:teacher/ns:surname" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="surname">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="birthdate">
+        <xsl:choose>
+            <xsl:when test="/ns:teacher/ns:birthdate">
+                <xsl:element name="date">
+                    <xsl:element name="day">
+                        <xsl:value-of select="/ns:teacher/ns:birthdate/ns:day" />
+                    </xsl:element>
+                    <xsl:element name="month">
+                        <xsl:value-of select="/ns:teacher/ns:birthdate/ns:month" />
+                    </xsl:element>
+                    <xsl:element name="year">
+                        <xsl:value-of select="/ns:teacher/ns:birthdate/ns:year" />
+                    </xsl:element>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="date">
+                    <xsl:element name="day">Unspecified</xsl:element>
+                    <xsl:element name="month">Unspecified</xsl:element>
+                    <xsl:element name="year">Unspecified</xsl:element>
+                </xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="address">
+        <xsl:choose>
+            <xsl:when test="/ns:teacher/ns:address">
+                <xsl:element name="address">
+                    <xsl:value-of select="/ns:teacher/ns:address" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="address">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="uid">
+        <xsl:element name="uid">
+            <xsl:value-of select="/ns:teacher/ns:uid" />
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>


[02/50] [abbrv] cxf git commit: Removing files that aren't needed

Posted by re...@apache.org.
Removing files that aren't needed


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f8764591
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f8764591
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f8764591

Branch: refs/heads/master-jaxrs-2.1
Commit: f8764591c66f51d618907dfe97c2ae1bc95b0d16
Parents: c2a735b
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue May 17 16:35:45 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue May 17 16:35:45 2016 +0100

----------------------------------------------------------------------
 .../src/main/resources/etc/Client_Sign.properties   |   6 ------
 .../main/resources/etc/Server_SignVerf.properties   |   5 -----
 .../src/main/resources/keystore/client-keystore.jks | Bin 1344 -> 0 bytes
 .../main/resources/keystore/server-truststore.jks   | Bin 639 -> 0 bytes
 4 files changed, 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/f8764591/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/etc/Client_Sign.properties
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/etc/Client_Sign.properties b/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/etc/Client_Sign.properties
deleted file mode 100644
index 55ee060..0000000
--- a/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/etc/Client_Sign.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-org.apache.ws.security.crypto.provider=org.apache.wss4j.common.crypto.Merlin
-org.apache.ws.security.crypto.merlin.keystore.type=jks
-org.apache.ws.security.crypto.merlin.keystore.password=storepassword
-org.apache.ws.security.crypto.merlin.keystore.alias=clientx509v1
-org.apache.ws.security.crypto.merlin.keystore.file=keystore/client-keystore.jks
-

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8764591/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/etc/Server_SignVerf.properties
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/etc/Server_SignVerf.properties b/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/etc/Server_SignVerf.properties
deleted file mode 100644
index c06ac2c..0000000
--- a/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/etc/Server_SignVerf.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-org.apache.ws.security.crypto.provider=org.apache.wss4j.common.crypto.Merlin
-org.apache.ws.security.crypto.merlin.keystore.type=jks
-org.apache.ws.security.crypto.merlin.keystore.password=storepassword
-org.apache.ws.security.crypto.merlin.keystore.alias=clientx509v1
-org.apache.ws.security.crypto.merlin.keystore.file=keystore/server-truststore.jks

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8764591/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/keystore/client-keystore.jks
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/keystore/client-keystore.jks b/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/keystore/client-keystore.jks
deleted file mode 100644
index bc744f9..0000000
Binary files a/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/keystore/client-keystore.jks and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8764591/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/keystore/server-truststore.jks
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/keystore/server-truststore.jks b/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/keystore/server-truststore.jks
deleted file mode 100644
index 2447028..0000000
Binary files a/distribution/src/main/release/samples/ws_security/sign_enc_policy/src/main/resources/keystore/server-truststore.jks and /dev/null differ


[11/50] [abbrv] cxf git commit: Adding initial StaxSerializer for XML Security

Posted by re...@apache.org.
Adding initial StaxSerializer for XML Security


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3cfc25de
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3cfc25de
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3cfc25de

Branch: refs/heads/master-jaxrs-2.1
Commit: 3cfc25def74eec26cb1a673b55540e2d1c3ca267
Parents: 62130bc
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu May 19 14:55:12 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu May 19 14:55:12 2016 +0100

----------------------------------------------------------------------
 .../cxf/ws/security/wss4j/StaxSerializer.java   | 104 +++++++++++++++++++
 .../ws/security/wss4j/WSS4JInInterceptor.java   |   1 +
 2 files changed, 105 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/3cfc25de/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
new file mode 100644
index 0000000..9af3d2f
--- /dev/null
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
@@ -0,0 +1,104 @@
+/**
+ * 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.ws.security.wss4j;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.dom.DOMResult;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.xml.security.encryption.AbstractSerializer;
+import org.apache.xml.security.encryption.XMLEncryptionException;
+
+/**
+ * Converts <code>String</code>s into <code>Node</code>s and visa versa using CXF's StaxUtils
+ */
+public class StaxSerializer extends AbstractSerializer {
+
+    /**
+     * @param source
+     * @param ctx
+     * @return the Node resulting from the parse of the source
+     * @throws XMLEncryptionException
+     */
+    public Node deserialize(byte[] source, Node ctx) throws XMLEncryptionException {
+        byte[] fragment = createContext(source, ctx);
+        return deserialize(ctx, new InputSource(new ByteArrayInputStream(fragment)));
+    }
+
+    /**
+     * @param source
+     * @param ctx
+     * @return the Node resulting from the parse of the source
+     * @throws XMLEncryptionException
+     */
+    public Node deserialize(String source, Node ctx) throws XMLEncryptionException {
+        String fragment = createContext(source, ctx);
+        return deserialize(ctx, new InputSource(new StringReader(fragment)));
+    }
+
+    /**
+     * @param ctx
+     * @param inputSource
+     * @return the Node resulting from the parse of the source
+     * @throws XMLEncryptionException
+     */
+    private Node deserialize(Node ctx, InputSource inputSource) throws XMLEncryptionException {
+        
+        Document contextDocument = null;
+        if (Node.DOCUMENT_NODE == ctx.getNodeType()) {
+            contextDocument = (Document)ctx;
+        } else {
+            contextDocument = ctx.getOwnerDocument();
+        }
+        
+        XMLStreamReader reader = StaxUtils.createXMLStreamReader(inputSource);
+        
+        // Import to a dummy fragment
+        DocumentFragment dummyFragment = contextDocument.createDocumentFragment();
+        XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(new DOMResult(dummyFragment));
+        
+        try {
+            StaxUtils.copy(reader, writer);
+        } catch (XMLStreamException ex) {
+            throw new XMLEncryptionException(ex);
+        }
+        
+        // Remove the "dummy" wrapper
+        DocumentFragment result = contextDocument.createDocumentFragment();
+        Node child = dummyFragment.getFirstChild().getFirstChild();
+        while (child != null) {
+            Node nextChild = child.getNextSibling();
+            result.appendChild(child);
+            child = nextChild;
+        }
+        
+        return result;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/3cfc25de/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
index 1a0a758..b506853 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
@@ -196,6 +196,7 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor {
             config = engine.getWssConfig();
         }
         reqData.setWssConfig(config);
+        // reqData.setEncryptionSerializer(new StaxSerializer());
         
         // Add Audience Restrictions for SAML
         configureAudienceRestriction(msg, reqData);


[33/50] [abbrv] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java
new file mode 100644
index 0000000..2059a7a
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java
@@ -0,0 +1,196 @@
+/**
+ * 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.ws.transfer.integration;
+
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.BindingProvider;
+
+import org.w3c.dom.Document;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.ContextUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resource.ResourceLocal;
+import org.apache.cxf.ws.transfer.resource.ResourceRemote;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactoryImpl;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.SimpleResourceResolver;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+public class IntegrationBaseTest {
+    
+    public static final String RESOURCE_FACTORY_ADDRESS = "local://ResourceFactory";
+    
+    public static final String RESOURCE_ADDRESS = "local://ResourceLocal";
+    
+    public static final String RESOURCE_REMOTE_ADDRESS = "local://ResourceRemote";
+    
+    public static final String RESOURCE_REMOTE_MANAGER_ADDRESS = "local://ResourceRemote"
+            + TransferConstants.RESOURCE_REMOTE_SUFFIX;
+    
+    public static final String RESOURCE_LOCAL_ADDRESS = "local://ResourceLocal";
+    
+    protected static DocumentBuilderFactory documentBuilderFactory;
+    
+    protected static DocumentBuilder documentBuilder;
+    
+    protected static Document document;
+    
+    protected Bus bus;
+    
+    @BeforeClass
+    public static void beforeClass() throws ParserConfigurationException {
+        documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        document = documentBuilder.newDocument();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        documentBuilderFactory = null;
+        documentBuilder = null;
+        document = null;
+    }
+    
+    @Before
+    public void before() {
+        bus = BusFactory.getDefaultBus();
+    }
+    
+    @After
+    public void after() {
+        bus.shutdown(true);
+        bus = null;
+    }
+    
+    protected Server createLocalResourceFactory(ResourceManager manager) {
+        ResourceFactoryImpl implementor = new ResourceFactoryImpl();
+        implementor.setResourceResolver(new SimpleResourceResolver(RESOURCE_ADDRESS, manager));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_ADDRESS);
+        factory.setServiceBean(implementor);
+        
+        return factory.create();
+    }
+    
+    protected Server createRemoteResourceFactory() {
+        ResourceFactoryImpl implementor = new ResourceFactoryImpl();
+        implementor.setResourceResolver(new SimpleResourceResolver(RESOURCE_REMOTE_ADDRESS, null));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_ADDRESS);
+        factory.setServiceBean(implementor);
+        return factory.create();
+    }
+    
+    protected Server createRemoteResource(ResourceManager manager) {
+        ResourceRemote implementor = new ResourceRemote();
+        implementor.setManager(manager);
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        
+        Map<String, Object> props = factory.getProperties(true);
+        props.put("jaxb.additionalContextClasses",
+                org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType.class);
+        factory.setProperties(props);
+        
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_REMOTE_MANAGER_ADDRESS);
+        factory.setServiceBean(implementor);
+        return factory.create();
+    }
+    
+    protected Server createLocalResource(ResourceManager manager) {
+        ResourceLocal implementor = new ResourceLocal();
+        implementor.setManager(manager);
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        
+        Map<String, Object> props = factory.getProperties(true);
+        props.put("jaxb.additionalContextClasses",
+                org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType.class);
+        factory.setProperties(props);
+        
+        factory.setBus(bus);
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(RESOURCE_LOCAL_ADDRESS);
+        factory.setServiceBean(implementor);
+        return factory.create();
+    }
+
+    protected Representation getRepresentation(String content) throws XMLStreamException {
+        Document doc = null;
+        doc = StaxUtils.read(new StringReader(content));
+        Representation representation = new Representation();
+        representation.setAny(doc.getDocumentElement());
+        return representation;
+    }
+
+    protected Resource createClient(ReferenceParametersType refParams) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+
+        Map<String, Object> props = factory.getProperties();
+        if (props == null) {
+            props = new HashMap<String, Object>();
+        }
+        props.put("jaxb.additionalContextClasses",
+                ExpressionType.class);
+        factory.setProperties(props);
+
+        factory.setBus(bus);
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(RESOURCE_ADDRESS);
+        Resource proxy = (Resource) factory.create();
+
+        // Add reference parameters
+        AddressingProperties addrProps = new AddressingProperties();
+        EndpointReferenceType endpoint = new EndpointReferenceType();
+        endpoint.setReferenceParameters(refParams);
+        endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS));
+        addrProps.setTo(endpoint);
+        ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
+
+        return proxy;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java
new file mode 100644
index 0000000..85dabb0
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java
@@ -0,0 +1,135 @@
+/**
+ * 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.ws.transfer.integration;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ResourceFactoryTest extends IntegrationBaseTest {
+    
+    private static final String RESOURCE_UUID = "123456";
+    
+    private static final String REF_PARAM_NAMESPACE = "org.apache.cxf.transfer/manager";
+    
+    private static final String REF_PARAM_LOCAL_NAME = "UUID";
+    
+    private ReferenceParametersType createReferenceParameters() {
+        ReferenceParametersType refParam = new ReferenceParametersType();
+        Element uuidEl = DOMUtils.createDocument().createElementNS(
+                REF_PARAM_NAMESPACE, REF_PARAM_LOCAL_NAME);
+        uuidEl.setTextContent(RESOURCE_UUID);
+        refParam.getAny().add(uuidEl);
+        return refParam;
+    }
+    
+    private Element createXMLRepresentation() {
+        Element root = document.createElement("root");
+        Element child1 = document.createElement("child1");
+        Element child2 = document.createElement("child2");
+        root.appendChild(child1);
+        root.appendChild(child2);
+        return root;
+    }
+    
+    private ResourceFactory createClient() {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_ADDRESS);
+        return (ResourceFactory) factory.create();
+    }
+    
+    @Test
+    public void createLocalResourceTest() {
+        ReferenceParametersType refParams = createReferenceParameters();
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.create(EasyMock.isA(Representation.class)))
+                .andReturn(refParams);
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+        
+        Server localResourceFactory = createLocalResourceFactory(manager);
+        ResourceFactory client = createClient();
+        
+        Create createRequest = new Create();
+        Representation representation = new Representation();
+        representation.setAny(createXMLRepresentation());
+        createRequest.setRepresentation(representation);
+        
+        CreateResponse response = client.create(createRequest);
+        EasyMock.verify(manager);
+        
+        Assert.assertEquals("ResourceAddress is other than expected.", RESOURCE_ADDRESS,
+                response.getResourceCreated().getAddress().getValue());
+        Element refParamEl = (Element) response.getResourceCreated().getReferenceParameters().getAny().get(0);
+        Assert.assertEquals(REF_PARAM_NAMESPACE, refParamEl.getNamespaceURI());
+        Assert.assertEquals(REF_PARAM_LOCAL_NAME, refParamEl.getLocalName());
+        Assert.assertEquals(RESOURCE_UUID, refParamEl.getTextContent());
+        Assert.assertEquals("root", ((Element) response.getRepresentation().getAny()).getLocalName());
+        Assert.assertEquals(2, ((Element) response.getRepresentation().getAny()).getChildNodes().getLength());
+        
+        localResourceFactory.destroy();
+    }
+    
+    @Test
+    public void createRemoteResourceTest() {
+        ReferenceParametersType refParams = createReferenceParameters();
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.create(EasyMock.isA(Representation.class)))
+                .andReturn(refParams);
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+        
+        Server remoteResourceFactory = createRemoteResourceFactory();
+        Server remoteResource = createRemoteResource(manager);
+        ResourceFactory client = createClient();
+        
+        Create createRequest = new Create();
+        Representation representation = new Representation();
+        representation.setAny(createXMLRepresentation());
+        createRequest.setRepresentation(representation);
+        
+        CreateResponse response = client.create(createRequest);
+        EasyMock.verify(manager);
+        
+        Assert.assertEquals("ResourceAddress is other than expected.", RESOURCE_REMOTE_ADDRESS,
+                response.getResourceCreated().getAddress().getValue());
+        Element refParamEl = (Element) response.getResourceCreated().getReferenceParameters().getAny().get(0);
+        Assert.assertEquals(REF_PARAM_NAMESPACE, refParamEl.getNamespaceURI());
+        Assert.assertEquals(REF_PARAM_LOCAL_NAME, refParamEl.getLocalName());
+        Assert.assertEquals(RESOURCE_UUID, refParamEl.getTextContent());
+        Assert.assertEquals("root", ((Element) response.getRepresentation().getAny()).getLocalName());
+        Assert.assertEquals(2, ((Element) response.getRepresentation().getAny()).getChildNodes().getLength());
+        
+        remoteResourceFactory.destroy();
+        remoteResource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java
new file mode 100644
index 0000000..e2d4a3c
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java
@@ -0,0 +1,168 @@
+/**
+ * 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.ws.transfer.integration;
+
+import javax.xml.ws.BindingProvider;
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.ContextUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ResourceTest extends IntegrationBaseTest {
+    
+    private static final String UUID_VALUE = "123456";
+    
+    private static final String REPRESENTATION_NAME = "name1";
+    
+    private static final String REPRESENTATION_NAMESPACE = "test";
+    
+    private static final String REPRESENTATION_VALUE = "value1";
+    
+    protected Resource createClient(ReferenceParametersType refParams) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(RESOURCE_LOCAL_ADDRESS);
+        Resource proxy = (Resource) factory.create();
+
+        // Add reference parameters
+        AddressingProperties addrProps = new AddressingProperties();
+        EndpointReferenceType endpoint = new EndpointReferenceType();
+        endpoint.setReferenceParameters(refParams);
+        endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS));
+        addrProps.setTo(endpoint);
+        ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
+
+        return proxy;
+    }
+    
+    @Test
+    public void getRequestTest() {
+        Element representationEl = document.createElementNS(REPRESENTATION_NAMESPACE, REPRESENTATION_NAME);
+        representationEl.setTextContent(REPRESENTATION_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+        
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.get(EasyMock.isA(ReferenceParametersType.class))).andReturn(representation);
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = document.createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent(UUID_VALUE);
+        refParams.getAny().add(uuid);
+        
+        Server server = createLocalResource(manager);
+        Resource client = createClient(refParams);
+        
+        GetResponse response = client.get(new Get());
+        EasyMock.verify(manager);
+        
+        representationEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                REPRESENTATION_NAMESPACE, representationEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                REPRESENTATION_NAME, representationEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                REPRESENTATION_VALUE, representationEl.getTextContent());
+        
+        server.destroy();
+    }
+    
+    @Test
+    public void putRequestTest() {
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.get(EasyMock.isA(ReferenceParametersType.class))).andReturn(new Representation());
+        EasyMock.expectLastCall().once();
+        manager.put(EasyMock.isA(ReferenceParametersType.class), EasyMock.isA(Representation.class));
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = document.createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent(UUID_VALUE);
+        refParams.getAny().add(uuid);
+        
+        Element representationEl = document.createElementNS(REPRESENTATION_NAMESPACE, REPRESENTATION_NAME);
+        representationEl.setTextContent(REPRESENTATION_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+        
+        Server server = createLocalResource(manager);
+        Resource client = createClient(refParams);
+        
+        Put putRequest = new Put();
+        putRequest.setRepresentation(representation);
+        
+        PutResponse response = client.put(putRequest);
+        EasyMock.verify(manager);
+        
+        representationEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                REPRESENTATION_NAMESPACE, representationEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                REPRESENTATION_NAME, representationEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                REPRESENTATION_VALUE, representationEl.getTextContent());
+        
+        server.destroy();
+    }
+    
+    @Test
+    public void deleteRequestTest() {
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        manager.delete(EasyMock.isA(ReferenceParametersType.class));
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = document.createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent(UUID_VALUE);
+        refParams.getAny().add(uuid);
+        
+        Server server = createLocalResource(manager);
+        Resource client = createClient(refParams);
+        
+        client.delete(new Delete());
+        EasyMock.verify(manager);
+        
+        server.destroy();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java
new file mode 100644
index 0000000..f473339
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java
@@ -0,0 +1,204 @@
+/**
+ * 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.ws.transfer.unit;
+
+import javax.xml.parsers.ParserConfigurationException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownResource;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MemoryResourceManagerTest {
+    
+    public static final String ELEMENT_NAMESPACE = "test";
+    
+    public static final String ELEMENT_NAME = "name1";
+    
+    public static final String ELEMENT_VALUE = "value1";
+    
+    public static final String ELEMENT_VALUE_NEW = "value2";
+    
+    private static Document document;
+    
+    private ResourceManager resourceManager;
+    
+    @BeforeClass
+    public static void beforeClass() throws ParserConfigurationException {
+        document = DOMUtils.createDocument();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        document = null;
+    }
+    
+    @Before
+    public void before() {
+        resourceManager = new MemoryResourceManager();
+    }
+    
+    @After
+    public void after() {
+        resourceManager = null;
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void getEmptyReferenceParamsTest() {
+        resourceManager.get(new ReferenceParametersType());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void getUnknownReferenceParamsTest() {
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = DOMUtils.createDocument().createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent("123456");
+        refParams.getAny().add(uuid);
+        resourceManager.get(refParams);
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void putEmptyReferenceParamsTest() {
+        resourceManager.put(new ReferenceParametersType(), new Representation());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void putUnknownReferenceParamsTest() {
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = DOMUtils.createDocument().createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent("123456");
+        refParams.getAny().add(uuid);
+        resourceManager.put(refParams, new Representation());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void deleteEmptyReferenceParamsTest() {
+        resourceManager.delete(new ReferenceParametersType());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void deleteUnknownReferenceParamsTest() {
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = DOMUtils.createDocument().createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent("123456");
+        refParams.getAny().add(uuid);
+        resourceManager.delete(refParams);
+    }
+    
+    @Test
+    public void createTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        Assert.assertTrue("ResourceManager returned unexpected count of reference elements.",
+                refParams.getAny().size() == 1);
+    }
+    
+    @Test
+    public void getTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        Representation returnedRepresentation = resourceManager.get(refParams);
+        
+        Element returnedEl = (Element) returnedRepresentation.getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                ELEMENT_NAMESPACE, returnedEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                ELEMENT_NAME, returnedEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                ELEMENT_VALUE, returnedEl.getTextContent());
+    }
+    
+    @Test
+    public void putTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+        
+        Element representationElNew = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationElNew.setTextContent(ELEMENT_VALUE_NEW);
+        Representation representationNew = new Representation();
+        representationNew.setAny(representationElNew);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        resourceManager.put(refParams, representationNew);
+        Representation returnedRepresentation = resourceManager.get(refParams);
+        
+        Element returnedEl = (Element) returnedRepresentation.getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                ELEMENT_NAMESPACE, returnedEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                ELEMENT_NAME, returnedEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                ELEMENT_VALUE_NEW, returnedEl.getTextContent());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void deleteTest() {
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        resourceManager.delete(refParams);
+        resourceManager.get(refParams);
+    }
+    
+    @Test
+    public void createEmptyRepresentationTest() {
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Assert.assertTrue("ResourceManager returned unexpected count of reference elements.",
+                refParams.getAny().size() == 1);
+    }
+    
+    @Test
+    public void putEmptyRepresentationTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        resourceManager.put(refParams, new Representation());
+    }
+    
+    @Test
+    public void getEmptyRepresentationTest() {
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Representation returnedRepresentation = resourceManager.get(refParams);
+        Assert.assertNull(returnedRepresentation.getAny());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java
new file mode 100644
index 0000000..45af31f
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.ws.transfer.unit;
+
+import java.io.InputStream;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.validationtransformation.XSDResourceValidator;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class XSDResourceValidatorTest {
+    
+
+    private Representation loadRepresentation(InputStream input) throws XMLStreamException {
+        Document doc = StaxUtils.read(input);
+        Representation representation = new Representation();
+        representation.setAny(doc.getDocumentElement());
+        return representation;
+    }
+    
+    @Test
+    public void validRepresentationTest() throws XMLStreamException {
+        XSDResourceValidator validator = new XSDResourceValidator(
+                new StreamSource(getClass().getResourceAsStream("/xml/xsdresourcevalidator/schema.xsd")));
+        boolean result = validator.validate(loadRepresentation(
+                getClass().getResourceAsStream("/xml/xsdresourcevalidator/validRepresentation.xml")), null);
+        Assert.assertTrue(result);
+    }
+    
+    @Test
+    public void invalidRepresentationTest() throws XMLStreamException {
+        XSDResourceValidator validator = new XSDResourceValidator(
+                new StreamSource(getClass().getResourceAsStream("/xml/xsdresourcevalidator/schema.xsd")));
+        boolean result = validator.validate(loadRepresentation(
+                getClass().getResourceAsStream("/xml/xsdresourcevalidator/invalidRepresentation.xml")), null);
+        Assert.assertFalse(result);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java
new file mode 100644
index 0000000..f70b9c2
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.ws.transfer.unit;
+
+import java.io.InputStream;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceTransformer;
+import org.apache.cxf.ws.transfer.validationtransformation.XSLTResourceTransformer;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class XSLTResourceTransformerTest {
+    
+    private Representation loadRepresentation(InputStream input) throws XMLStreamException {
+        Document doc = StaxUtils.read(input);
+        Representation representation = new Representation();
+        representation.setAny(doc.getDocumentElement());
+        return representation;
+    }
+    
+    @Test
+    public void transformTest() throws XMLStreamException {
+        ResourceTransformer transformer = new XSLTResourceTransformer(new StreamSource(
+                getClass().getResourceAsStream("/xml/xsltresourcetransformer/stylesheet.xsl")));
+        Representation representation = loadRepresentation(
+                getClass().getResourceAsStream("/xml/xsltresourcetransformer/representation.xml"));
+        
+        transformer.transform(representation, null);
+
+        Element representationEl = (Element) representation.getAny();
+        Assert.assertEquals("Expected root element with name \"person\".", "person",
+                representationEl.getLocalName());
+        Assert.assertTrue("Expected one element \"firstname\".",
+                representationEl.getElementsByTagName("firstname").getLength() == 1);
+        Assert.assertTrue("Expected one element \"lastname\".",
+                representationEl.getElementsByTagName("lastname").getLength() == 1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml
new file mode 100644
index 0000000..52be6ce
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<person>
+    <name>Name</name>
+    <surname>Surname</surname>
+</person>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd
new file mode 100644
index 0000000..6a0e7f5
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+  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.
+-->
+
+<xs:schema version="1.0"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:element name="person">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="name" type="xs:string"/>
+                <xs:element name="surname" type="xs:string"/>
+                <xs:element name="address" type="xs:string"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml
new file mode 100644
index 0000000..7d81e0f
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<person>
+    <name>Name</name>
+    <surname>Surname</surname>
+    <address>Address</address>
+</person>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml
new file mode 100644
index 0000000..a472f3c
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<person>
+    <name>Name</name>
+    <surname>Surname</surname>
+</person>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl
new file mode 100644
index 0000000..5519af8
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="/">
+        <xsl:element name="person">
+            <xsl:apply-templates/>
+        </xsl:element>
+    </xsl:template>
+   
+    <xsl:template match="/person/name">
+        <xsl:element name="firstname">
+            <xsl:value-of select="."/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="/person/surname">
+        <xsl:element name="lastname">
+            <xsl:value-of select="."/>
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/pom.xml
----------------------------------------------------------------------
diff --git a/systests/pom.xml b/systests/pom.xml
index b935926..3a5ba50 100644
--- a/systests/pom.xml
+++ b/systests/pom.xml
@@ -50,6 +50,7 @@
         <module>cdi</module>
         <module>rs-http-sci</module>
         <module>tracing</module>
-	<module>jibx</module>
+        <module>jibx</module>
+        <module>ws-transfer</module>
     </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/pom.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/pom.xml b/systests/ws-transfer/pom.xml
new file mode 100644
index 0000000..f032f51
--- /dev/null
+++ b/systests/ws-transfer/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    
+    <artifactId>cxf-systests-ws-transfer</artifactId>
+    <name>Apache CXF WS-Transfer System Tests</name>
+    <description>Apache CXF WS-Transfer System Tests</description>
+    <url>http://cxf.apache.org</url>
+    
+    <parent>
+        <artifactId>cxf-parent</artifactId>
+        <groupId>org.apache.cxf</groupId>
+        <version>3.2.0-SNAPSHOT</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+    
+    <dependencies>
+        <dependency>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>${project.groupId}</groupId>
+          <artifactId>cxf-rt-frontend-jaxws</artifactId>
+          <version>${project.version}</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>${project.groupId}</groupId>
+          <artifactId>cxf-rt-ws-transfer</artifactId>
+          <version>${project.version}</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>${project.groupId}</groupId>
+          <artifactId>cxf-rt-transports-http-jetty</artifactId>
+          <version>${project.version}</version>
+          <scope>test</scope>
+        </dependency>
+    </dependencies>
+    
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java
new file mode 100644
index 0000000..2f9feaa
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java
@@ -0,0 +1,103 @@
+/**
+ * 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.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CreateStudentTest {
+    
+    
+    @BeforeClass
+    public static void beforeClass() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void createStudentTest() throws XMLStreamException {
+        Document createStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudent.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_STUDENTS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+
+    @Test
+    public void createStudentPartialTest() throws XMLStreamException {
+        Document createStudentPartialXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudentPartial.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentPartialXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_STUDENTS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void createStudentWrongTest() throws XMLStreamException {
+        Document createStudentWrongXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudentWrong.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentWrongXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        rf.create(request);
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void createRandomTest() throws XMLStreamException {
+        Document randomXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/random.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(randomXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        rf.create(request);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java
new file mode 100644
index 0000000..9a67b9a
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java
@@ -0,0 +1,91 @@
+/**
+ * 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.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CreateTeacherTest {
+    
+    @BeforeClass
+    public static void beforeClass() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void createTeacherTest() throws XMLStreamException {
+        Document createTeacherXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacher.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_TEACHERS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+
+    @Test
+    public void createTeacherPartialTest() throws XMLStreamException {
+        Document createTeacherPartialXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacherPartial.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherPartialXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_TEACHERS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void createTeacherWrongTest() throws XMLStreamException {
+        Document createTeacherWrongXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacherWrong.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherWrongXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        rf.create(request);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java
new file mode 100644
index 0000000..b25a944
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java
@@ -0,0 +1,118 @@
+/**
+ * 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.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DeleteTest {
+    
+    @Before
+    public void before() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @After
+    public void after() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void deleteStudent() throws XMLStreamException {
+        CreateResponse response = createStudent();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void getDeletedStudent() throws XMLStreamException {
+        CreateResponse response = createStudent();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.get(new Get());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void deleteDeletedStudent() throws XMLStreamException {
+        CreateResponse response = createStudent();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.delete(new Delete());
+    }
+    
+    @Test
+    public void deleteTeacher() throws XMLStreamException {
+        CreateResponse response = createTeacher();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void getDeletedTeacher() throws XMLStreamException {
+        CreateResponse response = createTeacher();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.get(new Get());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void deleteDeletedTeacher() throws XMLStreamException {
+        CreateResponse response = createTeacher();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.delete(new Delete());
+    }
+    
+    private CreateResponse createStudent() throws XMLStreamException {
+        Document createStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudent.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+    
+    private CreateResponse createTeacher() throws XMLStreamException {
+        Document createTeacherXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacher.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java
new file mode 100644
index 0000000..65fdce7
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java
@@ -0,0 +1,111 @@
+/**
+ * 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.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class GetTest {
+    
+    private static EndpointReferenceType studentRef;
+    
+    private static EndpointReferenceType teacherRef;
+    
+    @BeforeClass
+    public static void beforeClass() throws XMLStreamException {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        
+        Document createStudentXML = StaxUtils.read(
+                GetTest.class.getResourceAsStream("/xml/createStudent.xml"));
+        Create studentRequest = new Create();
+        studentRequest.setRepresentation(new Representation());
+        studentRequest.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        studentRef = rf.create(studentRequest).getResourceCreated();
+        
+        Document createTeacherXML = StaxUtils.read(
+                GetTest.class.getResourceAsStream("/xml/createTeacher.xml"));
+        Create teacherRequest = new Create();
+        teacherRequest.setRepresentation(new Representation());
+        teacherRequest.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        teacherRef = rf.create(teacherRequest).getResourceCreated();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void getStudentTest() {
+        Resource client = TestUtils.createResourceClient(studentRef);
+        GetResponse response = client.get(new Get());
+        
+        Element representation = (Element) response.getRepresentation().getAny();
+        NodeList children = representation.getChildNodes();
+        for (int i = 0; i < children.getLength(); i++) {
+            Element child = (Element) children.item(i);
+            if ("name".equals(child.getLocalName())) {
+                Assert.assertEquals("John", child.getTextContent());
+            } else if ("surname".equals(child.getLocalName())) {
+                Assert.assertEquals("Smith", child.getTextContent());
+            } else if ("address".equals(child.getLocalName())) {
+                Assert.assertEquals("Street 21", child.getTextContent());
+            }
+        }
+    }
+    
+    @Test
+    public void getTeacherTest() {
+        Resource client = TestUtils.createResourceClient(teacherRef);
+        GetResponse response = client.get(new Get());
+        
+        Element representation = (Element) response.getRepresentation().getAny();
+        NodeList children = representation.getChildNodes();
+        for (int i = 0; i < children.getLength(); i++) {
+            Element child = (Element) children.item(i);
+            if ("name".equals(child.getLocalName())) {
+                Assert.assertEquals("Bob", child.getTextContent());
+            } else if ("surname".equals(child.getLocalName())) {
+                Assert.assertEquals("Stuart", child.getTextContent());
+            } else if ("address".equals(child.getLocalName())) {
+                Assert.assertEquals("Street 526", child.getTextContent());
+            }
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java
new file mode 100644
index 0000000..ec906b6
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java
@@ -0,0 +1,129 @@
+/**
+ * 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.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PutTest {
+    
+    @Before
+    public void before() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @After
+    public void after() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void rightStudentPutTest() throws XMLStreamException {
+        CreateResponse createResponse = createStudent();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putStudent.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void wrongStudentPutTest() throws XMLStreamException {
+        createStudent();
+        CreateResponse createResponse = createStudent();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putStudent.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    @Test
+    public void rightTeacherPutTest() throws XMLStreamException {
+        CreateResponse createResponse = createTeacher();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putTeacher.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void wrongTeacherPutTest() throws XMLStreamException {
+        createStudent();
+        CreateResponse createResponse = createTeacher();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putTeacher.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    private CreateResponse createStudent() throws XMLStreamException {
+        Document createStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudent.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+    
+    private CreateResponse createTeacher() throws XMLStreamException {
+        Document createTeacherXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacher.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java
new file mode 100644
index 0000000..90645d3
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java
@@ -0,0 +1,174 @@
+/**
+ * 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.ws.transfer;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingProvider;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.systest.ws.transfer.resolver.MyResourceResolver;
+import org.apache.cxf.systest.ws.transfer.validator.StudentPutResourceValidator;
+import org.apache.cxf.systest.ws.transfer.validator.TeacherResourceValidator;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resource.ResourceLocal;
+import org.apache.cxf.ws.transfer.resource.ResourceRemote;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactoryImpl;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+import org.apache.cxf.ws.transfer.validationtransformation.XSDResourceTypeIdentifier;
+import org.apache.cxf.ws.transfer.validationtransformation.XSLTResourceTransformer;
+
+/**
+ * Parent test for all tests in WS-Transfer System Tests.
+ */
+public final class TestUtils {
+    
+    public static final String RESOURCE_STUDENTS_URL = "http://localhost:8080/ResourceStudents";
+    
+    public static final String RESOURCE_FACTORY_URL = "http://localhost:8080/ResourceFactory";
+    
+    public static final String RESOURCE_TEACHERS_URL = "http://localhost:8081/ResourceTeachers";
+    
+    private static Server resourceFactoryServer;
+    
+    private static Server studentsResourceServer;
+    
+    private static Server teachersResourceFactoryServer;
+    
+    private static Server teachersResourceServer;
+    
+    private TestUtils() {
+        
+    }
+    
+    protected static ResourceFactory createResourceFactoryClient() {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setServiceClass(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_URL);
+        return (ResourceFactory) factory.create();
+    }
+    
+    protected static Resource createResourceClient(EndpointReferenceType ref) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(ref.getAddress().getValue());
+        Resource proxy = (Resource) factory.create();
+
+        // Add reference parameters
+        AddressingProperties addrProps = new AddressingProperties();
+        addrProps.setTo(ref);
+        ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
+
+        return proxy;
+    }
+    
+    protected static void createStudentsServers() {
+        UIDManager.reset();
+        ResourceManager studentsResourceManager = new MemoryResourceManager();
+        resourceFactoryServer = createResourceFactory(studentsResourceManager);
+        studentsResourceServer = createStudentsResource(studentsResourceManager);
+    }
+    
+    protected static void createTeachersServers() {
+        ResourceManager teachersResourceManager = new MemoryResourceManager();
+        ResourceRemote resource = new ResourceRemote();
+        resource.setManager(teachersResourceManager);
+        resource.getResourceTypeIdentifiers().add(new XSDResourceTypeIdentifier(
+                new StreamSource(TestUtils.class.getResourceAsStream("/schema/teacher.xsd")),
+                new XSLTResourceTransformer(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/xslt/teacherDefaultValues.xsl")),
+                        new TeacherResourceValidator())));
+        teachersResourceFactoryServer = createTeachersResourceFactoryEndpoint(resource);
+        teachersResourceServer = createTeacherResourceEndpoint(resource);
+    }
+    
+    protected static void destroyStudentsServers() {
+        resourceFactoryServer.destroy();
+        studentsResourceServer.destroy();
+    }
+    
+    protected static void destroyTeachersServers() {
+        teachersResourceFactoryServer.destroy();
+        teachersResourceServer.destroy();
+    }
+    
+    private static Server createResourceFactory(ResourceManager resourceManager) {
+        ResourceFactoryImpl resourceFactory = new ResourceFactoryImpl();
+        resourceFactory.setResourceResolver(
+                new MyResourceResolver(RESOURCE_STUDENTS_URL, resourceManager, RESOURCE_TEACHERS_URL));
+        resourceFactory.getResourceTypeIdentifiers().add(
+                new XSDResourceTypeIdentifier(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/schema/studentCreate.xsd")),
+                        new XSLTResourceTransformer(
+                                new StreamSource(TestUtils.class.getResourceAsStream("/xslt/studentCreate.xsl")))));
+        resourceFactory.getResourceTypeIdentifiers().add(
+                new XSDResourceTypeIdentifier(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/schema/teacherCreateBasic.xsd")),
+                        new XSLTResourceTransformer(
+                                new StreamSource(
+                                        TestUtils.class.getResourceAsStream("/xslt/teacherCreateBasic.xsl")))));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory.class);
+        factory.setServiceBean(resourceFactory);
+        factory.setAddress(RESOURCE_FACTORY_URL);
+        
+        return factory.create();
+    }
+    
+    private static Server createStudentsResource(ResourceManager resourceManager) {
+        ResourceLocal resourceLocal = new ResourceLocal();
+        resourceLocal.setManager(resourceManager);
+        resourceLocal.getResourceTypeIdentifiers().add(
+                new XSDResourceTypeIdentifier(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/schema/studentPut.xsd")),
+                        new XSLTResourceTransformer(
+                                new StreamSource(TestUtils.class.getResourceAsStream("/xslt/studentPut.xsl")),
+                                new StudentPutResourceValidator())));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(Resource.class);
+        factory.setServiceBean(resourceLocal);
+        factory.setAddress(RESOURCE_STUDENTS_URL);
+        return factory.create();
+    }
+    
+    private static Server createTeachersResourceFactoryEndpoint(ResourceRemote resource) {
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setServiceBean(resource);
+        factory.setAddress(RESOURCE_TEACHERS_URL + TransferConstants.RESOURCE_REMOTE_SUFFIX);
+        return factory.create();
+    }
+    
+    private static Server createTeacherResourceEndpoint(ResourceRemote resource) {
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(Resource.class);
+        factory.setServiceBean(resource);
+        factory.setAddress(RESOURCE_TEACHERS_URL);
+        return factory.create();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java
new file mode 100644
index 0000000..ea06312
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java
@@ -0,0 +1,40 @@
+/**
+ * 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.ws.transfer;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public final class UIDManager {
+    
+    private static final AtomicInteger UID = new AtomicInteger(1);
+    
+    private UIDManager() {
+        
+    }
+    
+    public static int getUID() {
+        return UID.getAndIncrement();
+    }
+    
+    public static void reset() {
+        UID.set(1);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java
new file mode 100644
index 0000000..54f4c16
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java
@@ -0,0 +1,55 @@
+/**
+ * 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.ws.transfer.resolver;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceReference;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceResolver;
+import org.apache.cxf.ws.transfer.shared.faults.InvalidRepresentation;
+
+public class MyResourceResolver implements ResourceResolver {
+
+    protected String studentURL;
+    
+    protected ResourceManager studentManager;
+    
+    protected String teachersURL;
+    
+    public MyResourceResolver(String studentURL, ResourceManager studentManager, String teachersURL) {
+        this.studentURL = studentURL;
+        this.studentManager = studentManager;
+        this.teachersURL = teachersURL;
+    }
+    
+    @Override
+    public ResourceReference resolve(Create body) {
+        Element representationEl = (Element) body.getRepresentation().getAny();
+        if ("student".equals(representationEl.getLocalName())) {
+            return new ResourceReference(studentURL, studentManager);
+        } else if ("teacher".equals(representationEl.getLocalName())) {
+            return new ResourceReference(teachersURL, null);
+        } else {
+            throw new InvalidRepresentation();
+        }
+    }
+    
+}


[17/50] [abbrv] cxf git commit: Adding outbound serializing functionality

Posted by re...@apache.org.
Adding outbound serializing functionality


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/bba546b4
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/bba546b4
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/bba546b4

Branch: refs/heads/master-jaxrs-2.1
Commit: bba546b4cdde6ff35f935a0bef30394fd4fc0e52
Parents: c29c334
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri May 20 11:44:12 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri May 20 14:01:19 2016 +0100

----------------------------------------------------------------------
 .../cxf/ws/security/wss4j/StaxSerializer.java   | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/bba546b4/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
index 9af3d2f..cc9045b 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
@@ -19,16 +19,20 @@
 package org.apache.cxf.ws.security.wss4j;
 
 import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.StringReader;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 
 import org.apache.cxf.staxutils.StaxUtils;
@@ -61,6 +65,28 @@ public class StaxSerializer extends AbstractSerializer {
         String fragment = createContext(source, ctx);
         return deserialize(ctx, new InputSource(new StringReader(fragment)));
     }
+    
+    @Override
+    public byte[] serializeToByteArray(Element element) throws Exception {
+        try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+            XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(baos);
+            StaxUtils.copy(element, writer);
+            writer.close();
+            return baos.toByteArray();
+        }
+    }
+    
+    @Override
+    public byte[] serializeToByteArray(NodeList content) throws Exception {
+        try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+            XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(baos);
+            for (int i = 0; i < content.getLength(); i++) {
+                StaxUtils.copy(new DOMSource(content.item(i)), writer);
+            }
+            writer.close();
+            return baos.toByteArray();
+        }
+    }
 
     /**
      * @param ctx


[37/50] [abbrv] cxf git commit: [CXF-6915] Support for inlined unencoded payloads in JWS Compact

Posted by re...@apache.org.
[CXF-6915] Support for inlined unencoded payloads in JWS Compact


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/49658f95
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/49658f95
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/49658f95

Branch: refs/heads/master-jaxrs-2.1
Commit: 49658f950be04296afb7e5a8a49e572aeeff80c4
Parents: 517ef67
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Tue May 24 16:24:15 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Tue May 24 16:24:15 2016 +0100

----------------------------------------------------------------------
 .../jose/jaxrs/JwsWriterInterceptor.java        | 22 ++++++++++++++----
 .../security/jose/jws/JwsCompactConsumer.java   |  6 -----
 .../security/jose/jws/JwsCompactProducer.java   |  3 ---
 .../security/jose/jwejws/JAXRSJweJwsTest.java   | 13 +++++++++++
 .../security/jose/jwejws/JAXRSJwsJsonTest.java  | 24 +++++++++++++++++++-
 5 files changed, 54 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/49658f95/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwsWriterInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwsWriterInterceptor.java b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwsWriterInterceptor.java
index e4d8aff..6bf79ed 100644
--- a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwsWriterInterceptor.java
+++ b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwsWriterInterceptor.java
@@ -47,6 +47,7 @@ import org.apache.cxf.rs.security.jose.jws.JwsSignatureProvider;
 public class JwsWriterInterceptor extends AbstractJwsWriterProvider implements WriterInterceptor {
     private boolean contentTypeRequired = true;
     private boolean useJwsOutputStream;
+    private boolean encodePayload = true;
     private JsonMapObjectReaderWriter writer = new JsonMapObjectReaderWriter();
     @Override
     public void aroundWriteTo(WriterInterceptorContext ctx) throws IOException, WebApplicationException {
@@ -57,6 +58,9 @@ public class JwsWriterInterceptor extends AbstractJwsWriterProvider implements W
         JwsHeaders headers = new JwsHeaders();
         JwsSignatureProvider sigProvider = getInitializedSigProvider(headers);
         setContentTypeIfNeeded(headers, ctx);
+        if (!encodePayload) {
+            headers.setPayloadEncodingStatus(false);
+        }
         OutputStream actualOs = ctx.getOutputStream();
         if (useJwsOutputStream) {
             JwsSignature jwsSignature = sigProvider.createJwsSignature(headers);
@@ -65,12 +69,19 @@ public class JwsWriterInterceptor extends AbstractJwsWriterProvider implements W
             byte[] headerBytes = StringUtils.toBytesUTF8(writer.toJson(headers));
             Base64UrlUtility.encodeAndStream(headerBytes, 0, headerBytes.length, jwsStream);
             jwsStream.write(new byte[]{'.'});
-                        
-            Base64UrlOutputStream base64Stream = new Base64UrlOutputStream(jwsStream);
-            ctx.setOutputStream(base64Stream);
+            
+            Base64UrlOutputStream base64Stream = null;
+            if (encodePayload) {           
+                base64Stream = new Base64UrlOutputStream(jwsStream);
+                ctx.setOutputStream(base64Stream);
+            } else {
+                ctx.setOutputStream(jwsStream);
+            }
             ctx.proceed();
             setJoseMediaType(ctx);
-            base64Stream.flush();
+            if (base64Stream != null) {
+                base64Stream.flush();
+            }
             jwsStream.flush();
         } else {
             CachedOutputStream cos = new CachedOutputStream(); 
@@ -107,4 +118,7 @@ public class JwsWriterInterceptor extends AbstractJwsWriterProvider implements W
         MediaType joseMediaType = JAXRSUtils.toMediaType(JoseConstants.MEDIA_TYPE_JOSE);
         ctx.setMediaType(joseMediaType);
     }
+    public void setEncodePayload(boolean encodePayload) {
+        this.encodePayload = encodePayload;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/49658f95/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
index 9d57222..8ec1194 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
@@ -39,7 +39,6 @@ public class JwsCompactConsumer {
     private String jwsPayload;
     private String decodedJwsPayload;
     private JwsHeaders jwsHeaders;
-    private boolean detached;
     public JwsCompactConsumer(String encodedJws) {
         this(encodedJws, null, null);
     }
@@ -67,7 +66,6 @@ public class JwsCompactConsumer {
                 LOG.warning("Compact JWS includes a payload expected to be detached");
                 throw new JwsException(JwsException.Error.INVALID_COMPACT_JWS);
             }
-            detached = true;
             jwsPayload = detachedPayload;
         }
         encodedSequence = parts[0] + "." + jwsPayload;
@@ -106,10 +104,6 @@ public class JwsCompactConsumer {
                 throw new JwsException(JwsException.Error.INVALID_COMPACT_JWS);
             }
             jwsHeaders = new JwsHeaders(joseHeaders.asMap());
-            if (JwsUtils.isPayloadUnencoded(jwsHeaders) && !detached) {
-                LOG.warning("Only detached payload can be unencoded");
-                throw new JwsException(JwsException.Error.INVALID_COMPACT_JWS);
-            }
         }
         return jwsHeaders;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/49658f95/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
index 53c1b0f..5523938 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
@@ -74,9 +74,6 @@ public class JwsCompactProducer {
     private String getSigningInput() {
         checkAlgorithm();
         boolean unencoded = JwsUtils.isPayloadUnencoded(getJwsHeaders());
-        if (unencoded && !detached) {
-            throw new JwsException(JwsException.Error.INVALID_COMPACT_JWS);
-        }
         return Base64UrlUtility.encode(writer.toJson(getJwsHeaders())) 
                + "." 
                + (unencoded ? plainJwsPayload : Base64UrlUtility.encode(plainJwsPayload));

http://git-wip-us.apache.org/repos/asf/cxf/blob/49658f95/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJweJwsTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJweJwsTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJweJwsTest.java
index 0d9e0d1..063b77d 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJweJwsTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJweJwsTest.java
@@ -254,6 +254,13 @@ public class JAXRSJweJwsTest extends AbstractBusClientServerTestBase {
         assertEquals("book", text);
     }
     @Test
+    public void testJwsJwkPlainTextHMacUnencoded() throws Exception {
+        String address = "https://localhost:" + PORT + "/jwsjwkhmac";
+        BookStore bs = createJwsBookStore(address, null, false);
+        String text = bs.echoText("book");
+        assertEquals("book", text);
+    }
+    @Test
     public void testJwsJwkBookHMac() throws Exception {
         String address = "https://localhost:" + PORT + "/jwsjwkhmac";
         BookStore bs = createJwsBookStore(address,
@@ -264,6 +271,11 @@ public class JAXRSJweJwsTest extends AbstractBusClientServerTestBase {
     }
     private BookStore createJwsBookStore(String address, 
                                          List<?> mbProviders) throws Exception {
+        return createJwsBookStore(address, mbProviders, true);
+    }
+    private BookStore createJwsBookStore(String address, 
+                                         List<?> mbProviders,
+                                         boolean encodePayload) throws Exception {
         JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = JAXRSJweJwsTest.class.getResource("client.xml");
@@ -273,6 +285,7 @@ public class JAXRSJweJwsTest extends AbstractBusClientServerTestBase {
         bean.setAddress(address);
         List<Object> providers = new LinkedList<Object>();
         JwsWriterInterceptor jwsWriter = new JwsWriterInterceptor();
+        jwsWriter.setEncodePayload(encodePayload);
         jwsWriter.setUseJwsOutputStream(true);
         providers.add(jwsWriter);
         providers.add(new JwsClientResponseFilter());

http://git-wip-us.apache.org/repos/asf/cxf/blob/49658f95/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsJsonTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsJsonTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsJsonTest.java
index 0089bb7..9ee411b 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsJsonTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsJsonTest.java
@@ -79,6 +79,17 @@ public class JAXRSJwsJsonTest extends AbstractBusClientServerTestBase {
         assertEquals("book", text);
     }
     @Test
+    public void testJwsJsonPlainTextHmacUnencoded() throws Exception {
+        String address = "https://localhost:" + PORT + "/jwsjsonhmac";
+        BookStore bs = createBookStore(address, 
+                                       Collections.singletonMap(JoseConstants.RSSEC_SIGNATURE_PROPS, 
+                                           "org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"),
+                                       null,
+                                       false);
+        String text = bs.echoText("book");
+        assertEquals("book", text);
+    }
+    @Test
     public void testJwsJsonBookBeanHmac() throws Exception {
         String address = "https://localhost:" + PORT + "/jwsjsonhmac";
         BookStore bs = createBookStore(address, 
@@ -170,11 +181,21 @@ public class JAXRSJwsJsonTest extends AbstractBusClientServerTestBase {
                                       List<?> extraProviders) throws Exception {
         return createBookStore(address, 
                                Collections.singletonMap(JoseConstants.RSSEC_SIGNATURE_PROPS, properties),
-                               extraProviders);
+                               extraProviders,
+                               true);
     }
     private BookStore createBookStore(String address, 
                                       Map<String, Object> mapProperties,
                                       List<?> extraProviders) throws Exception {
+        return createBookStore(address, 
+                               mapProperties,
+                               extraProviders,
+                               true);
+    }
+    private BookStore createBookStore(String address, 
+                                      Map<String, Object> mapProperties,
+                                      List<?> extraProviders,
+                                      boolean encodePayload) throws Exception {
         JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = JAXRSJwsJsonTest.class.getResource("client.xml");
@@ -185,6 +206,7 @@ public class JAXRSJwsJsonTest extends AbstractBusClientServerTestBase {
         List<Object> providers = new LinkedList<Object>();
         JwsJsonWriterInterceptor writer = new JwsJsonWriterInterceptor();
         writer.setUseJwsJsonOutputStream(true);
+        writer.setEncodePayload(encodePayload);
         providers.add(writer);
         providers.add(new JwsJsonClientResponseFilter());
         if (extraProviders != null) {


[04/50] [abbrv] cxf git commit: Fix unused imports

Posted by re...@apache.org.
Fix unused imports


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/cf8ac102
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/cf8ac102
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/cf8ac102

Branch: refs/heads/master-jaxrs-2.1
Commit: cf8ac102e728b8745da265ec969f7b5160829fdb
Parents: 0e5fd5a
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue May 17 12:24:18 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue May 17 12:24:18 2016 -0400

----------------------------------------------------------------------
 .../test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java  | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/cf8ac102/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
index 1f6eeb4..c6b2087 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
@@ -30,7 +30,6 @@ import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 
 import org.w3c.dom.Document;
@@ -40,7 +39,6 @@ import org.apache.cxf.helpers.DOMUtils.NullResolver;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.MessageImpl;
-import org.apache.cxf.staxutils.StaxSource;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.junit.Assert;
 import org.junit.Test;


[19/50] [abbrv] cxf git commit: Updates to not create the dummy wrapper if we're using woodstox

Posted by re...@apache.org.
Updates to not create the dummy wrapper if we're using woodstox


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2c40937a
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2c40937a
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2c40937a

Branch: refs/heads/master-jaxrs-2.1
Commit: 2c40937a9d4c52b5265ff736a940a24580487dc1
Parents: e8ea9e7
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri May 20 13:10:48 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri May 20 13:10:48 2016 -0400

----------------------------------------------------------------------
 .../cxf/ws/security/wss4j/StaxSerializer.java   | 116 ++++++++++++++++---
 1 file changed, 99 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2c40937a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
index cf74c01..f3f47f8 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
@@ -21,9 +21,13 @@ package org.apache.cxf.ws.security.wss4j;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
 
+import javax.xml.namespace.NamespaceContext;
 import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPEnvelope;
+import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -33,10 +37,12 @@ import javax.xml.transform.dom.DOMSource;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 
+
 import org.apache.cxf.binding.soap.saaj.SAAJStreamWriter;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.xml.security.encryption.AbstractSerializer;
@@ -46,7 +52,72 @@ import org.apache.xml.security.encryption.XMLEncryptionException;
  * Converts <code>String</code>s into <code>Node</code>s and visa versa using CXF's StaxUtils
  */
 public class StaxSerializer extends AbstractSerializer {
-
+    XMLInputFactory factory;
+    boolean validFactory;
+    
+    boolean addNamespaces(XMLStreamReader reader, Node ctx) {
+        try {
+            NamespaceContext nsctx = reader.getNamespaceContext();
+            if (nsctx instanceof com.ctc.wstx.sr.InputElementStack) {
+                com.ctc.wstx.sr.InputElementStack ies = (com.ctc.wstx.sr.InputElementStack)nsctx;
+                com.ctc.wstx.util.InternCache ic = com.ctc.wstx.util.InternCache.getInstance();
+                
+                Map<String, String> storedNamespaces = new HashMap<String, String>();
+                Node wk = ctx;
+                while (wk != null) {
+                    NamedNodeMap atts = wk.getAttributes();
+                    if (atts != null) {
+                        for (int i = 0; i < atts.getLength(); ++i) {
+                            Node att = atts.item(i);
+                            String nodeName = att.getNodeName();
+                            if ((nodeName.equals("xmlns") || nodeName.startsWith("xmlns:"))
+                                && !storedNamespaces.containsKey(att.getNodeName())) {
+                                
+                                String prefix = att.getLocalName();
+                                if (prefix.equals("xmlns")) {
+                                    prefix = "";
+                                }
+                                prefix = ic.intern(prefix);
+                                ies.addNsBinding(prefix, att.getNodeValue());
+                                storedNamespaces.put(nodeName, att.getNodeValue());
+                            }
+                        }
+                    }
+                    wk = wk.getParentNode();
+                }
+            }
+            return true;
+        } catch (Throwable t) {
+            t.printStackTrace();
+        }
+        return false;
+    }
+    
+    private XMLStreamReader createWstxReader(byte[] source, Node ctx) throws XMLEncryptionException {
+        try {
+            if (factory == null) {
+                factory = StaxUtils.createXMLInputFactory(true);
+                try {
+                    factory.setProperty("com.ctc.wstx.fragmentMode",
+                                        com.ctc.wstx.api.WstxInputProperties.PARSING_MODE_FRAGMENT);
+                    factory.setProperty(org.codehaus.stax2.XMLInputFactory2.P_REPORT_PROLOG_WHITESPACE, Boolean.TRUE);
+                    validFactory = true;
+                } catch (Throwable t) {
+                    //ignore
+                    validFactory = false;
+                }
+            }
+            if (validFactory) {
+                XMLStreamReader reader = factory.createXMLStreamReader(new ByteArrayInputStream(source));
+                if (addNamespaces(reader, ctx)) {
+                    return reader;
+                }
+            }
+        } catch (Throwable e) {
+            //ignore
+        }
+        return null;
+    }
     /**
      * @param source
      * @param ctx
@@ -54,6 +125,10 @@ public class StaxSerializer extends AbstractSerializer {
      * @throws XMLEncryptionException
      */
     public Node deserialize(byte[] source, Node ctx) throws XMLEncryptionException {
+        XMLStreamReader reader = createWstxReader(source, ctx);
+        if (reader != null) {
+            return deserialize(ctx, reader, false);            
+        }
         byte[] fragment = createContext(source, ctx);
         return deserialize(ctx, new InputSource(new ByteArrayInputStream(fragment)));
     }
@@ -98,16 +173,17 @@ public class StaxSerializer extends AbstractSerializer {
      * @throws XMLEncryptionException
      */
     private Node deserialize(Node ctx, InputSource inputSource) throws XMLEncryptionException {
-        
+        XMLStreamReader reader = StaxUtils.createXMLStreamReader(inputSource);
+        return deserialize(ctx, reader, true);
+    }
+    private Node deserialize(Node ctx, XMLStreamReader reader, boolean wrapped) throws XMLEncryptionException {
         Document contextDocument = null;
         if (Node.DOCUMENT_NODE == ctx.getNodeType()) {
             contextDocument = (Document)ctx;
         } else {
             contextDocument = ctx.getOwnerDocument();
         }
-        
-        XMLStreamReader reader = StaxUtils.createXMLStreamReader(inputSource);
-        
+
         XMLStreamWriter writer = null;
         try {
             if (ctx instanceof SOAPElement) {
@@ -122,7 +198,10 @@ public class StaxSerializer extends AbstractSerializer {
                 StaxUtils.copy(reader, writer);
                 
                 DocumentFragment result = contextDocument.createDocumentFragment();
-                Node child = element.getFirstChild().getFirstChild();
+                Node child = element.getFirstChild();
+                if (wrapped) {
+                    child = child.getFirstChild();
+                }
                 if (child != null && child.getNextSibling() == null) {
                     return child;
                 }
@@ -140,18 +219,21 @@ public class StaxSerializer extends AbstractSerializer {
             StaxUtils.copy(reader, writer);
             
             // Remove the "dummy" wrapper
-            DocumentFragment result = contextDocument.createDocumentFragment();
-            Node child = dummyFragment.getFirstChild().getFirstChild();
-            if (child != null && child.getNextSibling() == null) {
-                return child;
-            }
-            while (child != null) {
-                Node nextChild = child.getNextSibling();
-                result.appendChild(child);
-                child = nextChild;
-            }
             
-            return result;
+            if (wrapped) {
+                DocumentFragment result = contextDocument.createDocumentFragment();
+                Node child = dummyFragment.getFirstChild().getFirstChild();
+                if (child != null && child.getNextSibling() == null) {
+                    return child;
+                }
+                while (child != null) {
+                    Node nextChild = child.getNextSibling();
+                    result.appendChild(child);
+                    child = nextChild;
+                }
+                dummyFragment = result;
+            }
+            return dummyFragment;
         } catch (XMLStreamException ex) {
             throw new XMLEncryptionException(ex);
         }


[27/50] [abbrv] cxf git commit: Throw an exception if the client specifies another value with "none" for "prompt"

Posted by re...@apache.org.
Throw an exception if the client specifies another value with "none" for "prompt"


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e2f9b7da
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e2f9b7da
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e2f9b7da

Branch: refs/heads/master-jaxrs-2.1
Commit: e2f9b7da6a5e3c9a678c0b45415ac87735bd0494
Parents: 5e11c6d
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon May 23 15:03:46 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon May 23 15:04:19 2016 +0100

----------------------------------------------------------------------
 .../oidc/idp/OidcAuthorizationCodeService.java  | 29 ++++++++++++++++++++
 .../security/oidc/idp/OidcImplicitService.java  | 18 ++++++++++++
 .../jaxrs/security/oidc/OIDCNegativeTest.java   |  2 --
 3 files changed, 47 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e2f9b7da/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
index 9b6f4f8..a4e9ed5 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
@@ -19,19 +19,26 @@
 package org.apache.cxf.rs.security.oidc.idp;
 
 import java.util.List;
+import java.util.logging.Level;
 
 import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
 
 import org.apache.cxf.rs.security.oauth2.common.Client;
+import org.apache.cxf.rs.security.oauth2.common.OAuthError;
 import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
 import org.apache.cxf.rs.security.oauth2.common.OAuthRedirectionState;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
 import org.apache.cxf.rs.security.oauth2.common.UserSubject;
 import org.apache.cxf.rs.security.oauth2.grants.code.AuthorizationCodeRegistration;
+import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
 import org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService;
+import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
 
 public class OidcAuthorizationCodeService extends AuthorizationCodeGrantService {
+    private static final String PROMPT_PARAMETER = "prompt";
+    
     private boolean skipAuthorizationWithOidcScope;
     @Override
     protected boolean canAuthorizationBeSkipped(Client client,
@@ -47,6 +54,28 @@ public class OidcAuthorizationCodeService extends AuthorizationCodeGrantService
     public void setSkipAuthorizationWithOidcScope(boolean skipAuthorizationWithOidcScope) {
         this.skipAuthorizationWithOidcScope = skipAuthorizationWithOidcScope;
     }
+    
+    @Override
+    protected Response startAuthorization(MultivaluedMap<String, String> params, 
+                                          UserSubject userSubject,
+                                          Client client) {    
+        // Validate the prompt - if it contains "none" then an error is returned with any other value
+        String prompt = params.getFirst(PROMPT_PARAMETER);
+        if (prompt != null) {
+            String[] promptValues = prompt.trim().split(" ");
+            if (promptValues.length > 1) {
+                for (String promptValue : promptValues) {
+                    if ("none".equals(promptValue)) {
+                        LOG.log(Level.FINE, "The prompt value {} is invalid", prompt);
+                        throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
+                    }
+                }
+            }
+        }
+        
+        return super.startAuthorization(params, userSubject, client);
+    }
+    
     protected AuthorizationCodeRegistration createCodeRegistration(OAuthRedirectionState state, 
                                                                    Client client, 
                                                                    List<String> requestedScope, 

http://git-wip-us.apache.org/repos/asf/cxf/blob/e2f9b7da/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
index 558dfd8..c35526c 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
@@ -23,6 +23,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
+import java.util.logging.Level;
 
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
@@ -48,6 +49,8 @@ import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
 
 
 public class OidcImplicitService extends ImplicitGrantService {
+    private static final String PROMPT_PARAMETER = "prompt";
+    
     private boolean skipAuthorizationWithOidcScope;
     private OAuthJoseJwtProducer idTokenHandler;
     private IdTokenProvider idTokenProvider;
@@ -74,6 +77,21 @@ public class OidcImplicitService extends ImplicitGrantService {
             LOG.fine("A nonce is required for the Implicit flow");
             throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
         }
+        
+        // Validate the prompt - if it contains "none" then an error is returned with any other value
+        String prompt = params.getFirst(PROMPT_PARAMETER);
+        if (prompt != null) {
+            String[] promptValues = prompt.trim().split(" ");
+            if (promptValues.length > 1) {
+                for (String promptValue : promptValues) {
+                    if ("none".equals(promptValue)) {
+                        LOG.log(Level.FINE, "The prompt value {} is invalid", prompt);
+                        throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
+                    }
+                }
+            }
+        }
+        
         return super.startAuthorization(params, userSubject, client);
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/e2f9b7da/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
index 3f5d247..d24576b 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
@@ -60,9 +60,7 @@ public class OIDCNegativeTest extends AbstractBusClientServerTestBase {
         );
     }
     
-    // TODO
     @org.junit.Test
-    @org.junit.Ignore
     public void testImplicitFlowPromptNone() throws Exception {
         URL busFile = OIDCFlowTest.class.getResource("client.xml");
         


[41/50] [abbrv] cxf git commit: Updating policies annotation test

Posted by re...@apache.org.
Updating policies annotation test


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/39b19384
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/39b19384
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/39b19384

Branch: refs/heads/master-jaxrs-2.1
Commit: 39b19384a6031968b86dda0f49283dda712a067c
Parents: 0182a29
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed May 25 11:36:28 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed May 25 11:36:49 2016 +0100

----------------------------------------------------------------------
 .../ws/fault/DoubleItPortTypeImplJavaFirst.java    | 17 ++++++++---------
 .../org/apache/cxf/systest/ws/fault/FaultTest.java |  4 ++--
 2 files changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/39b19384/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
index fbbf957..5e20524 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
@@ -24,7 +24,9 @@ import javax.annotation.Resource;
 import javax.jws.WebService;
 import javax.xml.ws.WebServiceContext;
 
+import org.apache.cxf.annotations.Policies;
 import org.apache.cxf.annotations.Policy;
+import org.apache.cxf.annotations.Policy.Placement;
 import org.apache.cxf.feature.Features;
 import org.example.contract.doubleit.DoubleItFault;
 import org.example.contract.doubleit.DoubleItPortType;
@@ -35,22 +37,19 @@ import org.example.contract.doubleit.DoubleItPortType;
             name = "DoubleItSoap11NoPolicyBinding",
             endpointInterface = "org.example.contract.doubleit.DoubleItPortType")
 @Features(features = "org.apache.cxf.feature.LoggingFeature")     
-// @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml")
 public class DoubleItPortTypeImplJavaFirst implements DoubleItPortType {
     @Resource
     WebServiceContext wsContext;
     
-    //@Policies({
-        // @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml")
-        //@Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SignedEncryptedPolicy.xml", 
-         //       placement = Placement.BINDING_OPERATION)
-    //})  
-    
-    @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml")
+    @Policies({
+        @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml"),
+        @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SignedEncryptedPolicy.xml", 
+                placement = Placement.BINDING_OPERATION_OUTPUT)
+    })
     public int doubleIt(int numberToDouble) throws DoubleItFault {
         
         Principal pr = wsContext.getUserPrincipal();
-        if (pr == null || "alice".equals(pr.getName())) {
+        if ("alice".equals(pr.getName())) {
             return numberToDouble * 2;
         }
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/39b19384/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
index e34a511..471f07c 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
@@ -280,7 +280,7 @@ public class FaultTest extends AbstractBusClientServerTestBase {
         // Make a successful invocation
         ((BindingProvider)utPort).getRequestContext().put("security.username", "alice");
         utPort.doubleIt(25);
-        /*
+        
         // Now make an invocation using another username
         ((BindingProvider)utPort).getRequestContext().put("security.username", "bob");
         ((BindingProvider)utPort).getRequestContext().put("security.password", "password");
@@ -290,7 +290,7 @@ public class FaultTest extends AbstractBusClientServerTestBase {
         } catch (Exception ex) {
             assertTrue(ex.getMessage().contains("This is a fault"));
         }
-        */
+        
         ((java.io.Closeable)utPort).close();
         bus.shutdown(true);
     }


[29/50] [abbrv] cxf git commit: Update hsqldb to a more modern version

Posted by re...@apache.org.
Update hsqldb to a more modern version


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1e4b9612
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1e4b9612
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1e4b9612

Branch: refs/heads/master-jaxrs-2.1
Commit: 1e4b96124c326eb96804f6574419797e999acb40
Parents: f9a42a5
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon May 23 17:07:28 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon May 23 17:13:20 2016 +0100

----------------------------------------------------------------------
 rt/rs/security/oauth-parent/oauth2/pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1e4b9612/rt/rs/security/oauth-parent/oauth2/pom.xml
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/pom.xml b/rt/rs/security/oauth-parent/oauth2/pom.xml
index 08f0a1e..e11491a 100644
--- a/rt/rs/security/oauth-parent/oauth2/pom.xml
+++ b/rt/rs/security/oauth-parent/oauth2/pom.xml
@@ -36,7 +36,7 @@
             javax.servlet*;version="${cxf.osgi.javax.servlet.version}"
         </cxf.osgi.import>
         <hibernate.em.version>4.1.0.Final</hibernate.em.version>
-        <hsqldb.version>1.8.0.10</hsqldb.version>
+        <hsqldb.version>2.3.4</hsqldb.version>
         <openjpa.version>2.4.0</openjpa.version>
     </properties>
     <dependencies>
@@ -104,7 +104,7 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>hsqldb</groupId>
+            <groupId>org.hsqldb</groupId>
             <artifactId>hsqldb</artifactId>
             <version>${hsqldb.version}</version>
             <scope>test</scope>


[50/50] [abbrv] cxf git commit: CXF-5855: Introduce support for Server Sent Events. Initial implementation based on Atmosphere

Posted by re...@apache.org.
CXF-5855: Introduce support for Server Sent Events. Initial implementation based on Atmosphere


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/23d6d663
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/23d6d663
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/23d6d663

Branch: refs/heads/master-jaxrs-2.1
Commit: 23d6d663febbc397bf64771325f109fc53252cd0
Parents: ecb6eba
Author: reta <dr...@gmail.com>
Authored: Sun Apr 17 21:44:28 2016 -0400
Committer: reta <dr...@gmail.com>
Committed: Thu May 26 17:44:08 2016 -0400

----------------------------------------------------------------------
 .../src/main/release/samples/jax_rs/sse/LICENSE | 619 +++++++++++++++++++
 .../main/release/samples/jax_rs/sse/README.md   |   4 +
 .../src/main/release/samples/jax_rs/sse/pom.xml | 152 +++++
 .../sse/src/main/java/org/apache/sse/Stats.java |  56 ++
 .../java/org/apache/sse/StatsApplication.java   |  44 ++
 .../org/apache/sse/StatsRestServiceImpl.java    |  80 +++
 .../main/java/org/apache/sse/StatsServer.java   |  62 ++
 .../src/main/resources/META-INF/atmosphere.xml  |   6 +
 .../sse/src/main/resources/META-INF/beans.xml   |  10 +
 .../META-INF/cxf/org.apache.cxf.Logger          |   1 +
 .../sse/src/main/resources/log.properties       |   3 +
 .../jax_rs/sse/src/main/resources/logback.xml   |  16 +
 .../sse/src/main/resources/web-ui/index.html    |  49 ++
 .../resources/web-ui/javascripts/highcharts.js  | 270 ++++++++
 .../web-ui/javascripts/jquery-1.9.0.min.js      |   4 +
 distribution/src/main/release/samples/pom.xml   |   1 +
 parent/pom.xml                                  |  17 +-
 rt/rs/pom.xml                                   |   1 +
 rt/rs/sse/pom.xml                               |  70 +++
 .../jaxrs/sse/OutboundSseEventBodyWriter.java   | 139 +++++
 .../cxf/jaxrs/sse/OutboundSseEventImpl.java     | 171 +++++
 .../cxf/jaxrs/sse/SseBroadcasterImpl.java       |  65 ++
 .../cxf/jaxrs/sse/SseEventOutputProvider.java   |  53 ++
 .../org/apache/cxf/jaxrs/sse/SseFeature.java    |  41 ++
 .../SseAtmosphereContextProvider.java           |  57 ++
 .../SseAtmosphereEventOutputImpl.java           | 111 ++++
 .../atmosphere/SseAtmosphereInterceptor.java    | 180 ++++++
 .../SseAtmosphereInterceptorWriter.java         |  30 +
 .../SseAtmosphereResourceContext.java           |  60 ++
 .../cxf/jaxrs/sse/servlet/CXFSseServlet.java    |  41 ++
 30 files changed, 2412 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/LICENSE
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/LICENSE b/distribution/src/main/release/samples/jax_rs/sse/LICENSE
new file mode 100644
index 0000000..9be94f5
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/LICENSE
@@ -0,0 +1,619 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
+-- activemq-web
+=========================================================================
+== For the behaviour.js library                                        ==
+=========================================================================
+
+Copyright (c) 2005, Ben Nolan
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+    * Neither the name of the Ben Nolan nor the names of its
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=========================================================================
+== For the prototype.js library                                        ==
+=========================================================================
+
+Copyright (c) 2005 Sam Stephenson
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+
+====================================================================
+== Licenses for non-apache libraries included in this assembly    ==
+====================================================================
+
+jetty
+jmdns
+mx4j
+spring
+tanuki wrapper
+xmlpull
+xstream
+
+=========================================================================
+== Jetty is licensed under the Apache License Version 2.0              ==
+=========================================================================
+=========================================================================
+== jmdns is licensed under the Apache License Version 2.0              ==
+=========================================================================
+=========================================================================
+== For the mx4j, mx4j-remote, and mx4j-tools library                   ==
+=========================================================================
+
+         The MX4J License, Version 1.0
+
+         Copyright (c) 2001-2004 by the MX4J contributors.  All rights reserved.
+
+         Redistribution and use in source and binary forms, with or without
+         modification, are permitted provided that the following conditions
+         are met:
+
+         1. Redistributions of source code must retain the above copyright
+            notice, this list of conditions and the following disclaimer.
+
+         2. Redistributions in binary form must reproduce the above copyright
+            notice, this list of conditions and the following disclaimer in
+            the documentation and/or other materials provided with the
+            distribution.
+
+         3. The end-user documentation included with the redistribution,
+            if any, must include the following acknowledgment:
+               "This product includes software developed by the
+                MX4J project (http://mx4j.sourceforge.net)."
+            Alternately, this acknowledgment may appear in the software itself,
+            if and wherever such third-party acknowledgments normally appear.
+
+         4. The name "MX4J" must not be used to endorse or promote
+            products derived from this software without prior written
+            permission.
+            For written permission, please contact
+            biorn_steedom [at] users [dot] sourceforge [dot] net
+
+         5. Products derived from this software may not be called "MX4J",
+            nor may "MX4J" appear in their name, without prior written
+            permission of Simone Bordet.
+
+         THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+         WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+         DISCLAIMED.  IN NO EVENT SHALL THE MX4J CONTRIBUTORS
+         BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+         SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+         LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+         USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+         ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+         OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+         OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+         SUCH DAMAGE.
+         ====================================================================
+
+         This software consists of voluntary contributions made by many
+         individuals on behalf of the MX4J project.  For more information on
+         MX4J, please see
+         <a href="http://mx4j.sourceforge.net" target="_top">the MX4J website</a>.
+
+
+=========================================================================
+== Spring is licensed under the Apache License Version 2.0             ==
+=========================================================================
+
+=========================================================================
+== For the Tanuki Software libraries                                   ==
+=========================================================================
+Copyright (c) 1999, 2004 Tanuki Software
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of the Java Service Wrapper and associated
+documentation files (the "Software"), to deal in the Software
+without  restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sub-license,
+and/or sell copies of the Software, and to permit persons to
+whom the Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+
+Portions of the Software have been derived from source code
+developed by Silver Egg Technology under the following license:
+
+Copyright (c) 2001 Silver Egg Technology
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sub-license, and/or
+sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+
+=========================================================================
+== For the xmlpull library                                             ==
+=========================================================================
+
+XMLPULL API IS FREE
+-------------------
+
+All of the XMLPULL API source code, compiled code, and documentation
+contained in this distribution *except* for tests (see separate LICENSE_TESTS.txt)
+are in the Public Domain.
+
+XMLPULL API comes with NO WARRANTY or guarantee of fitness for any purpose.
+
+Initial authors:
+
+  Stefan Haustein
+  Aleksander Slominski
+
+2001-12-12
+
+=========================================================================
+== For the xstream library                                             ==
+=========================================================================
+
+(BSD Style License)
+
+Copyright (c) 2003-2004, Joe Walnes
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of
+conditions and the following disclaimer. Redistributions in binary form must reproduce
+the above copyright notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the distribution.
+
+Neither the name of XStream nor the names of its contributors may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
+
+=========================================================================
+== For jaxb-api and jaxb-impl (CDDL)                                   ==
+== Source code is at java.net                                          ==
+=========================================================================
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)
+Version 1.0
+
+    *
+
+      1. Definitions.
+          o
+
+            1.1. \u201cContributor\u201d means each individual or entity that creates or contributes to the creation of Modifications.
+          o
+
+            1.2. \u201cContributor Version\u201d means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor.
+          o
+
+            1.3. \u201cCovered Software\u201d means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof.
+          o
+
+            1.4. \u201cExecutable\u201d means the Covered Software in any form other than Source Code.
+          o
+
+            1.5. \u201cInitial Developer\u201d means the individual or entity that first makes Original Software available under this License.
+          o
+
+            1.6. \u201cLarger Work\u201d means a work which combines Covered Software or portions thereof with code not governed by the terms of this License.
+          o
+
+            1.7. \u201cLicense\u201d means this document.
+          o
+
+            1.8. \u201cLicensable\u201d means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.
+          o
+
+            1.9. \u201cModifications\u201d means the Source Code and Executable form of any of the following:
+                +
+
+                  A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications;
+                +
+
+                  B. Any new file that contains any part of the Original Software or previous Modification; or
+                +
+
+                  C. Any new file that is contributed or otherwise made available under the terms of this License.
+          o
+
+            1.10. \u201cOriginal Software\u201d means the Source Code and Executable form of computer software code that is originally released under this License.
+          o
+
+            1.11. \u201cPatent Claims\u201d means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.
+          o
+
+            1.12. \u201cSource Code\u201d means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code.
+          o
+
+            1.13. \u201cYou\u201d (or \u201cYour\u201d) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, \u201cYou\u201d includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, \u201ccontrol\u201d means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
+    *
+
+      2. License Grants.
+          o
+
+            2.1. The Initial Developer Grant.
+
+            Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license:
+                +
+
+                  (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and
+                +
+
+                  (b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof).
+                +
+
+                  (c) The licenses granted in Sections 2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License.
+                +
+
+                  (d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for code that You delete from the Original Software, or (2) for infringements caused by: (i) the modification of the Original Software, or (ii) the combination of the Original Software with other software or devices.
+          o
+
+            2.2. Contributor Grant.
+
+            Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:
+                +
+
+                  (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and
+                +
+
+                  (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1) Modifications made by that Contributor (or portions thereof); and (2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).
+                +
+
+                  (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party.
+                +
+
+                  (d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for any code that Contributor has deleted from the Contributor Version; (2) for infringements caused by: (i) third party modifications of Contributor Version, or (ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3) under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor.
+    *
+
+      3. Distribution Obligations.
+          o
+
+            3.1. Availability of Source Code.
+
+            Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange.
+          o
+
+            3.2. Modifications.
+
+            The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License.
+          o
+
+            3.3. Required Notices.
+
+            You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer.
+          o
+
+            3.4. Application of Additional Terms.
+
+            You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients\u2019 rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.
+          o
+
+            3.5. Distribution of Executable Versions.
+
+            You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipient\u2019s rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.
+          o
+
+            3.6. Larger Works.
+
+            You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software.
+    *
+
+      4. Versions of the License.
+          o
+
+            4.1. New Versions.
+
+            Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License.
+          o
+
+            4.2. Effect of New Versions.
+
+            You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward.
+          o
+
+            4.3. Modified Versions.
+
+            When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a) rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b) otherwise make it clear that the license contains terms which differ from this License.
+    *
+
+      5. DISCLAIMER OF WARRANTY.
+
+      COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN \u201cAS IS\u201d BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+    *
+
+      6. TERMINATION.
+          o
+
+            6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
+          o
+
+            6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as \u201cParticipant\u201d) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant t
 o a written agreement with Participant.
+          o
+
+            6.3. In the event of termination under Sections 6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination.
+    *
+
+      7. LIMITATION OF LIABILITY.
+
+      UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY\u2019S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+    *
+
+      8. U.S. GOVERNMENT END USERS.
+
+      The Covered Software is a \u201ccommercial item,\u201d as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of \u201ccommercial computer software\u201d (as that term is defined at 48 C.F.R. � 252.227-7014(a)(1)) and \u201ccommercial computer software documentation\u201d as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License.
+    *
+
+      9. MISCELLANEOUS.
+
+      This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdiction\u2019s conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys\u2019 fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contr
 act shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software.
+    *
+
+      10. RESPONSIBILITY FOR CLAIMS.
+
+      As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/README.md
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/README.md b/distribution/src/main/release/samples/jax_rs/sse/README.md
new file mode 100644
index 0000000..3f98f8c
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/README.md
@@ -0,0 +1,4 @@
+How to use
+==============
+
+http://localhost:8686/static/

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/pom.xml b/distribution/src/main/release/samples/jax_rs/sse/pom.xml
new file mode 100644
index 0000000..7dde933
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/pom.xml
@@ -0,0 +1,152 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>jax_rs_sse</artifactId>
+
+    <parent>
+        <groupId>org.apache.cxf.samples</groupId>
+        <artifactId>cxf-samples</artifactId>
+        <version>3.2.0-SNAPSHOT</version>
+        <relativePath>../..</relativePath>
+    </parent>
+    
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <cxf.jetty9.version>9.3.5.v20151012</cxf.jetty9.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.enterprise</groupId>
+            <artifactId>cdi-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-integration-cdi</artifactId>
+            <version>3.2.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+            <version>3.2.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-sse</artifactId>
+            <version>3.2.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.jaxrs</groupId>
+            <artifactId>jackson-jaxrs-json-provider</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.weld.servlet</groupId>
+            <artifactId>weld-servlet</artifactId>
+            <version>2.2.16.Final</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.weld</groupId>
+            <artifactId>weld-core</artifactId>
+            <version>2.2.16.Final</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-server</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-plus</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>apache-jsp</artifactId>
+            <version>${cxf.jetty9.version}</version>
+        </dependency>
+
+         <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-webapp</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-webapp</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.eclipse.jetty.websocket</groupId>
+            <artifactId>websocket-server</artifactId>
+            <version>${cxf.jetty9.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.atmosphere</groupId>
+            <artifactId>atmosphere-runtime</artifactId>
+            <version>2.4.3</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>1.6</version>
+                <configuration>
+                    <filters>
+                        <filter>
+                            <artifact>*:*</artifact>
+                            <excludes>
+                                <exclude>META-INF/*.SF</exclude>
+                                <exclude>META-INF/*.DSA</exclude>
+                                <exclude>META-INF/*.RSA</exclude>
+                            </excludes>
+                        </filter>
+                    </filters>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <transformers>
+                                <transformer
+                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                    <mainClass>org.apache.sse.StatsServer</mainClass>
+                                </transformer>
+                                <transformer
+                                    implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+                                    <resource>META-INF/cxf/bus-extensions.txt</resource>
+                                </transformer>
+                            </transformers>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/Stats.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/Stats.java b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/Stats.java
new file mode 100644
index 0000000..44180df
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/Stats.java
@@ -0,0 +1,56 @@
+/**
+ * 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.sse;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(value = Include.NON_NULL)
+public class Stats implements Serializable {
+    private static final long serialVersionUID = -6705829915457870975L;
+
+    private long timestamp;
+    private int load;
+    
+    public Stats() {
+    }
+
+    public Stats(long timestamp, int load) {
+        this.timestamp = timestamp;
+        this.load = load;
+    }
+
+    public long getTimestamp() {
+        return timestamp;
+    }
+    
+    public void setTimestamp(long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public int getLoad() {
+        return load;
+    }
+
+    public void setLoad(int load) {
+        this.load = load;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsApplication.java b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsApplication.java
new file mode 100644
index 0000000..5b8e40a
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsApplication.java
@@ -0,0 +1,44 @@
+/**
+ * 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.sse;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import org.apache.cxf.jaxrs.sse.SseFeature;
+
+@ApplicationPath("api")
+public class StatsApplication extends Application {
+    @Inject private StatsRestServiceImpl statsRestService;
+    
+    @Override
+    public Set<Object> getSingletons() {
+        final Set<Object> singletons = new HashSet<>();
+        singletons.add(new SseFeature());
+        singletons.add(statsRestService);
+        singletons.add(new JacksonJsonProvider());
+        return singletons;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsRestServiceImpl.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsRestServiceImpl.java b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsRestServiceImpl.java
new file mode 100644
index 0000000..85c5ac2
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsRestServiceImpl.java
@@ -0,0 +1,80 @@
+/**
+ * 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.sse;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.Random;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.sse.OutboundSseEvent;
+import javax.ws.rs.sse.SseContext;
+import javax.ws.rs.sse.SseEventOutput;
+
+@Path("/stats")
+public class StatsRestServiceImpl {
+    private static final Random RANDOM = new Random();
+
+    private static OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, final int eventId) {
+        return builder
+            .id("" + eventId)
+            .data(Stats.class, new Stats(new Date().getTime(), RANDOM.nextInt(100)))
+            .mediaType(MediaType.APPLICATION_JSON_TYPE)
+            .build();
+    }
+    
+    @GET
+    @Path("sse/{id}")
+    @Produces("text/event-stream")
+    public SseEventOutput stats(@Context SseContext sseContext, @PathParam("id") final String id) {
+        final SseEventOutput output = sseContext.newOutput();
+        
+        new Thread() {
+            public void run() {
+                try {
+                    output.write(createStatsEvent(sseContext.newEvent().name("stats"), 1));
+                    Thread.sleep(1000);
+                    output.write(createStatsEvent(sseContext.newEvent().name("stats"), 2));
+                    Thread.sleep(1000);
+                    output.write(createStatsEvent(sseContext.newEvent().name("stats"), 3));
+                    Thread.sleep(1000);
+                    output.write(createStatsEvent(sseContext.newEvent().name("stats"), 4));
+                    Thread.sleep(1000);
+                    output.write(createStatsEvent(sseContext.newEvent().name("stats"), 5));
+                    Thread.sleep(1000);
+                    output.write(createStatsEvent(sseContext.newEvent().name("stats"), 6));
+                    Thread.sleep(1000);
+                    output.write(createStatsEvent(sseContext.newEvent().name("stats"), 7));
+                    Thread.sleep(1000);
+                    output.write(createStatsEvent(sseContext.newEvent().name("stats"), 8));
+                    output.close();
+                } catch (final InterruptedException | IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }.start();
+
+        return output;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsServer.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsServer.java b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsServer.java
new file mode 100644
index 0000000..dc36965
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/org/apache/sse/StatsServer.java
@@ -0,0 +1,62 @@
+/**
+ * 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.sse;
+
+import org.apache.cxf.cdi.CXFCdiServlet;
+import org.apache.cxf.jaxrs.sse.servlet.CXFSseServlet;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.HandlerList;
+import org.eclipse.jetty.servlet.DefaultServlet;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener;
+import org.jboss.weld.environment.servlet.Listener;
+
+public final class StatsServer {
+    private StatsServer() {
+    }
+    
+    public static void main(final String[] args) throws Exception {
+        final Server server = new Server(8686);
+
+        final ServletHolder staticHolder = new ServletHolder(new DefaultServlet());
+        final ServletContextHandler staticContext = new ServletContextHandler();
+        staticContext.setContextPath("/static");
+        staticContext.addServlet(staticHolder, "/*");
+        staticContext.setResourceBase(StatsServer.class.getResource("/web-ui").toURI().toString());
+
+         // Register and map the dispatcher servlet
+        final CXFSseServlet cxfServlet = new CXFSseServlet(new CXFCdiServlet());
+        final ServletHolder cxfServletHolder = new ServletHolder(cxfServlet);
+        final ServletContextHandler context = new ServletContextHandler();
+        context.setContextPath("/");
+        context.addEventListener(new Listener());
+        context.addEventListener(new BeanManagerResourceBindingListener());
+        context.addServlet(cxfServletHolder, "/rest/*");
+
+        HandlerList handlers = new HandlerList();
+        handlers.addHandler(staticContext);
+        handlers.addHandler(context);
+        
+        server.setHandler(handlers);
+        server.start();
+        server.join();
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/atmosphere.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/atmosphere.xml b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/atmosphere.xml
new file mode 100644
index 0000000..9fc1344
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/atmosphere.xml
@@ -0,0 +1,6 @@
+<atmosphere-handlers>
+    <!-- CXF -->
+    <atmosphere-handler support-session="false" context-root="/*" class-name="org.atmosphere.handler.ReflectorServletProcessor">
+        <property name="servletClassName" value="org.apache.cxf.cdi.CXFCdiServlet"/>
+    </atmosphere-handler>
+</atmosphere-handlers>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/beans.xml b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..7e2559b
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_1.xsd"	
+	version="1.1">	
+
+	<scan>
+		<exclude name="org.apache.cxf.**" />
+	</scan>
+</beans>

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/cxf/org.apache.cxf.Logger b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
new file mode 100644
index 0000000..27dd788
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
@@ -0,0 +1 @@
+org.apache.cxf.common.logging.Slf4jLogger
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/log.properties
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/log.properties b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/log.properties
new file mode 100644
index 0000000..63477d3
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/log.properties
@@ -0,0 +1,3 @@
+handlers=java.util.logging.ConsoleHandler
+org.jboss.weld.level=FINEST
+java.util.logging.ConsoleHandler.level=FINEST
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/logback.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/logback.xml b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/logback.xml
new file mode 100644
index 0000000..1052186
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/logback.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="5 seconds">
+	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+		<encoder>
+			<pattern>[%level] %d{yyyy-MM-dd HH:mm:ss.SSS} %logger{36} - [%X] %msg%n</pattern>
+		</encoder>
+	</appender>
+
+	<root level="DEBUG">
+		<appender-ref ref="STDOUT" />
+	</root>
+	
+	<logger category="org.jboss.weld">  
+    	<level name="DEBUG"/>  
+	</logger>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/index.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/index.html b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/index.html
new file mode 100644
index 0000000..2aaed6e
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/index.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>SSE: Apache CXF example</title>
+        <script src="javascripts/jquery-1.9.0.min.js" type="text/javascript"></script>
+        <script src="javascripts/highcharts.js" type="text/javascript"></script>
+    </head>
+    
+    <body>
+		<div id="content">
+			<div id="chart">
+			</div>
+		</div>
+	</body>
+</html>
+
+<script type="text/javascript">
+	var chart = new Highcharts.Chart({
+	    chart: {
+	        renderTo: 'chart',
+	        defaultSeriesType: 'spline'
+	    },           
+	    xAxis: {
+	        type: 'datetime'
+	    },   
+	    series: [{
+	        name: "CPU",
+	        data: []
+	       }
+	    ]
+	}); 
+
+	if( !!window.EventSource ) {
+	    var event = new EventSource("http://localhost:8686/rest/api/stats/sse/1");
+	
+	    event.addEventListener('message', function( event ) {	
+	    	var datapoint = jQuery.parseJSON( event.data );
+	    	 
+	    	chart.series[ 0 ].addPoint({
+	            x: datapoint.timestamp,
+	            y: datapoint.load
+	        }, true, chart.series[ 0 ].data.length >= 50 );
+	    } );
+
+	    $('#content').bind('unload',function() {
+	    	event.close();
+		}); 	                       
+	} 	
+</script>
\ No newline at end of file


[49/50] [abbrv] cxf git commit: CXF-5855: Introduce support for Server Sent Events. Initial implementation based on Atmosphere

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/javascripts/highcharts.js
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/javascripts/highcharts.js b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/javascripts/highcharts.js
new file mode 100644
index 0000000..327d865
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/javascripts/highcharts.js
@@ -0,0 +1,270 @@
+/*
+ Highcharts JS v3.0.1 (2013-04-09)
+
+ (c) 2009-2013 Torstein H�nsi
+
+ License: www.highcharts.com/license
+*/
+(function(){function v(a,b){var c;a||(a={});for(c in b)a[c]=b[c];return a}function y(){var a,b=arguments.length,c={},d=function(a,b){var c,h;for(h in b)b.hasOwnProperty(h)&&(c=b[h],typeof a!=="object"&&(a={}),a[h]=c&&typeof c==="object"&&Object.prototype.toString.call(c)!=="[object Array]"&&typeof c.nodeType!=="number"?d(a[h]||{},c):b[h]);return a};for(a=0;a<b;a++)c=d(c,arguments[a]);return c}function u(a,b){return parseInt(a,b||10)}function fa(a){return typeof a==="string"}function V(a){return typeof a===
+"object"}function Ba(a){return Object.prototype.toString.call(a)==="[object Array]"}function Ca(a){return typeof a==="number"}function ka(a){return I.log(a)/I.LN10}function da(a){return I.pow(10,a)}function ga(a,b){for(var c=a.length;c--;)if(a[c]===b){a.splice(c,1);break}}function r(a){return a!==x&&a!==null}function A(a,b,c){var d,e;if(fa(b))r(c)?a.setAttribute(b,c):a&&a.getAttribute&&(e=a.getAttribute(b));else if(r(b)&&V(b))for(d in b)a.setAttribute(d,b[d]);return e}function ha(a){return Ba(a)?
+a:[a]}function o(){var a=arguments,b,c,d=a.length;for(b=0;b<d;b++)if(c=a[b],typeof c!=="undefined"&&c!==null)return c}function L(a,b){if(Da&&b&&b.opacity!==x)b.filter="alpha(opacity="+b.opacity*100+")";v(a.style,b)}function U(a,b,c,d,e){a=z.createElement(a);b&&v(a,b);e&&L(a,{padding:0,border:S,margin:0});c&&L(a,c);d&&d.appendChild(a);return a}function ea(a,b){var c=function(){};c.prototype=new a;v(c.prototype,b);return c}function Na(a,b,c,d){var e=N.lang,f=b===-1?((a||0).toString().split(".")[1]||
+"").length:isNaN(b=Q(b))?2:b,b=c===void 0?e.decimalPoint:c,d=d===void 0?e.thousandsSep:d,e=a<0?"-":"",c=String(u(a=Q(+a||0).toFixed(f))),g=c.length>3?c.length%3:0;return e+(g?c.substr(0,g)+d:"")+c.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+d)+(f?b+Q(a-c).toFixed(f).slice(2):"")}function ua(a,b){return Array((b||2)+1-String(a).length).join(0)+a}function Ea(a,b){for(var c="{",d=!1,e,f,g,h,i,j=[];(c=a.indexOf(c))!==-1;){e=a.slice(0,c);if(d){f=e.split(":");g=f.shift().split(".");i=g.length;e=b;for(h=0;h<
+i;h++)e=e[g[h]];if(f.length)f=f.join(":"),g=/\.([0-9])/,h=N.lang,i=void 0,/f$/.test(f)?(i=(i=f.match(g))?i[1]:-1,e=Na(e,i,h.decimalPoint,f.indexOf(",")>-1?h.thousandsSep:"")):e=Ua(f,e)}j.push(e);a=a.slice(c+1);c=(d=!d)?"}":"{"}j.push(a);return j.join("")}function ib(a,b,c,d){var e,c=o(c,1);e=a/c;b||(b=[1,2,2.5,5,10],d&&d.allowDecimals===!1&&(c===1?b=[1,2,5,10]:c<=0.1&&(b=[1/c])));for(d=0;d<b.length;d++)if(a=b[d],e<=(b[d]+(b[d+1]||b[d]))/2)break;a*=c;return a}function yb(a,b){var c=b||[[zb,[1,2,5,
+10,20,25,50,100,200,500]],[jb,[1,2,5,10,15,30]],[Va,[1,2,5,10,15,30]],[Oa,[1,2,3,4,6,8,12]],[oa,[1,2]],[Wa,[1,2]],[Pa,[1,2,3,4,6]],[va,null]],d=c[c.length-1],e=E[d[0]],f=d[1],g;for(g=0;g<c.length;g++)if(d=c[g],e=E[d[0]],f=d[1],c[g+1]&&a<=(e*f[f.length-1]+E[c[g+1][0]])/2)break;e===E[va]&&a<5*e&&(f=[1,2,5]);e===E[va]&&a<5*e&&(f=[1,2,5]);c=ib(a/e,f);return{unitRange:e,count:c,unitName:d[0]}}function Ab(a,b,c,d){var e=[],f={},g=N.global.useUTC,h,i=new Date(b),j=a.unitRange,k=a.count;if(r(b)){j>=E[jb]&&
+(i.setMilliseconds(0),i.setSeconds(j>=E[Va]?0:k*T(i.getSeconds()/k)));if(j>=E[Va])i[Bb](j>=E[Oa]?0:k*T(i[kb]()/k));if(j>=E[Oa])i[Cb](j>=E[oa]?0:k*T(i[lb]()/k));if(j>=E[oa])i[mb](j>=E[Pa]?1:k*T(i[Qa]()/k));j>=E[Pa]&&(i[Db](j>=E[va]?0:k*T(i[Xa]()/k)),h=i[Ya]());j>=E[va]&&(h-=h%k,i[Eb](h));if(j===E[Wa])i[mb](i[Qa]()-i[nb]()+o(d,1));b=1;h=i[Ya]();for(var d=i.getTime(),m=i[Xa](),l=i[Qa](),i=g?0:(864E5+i.getTimezoneOffset()*6E4)%864E5;d<c;)e.push(d),j===E[va]?d=Za(h+b*k,0):j===E[Pa]?d=Za(h,m+b*k):!g&&(j===
+E[oa]||j===E[Wa])?d=Za(h,m,l+b*k*(j===E[oa]?1:7)):(j<=E[Oa]&&d%E[oa]===i&&(f[d]=oa),d+=j*k),b++;e.push(d)}e.info=v(a,{higherRanks:f,totalRange:j*k});return e}function Fb(){this.symbol=this.color=0}function Gb(a,b){var c=a.length,d,e;for(e=0;e<c;e++)a[e].ss_i=e;a.sort(function(a,c){d=b(a,c);return d===0?a.ss_i-c.ss_i:d});for(e=0;e<c;e++)delete a[e].ss_i}function Fa(a){for(var b=a.length,c=a[0];b--;)a[b]<c&&(c=a[b]);return c}function pa(a){for(var b=a.length,c=a[0];b--;)a[b]>c&&(c=a[b]);return c}function Ga(a,
+b){for(var c in a)a[c]&&a[c]!==b&&a[c].destroy&&a[c].destroy(),delete a[c]}function Ra(a){$a||($a=U(wa));a&&$a.appendChild(a);$a.innerHTML=""}function qa(a,b){var c="Highcharts error #"+a+": www.highcharts.com/errors/"+a;if(b)throw c;else O.console&&console.log(c)}function ia(a){return parseFloat(a.toPrecision(14))}function Ha(a,b){xa=o(a,b.animation)}function Hb(){var a=N.global.useUTC,b=a?"getUTC":"get",c=a?"setUTC":"set";Za=a?Date.UTC:function(a,b,c,g,h,i){return(new Date(a,b,o(c,1),o(g,0),o(h,
+0),o(i,0))).getTime()};kb=b+"Minutes";lb=b+"Hours";nb=b+"Day";Qa=b+"Date";Xa=b+"Month";Ya=b+"FullYear";Bb=c+"Minutes";Cb=c+"Hours";mb=c+"Date";Db=c+"Month";Eb=c+"FullYear"}function ra(){}function Ia(a,b,c,d){this.axis=a;this.pos=b;this.type=c||"";this.isNew=!0;!c&&!d&&this.addLabel()}function ob(a,b){this.axis=a;if(b)this.options=b,this.id=b.id}function Ib(a,b,c,d,e,f){var g=a.chart.inverted;this.axis=a;this.isNegative=c;this.options=b;this.x=d;this.stack=e;this.percent=f==="percent";this.alignOptions=
+{align:b.align||(g?c?"left":"right":"center"),verticalAlign:b.verticalAlign||(g?"middle":c?"bottom":"top"),y:o(b.y,g?4:c?14:-6),x:o(b.x,g?c?-6:6:0)};this.textAlign=b.textAlign||(g?c?"right":"left":"center")}function ab(){this.init.apply(this,arguments)}function pb(){this.init.apply(this,arguments)}function qb(a,b){this.init(a,b)}function rb(a,b){this.init(a,b)}function sb(){this.init.apply(this,arguments)}var x,z=document,O=window,I=Math,t=I.round,T=I.floor,ja=I.ceil,q=I.max,K=I.min,Q=I.abs,Y=I.cos,
+ca=I.sin,Ja=I.PI,bb=Ja*2/360,ya=navigator.userAgent,Jb=O.opera,Da=/msie/i.test(ya)&&!Jb,cb=z.documentMode===8,db=/AppleWebKit/.test(ya),eb=/Firefox/.test(ya),Kb=/(Mobile|Android|Windows Phone)/.test(ya),sa="http://www.w3.org/2000/svg",Z=!!z.createElementNS&&!!z.createElementNS(sa,"svg").createSVGRect,Rb=eb&&parseInt(ya.split("Firefox/")[1],10)<4,$=!Z&&!Da&&!!z.createElement("canvas").getContext,Sa,fb=z.documentElement.ontouchstart!==x,Lb={},tb=0,$a,N,Ua,xa,ub,E,ta=function(){},za=[],wa="div",S="none",
+Mb="rgba(192,192,192,"+(Z?1.0E-4:0.002)+")",zb="millisecond",jb="second",Va="minute",Oa="hour",oa="day",Wa="week",Pa="month",va="year",Nb="stroke-width",Za,kb,lb,nb,Qa,Xa,Ya,Bb,Cb,mb,Db,Eb,aa={};O.Highcharts=O.Highcharts?qa(16,!0):{};Ua=function(a,b,c){if(!r(b)||isNaN(b))return"Invalid date";var a=o(a,"%Y-%m-%d %H:%M:%S"),d=new Date(b),e,f=d[lb](),g=d[nb](),h=d[Qa](),i=d[Xa](),j=d[Ya](),k=N.lang,m=k.weekdays,d=v({a:m[g].substr(0,3),A:m[g],d:ua(h),e:h,b:k.shortMonths[i],B:k.months[i],m:ua(i+1),y:j.toString().substr(2,
+2),Y:j,H:ua(f),I:ua(f%12||12),l:f%12||12,M:ua(d[kb]()),p:f<12?"AM":"PM",P:f<12?"am":"pm",S:ua(d.getSeconds()),L:ua(t(b%1E3),3)},Highcharts.dateFormats);for(e in d)for(;a.indexOf("%"+e)!==-1;)a=a.replace("%"+e,typeof d[e]==="function"?d[e](b):d[e]);return c?a.substr(0,1).toUpperCase()+a.substr(1):a};Fb.prototype={wrapColor:function(a){if(this.color>=a)this.color=0},wrapSymbol:function(a){if(this.symbol>=a)this.symbol=0}};E=function(){for(var a=0,b=arguments,c=b.length,d={};a<c;a++)d[b[a++]]=b[a];return d}(zb,
+1,jb,1E3,Va,6E4,Oa,36E5,oa,864E5,Wa,6048E5,Pa,26784E5,va,31556952E3);ub={init:function(a,b,c){var b=b||"",d=a.shift,e=b.indexOf("C")>-1,f=e?7:3,g,b=b.split(" "),c=[].concat(c),h,i,j=function(a){for(g=a.length;g--;)a[g]==="M"&&a.splice(g+1,0,a[g+1],a[g+2],a[g+1],a[g+2])};e&&(j(b),j(c));a.isArea&&(h=b.splice(b.length-6,6),i=c.splice(c.length-6,6));if(d<=c.length/f)for(;d--;)c=[].concat(c).splice(0,f).concat(c);a.shift=0;if(b.length)for(a=c.length;b.length<a;)d=[].concat(b).splice(b.length-f,f),e&&(d[f-
+6]=d[f-2],d[f-5]=d[f-1]),b=b.concat(d);h&&(b=b.concat(h),c=c.concat(i));return[b,c]},step:function(a,b,c,d){var e=[],f=a.length;if(c===1)e=d;else if(f===b.length&&c<1)for(;f--;)d=parseFloat(a[f]),e[f]=isNaN(d)?a[f]:c*parseFloat(b[f]-d)+d;else e=b;return e}};(function(a){O.HighchartsAdapter=O.HighchartsAdapter||a&&{init:function(b){var c=a.fx,d=c.step,e,f=a.Tween,g=f&&f.propHooks;a.extend(a.easing,{easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c}});a.each(["cur","_default","width","height",
+"opacity"],function(a,b){var e=d,k,m;b==="cur"?e=c.prototype:b==="_default"&&f&&(e=g[b],b="set");(k=e[b])&&(e[b]=function(c){c=a?c:this;m=c.elem;return m.attr?m.attr(c.prop,b==="cur"?x:c.now):k.apply(this,arguments)})});e=function(a){var c=a.elem,d;if(!a.started)d=b.init(c,c.d,c.toD),a.start=d[0],a.end=d[1],a.started=!0;c.attr("d",b.step(a.start,a.end,a.pos,c.toD))};f?g.d={set:e}:d.d=e;this.each=Array.prototype.forEach?function(a,b){return Array.prototype.forEach.call(a,b)}:function(a,b){for(var c=
+0,d=a.length;c<d;c++)if(b.call(a[c],a[c],c,a)===!1)return c};a.fn.highcharts=function(){var a="Chart",b=arguments,c,d;fa(b[0])&&(a=b[0],b=Array.prototype.slice.call(b,1));c=b[0];if(c!==x)c.chart=c.chart||{},c.chart.renderTo=this[0],new Highcharts[a](c,b[1]),d=this;c===x&&(d=za[A(this[0],"data-highcharts-chart")]);return d}},getScript:a.getScript,inArray:a.inArray,adapterRun:function(b,c){return a(b)[c]()},grep:a.grep,map:function(a,c){for(var d=[],e=0,f=a.length;e<f;e++)d[e]=c.call(a[e],a[e],e,a);
+return d},offset:function(b){return a(b).offset()},addEvent:function(b,c,d){a(b).bind(c,d)},removeEvent:function(b,c,d){var e=z.removeEventListener?"removeEventListener":"detachEvent";z[e]&&b&&!b[e]&&(b[e]=function(){});a(b).unbind(c,d)},fireEvent:function(b,c,d,e){var f=a.Event(c),g="detached"+c,h;!Da&&d&&(delete d.layerX,delete d.layerY);v(f,d);b[c]&&(b[g]=b[c],b[c]=null);a.each(["preventDefault","stopPropagation"],function(a,b){var c=f[b];f[b]=function(){try{c.call(f)}catch(a){b==="preventDefault"&&
+(h=!0)}}});a(b).trigger(f);b[g]&&(b[c]=b[g],b[g]=null);e&&!f.isDefaultPrevented()&&!h&&e(f)},washMouseEvent:function(a){var c=a.originalEvent||a;if(c.pageX===x)c.pageX=a.pageX,c.pageY=a.pageY;return c},animate:function(b,c,d){var e=a(b);if(c.d)b.toD=c.d,c.d=1;e.stop();c.opacity!==x&&b.attr&&(c.opacity+="px");e.animate(c,d)},stop:function(b){a(b).stop()}}})(O.jQuery);var W=O.HighchartsAdapter,M=W||{};W&&W.init.call(W,ub);var gb=M.adapterRun,Sb=M.getScript,la=M.inArray,n=M.each,Ob=M.grep,Tb=M.offset,
+Ka=M.map,J=M.addEvent,ba=M.removeEvent,D=M.fireEvent,Pb=M.washMouseEvent,vb=M.animate,Ta=M.stop,M={enabled:!0,align:"center",x:0,y:15,style:{color:"#666",cursor:"default",fontSize:"11px",lineHeight:"14px"}};N={colors:"#2f7ed8,#0d233a,#8bbc21,#910000,#1aadce,#492970,#f28f43,#77a1e5,#c42525,#a6c96a".split(","),symbols:["circle","diamond","square","triangle","triangle-down"],lang:{loading:"Loading...",months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),
+shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),decimalPoint:".",numericSymbols:"k,M,G,T,P,E".split(","),resetZoom:"Reset zoom",resetZoomTitle:"Reset zoom level 1:1",thousandsSep:","},global:{useUTC:!0,canvasToolsURL:"http://code.highcharts.com/3.0.1/modules/canvas-tools.js",VMLRadialGradientURL:"http://code.highcharts.com/3.0.1/gfx/vml-radial-gradient.png"},chart:{borderColor:"#4572A7",borderRadius:5,
+defaultSeriesType:"line",ignoreHiddenSeries:!0,spacingTop:10,spacingRight:10,spacingBottom:15,spacingLeft:10,style:{fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif',fontSize:"12px"},backgroundColor:"#FFFFFF",plotBorderColor:"#C0C0C0",resetZoomButton:{theme:{zIndex:20},position:{align:"right",x:-10,y:10}}},title:{text:"Chart title",align:"center",y:15,style:{color:"#274b6d",fontSize:"16px"}},subtitle:{text:"",align:"center",y:30,style:{color:"#4d759e"}},plotOptions:{line:{allowPointSelect:!1,
+showCheckbox:!1,animation:{duration:1E3},events:{},lineWidth:2,marker:{enabled:!0,lineWidth:0,radius:4,lineColor:"#FFFFFF",states:{hover:{enabled:!0},select:{fillColor:"#FFFFFF",lineColor:"#000000",lineWidth:2}}},point:{events:{}},dataLabels:y(M,{enabled:!1,formatter:function(){return this.y},verticalAlign:"bottom",y:0}),cropThreshold:300,pointRange:0,showInLegend:!0,states:{hover:{marker:{}},select:{marker:{}}},stickyTracking:!0}},labels:{style:{position:"absolute",color:"#3E576F"}},legend:{enabled:!0,
+align:"center",layout:"horizontal",labelFormatter:function(){return this.name},borderWidth:1,borderColor:"#909090",borderRadius:5,navigation:{activeColor:"#274b6d",inactiveColor:"#CCC"},shadow:!1,itemStyle:{cursor:"pointer",color:"#274b6d",fontSize:"12px"},itemHoverStyle:{color:"#000"},itemHiddenStyle:{color:"#CCC"},itemCheckboxStyle:{position:"absolute",width:"13px",height:"13px"},symbolWidth:16,symbolPadding:5,verticalAlign:"bottom",x:0,y:0,title:{style:{fontWeight:"bold"}}},loading:{labelStyle:{fontWeight:"bold",
+position:"relative",top:"1em"},style:{position:"absolute",backgroundColor:"white",opacity:0.5,textAlign:"center"}},tooltip:{enabled:!0,animation:Z,backgroundColor:"rgba(255, 255, 255, .85)",borderWidth:1,borderRadius:3,dateTimeLabelFormats:{millisecond:"%A, %b %e, %H:%M:%S.%L",second:"%A, %b %e, %H:%M:%S",minute:"%A, %b %e, %H:%M",hour:"%A, %b %e, %H:%M",day:"%A, %b %e, %Y",week:"Week from %A, %b %e, %Y",month:"%B %Y",year:"%Y"},headerFormat:'<span style="font-size: 10px">{point.key}</span><br/>',
+pointFormat:'<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>',shadow:!0,snap:Kb?25:10,style:{color:"#333333",cursor:"default",fontSize:"12px",padding:"8px",whiteSpace:"nowrap"}},credits:{enabled:!0,text:"Highcharts.com",href:"http://www.highcharts.com",position:{align:"right",x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#909090",fontSize:"9px"}}};var X=N.plotOptions,W=X.line;Hb();var ma=function(a){var b=[],c,d;(function(a){a&&a.stops?d=Ka(a.stops,
+function(a){return ma(a[1])}):(c=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(a))?b=[u(c[1]),u(c[2]),u(c[3]),parseFloat(c[4],10)]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(a))?b=[u(c[1],16),u(c[2],16),u(c[3],16),1]:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(a))&&(b=[u(c[1]),u(c[2]),u(c[3]),1])})(a);return{get:function(c){var f;d?(f=y(a),f.stops=[].concat(f.stops),n(d,function(a,b){f.stops[b]=[f.stops[b][0],
+a.get(c)]})):f=b&&!isNaN(b[0])?c==="rgb"?"rgb("+b[0]+","+b[1]+","+b[2]+")":c==="a"?b[3]:"rgba("+b.join(",")+")":a;return f},brighten:function(a){if(d)n(d,function(b){b.brighten(a)});else if(Ca(a)&&a!==0){var c;for(c=0;c<3;c++)b[c]+=u(a*255),b[c]<0&&(b[c]=0),b[c]>255&&(b[c]=255)}return this},rgba:b,setOpacity:function(a){b[3]=a;return this}}};ra.prototype={init:function(a,b){this.element=b==="span"?U(b):z.createElementNS(sa,b);this.renderer=a;this.attrSetters={}},opacity:1,animate:function(a,b,c){b=
+o(b,xa,!0);Ta(this);if(b){b=y(b);if(c)b.complete=c;vb(this,a,b)}else this.attr(a),c&&c()},attr:function(a,b){var c,d,e,f,g=this.element,h=g.nodeName.toLowerCase(),i=this.renderer,j,k=this.attrSetters,m=this.shadows,l,p,s=this;fa(a)&&r(b)&&(c=a,a={},a[c]=b);if(fa(a))c=a,h==="circle"?c={x:"cx",y:"cy"}[c]||c:c==="strokeWidth"&&(c="stroke-width"),s=A(g,c)||this[c]||0,c!=="d"&&c!=="visibility"&&(s=parseFloat(s));else{for(c in a)if(j=!1,d=a[c],e=k[c]&&k[c].call(this,d,c),e!==!1){e!==x&&(d=e);if(c==="d")d&&
+d.join&&(d=d.join(" ")),/(NaN| {2}|^$)/.test(d)&&(d="M 0 0");else if(c==="x"&&h==="text")for(e=0;e<g.childNodes.length;e++)f=g.childNodes[e],A(f,"x")===A(g,"x")&&A(f,"x",d);else if(this.rotation&&(c==="x"||c==="y"))p=!0;else if(c==="fill")d=i.color(d,g,c);else if(h==="circle"&&(c==="x"||c==="y"))c={x:"cx",y:"cy"}[c]||c;else if(h==="rect"&&c==="r")A(g,{rx:d,ry:d}),j=!0;else if(c==="translateX"||c==="translateY"||c==="rotation"||c==="verticalAlign"||c==="scaleX"||c==="scaleY")j=p=!0;else if(c==="stroke")d=
+i.color(d,g,c);else if(c==="dashstyle")if(c="stroke-dasharray",d=d&&d.toLowerCase(),d==="solid")d=S;else{if(d){d=d.replace("shortdashdotdot","3,1,1,1,1,1,").replace("shortdashdot","3,1,1,1").replace("shortdot","1,1,").replace("shortdash","3,1,").replace("longdash","8,3,").replace(/dot/g,"1,3,").replace("dash","4,3,").replace(/,$/,"").split(",");for(e=d.length;e--;)d[e]=u(d[e])*a["stroke-width"];d=d.join(",")}}else if(c==="width")d=u(d);else if(c==="align")c="text-anchor",d={left:"start",center:"middle",
+right:"end"}[d];else if(c==="title")e=g.getElementsByTagName("title")[0],e||(e=z.createElementNS(sa,"title"),g.appendChild(e)),e.textContent=d;c==="strokeWidth"&&(c="stroke-width");if(c==="stroke-width"||c==="stroke"){this[c]=d;if(this.stroke&&this["stroke-width"])A(g,"stroke",this.stroke),A(g,"stroke-width",this["stroke-width"]),this.hasStroke=!0;else if(c==="stroke-width"&&d===0&&this.hasStroke)g.removeAttribute("stroke"),this.hasStroke=!1;j=!0}this.symbolName&&/^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(c)&&
+(l||(this.symbolAttr(a),l=!0),j=!0);if(m&&/^(width|height|visibility|x|y|d|transform)$/.test(c))for(e=m.length;e--;)A(m[e],c,c==="height"?q(d-(m[e].cutHeight||0),0):d);if((c==="width"||c==="height")&&h==="rect"&&d<0)d=0;this[c]=d;c==="text"?(d!==this.textStr&&delete this.bBox,this.textStr=d,this.added&&i.buildText(this)):j||A(g,c,d)}p&&this.updateTransform()}return s},addClass:function(a){A(this.element,"class",A(this.element,"class")+" "+a);return this},symbolAttr:function(a){var b=this;n("x,y,r,start,end,width,height,innerR,anchorX,anchorY".split(","),
+function(c){b[c]=o(a[c],b[c])});b.attr({d:b.renderer.symbols[b.symbolName](b.x,b.y,b.width,b.height,b)})},clip:function(a){return this.attr("clip-path",a?"url("+this.renderer.url+"#"+a.id+")":S)},crisp:function(a,b,c,d,e){var f,g={},h={},i,a=a||this.strokeWidth||this.attr&&this.attr("stroke-width")||0;i=t(a)%2/2;h.x=T(b||this.x||0)+i;h.y=T(c||this.y||0)+i;h.width=T((d||this.width||0)-2*i);h.height=T((e||this.height||0)-2*i);h.strokeWidth=a;for(f in h)this[f]!==h[f]&&(this[f]=g[f]=h[f]);return g},
+css:function(a){var b=this.element,b=a&&a.width&&b.nodeName.toLowerCase()==="text",c,d="",e=function(a,b){return"-"+b.toLowerCase()};if(a&&a.color)a.fill=a.color;this.styles=a=v(this.styles,a);$&&b&&delete a.width;if(Da&&!Z)b&&delete a.width,L(this.element,a);else{for(c in a)d+=c.replace(/([A-Z])/g,e)+":"+a[c]+";";this.attr({style:d})}b&&this.added&&this.renderer.buildText(this);return this},on:function(a,b){if(fb&&a==="click")this.element.ontouchstart=function(a){a.preventDefault();b()};this.element["on"+
+a]=b;return this},setRadialReference:function(a){this.element.radialReference=a;return this},translate:function(a,b){return this.attr({translateX:a,translateY:b})},invert:function(){this.inverted=!0;this.updateTransform();return this},htmlCss:function(a){var b=this.element;if(b=a&&b.tagName==="SPAN"&&a.width)delete a.width,this.textWidth=b,this.updateTransform();this.styles=v(this.styles,a);L(this.element,a);return this},htmlGetBBox:function(){var a=this.element,b=this.bBox;if(!b){if(a.nodeName===
+"text")a.style.position="absolute";b=this.bBox={x:a.offsetLeft,y:a.offsetTop,width:a.offsetWidth,height:a.offsetHeight}}return b},htmlUpdateTransform:function(){if(this.added){var a=this.renderer,b=this.element,c=this.translateX||0,d=this.translateY||0,e=this.x||0,f=this.y||0,g=this.textAlign||"left",h={left:0,center:0.5,right:1}[g],i=g&&g!=="left",j=this.shadows;if(c||d)L(b,{marginLeft:c,marginTop:d}),j&&n(j,function(a){L(a,{marginLeft:c+1,marginTop:d+1})});this.inverted&&n(b.childNodes,function(c){a.invertChild(c,
+b)});if(b.tagName==="SPAN"){var k,m,j=this.rotation,l,p=0,s=1,p=0,wb;l=u(this.textWidth);var B=this.xCorr||0,w=this.yCorr||0,G=[j,g,b.innerHTML,this.textWidth].join(",");k={};if(G!==this.cTT){if(r(j))a.isSVG?(B=Da?"-ms-transform":db?"-webkit-transform":eb?"MozTransform":Jb?"-o-transform":"",k[B]=k.transform="rotate("+j+"deg)"):(p=j*bb,s=Y(p),p=ca(p),k.filter=j?["progid:DXImageTransform.Microsoft.Matrix(M11=",s,", M12=",-p,", M21=",p,", M22=",s,", sizingMethod='auto expand')"].join(""):S),L(b,k);k=
+o(this.elemWidth,b.offsetWidth);m=o(this.elemHeight,b.offsetHeight);if(k>l&&/[ \-]/.test(b.textContent||b.innerText))L(b,{width:l+"px",display:"block",whiteSpace:"normal"}),k=l;l=a.fontMetrics(b.style.fontSize).b;B=s<0&&-k;w=p<0&&-m;wb=s*p<0;B+=p*l*(wb?1-h:h);w-=s*l*(j?wb?h:1-h:1);i&&(B-=k*h*(s<0?-1:1),j&&(w-=m*h*(p<0?-1:1)),L(b,{textAlign:g}));this.xCorr=B;this.yCorr=w}L(b,{left:e+B+"px",top:f+w+"px"});if(db)m=b.offsetHeight;this.cTT=G}}else this.alignOnAdd=!0},updateTransform:function(){var a=this.translateX||
+0,b=this.translateY||0,c=this.scaleX,d=this.scaleY,e=this.inverted,f=this.rotation,g=[];e&&(a+=this.attr("width"),b+=this.attr("height"));(a||b)&&g.push("translate("+a+","+b+")");e?g.push("rotate(90) scale(-1,1)"):f&&g.push("rotate("+f+" "+(this.x||0)+" "+(this.y||0)+")");(r(c)||r(d))&&g.push("scale("+o(c,1)+" "+o(d,1)+")");g.length&&A(this.element,"transform",g.join(" "))},toFront:function(){var a=this.element;a.parentNode.appendChild(a);return this},align:function(a,b,c){var d,e,f,g,h={};e=this.renderer;
+f=e.alignedObjects;if(a){if(this.alignOptions=a,this.alignByTranslate=b,!c||fa(c))this.alignTo=d=c||"renderer",ga(f,this),f.push(this),c=null}else a=this.alignOptions,b=this.alignByTranslate,d=this.alignTo;c=o(c,e[d],e);d=a.align;e=a.verticalAlign;f=(c.x||0)+(a.x||0);g=(c.y||0)+(a.y||0);if(d==="right"||d==="center")f+=(c.width-(a.width||0))/{right:1,center:2}[d];h[b?"translateX":"x"]=t(f);if(e==="bottom"||e==="middle")g+=(c.height-(a.height||0))/({bottom:1,middle:2}[e]||1);h[b?"translateY":"y"]=t(g);
+this[this.placed?"animate":"attr"](h);this.placed=!0;this.alignAttr=h;return this},getBBox:function(){var a=this.bBox,b=this.renderer,c,d=this.rotation;c=this.element;var e=this.styles,f=d*bb;if(!a){if(c.namespaceURI===sa||b.forExport){try{a=c.getBBox?v({},c.getBBox()):{width:c.offsetWidth,height:c.offsetHeight}}catch(g){}if(!a||a.width<0)a={width:0,height:0}}else a=this.htmlGetBBox();if(b.isSVG){b=a.width;c=a.height;if(Da&&e&&e.fontSize==="11px"&&c.toPrecision(3)==="22.7")a.height=c=14;if(d)a.width=
+Q(c*ca(f))+Q(b*Y(f)),a.height=Q(c*Y(f))+Q(b*ca(f))}this.bBox=a}return a},show:function(){return this.attr({visibility:"visible"})},hide:function(){return this.attr({visibility:"hidden"})},fadeOut:function(a){var b=this;b.animate({opacity:0},{duration:a||150,complete:function(){b.hide()}})},add:function(a){var b=this.renderer,c=a||b,d=c.element||b.box,e=d.childNodes,f=this.element,g=A(f,"zIndex"),h;if(a)this.parentGroup=a;this.parentInverted=a&&a.inverted;this.textStr!==void 0&&b.buildText(this);if(g)c.handleZ=
+!0,g=u(g);if(c.handleZ)for(c=0;c<e.length;c++)if(a=e[c],b=A(a,"zIndex"),a!==f&&(u(b)>g||!r(g)&&r(b))){d.insertBefore(f,a);h=!0;break}h||d.appendChild(f);this.added=!0;D(this,"add");return this},safeRemoveChild:function(a){var b=a.parentNode;b&&b.removeChild(a)},destroy:function(){var a=this,b=a.element||{},c=a.shadows,d,e;b.onclick=b.onmouseout=b.onmouseover=b.onmousemove=b.point=null;Ta(a);if(a.clipPath)a.clipPath=a.clipPath.destroy();if(a.stops){for(e=0;e<a.stops.length;e++)a.stops[e]=a.stops[e].destroy();
+a.stops=null}a.safeRemoveChild(b);c&&n(c,function(b){a.safeRemoveChild(b)});a.alignTo&&ga(a.renderer.alignedObjects,a);for(d in a)delete a[d];return null},shadow:function(a,b,c){var d=[],e,f,g=this.element,h,i,j,k;if(a){i=o(a.width,3);j=(a.opacity||0.15)/i;k=this.parentInverted?"(-1,-1)":"("+o(a.offsetX,1)+", "+o(a.offsetY,1)+")";for(e=1;e<=i;e++){f=g.cloneNode(0);h=i*2+1-2*e;A(f,{isShadow:"true",stroke:a.color||"black","stroke-opacity":j*e,"stroke-width":h,transform:"translate"+k,fill:S});if(c)A(f,
+"height",q(A(f,"height")-h,0)),f.cutHeight=h;b?b.element.appendChild(f):g.parentNode.insertBefore(f,g);d.push(f)}this.shadows=d}return this}};var Aa=function(){this.init.apply(this,arguments)};Aa.prototype={Element:ra,init:function(a,b,c,d){var e=location,f;f=this.createElement("svg").attr({xmlns:sa,version:"1.1"});a.appendChild(f.element);this.isSVG=!0;this.box=f.element;this.boxWrapper=f;this.alignedObjects=[];this.url=(eb||db)&&z.getElementsByTagName("base").length?e.href.replace(/#.*?$/,"").replace(/([\('\)])/g,
+"\\$1").replace(/ /g,"%20"):"";this.createElement("desc").add().element.appendChild(z.createTextNode("Created with Highcharts 3.0.1"));this.defs=this.createElement("defs").add();this.forExport=d;this.gradients={};this.setSize(b,c,!1);var g;if(eb&&a.getBoundingClientRect)this.subPixelFix=b=function(){L(a,{left:0,top:0});g=a.getBoundingClientRect();L(a,{left:ja(g.left)-g.left+"px",top:ja(g.top)-g.top+"px"})},b(),J(O,"resize",b)},isHidden:function(){return!this.boxWrapper.getBBox().width},destroy:function(){var a=
+this.defs;this.box=null;this.boxWrapper=this.boxWrapper.destroy();Ga(this.gradients||{});this.gradients=null;if(a)this.defs=a.destroy();this.subPixelFix&&ba(O,"resize",this.subPixelFix);return this.alignedObjects=null},createElement:function(a){var b=new this.Element;b.init(this,a);return b},draw:function(){},buildText:function(a){for(var b=a.element,c=this,d=c.forExport,e=o(a.textStr,"").toString().replace(/<(b|strong)>/g,'<span style="font-weight:bold">').replace(/<(i|em)>/g,'<span style="font-style:italic">').replace(/<a/g,
+"<span").replace(/<\/(b|strong|i|em|a)>/g,"</span>").split(/<br.*?>/g),f=b.childNodes,g=/style="([^"]+)"/,h=/href="([^"]+)"/,i=A(b,"x"),j=a.styles,k=j&&j.width&&u(j.width),m=j&&j.lineHeight,l=f.length;l--;)b.removeChild(f[l]);k&&!a.added&&this.box.appendChild(b);e[e.length-1]===""&&e.pop();n(e,function(e,f){var l,o=0,e=e.replace(/<span/g,"|||<span").replace(/<\/span>/g,"</span>|||");l=e.split("|||");n(l,function(e){if(e!==""||l.length===1){var p={},n=z.createElementNS(sa,"tspan"),q;g.test(e)&&(q=
+e.match(g)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),A(n,"style",q));h.test(e)&&!d&&(A(n,"onclick",'location.href="'+e.match(h)[1]+'"'),L(n,{cursor:"pointer"}));e=(e.replace(/<(.|\n)*?>/g,"")||" ").replace(/&lt;/g,"<").replace(/&gt;/g,">");n.appendChild(z.createTextNode(e));o?p.dx=0:p.x=i;A(n,p);!o&&f&&(!Z&&d&&L(n,{display:"block"}),A(n,"dy",m||c.fontMetrics(/px$/.test(n.style.fontSize)?n.style.fontSize:j.fontSize).h,db&&n.offsetHeight));b.appendChild(n);o++;if(k)for(var e=e.replace(/([^\^])-/g,
+"$1- ").split(" "),r,t=[];e.length||t.length;)delete a.bBox,r=a.getBBox().width,p=r>k,!p||e.length===1?(e=t,t=[],e.length&&(n=z.createElementNS(sa,"tspan"),A(n,{dy:m||16,x:i}),q&&A(n,"style",q),b.appendChild(n),r>k&&(k=r))):(n.removeChild(n.firstChild),t.unshift(e.pop())),e.length&&n.appendChild(z.createTextNode(e.join(" ").replace(/- /g,"-")))}})})},button:function(a,b,c,d,e,f,g){var h=this.label(a,b,c,null,null,null,null,null,"button"),i=0,j,k,m,l,p,a={x1:0,y1:0,x2:0,y2:1},e=y({"stroke-width":1,
+stroke:"#CCCCCC",fill:{linearGradient:a,stops:[[0,"#FEFEFE"],[1,"#F6F6F6"]]},r:2,padding:5,style:{color:"black"}},e);m=e.style;delete e.style;f=y(e,{stroke:"#68A",fill:{linearGradient:a,stops:[[0,"#FFF"],[1,"#ACF"]]}},f);l=f.style;delete f.style;g=y(e,{stroke:"#68A",fill:{linearGradient:a,stops:[[0,"#9BD"],[1,"#CDF"]]}},g);p=g.style;delete g.style;J(h.element,"mouseenter",function(){h.attr(f).css(l)});J(h.element,"mouseleave",function(){j=[e,f,g][i];k=[m,l,p][i];h.attr(j).css(k)});h.setState=function(a){(i=
+a)?a===2&&h.attr(g).css(p):h.attr(e).css(m)};return h.on("click",function(){d.call(h)}).attr(e).css(v({cursor:"default"},m))},crispLine:function(a,b){a[1]===a[4]&&(a[1]=a[4]=t(a[1])-b%2/2);a[2]===a[5]&&(a[2]=a[5]=t(a[2])+b%2/2);return a},path:function(a){var b={fill:S};Ba(a)?b.d=a:V(a)&&v(b,a);return this.createElement("path").attr(b)},circle:function(a,b,c){a=V(a)?a:{x:a,y:b,r:c};return this.createElement("circle").attr(a)},arc:function(a,b,c,d,e,f){if(V(a))b=a.y,c=a.r,d=a.innerR,e=a.start,f=a.end,
+a=a.x;return this.symbol("arc",a||0,b||0,c||0,c||0,{innerR:d||0,start:e||0,end:f||0})},rect:function(a,b,c,d,e,f){e=V(a)?a.r:e;e=this.createElement("rect").attr({rx:e,ry:e,fill:S});return e.attr(V(a)?a:e.crisp(f,a,b,q(c,0),q(d,0)))},setSize:function(a,b,c){var d=this.alignedObjects,e=d.length;this.width=a;this.height=b;for(this.boxWrapper[o(c,!0)?"animate":"attr"]({width:a,height:b});e--;)d[e].align()},g:function(a){var b=this.createElement("g");return r(a)?b.attr({"class":"highcharts-"+a}):b},image:function(a,
+b,c,d,e){var f={preserveAspectRatio:S};arguments.length>1&&v(f,{x:b,y:c,width:d,height:e});f=this.createElement("image").attr(f);f.element.setAttributeNS?f.element.setAttributeNS("http://www.w3.org/1999/xlink","href",a):f.element.setAttribute("hc-svg-href",a);return f},symbol:function(a,b,c,d,e,f){var g,h=this.symbols[a],h=h&&h(t(b),t(c),d,e,f),i=/^url\((.*?)\)$/,j,k;if(h)g=this.path(h),v(g,{symbolName:a,x:b,y:c,width:d,height:e}),f&&v(g,f);else if(i.test(a))k=function(a,b){a.element&&(a.attr({width:b[0],
+height:b[1]}),a.alignByTranslate||a.translate(t((d-b[0])/2),t((e-b[1])/2)))},j=a.match(i)[1],a=Lb[j],g=this.image(j).attr({x:b,y:c}),g.isImg=!0,a?k(g,a):(g.attr({width:0,height:0}),U("img",{onload:function(){k(g,Lb[j]=[this.width,this.height])},src:j}));return g},symbols:{circle:function(a,b,c,d){var e=0.166*c;return["M",a+c/2,b,"C",a+c+e,b,a+c+e,b+d,a+c/2,b+d,"C",a-e,b+d,a-e,b,a+c/2,b,"Z"]},square:function(a,b,c,d){return["M",a,b,"L",a+c,b,a+c,b+d,a,b+d,"Z"]},triangle:function(a,b,c,d){return["M",
+a+c/2,b,"L",a+c,b+d,a,b+d,"Z"]},"triangle-down":function(a,b,c,d){return["M",a,b,"L",a+c,b,a+c/2,b+d,"Z"]},diamond:function(a,b,c,d){return["M",a+c/2,b,"L",a+c,b+d/2,a+c/2,b+d,a,b+d/2,"Z"]},arc:function(a,b,c,d,e){var f=e.start,c=e.r||c||d,g=e.end-0.001,d=e.innerR,h=e.open,i=Y(f),j=ca(f),k=Y(g),g=ca(g),e=e.end-f<Ja?0:1;return["M",a+c*i,b+c*j,"A",c,c,0,e,1,a+c*k,b+c*g,h?"M":"L",a+d*k,b+d*g,"A",d,d,0,e,0,a+d*i,b+d*j,h?"":"Z"]}},clipRect:function(a,b,c,d){var e="highcharts-"+tb++,f=this.createElement("clipPath").attr({id:e}).add(this.defs),
+a=this.rect(a,b,c,d,0).add(f);a.id=e;a.clipPath=f;return a},color:function(a,b,c){var d=this,e,f=/^rgba/,g,h,i,j,k,m,l,p=[];a&&a.linearGradient?g="linearGradient":a&&a.radialGradient&&(g="radialGradient");if(g){c=a[g];h=d.gradients;j=a.stops;b=b.radialReference;Ba(c)&&(a[g]=c={x1:c[0],y1:c[1],x2:c[2],y2:c[3],gradientUnits:"userSpaceOnUse"});g==="radialGradient"&&b&&!r(c.gradientUnits)&&(c=y(c,{cx:b[0]-b[2]/2+c.cx*b[2],cy:b[1]-b[2]/2+c.cy*b[2],r:c.r*b[2],gradientUnits:"userSpaceOnUse"}));for(l in c)l!==
+"id"&&p.push(l,c[l]);for(l in j)p.push(j[l]);p=p.join(",");h[p]?a=h[p].id:(c.id=a="highcharts-"+tb++,h[p]=i=d.createElement(g).attr(c).add(d.defs),i.stops=[],n(j,function(a){f.test(a[1])?(e=ma(a[1]),k=e.get("rgb"),m=e.get("a")):(k=a[1],m=1);a=d.createElement("stop").attr({offset:a[0],"stop-color":k,"stop-opacity":m}).add(i);i.stops.push(a)}));return"url("+d.url+"#"+a+")"}else return f.test(a)?(e=ma(a),A(b,c+"-opacity",e.get("a")),e.get("rgb")):(b.removeAttribute(c+"-opacity"),a)},text:function(a,
+b,c,d){var e=N.chart.style,f=$||!Z&&this.forExport;if(d&&!this.forExport)return this.html(a,b,c);b=t(o(b,0));c=t(o(c,0));a=this.createElement("text").attr({x:b,y:c,text:a}).css({fontFamily:e.fontFamily,fontSize:e.fontSize});f&&a.css({position:"absolute"});a.x=b;a.y=c;return a},html:function(a,b,c){var d=N.chart.style,e=this.createElement("span"),f=e.attrSetters,g=e.element,h=e.renderer;f.text=function(a){a!==g.innerHTML&&delete this.bBox;g.innerHTML=a;return!1};f.x=f.y=f.align=function(a,b){b==="align"&&
+(b="textAlign");e[b]=a;e.htmlUpdateTransform();return!1};e.attr({text:a,x:t(b),y:t(c)}).css({position:"absolute",whiteSpace:"nowrap",fontFamily:d.fontFamily,fontSize:d.fontSize});e.css=e.htmlCss;if(h.isSVG)e.add=function(a){var b,c=h.box.parentNode,d=[];if(a){if(b=a.div,!b){for(;a;)d.push(a),a=a.parentGroup;n(d.reverse(),function(a){var d;b=a.div=a.div||U(wa,{className:A(a.element,"class")},{position:"absolute",left:(a.translateX||0)+"px",top:(a.translateY||0)+"px"},b||c);d=b.style;v(a.attrSetters,
+{translateX:function(a){d.left=a+"px"},translateY:function(a){d.top=a+"px"},visibility:function(a,b){d[b]=a}})})}}else b=c;b.appendChild(g);e.added=!0;e.alignOnAdd&&e.htmlUpdateTransform();return e};return e},fontMetrics:function(a){var a=u(a||11),a=a<24?a+4:t(a*1.2),b=t(a*0.8);return{h:a,b:b}},label:function(a,b,c,d,e,f,g,h,i){function j(){var a,b;a=o.element.style;w=(La===void 0||xb===void 0||s.styles.textAlign)&&o.getBBox();s.width=(La||w.width||0)+2*q+hb;s.height=(xb||w.height||0)+2*q;A=q+p.fontMetrics(a&&
+a.fontSize).b;if(z){if(!B)a=t(-G*q),b=h?-A:0,s.box=B=d?p.symbol(d,a,b,s.width,s.height):p.rect(a,b,s.width,s.height,0,u[Nb]),B.add(s);B.isImg||B.attr(y({width:s.width,height:s.height},u));u=null}}function k(){var a=s.styles,a=a&&a.textAlign,b=hb+q*(1-G),c;c=h?0:A;if(r(La)&&(a==="center"||a==="right"))b+={center:0.5,right:1}[a]*(La-w.width);(b!==o.x||c!==o.y)&&o.attr({x:b,y:c});o.x=b;o.y=c}function m(a,b){B?B.attr(a,b):u[a]=b}function l(){o.add(s);s.attr({text:a,x:b,y:c});B&&r(e)&&s.attr({anchorX:e,
+anchorY:f})}var p=this,s=p.g(i),o=p.text("",0,0,g).attr({zIndex:1}),B,w,G=0,q=3,hb=0,La,xb,P,H,C=0,u={},A,g=s.attrSetters,z;J(s,"add",l);g.width=function(a){La=a;return!1};g.height=function(a){xb=a;return!1};g.padding=function(a){r(a)&&a!==q&&(q=a,k());return!1};g.paddingLeft=function(a){r(a)&&a!==hb&&(hb=a,k());return!1};g.align=function(a){G={left:0,center:0.5,right:1}[a];return!1};g.text=function(a,b){o.attr(b,a);j();k();return!1};g[Nb]=function(a,b){z=!0;C=a%2/2;m(b,a);return!1};g.stroke=g.fill=
+g.r=function(a,b){b==="fill"&&(z=!0);m(b,a);return!1};g.anchorX=function(a,b){e=a;m(b,a+C-P);return!1};g.anchorY=function(a,b){f=a;m(b,a-H);return!1};g.x=function(a){s.x=a;a-=G*((La||w.width)+q);P=t(a);s.attr("translateX",P);return!1};g.y=function(a){H=s.y=t(a);s.attr("translateY",H);return!1};var E=s.css;return v(s,{css:function(a){if(a){var b={},a=y(a);n("fontSize,fontWeight,fontFamily,color,lineHeight,width".split(","),function(c){a[c]!==x&&(b[c]=a[c],delete a[c])});o.css(b)}return E.call(s,a)},
+getBBox:function(){return{width:w.width+2*q,height:w.height+2*q,x:w.x-q,y:w.y-q}},shadow:function(a){B&&B.shadow(a);return s},destroy:function(){ba(s,"add",l);ba(s.element,"mouseenter");ba(s.element,"mouseleave");o&&(o=o.destroy());B&&(B=B.destroy());ra.prototype.destroy.call(s);s=p=j=k=m=l=null}})}};Sa=Aa;var F;if(!Z&&!$){Highcharts.VMLElement=F={init:function(a,b){var c=["<",b,' filled="f" stroked="f"'],d=["position: ","absolute",";"],e=b===wa;(b==="shape"||e)&&d.push("left:0;top:0;width:1px;height:1px;");
+d.push("visibility: ",e?"hidden":"visible");c.push(' style="',d.join(""),'"/>');if(b)c=e||b==="span"||b==="img"?c.join(""):a.prepVML(c),this.element=U(c);this.renderer=a;this.attrSetters={}},add:function(a){var b=this.renderer,c=this.element,d=b.box,d=a?a.element||a:d;a&&a.inverted&&b.invertChild(c,d);d.appendChild(c);this.added=!0;this.alignOnAdd&&!this.deferUpdateTransform&&this.updateTransform();D(this,"add");return this},updateTransform:ra.prototype.htmlUpdateTransform,attr:function(a,b){var c,
+d,e,f=this.element||{},g=f.style,h=f.nodeName,i=this.renderer,j=this.symbolName,k,m=this.shadows,l,p=this.attrSetters,s=this;fa(a)&&r(b)&&(c=a,a={},a[c]=b);if(fa(a))c=a,s=c==="strokeWidth"||c==="stroke-width"?this.strokeweight:this[c];else for(c in a)if(d=a[c],l=!1,e=p[c]&&p[c].call(this,d,c),e!==!1&&d!==null){e!==x&&(d=e);if(j&&/^(x|y|r|start|end|width|height|innerR|anchorX|anchorY)/.test(c))k||(this.symbolAttr(a),k=!0),l=!0;else if(c==="d"){d=d||[];this.d=d.join(" ");e=d.length;l=[];for(var o;e--;)if(Ca(d[e]))l[e]=
+t(d[e]*10)-5;else if(d[e]==="Z")l[e]="x";else if(l[e]=d[e],d.isArc&&(d[e]==="wa"||d[e]==="at"))o=d[e]==="wa"?1:-1,l[e+5]===l[e+7]&&(l[e+7]-=o),l[e+6]===l[e+8]&&(l[e+8]-=o);d=l.join(" ")||"x";f.path=d;if(m)for(e=m.length;e--;)m[e].path=m[e].cutOff?this.cutOffPath(d,m[e].cutOff):d;l=!0}else if(c==="visibility"){if(m)for(e=m.length;e--;)m[e].style[c]=d;h==="DIV"&&(d=d==="hidden"?"-999em":0,cb||(g[c]=d?"visible":"hidden"),c="top");g[c]=d;l=!0}else if(c==="zIndex")d&&(g[c]=d),l=!0;else if(la(c,["x","y",
+"width","height"])!==-1)this[c]=d,c==="x"||c==="y"?c={x:"left",y:"top"}[c]:d=q(0,d),this.updateClipping?(this[c]=d,this.updateClipping()):g[c]=d,l=!0;else if(c==="class"&&h==="DIV")f.className=d;else if(c==="stroke")d=i.color(d,f,c),c="strokecolor";else if(c==="stroke-width"||c==="strokeWidth")f.stroked=d?!0:!1,c="strokeweight",this[c]=d,Ca(d)&&(d+="px");else if(c==="dashstyle")(f.getElementsByTagName("stroke")[0]||U(i.prepVML(["<stroke/>"]),null,null,f))[c]=d||"solid",this.dashstyle=d,l=!0;else if(c===
+"fill")if(h==="SPAN")g.color=d;else{if(h!=="IMG")f.filled=d!==S?!0:!1,d=i.color(d,f,c,this),c="fillcolor"}else if(c==="opacity")l=!0;else if(h==="shape"&&c==="rotation")this[c]=d,f.style.left=-t(ca(d*bb)+1)+"px",f.style.top=t(Y(d*bb))+"px";else if(c==="translateX"||c==="translateY"||c==="rotation")this[c]=d,this.updateTransform(),l=!0;else if(c==="text")this.bBox=null,f.innerHTML=d,l=!0;l||(cb?f[c]=d:A(f,c,d))}return s},clip:function(a){var b=this,c;a?(c=a.members,ga(c,b),c.push(b),b.destroyClip=
+function(){ga(c,b)},a=a.getCSS(b)):(b.destroyClip&&b.destroyClip(),a={clip:cb?"inherit":"rect(auto)"});return b.css(a)},css:ra.prototype.htmlCss,safeRemoveChild:function(a){a.parentNode&&Ra(a)},destroy:function(){this.destroyClip&&this.destroyClip();return ra.prototype.destroy.apply(this)},on:function(a,b){this.element["on"+a]=function(){var a=O.event;a.target=a.srcElement;b(a)};return this},cutOffPath:function(a,b){var c,a=a.split(/[ ,]/);c=a.length;if(c===9||c===11)a[c-4]=a[c-2]=u(a[c-2])-10*b;
+return a.join(" ")},shadow:function(a,b,c){var d=[],e,f=this.element,g=this.renderer,h,i=f.style,j,k=f.path,m,l,p,s;k&&typeof k.value!=="string"&&(k="x");l=k;if(a){p=o(a.width,3);s=(a.opacity||0.15)/p;for(e=1;e<=3;e++){m=p*2+1-2*e;c&&(l=this.cutOffPath(k.value,m+0.5));j=['<shape isShadow="true" strokeweight="',m,'" filled="false" path="',l,'" coordsize="10 10" style="',f.style.cssText,'" />'];h=U(g.prepVML(j),null,{left:u(i.left)+o(a.offsetX,1),top:u(i.top)+o(a.offsetY,1)});if(c)h.cutOff=m+1;j=['<stroke color="',
+a.color||"black",'" opacity="',s*e,'"/>'];U(g.prepVML(j),null,null,h);b?b.element.appendChild(h):f.parentNode.insertBefore(h,f);d.push(h)}this.shadows=d}return this}};F=ea(ra,F);var na={Element:F,isIE8:ya.indexOf("MSIE 8.0")>-1,init:function(a,b,c){var d,e;this.alignedObjects=[];d=this.createElement(wa);e=d.element;e.style.position="relative";a.appendChild(d.element);this.isVML=!0;this.box=e;this.boxWrapper=d;this.setSize(b,c,!1);if(!z.namespaces.hcv)z.namespaces.add("hcv","urn:schemas-microsoft-com:vml"),
+z.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "},isHidden:function(){return!this.box.offsetWidth},clipRect:function(a,b,c,d){var e=this.createElement(),f=V(a);return v(e,{members:[],left:f?a.x:a,top:f?a.y:b,width:f?a.width:c,height:f?a.height:d,getCSS:function(a){var b=a.element,c=b.nodeName,a=a.inverted,d=this.top-(c==="shape"?b.offsetTop:0),e=this.left,b=e+this.width,f=d+this.height,d={clip:"rect("+t(a?e:d)+
+"px,"+t(a?f:b)+"px,"+t(a?b:f)+"px,"+t(a?d:e)+"px)"};!a&&cb&&c==="DIV"&&v(d,{width:b+"px",height:f+"px"});return d},updateClipping:function(){n(e.members,function(a){a.css(e.getCSS(a))})}})},color:function(a,b,c,d){var e=this,f,g=/^rgba/,h,i,j=S;a&&a.linearGradient?i="gradient":a&&a.radialGradient&&(i="pattern");if(i){var k,m,l=a.linearGradient||a.radialGradient,p,s,o,B,w,q="",a=a.stops,r,t=[],x=function(){h=['<fill colors="'+t.join(",")+'" opacity="',o,'" o:opacity2="',s,'" type="',i,'" ',q,'focus="100%" method="any" />'];
+U(e.prepVML(h),null,null,b)};p=a[0];r=a[a.length-1];p[0]>0&&a.unshift([0,p[1]]);r[0]<1&&a.push([1,r[1]]);n(a,function(a,b){g.test(a[1])?(f=ma(a[1]),k=f.get("rgb"),m=f.get("a")):(k=a[1],m=1);t.push(a[0]*100+"% "+k);b?(o=m,B=k):(s=m,w=k)});if(c==="fill")if(i==="gradient")c=l.x1||l[0]||0,a=l.y1||l[1]||0,p=l.x2||l[2]||0,l=l.y2||l[3]||0,q='angle="'+(90-I.atan((l-a)/(p-c))*180/Ja)+'"',x();else{var j=l.r,v=j*2,P=j*2,H=l.cx,C=l.cy,y=b.radialReference,u,j=function(){y&&(u=d.getBBox(),H+=(y[0]-u.x)/u.width-
+0.5,C+=(y[1]-u.y)/u.height-0.5,v*=y[2]/u.width,P*=y[2]/u.height);q='src="'+N.global.VMLRadialGradientURL+'" size="'+v+","+P+'" origin="0.5,0.5" position="'+H+","+C+'" color2="'+w+'" ';x()};d.added?j():J(d,"add",j);j=B}else j=k}else if(g.test(a)&&b.tagName!=="IMG")f=ma(a),h=["<",c,' opacity="',f.get("a"),'"/>'],U(this.prepVML(h),null,null,b),j=f.get("rgb");else{j=b.getElementsByTagName(c);if(j.length)j[0].opacity=1,j[0].type="solid";j=a}return j},prepVML:function(a){var b=this.isIE8,a=a.join("");b?
+(a=a.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),a=a.indexOf('style="')===-1?a.replace("/>",' style="display:inline-block;behavior:url(#default#VML);" />'):a.replace('style="','style="display:inline-block;behavior:url(#default#VML);')):a=a.replace("<","<hcv:");return a},text:Aa.prototype.html,path:function(a){var b={coordsize:"10 10"};Ba(a)?b.d=a:V(a)&&v(b,a);return this.createElement("shape").attr(b)},circle:function(a,b,c){if(V(a))c=a.r,b=a.y,a=a.x;return this.symbol("circle").attr({x:a-
+c,y:b-c,width:2*c,height:2*c})},g:function(a){var b;a&&(b={className:"highcharts-"+a,"class":"highcharts-"+a});return this.createElement(wa).attr(b)},image:function(a,b,c,d,e){var f=this.createElement("img").attr({src:a});arguments.length>1&&f.attr({x:b,y:c,width:d,height:e});return f},rect:function(a,b,c,d,e,f){if(V(a))b=a.y,c=a.width,d=a.height,f=a.strokeWidth,a=a.x;var g=this.symbol("rect");g.r=e;return g.attr(g.crisp(f,a,b,q(c,0),q(d,0)))},invertChild:function(a,b){var c=b.style;L(a,{flip:"x",
+left:u(c.width)-1,top:u(c.height)-1,rotation:-90})},symbols:{arc:function(a,b,c,d,e){var f=e.start,g=e.end,h=e.r||c||d,c=e.innerR,d=Y(f),i=ca(f),j=Y(g),k=ca(g);if(g-f===0)return["x"];f=["wa",a-h,b-h,a+h,b+h,a+h*d,b+h*i,a+h*j,b+h*k];e.open&&!c&&f.push("e","M",a,b);f.push("at",a-c,b-c,a+c,b+c,a+c*j,b+c*k,a+c*d,b+c*i,"x","e");f.isArc=!0;return f},circle:function(a,b,c,d){return["wa",a,b,a+c,b+d,a+c,b+d/2,a+c,b+d/2,"e"]},rect:function(a,b,c,d,e){var f=a+c,g=b+d,h;!r(e)||!e.r?f=Aa.prototype.symbols.square.apply(0,
+arguments):(h=K(e.r,c,d),f=["M",a+h,b,"L",f-h,b,"wa",f-2*h,b,f,b+2*h,f-h,b,f,b+h,"L",f,g-h,"wa",f-2*h,g-2*h,f,g,f,g-h,f-h,g,"L",a+h,g,"wa",a,g-2*h,a+2*h,g,a+h,g,a,g-h,"L",a,b+h,"wa",a,b,a+2*h,b+2*h,a,b+h,a+h,b,"x","e"]);return f}}};Highcharts.VMLRenderer=F=function(){this.init.apply(this,arguments)};F.prototype=y(Aa.prototype,na);Sa=F}var Qb;if($)Highcharts.CanVGRenderer=F=function(){sa="http://www.w3.org/1999/xhtml"},F.prototype.symbols={},Qb=function(){function a(){var a=b.length,d;for(d=0;d<a;d++)b[d]();
+b=[]}var b=[];return{push:function(c,d){b.length===0&&Sb(d,a);b.push(c)}}}(),Sa=F;Ia.prototype={addLabel:function(){var a=this.axis,b=a.options,c=a.chart,d=a.horiz,e=a.categories,f=a.series[0]&&a.series[0].names,g=this.pos,h=b.labels,i=a.tickPositions,d=d&&e&&!h.step&&!h.staggerLines&&!h.rotation&&c.plotWidth/i.length||!d&&(c.optionsMarginLeft||c.plotWidth/2),j=g===i[0],k=g===i[i.length-1],f=e?o(e[g],f&&f[g],g):g,e=this.label,i=i.info,m;a.isDatetimeAxis&&i&&(m=b.dateTimeLabelFormats[i.higherRanks[g]||
+i.unitName]);this.isFirst=j;this.isLast=k;b=a.labelFormatter.call({axis:a,chart:c,isFirst:j,isLast:k,dateTimeLabelFormat:m,value:a.isLog?ia(da(f)):f});g=d&&{width:q(1,t(d-2*(h.padding||10)))+"px"};g=v(g,h.style);if(r(e))e&&e.attr({text:b}).css(g);else{d={align:h.align};if(Ca(h.rotation))d.rotation=h.rotation;this.label=r(b)&&h.enabled?c.renderer.text(b,0,0,h.useHTML).attr(d).css(g).add(a.labelGroup):null}},getLabelSize:function(){var a=this.label,b=this.axis;return a?(this.labelBBox=a.getBBox())[b.horiz?
+"height":"width"]:0},getLabelSides:function(){var a=this.axis.options.labels,b=this.labelBBox.width,a=b*{left:0,center:0.5,right:1}[a.align]-a.x;return[-a,b-a]},handleOverflow:function(a,b){var c=!0,d=this.axis,e=d.chart,f=this.isFirst,g=this.isLast,h=b.x,i=d.reversed,j=d.tickPositions;if(f||g){var k=this.getLabelSides(),m=k[0],k=k[1],e=e.plotLeft,l=e+d.len,j=(d=d.ticks[j[a+(f?1:-1)]])&&d.label.xy&&d.label.xy.x+d.getLabelSides()[f?0:1];f&&!i||g&&i?h+m<e&&(h=e-m,d&&h+k>j&&(c=!1)):h+k>l&&(h=l-k,d&&
+h+m<j&&(c=!1));b.x=h}return c},getPosition:function(a,b,c,d){var e=this.axis,f=e.chart,g=d&&f.oldChartHeight||f.chartHeight;return{x:a?e.translate(b+c,null,null,d)+e.transB:e.left+e.offset+(e.opposite?(d&&f.oldChartWidth||f.chartWidth)-e.right-e.left:0),y:a?g-e.bottom+e.offset-(e.opposite?e.height:0):g-e.translate(b+c,null,null,d)-e.transB}},getLabelPosition:function(a,b,c,d,e,f,g,h){var i=this.axis,j=i.transA,k=i.reversed,i=i.staggerLines,a=a+e.x-(f&&d?f*j*(k?-1:1):0),b=b+e.y-(f&&!d?f*j*(k?1:-1):
+0);r(e.y)||(b+=u(c.styles.lineHeight)*0.9-c.getBBox().height/2);i&&(b+=g/(h||1)%i*16);return{x:a,y:b}},getMarkPath:function(a,b,c,d,e,f){return f.crispLine(["M",a,b,"L",a+(e?0:-c),b+(e?c:0)],d)},render:function(a,b,c){var d=this.axis,e=d.options,f=d.chart.renderer,g=d.horiz,h=this.type,i=this.label,j=this.pos,k=e.labels,m=this.gridLine,l=h?h+"Grid":"grid",p=h?h+"Tick":"tick",s=e[l+"LineWidth"],n=e[l+"LineColor"],B=e[l+"LineDashStyle"],w=e[p+"Length"],l=e[p+"Width"]||0,q=e[p+"Color"],r=e[p+"Position"],
+p=this.mark,t=k.step,v=!0,u=d.tickmarkOffset,P=this.getPosition(g,j,u,b),H=P.x,P=P.y,C=g&&H===d.pos||!g&&P===d.pos+d.len?-1:1,y=d.staggerLines;this.isActive=!0;if(s){j=d.getPlotLinePath(j+u,s*C,b,!0);if(m===x){m={stroke:n,"stroke-width":s};if(B)m.dashstyle=B;if(!h)m.zIndex=1;if(b)m.opacity=0;this.gridLine=m=s?f.path(j).attr(m).add(d.gridGroup):null}if(!b&&m&&j)m[this.isNew?"attr":"animate"]({d:j,opacity:c})}if(l&&w)r==="inside"&&(w=-w),d.opposite&&(w=-w),b=this.getMarkPath(H,P,w,l*C,g,f),p?p.animate({d:b,
+opacity:c}):this.mark=f.path(b).attr({stroke:q,"stroke-width":l,opacity:c}).add(d.axisGroup);if(i&&!isNaN(H))i.xy=P=this.getLabelPosition(H,P,i,g,k,u,a,t),this.isFirst&&!o(e.showFirstLabel,1)||this.isLast&&!o(e.showLastLabel,1)?v=!1:!y&&g&&k.overflow==="justify"&&!this.handleOverflow(a,P)&&(v=!1),t&&a%t&&(v=!1),v&&!isNaN(P.y)?(P.opacity=c,i[this.isNew?"attr":"animate"](P),this.isNew=!1):i.attr("y",-9999)},destroy:function(){Ga(this,this.axis)}};ob.prototype={render:function(){var a=this,b=a.axis,
+c=b.horiz,d=(b.pointRange||0)/2,e=a.options,f=e.label,g=a.label,h=e.width,i=e.to,j=e.from,k=r(j)&&r(i),m=e.value,l=e.dashStyle,p=a.svgElem,s=[],n,B=e.color,w=e.zIndex,G=e.events,t=b.chart.renderer;b.isLog&&(j=ka(j),i=ka(i),m=ka(m));if(h){if(s=b.getPlotLinePath(m,h),d={stroke:B,"stroke-width":h},l)d.dashstyle=l}else if(k){if(j=q(j,b.min-d),i=K(i,b.max+d),s=b.getPlotBandPath(j,i,e),d={fill:B},e.borderWidth)d.stroke=e.borderColor,d["stroke-width"]=e.borderWidth}else return;if(r(w))d.zIndex=w;if(p)s?
+p.animate({d:s},null,p.onGetPath):(p.hide(),p.onGetPath=function(){p.show()});else if(s&&s.length&&(a.svgElem=p=t.path(s).attr(d).add(),G))for(n in e=function(b){p.on(b,function(c){G[b].apply(a,[c])})},G)e(n);if(f&&r(f.text)&&s&&s.length&&b.width>0&&b.height>0){f=y({align:c&&k&&"center",x:c?!k&&4:10,verticalAlign:!c&&k&&"middle",y:c?k?16:10:k?6:-4,rotation:c&&!k&&90},f);if(!g)a.label=g=t.text(f.text,0,0).attr({align:f.textAlign||f.align,rotation:f.rotation,zIndex:w}).css(f.style).add();b=[s[1],s[4],
+o(s[6],s[1])];s=[s[2],s[5],o(s[7],s[2])];c=Fa(b);k=Fa(s);g.align(f,!1,{x:c,y:k,width:pa(b)-c,height:pa(s)-k});g.show()}else g&&g.hide();return a},destroy:function(){ga(this.axis.plotLinesAndBands,this);Ga(this,this.axis)}};Ib.prototype={destroy:function(){Ga(this,this.axis)},setTotal:function(a){this.cum=this.total=a},render:function(a){var b=this.options,c=b.formatter.call(this);this.label?this.label.attr({text:c,visibility:"hidden"}):this.label=this.axis.chart.renderer.text(c,0,0,b.useHTML).css(b.style).attr({align:this.textAlign,
+rotation:b.rotation,visibility:"hidden"}).add(a)},setOffset:function(a,b){var c=this.axis,d=c.chart,e=d.inverted,f=this.isNegative,g=c.translate(this.percent?100:this.total,0,0,0,1),c=c.translate(0),c=Q(g-c),h=d.xAxis[0].translate(this.x)+a,i=d.plotHeight,f={x:e?f?g:g-c:h,y:e?i-h-b:f?i-g-c:i-g,width:e?c:b,height:e?b:c};if(e=this.label)e.align(this.alignOptions,null,f),f=e.alignAttr,e.attr({visibility:this.options.crop===!1||d.isInsidePlot(f.x,f.y)?Z?"inherit":"visible":"hidden"})}};ab.prototype={defaultOptions:{dateTimeLabelFormats:{millisecond:"%H:%M:%S.%L",
+second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%e. %b",week:"%e. %b",month:"%b '%y",year:"%Y"},endOnTick:!1,gridLineColor:"#C0C0C0",labels:M,lineColor:"#C0D0E0",lineWidth:1,minPadding:0.01,maxPadding:0.01,minorGridLineColor:"#E0E0E0",minorGridLineWidth:1,minorTickColor:"#A0A0A0",minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickColor:"#C0D0E0",tickLength:5,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",tickWidth:1,title:{align:"middle",style:{color:"#4d759e",
+fontWeight:"bold"}},type:"linear"},defaultYAxisOptions:{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{align:"right",x:-8,y:3},lineWidth:0,maxPadding:0.05,minPadding:0.05,startOnTick:!0,tickWidth:0,title:{rotation:270,text:"Values"},stackLabels:{enabled:!1,formatter:function(){return this.total},style:M.style}},defaultLeftAxisOptions:{labels:{align:"right",x:-8,y:null},title:{rotation:270}},defaultRightAxisOptions:{labels:{align:"left",x:8,y:null},title:{rotation:90}},
+defaultBottomAxisOptions:{labels:{align:"center",x:0,y:14},title:{rotation:0}},defaultTopAxisOptions:{labels:{align:"center",x:0,y:-5},title:{rotation:0}},init:function(a,b){var c=b.isX;this.horiz=a.inverted?!c:c;this.xOrY=(this.isXAxis=c)?"x":"y";this.opposite=b.opposite;this.side=this.horiz?this.opposite?0:2:this.opposite?1:3;this.setOptions(b);var d=this.options,e=d.type;this.labelFormatter=d.labels.formatter||this.defaultLabelFormatter;this.staggerLines=this.horiz&&d.labels.staggerLines;this.userOptions=
+b;this.minPixelPadding=0;this.chart=a;this.reversed=d.reversed;this.zoomEnabled=d.zoomEnabled!==!1;this.categories=d.categories||e==="category";this.isLog=e==="logarithmic";this.isDatetimeAxis=e==="datetime";this.isLinked=r(d.linkedTo);this.tickmarkOffset=this.categories&&d.tickmarkPlacement==="between"?0.5:0;this.ticks={};this.minorTicks={};this.plotLinesAndBands=[];this.alternateBands={};this.len=0;this.minRange=this.userMinRange=d.minRange||d.maxZoom;this.range=d.range;this.offset=d.offset||0;
+this.stacks={};this._stacksTouched=0;this.min=this.max=null;var f,d=this.options.events;la(this,a.axes)===-1&&(a.axes.push(this),a[c?"xAxis":"yAxis"].push(this));this.series=this.series||[];if(a.inverted&&c&&this.reversed===x)this.reversed=!0;this.removePlotLine=this.removePlotBand=this.removePlotBandOrLine;for(f in d)J(this,f,d[f]);if(this.isLog)this.val2lin=ka,this.lin2val=da},setOptions:function(a){this.options=y(this.defaultOptions,this.isXAxis?{}:this.defaultYAxisOptions,[this.defaultTopAxisOptions,
+this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],y(N[this.isXAxis?"xAxis":"yAxis"],a))},update:function(a,b){var c=this.chart,a=c.options[this.xOrY+"Axis"][this.options.index]=y(this.userOptions,a);this.destroy();this._addedPlotLB=!1;this.init(c,a);c.isDirtyBox=!0;o(b,!0)&&c.redraw()},remove:function(a){var b=this.chart,c=this.xOrY+"Axis";n(this.series,function(a){a.remove(!1)});ga(b.axes,this);ga(b[c],this);b.options[c].splice(this.options.index,
+1);this.destroy();b.isDirtyBox=!0;o(a,!0)&&b.redraw()},defaultLabelFormatter:function(){var a=this.axis,b=this.value,c=a.categories,d=this.dateTimeLabelFormat,e=N.lang.numericSymbols,f=e&&e.length,g,h=a.options.labels.format,a=a.isLog?b:a.tickInterval;if(h)g=Ea(h,this);else if(c)g=b;else if(d)g=Ua(d,b);else if(f&&a>=1E3)for(;f--&&g===x;)c=Math.pow(1E3,f+1),a>=c&&e[f]!==null&&(g=Na(b/c,-1)+e[f]);g===x&&(g=b>=1E3?Na(b,0):Na(b,-1));return g},getSeriesExtremes:function(){var a=this,b=a.chart,c=a.stacks,
+d=[],e=[],f=a._stacksTouched+=1,g,h;a.hasVisibleSeries=!1;a.dataMin=a.dataMax=null;n(a.series,function(g){if(g.visible||!b.options.chart.ignoreHiddenSeries){var j=g.options,k,m,l,p,s,n,B,w,G,t=j.threshold,v,u=[],y=0;a.hasVisibleSeries=!0;if(a.isLog&&t<=0)t=j.threshold=null;if(a.isXAxis){if(j=g.xData,j.length)a.dataMin=K(o(a.dataMin,j[0]),Fa(j)),a.dataMax=q(o(a.dataMax,j[0]),pa(j))}else{var P,H,C,A=g.cropped,z=g.xAxis.getExtremes(),E=!!g.modifyValue;k=j.stacking;a.usePercentage=k==="percent";if(k)s=
+j.stack,p=g.type+o(s,""),n="-"+p,g.stackKey=p,m=d[p]||[],d[p]=m,l=e[n]||[],e[n]=l;if(a.usePercentage)a.dataMin=0,a.dataMax=99;j=g.processedXData;B=g.processedYData;v=B.length;for(h=0;h<v;h++){w=j[h];G=B[h];if(k)H=(P=G<t)?l:m,C=P?n:p,r(H[w])?(H[w]=ia(H[w]+G),G=[G,H[w]]):H[w]=G,c[C]||(c[C]={}),c[C][w]||(c[C][w]=new Ib(a,a.options.stackLabels,P,w,s,k)),c[C][w].setTotal(H[w]),c[C][w].touched=f;if(G!==null&&G!==x&&(!a.isLog||G.length||G>0))if(E&&(G=g.modifyValue(G)),g.getExtremesFromAll||A||(j[h+1]||w)>=
+z.min&&(j[h-1]||w)<=z.max)if(w=G.length)for(;w--;)G[w]!==null&&(u[y++]=G[w]);else u[y++]=G}if(!a.usePercentage&&u.length)g.dataMin=k=Fa(u),g.dataMax=g=pa(u),a.dataMin=K(o(a.dataMin,k),k),a.dataMax=q(o(a.dataMax,g),g);if(r(t))if(a.dataMin>=t)a.dataMin=t,a.ignoreMinPadding=!0;else if(a.dataMax<t)a.dataMax=t,a.ignoreMaxPadding=!0}}});for(g in c)for(h in c[g])c[g][h].touched<f&&(c[g][h].destroy(),delete c[g][h])},translate:function(a,b,c,d,e,f){var g=this.len,h=1,i=0,j=d?this.oldTransA:this.transA,d=
+d?this.oldMin:this.min,k=this.minPixelPadding,e=(this.options.ordinal||this.isLog&&e)&&this.lin2val;if(!j)j=this.transA;c&&(h*=-1,i=g);this.reversed&&(h*=-1,i-=h*g);b?(a=a*h+i,a-=k,a=a/j+d,e&&(a=this.lin2val(a))):(e&&(a=this.val2lin(a)),a=h*(a-d)*j+i+h*k+(f?j*this.pointRange/2:0));return a},toPixels:function(a,b){return this.translate(a,!1,!this.horiz,null,!0)+(b?0:this.pos)},toValue:function(a,b){return this.translate(a-(b?0:this.pos),!0,!this.horiz,null,!0)},getPlotLinePath:function(a,b,c,d){var e=
+this.chart,f=this.left,g=this.top,h,i,j,a=this.translate(a,null,null,c),k=c&&e.oldChartHeight||e.chartHeight,m=c&&e.oldChartWidth||e.chartWidth,l;h=this.transB;c=i=t(a+h);h=j=t(k-a-h);if(isNaN(a))l=!0;else if(this.horiz){if(h=g,j=k-this.bottom,c<f||c>f+this.width)l=!0}else if(c=f,i=m-this.right,h<g||h>g+this.height)l=!0;return l&&!d?null:e.renderer.crispLine(["M",c,h,"L",i,j],b||0)},getPlotBandPath:function(a,b){var c=this.getPlotLinePath(b),d=this.getPlotLinePath(a);d&&c?d.push(c[4],c[5],c[1],c[2]):
+d=null;return d},getLinearTickPositions:function(a,b,c){for(var d,b=ia(T(b/a)*a),c=ia(ja(c/a)*a),e=[];b<=c;){e.push(b);b=ia(b+a);if(b===d)break;d=b}return e},getLogTickPositions:function(a,b,c,d){var e=this.options,f=this.len,g=[];if(!d)this._minorAutoInterval=null;if(a>=0.5)a=t(a),g=this.getLinearTickPositions(a,b,c);else if(a>=0.08)for(var f=T(b),h,i,j,k,m,e=a>0.3?[1,2,4]:a>0.15?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9];f<c+1&&!m;f++){i=e.length;for(h=0;h<i&&!m;h++)j=ka(da(f)*e[h]),j>b&&(!d||k<=c)&&g.push(k),
+k>c&&(m=!0),k=j}else if(b=da(b),c=da(c),a=e[d?"minorTickInterval":"tickInterval"],a=o(a==="auto"?null:a,this._minorAutoInterval,(c-b)*(e.tickPixelInterval/(d?5:1))/((d?f/this.tickPositions.length:f)||1)),a=ib(a,null,I.pow(10,T(I.log(a)/I.LN10))),g=Ka(this.getLinearTickPositions(a,b,c),ka),!d)this._minorAutoInterval=a/5;if(!d)this.tickInterval=a;return g},getMinorTickPositions:function(){var a=this.options,b=this.tickPositions,c=this.minorTickInterval,d=[],e;if(this.isLog){e=b.length;for(a=1;a<e;a++)d=
+d.concat(this.getLogTickPositions(c,b[a-1],b[a],!0))}else if(this.isDatetimeAxis&&a.minorTickInterval==="auto")d=d.concat(Ab(yb(c),this.min,this.max,a.startOfWeek)),d[0]<this.min&&d.shift();else for(b=this.min+(b[0]-this.min)%c;b<=this.max;b+=c)d.push(b);return d},adjustForMinRange:function(){var a=this.options,b=this.min,c=this.max,d,e=this.dataMax-this.dataMin>=this.minRange,f,g,h,i,j;if(this.isXAxis&&this.minRange===x&&!this.isLog)r(a.min)||r(a.max)?this.minRange=null:(n(this.series,function(a){i=
+a.xData;for(g=j=a.xIncrement?1:i.length-1;g>0;g--)if(h=i[g]-i[g-1],f===x||h<f)f=h}),this.minRange=K(f*5,this.dataMax-this.dataMin));if(c-b<this.minRange){var k=this.minRange;d=(k-c+b)/2;d=[b-d,o(a.min,b-d)];if(e)d[2]=this.dataMin;b=pa(d);c=[b+k,o(a.max,b+k)];if(e)c[2]=this.dataMax;c=Fa(c);c-b<k&&(d[0]=c-k,d[1]=o(a.min,c-k),b=pa(d))}this.min=b;this.max=c},setAxisTranslation:function(a){var b=this.max-this.min,c=0,d,e=0,f=0,g=this.linkedParent,h=this.transA;if(this.isXAxis)g?(e=g.minPointOffset,f=g.pointRangePadding):
+n(this.series,function(a){var g=a.pointRange,h=a.options.pointPlacement,m=a.closestPointRange;g>b&&(g=0);c=q(c,g);e=q(e,h?0:g/2);f=q(f,h==="on"?0:g);!a.noSharedTooltip&&r(m)&&(d=r(d)?K(d,m):m)}),g=this.ordinalSlope?this.ordinalSlope/d:1,this.minPointOffset=e*=g,this.pointRangePadding=f*=g,this.pointRange=K(c,b),this.closestPointRange=d;if(a)this.oldTransA=h;this.translationSlope=this.transA=h=this.len/(b+f||1);this.transB=this.horiz?this.left:this.bottom;this.minPixelPadding=h*e},setTickPositions:function(a){var b=
+this,c=b.chart,d=b.options,e=b.isLog,f=b.isDatetimeAxis,g=b.isXAxis,h=b.isLinked,i=b.options.tickPositioner,j=d.maxPadding,k=d.minPadding,m=d.tickInterval,l=d.minTickInterval,p=d.tickPixelInterval,s=b.categories;h?(b.linkedParent=c[g?"xAxis":"yAxis"][d.linkedTo],c=b.linkedParent.getExtremes(),b.min=o(c.min,c.dataMin),b.max=o(c.max,c.dataMax),d.type!==b.linkedParent.options.type&&qa(11,1)):(b.min=o(b.userMin,d.min,b.dataMin),b.max=o(b.userMax,d.max,b.dataMax));if(e)!a&&K(b.min,o(b.dataMin,b.min))<=
+0&&qa(10,1),b.min=ia(ka(b.min)),b.max=ia(ka(b.max));if(b.range&&(b.userMin=b.min=q(b.min,b.max-b.range),b.userMax=b.max,a))b.range=null;b.beforePadding&&b.beforePadding();b.adjustForMinRange();if(!s&&!b.usePercentage&&!h&&r(b.min)&&r(b.max)&&(c=b.max-b.min)){if(!r(d.min)&&!r(b.userMin)&&k&&(b.dataMin<0||!b.ignoreMinPadding))b.min-=c*k;if(!r(d.max)&&!r(b.userMax)&&j&&(b.dataMax>0||!b.ignoreMaxPadding))b.max+=c*j}b.tickInterval=b.min===b.max||b.min===void 0||b.max===void 0?1:h&&!m&&p===b.linkedParent.options.tickPixelInterval?
+b.linkedParent.tickInterval:o(m,s?1:(b.max-b.min)*p/(b.len||1));g&&!a&&n(b.series,function(a){a.processData(b.min!==b.oldMin||b.max!==b.oldMax)});b.setAxisTranslation(!0);b.beforeSetTickPositions&&b.beforeSetTickPositions();if(b.postProcessTickInterval)b.tickInterval=b.postProcessTickInterval(b.tickInterval);if(!m&&b.tickInterval<l)b.tickInterval=l;if(!f&&!e&&(a=I.pow(10,T(I.log(b.tickInterval)/I.LN10)),!m))b.tickInterval=ib(b.tickInterval,null,a,d);b.minorTickInterval=d.minorTickInterval==="auto"&&
+b.tickInterval?b.tickInterval/5:d.minorTickInterval;b.tickPositions=i=d.tickPositions?[].concat(d.tickPositions):i&&i.apply(b,[b.min,b.max]);if(!i)i=f?(b.getNonLinearTimeTicks||Ab)(yb(b.tickInterval,d.units),b.min,b.max,d.startOfWeek,b.ordinalPositions,b.closestPointRange,!0):e?b.getLogTickPositions(b.tickInterval,b.min,b.max):b.getLinearTickPositions(b.tickInterval,b.min,b.max),b.tickPositions=i;if(!h)e=i[0],f=i[i.length-1],h=b.minPointOffset||0,d.startOnTick?b.min=e:b.min-h>e&&i.shift(),d.endOnTick?
+b.max=f:b.max+h<f&&i.pop(),i.length===1&&(b.min-=0.001,b.max+=0.001)},setMaxTicks:function(){var a=this.chart,b=a.maxTicks||{},c=this.tickPositions,d=this._maxTicksKey=[this.xOrY,this.pos,this.len].join("-");if(!this.isLinked&&!this.isDatetimeAxis&&c&&c.length>(b[d]||0)&&this.options.alignTicks!==!1)b[d]=c.length;a.maxTicks=b},adjustTickAmount:function(){var a=this._maxTicksKey,b=this.tickPositions,c=this.chart.maxTicks;if(c&&c[a]&&!this.isDatetimeAxis&&!this.categories&&!this.isLinked&&this.options.alignTicks!==
+!1){var d=this.tickAmount,e=b.length;this.tickAmount=a=c[a];if(e<a){for(;b.length<a;)b.push(ia(b[b.length-1]+this.tickInterval));this.transA*=(e-1)/(a-1);this.max=b[b.length-1]}if(r(d)&&a!==d)this.isDirty=!0}},setScale:function(){var a=this.stacks,b,c,d,e;this.oldMin=this.min;this.oldMax=this.max;this.oldAxisLength=this.len;this.setAxisSize();e=this.len!==this.oldAxisLength;n(this.series,function(a){if(a.isDirtyData||a.isDirty||a.xAxis.isDirty)d=!0});if(e||d||this.isLinked||this.forceRedraw||this.userMin!==
+this.oldUserMin||this.userMax!==this.oldUserMax)if(this.forceRedraw=!1,this.getSeriesExtremes(),this.setTickPositions(),this.oldUserMin=this.userMin,this.oldUserMax=this.userMax,!this.isDirty)this.isDirty=e||this.min!==this.oldMin||this.max!==this.oldMax;if(!this.isXAxis)for(b in a)for(c in a[b])a[b][c].cum=a[b][c].total;this.setMaxTicks()},setExtremes:function(a,b,c,d,e){var f=this,g=f.chart,c=o(c,!0),e=v(e,{min:a,max:b});D(f,"setExtremes",e,function(){f.userMin=a;f.userMax=b;f.isDirtyExtremes=!0;
+c&&g.redraw(d)})},zoom:function(a,b){this.allowZoomOutside||(a<=this.dataMin&&(a=x),b>=this.dataMax&&(b=x));this.displayBtn=a!==x||b!==x;this.setExtremes(a,b,!1,x,{trigger:"zoom"});return!0},setAxisSize:function(){var a=this.chart,b=this.options,c=b.offsetLeft||0,d=b.offsetRight||0,e=this.horiz,f,g;this.left=g=o(b.left,a.plotLeft+c);this.top=f=o(b.top,a.plotTop);this.width=c=o(b.width,a.plotWidth-c+d);this.height=b=o(b.height,a.plotHeight);this.bottom=a.chartHeight-b-f;this.right=a.chartWidth-c-g;
+this.len=q(e?c:b,0);this.pos=e?g:f},getExtremes:function(){var a=this.isLog;return{min:a?ia(da(this.min)):this.min,max:a?ia(da(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(a){var b=this.isLog,c=b?da(this.min):this.min,b=b?da(this.max):this.max;c>a||a===null?a=c:b<a&&(a=b);return this.translate(a,0,1,0,1)},addPlotBand:function(a){this.addPlotBandOrLine(a,"plotBands")},addPlotLine:function(a){this.addPlotBandOrLine(a,
+"plotLines")},addPlotBandOrLine:function(a,b){var c=(new ob(this,a)).render(),d=this.userOptions;b&&(d[b]=d[b]||[],d[b].push(a));this.plotLinesAndBands.push(c);return c},getOffset:function(){var a=this,b=a.chart,c=b.renderer,d=a.options,e=a.tickPositions,f=a.ticks,g=a.horiz,h=a.side,i=b.inverted?[1,0,3,2][h]:h,j,k=0,m,l=0,p=d.title,s=d.labels,t=0,B=b.axisOffset,w=b.clipOffset,G=[-1,1,1,-1][h],v;a.hasData=b=a.hasVisibleSeries||r(a.min)&&r(a.max)&&!!e;a.showAxis=j=b||o(d.showEmpty,!0);if(!a.axisGroup)a.gridGroup=
+c.g("grid").attr({zIndex:d.gridZIndex||1}).add(),a.axisGroup=c.g("axis").attr({zIndex:d.zIndex||2}).add(),a.labelGroup=c.g("axis-labels").attr({zIndex:s.zIndex||7}).add();if(b||a.isLinked)n(e,function(b){f[b]?f[b].addLabel():f[b]=new Ia(a,b)}),n(e,function(a){if(h===0||h===2||{1:"left",3:"right"}[h]===s.align)t=q(f[a].getLabelSize(),t)}),a.staggerLines&&(t+=(a.staggerLines-1)*16);else for(v in f)f[v].destroy(),delete f[v];if(p&&p.text&&p.enabled!==!1){if(!a.axisTitle)a.axisTitle=c.text(p.text,0,0,
+p.useHTML).attr({zIndex:7,rotation:p.rotation||0,align:p.textAlign||{low:"left",middle:"center",high:"right"}[p.align]}).css(p.style).add(a.axisGroup),a.axisTitle.isNew=!0;if(j)k=a.axisTitle.getBBox()[g?"height":"width"],l=o(p.margin,g?5:10),m=p.offset;a.axisTitle[j?"show":"hide"]()}a.offset=G*o(d.offset,B[h]);a.axisTitleMargin=o(m,t+l+(h!==2&&t&&G*d.labels[g?"y":"x"]));B[h]=q(B[h],a.axisTitleMargin+k+G*a.offset);w[i]=q(w[i],d.lineWidth)},getLinePath:function(a){var b=this.chart,c=this.opposite,d=
+this.offset,e=this.horiz,f=this.left+(c?this.width:0)+d;this.lineTop=d=b.chartHeight-this.bottom-(c?this.height:0)+d;c||(a*=-1);return b.renderer.crispLine(["M",e?this.left:f,e?d:this.top,"L",e?b.chartWidth-this.right:f,e?d:b.chartHeight-this.bottom],a)},getTitlePosition:function(){var a=this.horiz,b=this.left,c=this.top,d=this.len,e=this.options.title,f=a?b:c,g=this.opposite,h=this.offset,i=u(e.style.fontSize||12),d={low:f+(a?0:d),middle:f+d/2,high:f+(a?d:0)}[e.align],b=(a?c+this.height:b)+(a?1:
+-1)*(g?-1:1)*this.axisTitleMargin+(this.side===2?i:0);return{x:a?d:b+(g?this.width:0)+h+(e.x||0),y:a?b-(g?this.height:0)+h:d+(e.y||0)}},render:function(){var a=this,b=a.chart,c=b.renderer,d=a.options,e=a.isLog,f=a.isLinked,g=a.tickPositions,h=a.axisTitle,i=a.stacks,j=a.ticks,k=a.minorTicks,m=a.alternateBands,l=d.stackLabels,p=d.alternateGridColor,s=a.tickmarkOffset,o=d.lineWidth,B,w=b.hasRendered&&r(a.oldMin)&&!isNaN(a.oldMin);B=a.hasData;var q=a.showAxis,t,v;n([j,k,m],function(a){for(var b in a)a[b].isActive=
+!1});if(B||f)if(a.minorTickInterval&&!a.categories&&n(a.getMinorTickPositions(),function(b){k[b]||(k[b]=new Ia(a,b,"minor"));w&&k[b].isNew&&k[b].render(null,!0);k[b].render(null,!1,1)}),g.length&&(n(g.slice(1).concat([g[0]]),function(b,c){c=c===g.length-1?0:c+1;if(!f||b>=a.min&&b<=a.max)j[b]||(j[b]=new Ia(a,b)),w&&j[b].isNew&&j[b].render(c,!0),j[b].render(c,!1,1)}),s&&a.min===0&&(j[-1]||(j[-1]=new Ia(a,-1,null,!0)),j[-1].render(-1))),p&&n(g,function(b,c){if(c%2===0&&b<a.max)m[b]||(m[b]=new ob(a)),
+t=b+s,v=g[c+1]!==x?g[c+1]+s:a.max,m[b].options={from:e?da(t):t,to:e?da(v):v,color:p},m[b].render(),m[b].isActive=!0}),!a._addedPlotLB)n((d.plotLines||[]).concat(d.plotBands||[]),function(b){a.addPlotBandOrLine(b)}),a._addedPlotLB=!0;n([j,k,m],function(a){var c,d,e=[],f=xa?xa.duration||500:0,g=function(){for(d=e.length;d--;)a[e[d]]&&!a[e[d]].isActive&&(a[e[d]].destroy(),delete a[e[d]])};for(c in a)if(!a[c].isActive)a[c].render(c,!1,0),a[c].isActive=!1,e.push(c);a===m||!b.hasRendered||!f?g():f&&setTimeout(g,
+f)});if(o)B=a.getLinePath(o),a.axisLine?a.axisLine.animate({d:B}):a.axisLine=c.path(B).attr({stroke:d.lineColor,"stroke-width":o,zIndex:7}).add(a.axisGroup),a.axisLine[q?"show":"hide"]();if(h&&q)h[h.isNew?"attr":"animate"](a.getTitlePosition()),h.isNew=!1;if(l&&l.enabled){var u,y,d=a.stackTotalGroup;if(!d)a.stackTotalGroup=d=c.g("stack-labels").attr({visibility:"visible",zIndex:6}).add();d.translate(b.plotLeft,b.plotTop);for(u in i)for(y in c=i[u],c)c[y].render(d)}a.isDirty=!1},removePlotBandOrLine:function(a){for(var b=
+this.plotLinesAndBands,c=b.length;c--;)b[c].id===a&&b[c].destroy()},setTitle:function(a,b){this.update({title:a},b)},redraw:function(){var a=this.chart.pointer;a.reset&&a.reset(!0);this.render();n(this.plotLinesAndBands,function(a){a.render()});n(this.series,function(a){a.isDirty=!0})},setCategories:function(a,b){this.update({categories:a},b)},destroy:function(){var a=this,b=a.stacks,c;ba(a);for(c in b)Ga(b[c]),b[c]=null;n([a.ticks,a.minorTicks,a.alternateBands,a.plotLinesAndBands],function(a){Ga(a)});
+n("stackTotalGroup,axisLine,axisGroup,gridGroup,labelGroup,axisTitle".split(","),function(b){a[b]&&(a[b]=a[b].destroy())})}};pb.prototype={init:function(a,b){var c=b.borderWidth,d=b.style,e=u(d.padding);this.chart=a;this.options=b;this.crosshairs=[];this.now={x:0,y:0};this.isHidden=!0;this.label=a.renderer.label("",0,0,b.shape,null,null,b.useHTML,null,"tooltip").attr({padding:e,fill:b.backgroundColor,"stroke-width":c,r:b.borderRadius,zIndex:8}).css(d).css({padding:0}).hide().add();$||this.label.shadow(b.shadow);
+this.shared=b.shared},destroy:function(){n(this.crosshairs,function(a){a&&a.destroy()});if(this.label)this.label=this.label.destroy()},move:function(a,b,c,d){var e=this,f=e.now,g=e.options.animation!==!1&&!e.isHidden;v(f,{x:g?(2*f.x+a)/3:a,y:g?(f.y+b)/2:b,anchorX:g?(2*f.anchorX+c)/3:c,anchorY:g?(f.anchorY+d)/2:d});e.label.attr(f);if(g&&(Q(a-f.x)>1||Q(b-f.y)>1))clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout(function(){e&&e.move(a,b,c,d)},32)},hide:function(){var a=this,b;if(!this.isHidden)b=
+this.chart.hoverPoints,this.hideTimer=setTimeout(function(){a.label.fadeOut();a.isHidden=!0},o(this.options.hideDelay,500)),b&&n(b,function(a){a.setState()}),this.chart.hoverPoints=null},hideCrosshairs:function(){n(this.crosshairs,function(a){a&&a.hide()})},getAnchor:function(a,b){var c,d=this.chart,e=d.inverted,f=d.plotTop,g=0,h=0,i,a=ha(a);c=a[0].tooltipPos;this.followPointer&&b&&(b.chartX===x&&(b=d.pointer.normalize(b)),c=[b.chartX-d.plotLeft,b.chartY-f]);c||(n(a,function(a){i=a.series.yAxis;g+=
+a.plotX;h+=(a.plotLow?(a.plotLow+a.plotHigh)/2:a.plotY)+(!e&&i?i.top-f:0)}),g/=a.length,h/=a.length,c=[e?d.plotWidth-h:g,this.shared&&!e&&a.length>1&&b?b.chartY-f:e?d.plotHeight-g:h]);return Ka(c,t)},getPosition:function(a,b,c){var d=this.chart,e=d.plotLeft,f=d.plotTop,g=d.plotWidth,h=d.plotHeight,i=o(this.options.distance,12),j=c.plotX,c=c.plotY,d=j+e+(d.inverted?i:-a-i),k=c-b+f+15,m;d<7&&(d=e+q(j,0)+i);d+a>e+g&&(d-=d+a-(e+g),k=c-b+f-i,m=!0);k<f+5&&(k=f+5,m&&c>=k&&c<=k+b&&(k=c+f+i));k+b>f+h&&(k=
+q(f,f+h-b-i));return{x:d,y:k}},defaultFormatter:function(a){var b=this.points||ha(this),c=b[0].series,d;d=[c.tooltipHeaderFormatter(b[0])];n(b,function(a){c=a.series;d.push(c.tooltipFormatter&&c.tooltipFormatter(a)||a.point.tooltipFormatter(c.tooltipOptions.pointFormat))});d.push(a.options.footerFormat||"");return d.join("")},refresh:function(a,b){var c=this.chart,d=this.label,e=this.options,f,g,h,i={},j,k=[];j=e.formatter||this.defaultFormatter;var i=c.hoverPoints,m,l=e.crosshairs;h=this.shared;
+clearTimeout(this.hideTimer);this.followPointer=ha(a)[0].series.tooltipOptions.followPointer;g=this.getAnchor(a,b);f=g[0];g=g[1];h&&(!a.series||!a.series.noSharedTooltip)?(c.hoverPoints=a,i&&n(i,function(a){a.setState()}),n(a,function(a){a.setState("hover");k.push(a.getLabelConfig())}),i={x:a[0].category,y:a[0].y},i.points=k,a=a[0]):i=a.getLabelConfig();j=j.call(i,this);i=a.series;h=h||!i.isCartesian||i.tooltipOutsidePlot||c.isInsidePlot(f,g);j===!1||!h?this.hide():(this.isHidden&&(Ta(d),d.attr("opacity",
+1).show()),d.attr({text:j}),m=e.borderColor||a.color||i.color||"#606060",d.attr({stroke:m}),this.updatePosition({plotX:f,plotY:g}),this.isHidden=!1);if(l){l=ha(l);for(d=l.length;d--;)if(e=a.series[d?"yAxis":"xAxis"],l[d]&&e)if(h=d?o(a.stackY,a.y):a.x,e.isLog&&(h=ka(h)),e=e.getPlotLinePath(h,1),this.crosshairs[d])this.crosshairs[d].attr({d:e,visibility:"visible"});else{h={"stroke-width":l[d].width||1,stroke:l[d].color||"#C0C0C0",zIndex:l[d].zIndex||2};if(l[d].dashStyle)h.dashstyle=l[d].dashStyle;this.crosshairs[d]=
+c.renderer.path(e).attr(h).add()}}D(c,"tooltipRefresh",{text:j,x:f+c.plotLeft,y:g+c.plotTop,borderColor:m})},updatePosition:function(a){var b=this.chart,c=this.label,c=(this.options.positioner||this.getPosition).call(this,c.width,c.height,a);this.move(t(c.x),t(c.y),a.plotX+b.plotLeft,a.plotY+b.plotTop)}};qb.prototype={init:function(a,b){var c=$?"":b.chart.zoomType,d=a.inverted,e;this.options=b;this.chart=a;this.zoomX=e=/x/.test(c);this.zoomY=c=/y/.test(c);this.zoomHor=e&&!d||c&&d;this.zoomVert=c&&
+!d||e&&d;this.pinchDown=[];this.lastValidTouch={};if(b.tooltip.enabled)a.tooltip=new pb(a,b.tooltip);this.setDOMEvents()},normalize:function(a){var b,c,d,a=a||O.event;if(!a.target)a.target=a.srcElement;a=Pb(a);d=a.touches?a.touches.item(0):a;this.chartPosition=b=Tb(this.chart.container);d.pageX===x?(c=a.x,b=a.y):(c=d.pageX-b.left,b=d.pageY-b.top);return v(a,{chartX:t(c),chartY:t(b)})},getCoordinates:function(a){var b={xAxis:[],yAxis:[]};n(this.chart.axes,function(c){b[c.isXAxis?"xAxis":"yAxis"].push({axis:c,
+value:c.toValue(a[c.horiz?"chartX":"chartY"])})});return b},getIndex:function(a){var b=this.chart;return b.inverted?b.plotHeight+b.plotTop-a.chartY:a.chartX-b.plotLeft},runPointActions:function(a){var b=this.chart,c=b.series,d=b.tooltip,e,f=b.hoverPoint,g=b.hoverSeries,h,i,j=b.chartWidth,k=this.getIndex(a);if(d&&this.options.tooltip.shared&&(!g||!g.noSharedTooltip)){e=[];h=c.length;for(i=0;i<h;i++)if(c[i].visible&&c[i].options.enableMouseTracking!==!1&&!c[i].noSharedTooltip&&c[i].tooltipPoints.length&&
+(b=c[i].tooltipPoints[k],b.series))b._dist=Q(k-b.clientX),j=K(j,b._dist),e.push(b);for(h=e.length;h--;)e[h]._dist>j&&e.splice(h,1);if(e.length&&e[0].clientX!==this.hoverX)d.refresh(e,a),this.hoverX=e[0].clientX}if(g&&g.tracker){if((b=g.tooltipPoints[k])&&b!==f)b.onMouseOver(a)}else d&&d.followPointer&&!d.isHidden&&(a=d.getAnchor([{}],a),d.updatePosition({plotX:a[0],plotY:a[1]}))},reset:function(a){var b=this.chart,c=b.hoverSeries,d=b.hoverPoint,e=b.tooltip,b=e&&e.shared?b.hoverPoints:d;(a=a&&e&&b)&&
+ha(b)[0].plotX===x&&(a=!1);if(a)e.refresh(b);else{if(d)d.onMouseOut();if(c)c.onMouseOut();e&&(e.hide(),e.hideCrosshairs());this.hoverX=null}},scaleGroups:function(a,b){var c=this.chart;n(c.series,function(d){d.xAxis.zoomEnabled&&(d.group.attr(a),d.markerGroup&&(d.markerGroup.attr(a),d.markerGroup.clip(b?c.clipRect:null)),d.dataLabelsGroup&&d.dataLabelsGroup.attr(a))});c.clipRect.attr(b||c.clipBox)},pinchTranslateDirection:function(a,b,c,d,e,f,g){var h=this.chart,i=a?"x":"y",j=a?"X":"Y",k="chart"+
+j,m=a?"width":"height",l=h["plot"+(a?"Left":"Top")],p,s,o=1,n=h.inverted,w=h.bounds[a?"h":"v"],q=b.length===1,t=b[0][k],r=c[0][k],v=!q&&b[1][k],u=!q&&c[1][k],x,c=function(){!q&&Q(t-v)>20&&(o=Q(r-u)/Q(t-v));s=(l-r)/o+t;p=h["plot"+(a?"Width":"Height")]/o};c();b=s;b<w.min?(b=w.min,x=!0):b+p>w.max&&(b=w.max-p,x=!0);x?(r-=0.8*(r-g[i][0]),q||(u-=0.8*(u-g[i][1])),c()):g[i]=[r,u];n||(f[i]=s-l,f[m]=p);f=n?1/o:o;e[m]=p;e[i]=b;d[n?a?"scaleY":"scaleX":"scale"+j]=o;d["translate"+j]=f*l+(r-f*t)},pinch:function(a){var b=
+this,c=b.chart,d=b.pinchDown,e=c.tooltip.options.followTouchMove,f=a.touches,g=f.length,h=b.lastValidTouch,i=b.zoomHor||b.pinchHor,j=b.zoomVert||b.pinchVert,k=i||j,m=b.selectionMarker,l={},p={};a.type==="touchstart"&&e&&(b.inClass(a.target,"highcharts-tracker")?(!c.runTrackerClick||g>1)&&a.preventDefault():(!c.runChartClick||g>1)&&a.preventDefault());Ka(f,function(a){return b.normalize(a)});if(a.type==="touchstart")n(f,function(a,b){d[b]={chartX:a.chartX,chartY:a.chartY}}),h.x=[d[0].chartX,d[1]&&
+d[1].chartX],h.y=[d[0].chartY,d[1]&&d[1].chartY],n(c.axes,function(a){if(a.zoomEnabled){var b=c.bounds[a.horiz?"h":"v"],d=a.minPixelPadding,e=a.toPixels(a.dataMin),f=a.toPixels(a.dataMax),g=K(e,f),e=q(e,f);b.min=K(a.pos,g-d);b.max=q(a.pos+a.len,e+d)}});else if(d.length){if(!m)b.selectionMarker=m=v({destroy:ta},c.plotBox);i&&b.pinchTranslateDirection(!0,d,f,l,m,p,h);j&&b.pinchTranslateDirection(!1,d,f,l,m,p,h);b.hasPinched=k;b.scaleGroups(l,p);!k&&e&&g===1&&this.runPointActions(b.normalize(a))}},dragStart:function(a){var b=
+this.chart;b.mouseIsDown=a.type;b.cancelClick=!1;b.mouseDownX=this.mouseDownX=a.chartX;this.mouseDownY=a.chartY},drag:function(a){var b=this.chart,c=b.options.chart,d=a.chartX,a=a.chartY,e=this.zoomHor,f=this.zoomVert,g=b.plotLeft,h=b.plotTop,i=b.plotWidth,j=b.plotHeight,k,m=this.mouseDownX,l=this.mouseDownY;d<g?d=g:d>g+i&&(d=g+i);a<h?a=h:a>h+j&&(a=h+j);this.hasDragged=Math.sqrt(Math.pow(m-d,2)+Math.pow(l-a,2));if(this.hasDragged>10){k=b.isInsidePlot(m-g,l-h);if(b.hasCartesianSeries&&(this.zoomX||
+this.zoomY)&&k&&!this.selectionMarker)this.selectionMarker=b.renderer.rect(g,h,e?1:i,f?1:j,0).attr({fill:c.selectionMarkerFill||"rgba(69,114,167,0.25)",zIndex:7}).add();this.selectionMarker&&e&&(e=d-m,this.selectionMarker.attr({width:Q(e),x:(e>0?0:e)+m}));this.selectionMarker&&f&&(e=a-l,this.selectionMarker.attr({height:Q(e),y:(e>0?0:e)+l}));k&&!this.selectionMarker&&c.panning&&b.pan(d)}},drop:function(a){var b=this.chart,c=this.hasPinched;if(this.selectionMarker){var d={xAxis:[],yAxis:[],originalEvent:a.originalEvent||
+a},e=this.selectionMarker,f=e.x,g=e.y,h;if(this.hasDragged||c)n(b.axes,function(a){if(a.zoomEnabled){var b=a.horiz,c=a.minPixelPadding,m=a.toValue((b?f:g)+c),b=a.toValue((b?f+e.width:g+e.height)-c);!isNaN(m)&&!isNaN(b)&&(d[a.xOrY+"Axis"].push({axis:a,min:K(m,b),max:q(m,b)}),h=!0)}}),h&&D(b,"selection",d,function(a){b.zoom(v(a,c?{animation:!1}:null))});this.selectionMarker=this.selectionMarker.destroy();c&&this.scaleGroups({translateX:b.plotLeft,translateY:b.plotTop,scaleX:1,scaleY:1})}if(b)L(b.container,
+{cursor:b._cursor}),b.cancelClick=this.hasDragged,b.mouseIsDown=this.hasDragged=this.hasPinched=!1,this.pinchDown=[]},onContainerMouseDown:function(a){a=this.normalize(a);a.preventDefault&&a.preventDefault();this.dragStart(a)},onDocumentMouseUp:function(a){this.drop(a)},onDocumentMouseMove:function(a){var b=this.chart,c=this.chartPosition,d=b.hoverSeries,a=Pb(a);c&&d&&d.isCartesian&&!b.isInsidePlot(a.pageX-c.left-b.plotLeft,a.pageY-c.top-b.plotTop)&&this.reset()},onContainerMouseLeave:function(){this.reset();
+this.chartPosition=null},onContainerMouseMove:function(a){var b=this.chart,a=this.normalize(a);a.returnValue=!1;b.mouseIsDown==="mousedown"&&this.drag(a);b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&this.runPointActions(a)},inClass:function(a,b){for(var c;a;){if(c=A(a,"class"))if(c.indexOf(b)!==-1)return!0;else if(c.indexOf("highcharts-container")!==-1)return!1;a=a.parentNode}},onTrackerMouseOut:function(a){var b=this.chart.hoverSeries;if(b&&!b.options.stickyTracking&&!this.inClass(a.toElement||
+a.relatedTarget,"highcharts-tooltip"))b.onMouseOut()},onContainerClick:function(a){var b=this.chart,c=b.hoverPoint,d=b.plotLeft,e=b.plotTop,f=b.inverted,g,h,i,a=this.normalize(a);a.cancelBubble=!0;if(!b.cancelClick)c&&this.inClass(a.target,"highcharts-tracker")?(g=this.chartPosition,h=c.plotX,i=c.plotY,v(c,{pageX:g.left+d+(f?b.plotWidth-i:h),pageY:g.top+e+(f?b.plotHeight-h:i)}),D(c.series,"click",v(a,{point:c})),c.firePointEvent("click",a)):(v(a,this.getCoordinates(a)),b.isInsidePlot(a.chartX-d,a.chartY-
+e)&&D(b,"click",a))},onContainerTouchStart:function(a){var b=this.chart;a.touches.length===1?(a=this.normalize(a),b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&(this.runPointActions(a),this.pinch(a))):a.touches.length===2&&this.pinch(a)},onContainerTouchMove:function(a){(a.touches.length===1||a.touches.length===2)&&this.pinch(a)},onDocumentTouchEnd:function(a){this.drop(a)},setDOMEvents:function(){var a=this,b=a.chart.container,c;this._events=c=[[b,"onmousedown","onContainerMouseDown"],
+[b,"onmousemove","onContainerMouseMove"],[b,"onclick","onContainerClick"],[b,"mouseleave","onContainerMouseLeave"],[z,"mousemove","onDocumentMouseMove"],[z,"mouseup","onDocumentMouseUp"]];fb&&c.push([b,"ontouchstart","onContainerTouchStart"],[b,"ontouchmove","onContainerTouchMove"],[z,"touchend","onDocumentTouchEnd"]);n(c,function(b){a["_"+b[2]]=function(c){a[b[2]](c)};b[1].indexOf("on")===0?b[0][b[1]]=a["_"+b[2]]:J(b[0],b[1],a["_"+b[2]])})},destroy:function(){var a=this;n(a._events,function(b){b[1].indexOf("on")===
+0?b[0][b[1]]=null:ba(b[0],b[1],a["_"+b[2]])});delete a._events;clearInterval(a.tooltipTimeout)}};rb.prototype={init:function(a,b){var c=this,d=b.itemStyle,e=o(b.padding,8),f=b.itemMarginTop||0;this.options=b;if(b.enabled)c.baseline=u(d.fontSize)+3+f,c.itemStyle=d,c.itemHiddenStyle=y(d,b.itemHiddenStyle),c.itemMarginTop=f,c.padding=e,c.initialItemX=e,c.initialItemY=e-5,c.maxItemWidth=0,c.chart=a,c.itemHeight=0,c.lastLineHeight=0,c.render(),J(c.chart,"endResize",function(){c.positionCheckboxes()})},
+colorizeItem:function(a,b){var c=this.options,d=a.legendItem,e=a.legendLine,f=a.legendSymbol,g=this.itemHiddenStyle.color,c=b?c.itemStyle.color:g,h=b?a.color:g,g=a.options&&a.options.marker,i={stroke:h,fill:h},j;d&&d.css({fill:c,color:c});e&&e.attr({stroke:h});if(f){if(g)for(j in g=a.convertAttribs(g),g)d=g[j],d!==x&&(i[j]=d);f.attr(i)}},positionItem:function(a){var b=this.options,c=b.symbolPadding,b=!b.rtl,d=a._legendItemPos,e=d[0],d=d[1],f=a.checkbox;a.legendGroup&&a.legendGroup.translate(b?e:this.legendWidth-
+e-2*c-4,d);if(f)f.x=e,f.y=d},destroyItem:function(a){var b=a.checkbox;n(["legendItem","legendLine","legendSymbol","legendGroup"],function(b){a[b]&&a[b].destroy()});b&&Ra(a.checkbox)},destroy:function(){var a=this.group,b=this.box;if(b)this.box=b.destroy();if(a)this.group=a.destroy()},positionCheckboxes:function(a){var b=this.group.alignAttr,c,d=this.clipHeight||this.legendHeight;if(b)c=b.translateY,n(this.allItems,function(e){var f=e.checkbox,g;f&&(g=c+f.y+(a||0)+3,L(f,{left:b.translateX+e.legendItemWidth+
+f.x-20+"px",top:g+"px",display:g>c-6&&g<c+d-6?"":S}))})},renderTitle:function(){var a=this.padding,b=this.options.title,c=0;if(b.text){if(!this.title)this.title=this.chart.renderer.label(b.text,a-3,a-4,null,null,null,null,null,"legend-title").attr({zIndex:1}).css(b.style).add(this.group);c=this.title.getBBox().height;this.contentGroup.attr({translateY:c})}this.titleHeight=c},renderItem:function(a){var w;var b=this,c=b.chart,d=c.renderer,e=b.options,f=e.layout==="horizontal",g=e.symbolWidth,h=e.symbolPadding,
+i=b.itemStyle,j=b.itemHiddenStyle,k=b.padding,m=!e.rtl,l=e.width,p=e.itemMarginBottom||0,s=b.itemMarginTop,o=b.initialItemX,n=a.legendItem,t=a.series||a,r=t.options,v=r.showCheckbox,u=e.useHTML;if(!n&&(a.legendGroup=d.g("legend-item").attr({zIndex:1}).add(b.scrollGroup),t.drawLegendSymbol(b,a),a.legendItem=n=d.text(e.labelFormat?Ea(e.labelFormat,a):e.labelFormatter.call(a),m?g+h:-h,b.baseline,u).css(y(a.visible?i:j)).attr({align:m?"left":"right",zIndex:2}).add(a.legendGroup),(u?n:a.legendGroup).on("mouseover",
+function(){a.setState("hover");n.css(b.options.itemHoverStyle)}).on("mouseout",function(){n.css(a.visible?i:j);a.setState()}).on("click",function(b){var c=function(){a.setVisible()},b={browserEvent:b};a.firePointEvent?a.firePointEvent("legendItemClick",b,c):D(a,"legendItemClick",b,c)}),b.colorizeItem(a,a.visible),r&&v))a.checkbox=U("input",{type:"checkbox",checked:a.selected,defaultChecked:a.selected},e.itemCheckboxStyle,c.container),J(a.checkbox,"click",function(b){D(a,"checkboxClick",{checked:b.target.checked},
+function(){a.select()})});d=n.getBBox();w=a.legendItemWidth=e.itemWidth||g+h+d.width+k+(v?20:0),e=w;b.itemHeight=g=d.height;if(f&&b.itemX-o+e>(l||c.chartWidth-2*k-o))b.itemX=o,b.itemY+=s+b.lastLineHeight+p,b.lastLineHeight=0;b.maxItemWidth=q(b.maxItemWidth,e);b.lastItemY=s+b.itemY+p;b.lastLineHeight=q(g,b.lastLineHeight);a._legendItemPos=[b.itemX,b.itemY];f?b.itemX+=e:(b.itemY+=s+g+p,b.lastLineHeight=g);b.offsetWidth=l||q(f?b.itemX-o:e,b.offsetWidth)},render:function(){var a=this,b=a.chart,c=b.renderer,
+d=a.group,e,f,g,h,i=a.box,j=a.options,k=a.padding,m=j.borderWidth,l=j.backgroundColor;a.itemX=a.initialItemX;a.itemY=a.initialItemY;a.offsetWidth=0;a.lastItemY=0;if(!d)a.group=d=c.g("legend").attr({zIndex:7}).add(),a.contentGroup=c.g().attr({zIndex:1}).add(d),a.scrollGroup=c.g().add(a.contentGroup),a.clipRect=c.clipRect(0,0,9999,b.chartHeight),a.contentGroup.clip(a.clipRect);a.renderTitle();e=[];n(b.series,function(a){var b=a.options;b.showInLegend&&!r(b.linkedTo)&&(e=e.concat(a.legendItems||(b.legendType===
+"point"?a.data:a)))});Gb(e,function(a,b){return(a.options&&a.options.legendIndex||0)-(b.options&&b.options.legendIndex||0)});j.reversed&&e.reverse();a.allItems=e;a.display=f=!!e.length;n(e,function(b){a.renderItem(b)});g=j.width||a.offsetWidth;h=a.lastItemY+a.lastLineHeight+a.titleHeight;h=a.handleOverflow(h);if(m||l){g+=k;h+=k;if(i){if(g>0&&h>0)i[i.isNew?"attr":"animate"](i.crisp(null,null,null,g,h)),i.isNew=!1}else a.box=i=c.rect(0,0,g,h,j.borderRadius,m||0).attr({stroke:j.borderColor,"stroke-width":m||
+0,fill:l||S}).add(d).shadow(j.shadow),i.isNew=!0;i[f?"show":"hide"]()}a.legendWidth=g;a.legendHeight=h;n(e,function(b){a.positionItem(b)});f&&d.align(v({width:g,height:h},j),!0,"spacingBox");b.isResizing||this.positionCheckboxes()},handleOverflow:function(a){var b=this,c=this.chart,d=c.renderer,e=this.options,f=e.y,f=c.spacingBox.height+(e.verticalAlign==="top"?-f:f)-this.padding,g=e.maxHeight,h=this.clipRect,i=e.navigation,j=o(i.animation,!0),k=i.arrowSize||12,m=this.nav;e.layout==="horizontal"&&
+(f/=2);g&&(f=K(f,g));if(a>f&&!e.useHTML){this.clipHeight=c=f-20-this.titleHeight;this.pageCount=ja(a/c);this.currentPage=o(this.currentPage,1);this.fullHeight=a;h.attr({height:c});if(!m)this.nav=m=d.g().attr({zIndex:1}).add(this.group),this.up=d.symbol("triangle",0,0,k,k).on("click",function(){b.scroll(-1,j)}).add(m),this.pager=d.text("",15,10).css(i.style).add(m),this.down=d.symbol("triangle-down",0,0,k,k).on("click",function(){b.scroll(1,j)}).add(m);b.scroll(0);a=f}else if(m)h.attr({height:c.chartHeight}),
+m.hide(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0;return a},scroll:function(a,b){var c=this.pageCount,d=this.currentPage+a,e=this.clipHeight,f=this.options.navigation,g=f.activeColor,h=f.inactiveColor,f=this.pager,i=this.padding;d>c&&(d=c);if(d>0)b!==x&&Ha(b,this.chart),this.nav.attr({translateX:i,translateY:e+7+this.titleHeight,visibility:"visible"}),this.up.attr({fill:d===1?h:g}).css({cursor:d===1?"default":"pointer"}),f.attr({text:d+"/"+this.pageCount}),this.down.attr({x:18+this.pager.getBBox().width,
+fill:d===c?h:g}).css({cursor:d===c?"default":"pointer"}),e=-K(e*(d-1),this.fullHeight-e+i)+1,this.scrollGroup.animate({translateY:e}),f.attr({text:d+"/"+c}),this.currentPage=d,this.positionCheckboxes(e)}};sb.prototype={init:function(a,b){var c,d=a.series;a.series=null;c=y(N,a);c.series=a.series=d;var d=c.chart,e=d.margin,e=V(e)?e:[e,e,e,e];this.optionsMarginTop=o(d.marginTop,e[0]);this.optionsMarginRight=o(d.marginRight,e[1]);this.optionsMarginBottom=o(d.marginBottom,e[2]);this.optionsMarginLeft=
+o(d.marginLeft,e[3]);this.runChartClick=(e=d.events)&&!!e.click;this.bounds={h:{},v:{}};this.callback=b;this.isResizing=0;this.options=c;this.axes=[];this.series=[];this.hasCartesianSeries=d.showAxes;var f=this,g;f.index=za.length;za.push(f);d.reflow!==!1&&J(f,"load",function(){f.initReflow()});if(e)for(g in e)J(f,g,e[g]);f.xAxis=[];f.yAxis=[];f.animation=$?!1:o(d.animation,!0);f.pointCount=0;f.counters=new Fb;f.firstRender()},initSeries:function(a){var b=this.options.chart;(b=aa[a.type||b.type||
+b.defaultSeriesType])||qa(17,!0);b=new b;b.init(this,a);return b},addSeries:function(a,b,c){var d,e=this;a&&(b=o(b,!0),D(e,"addSeries",{options:a},function(){d=e.initSeries(a);e.isDirtyLegend=!0;b&&e.redraw(c)}));return d},addAxis:function(a,b,c,d){var b=b?"xAxis":"yAxis",e=this.options;new ab(this,y(a,{index:this[b].length}));e[b]=ha(e[b]||{});e[b].push(a);o(c,!0)&&this.redraw(d)},isInsidePlot:function(a,b,c){var d=c?b:a,a=c?a:b;return d>=0&&d<=this.plotWidth&&a>=0&&a<=this.plotHeight},adjustTickAmounts:function(){this.options.chart.alignTicks!==
+!1&&n(this.axes,function(a){a.adjustTickAmount()});this.maxTicks=null},redraw:function(a){var b=this.axes,c=this.series,d=this.pointer,e=this.legend,f=this.isDirtyLegend,g,h=this.isDirtyBox,i=c.length,j=i,k=this.renderer,m=k.isHidden(),l=[];Ha(a,this);for(m&&this.cloneRenderTo();j--;)if(a=c[j],a.isDirty&&a.options.stacking){g=!0;break}if(g)for(j=i;j--;)if(a=c[j],a.options.stacking)a.isDirty=!0;n(c,function(a){a.isDirty&&a.options.legendType==="point"&&(f=!0)});if(f&&e.options.enabled)e.render(),this.isDirtyLegend=
+!1;if(this.hasCartesianSeries){if(!this.isResizing)this.maxTicks=null,n(b,function(a){a.setScale()});this.adjustTickAmounts();this.getMargins();n(b,function(a){if(a.isDirtyExtremes)a.isDirtyExtremes=!1,l.push(function(){D(a,"afterSetExtremes",a.getExtremes())});if(a.isDirty||h||g)a.redraw(),h=!0})}h&&this.drawChartBox();n(c,function(a){a.isDirty&&a.visible&&(!a.isCartesian||a.xAxis)&&a.redraw()});d&&d.reset&&d.reset(!0);k.draw();D(this,"redraw");m&&this.cloneRenderTo(!0);n(l,function(a){a.call()})},
+showLoading:function(a){var b=this.options,c=this.loadingDiv,d=b.loading;if(!c)this.loadingDiv=c=U(wa,{className:"highcharts-loading"},v(d.style,{zIndex:10,display:S}),this.container),this.loadingSpan=U("span",null,d.labelStyle,c);this.loadingSpan.innerHTML=a||b.lang.loading;if(!this.loadingShown)L(c,{opacity:0,display:"",left:this.plotLeft+"px",top:this.plotTop+"px",width:this.plotWidth+"px",height:this.plotHeight+"px"}),vb(c,{opacity:d.style.opacity},{duration:d.showDuration||0}),this.loadingShown=
+!0},hideLoading:function(){var a=this.options,b=this.loadingDiv;b&&vb(b,{opacity:0},{duration:a.loading.hideDuration||100,complete:function(){L(b,{display:S})}});this.loadingShown=!1},get:function(a){var b=this.axes,c=this.series,d,e;for(d=0;d<b.length;d++)if(b[d].options.id===a)return b[d];for(d=0;d<c.length;d++)if(c[d].options.id===a)return c[d];for(d=0;d<c.length;d++){e=c[d].points||[];for(b=0;b<e.length;b++)if(e[b].id===a)return e[b]}return null},getAxes:function(){var a=this,b=this.options,c=
+b.xAxis=ha(b.xAxis||{}),b=b.yAxis=ha(b.yAxis||{});n(c,function(a,b){a.index=b;a.isX=!0});n(b,function(a,b){a.index=b});c=c.concat(b);n(c,function(b){new ab(a,b)});a.adjustTickAmounts()},getSelectedPoints:function(){var a=[];n(this.series,function(b){a=a.concat(Ob(b.points||[],function(a){return a.selected}))});return a},getSelectedSeries:function(){return Ob(this.series,function(a){return a.selected})},showResetZoom:function(){var a=this,b=N.lang,c=a.options.chart.resetZoomButton,d=c.theme,e=d.states,
+f=c.relativeTo==="chart"?null:"plotBox";this.resetZoomButton=a.renderer.button(b.resetZoom,null,null,function(){a.zoomOut()},d,e&&e.hover).attr({align:c.position.align,title:b.resetZoomTitle}).add().align(c.position,!1,f)},zoomOut:function(){var a=this;D(a,"selection",{resetSelection:!0},function(){a.zoom()})},zoom:function(a){var b,c=this.pointer,d=!1,e;!a||a.resetSelection?n(this.axes,function(a){b=a.zoom()}):n(a.xAxis.concat(a.yAxis),function(a){var e=a.axis,h=e.isXAxis;if(c[h?"zoomX":"zoomY"]||
+c[h?"pinchX":"pinchY"])b=e.zoom(a.min,a.max),e.displayBtn&&(d=!0)});e=this.resetZoomButton;if(d&&!e)this.showResetZoom();else if(!d&&V(e))this.resetZoomButton=e.destroy();b&&this.redraw(o(this.options.

<TRUNCATED>

[39/50] [abbrv] cxf git commit: Support @Policy annotation on impl methods. Fixes the Policy annotation test Colm added

Posted by re...@apache.org.
Support @Policy annotation on impl methods. Fixes the Policy annotation test Colm added


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/28f130c5
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/28f130c5
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/28f130c5

Branch: refs/heads/master-jaxrs-2.1
Commit: 28f130c59cad98037b4812f21d3610b96a3edc49
Parents: abc147c
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue May 24 13:30:21 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue May 24 13:30:21 2016 -0400

----------------------------------------------------------------------
 .../java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java | 5 ++---
 .../cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java  | 4 +++-
 .../cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java     | 4 +++-
 .../test/java/org/apache/cxf/systest/ws/fault/FaultTest.java    | 2 --
 4 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/28f130c5/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
----------------------------------------------------------------------
diff --git a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
index b35295e..c9e2e32 100644
--- a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
+++ b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
@@ -91,9 +91,8 @@ public class PolicyAnnotationListener implements FactoryBeanListener {
             if (ep.getEndpointInfo().getInterface() != null) {
                 addPolicies(factory, ep, cls);
             
-                // this will allow us to support annotations in Implementations, but only for
-                // class level annotations.  Method level annotations are not currently supported
-                // for implementations.  The call has been moved here so that the ServiceInfo
+                // this will allow us to support annotations in Implementations.
+                // The call has been moved here so that the ServiceInfo
                 // policy stuff is loaded before jaxws factory calls the PolicyEngineImpl
                 addEndpointImplPolicies(factory, ep, implCls);
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/28f130c5/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
index 1c65fac..c55b832 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
@@ -84,6 +84,7 @@ import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.ServiceImpl;
 import org.apache.cxf.service.ServiceModelSchemaValidator;
+import org.apache.cxf.service.factory.FactoryBeanListener;
 import org.apache.cxf.service.factory.FactoryBeanListener.Event;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.factory.SimpleMethodDispatcher;
@@ -355,7 +356,8 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
     }
 
     public void updateBindingOperation(BindingOperationInfo boi) {
-        //nothing
+        Method m = getMethodDispatcher().getMethod(boi);
+        sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, boi.getBinding(), boi, m);
     }
 
     public Endpoint createEndpoint(EndpointInfo ei) throws EndpointException {

http://git-wip-us.apache.org/repos/asf/cxf/blob/28f130c5/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
index 0d3d6a7..fbbf957 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
@@ -30,7 +30,9 @@ import org.example.contract.doubleit.DoubleItFault;
 import org.example.contract.doubleit.DoubleItPortType;
 
 @WebService(targetNamespace = "http://www.example.org/contract/DoubleIt", 
-            serviceName = "DoubleItService", 
+            serviceName = "DoubleItService",
+            portName = "DoubleItSoap11NoPolicyBinding",
+            name = "DoubleItSoap11NoPolicyBinding",
             endpointInterface = "org.example.contract.doubleit.DoubleItPortType")
 @Features(features = "org.apache.cxf.feature.LoggingFeature")     
 // @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml")

http://git-wip-us.apache.org/repos/asf/cxf/blob/28f130c5/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
index 755f11b..e34a511 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
@@ -259,10 +259,8 @@ public class FaultTest extends AbstractBusClientServerTestBase {
         bus.shutdown(true);
     }
     
-    // TODO - There seems to be a bug when a security policy is applied to a method as opposed to the class
     // See DoubleItPortTypeImplJavaFirst
     @org.junit.Test
-    @org.junit.Ignore
     public void testJavaFirst() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();


[03/50] [abbrv] cxf git commit: [CXF-6900] Get Colm's tests working....

Posted by re...@apache.org.
[CXF-6900] Get Colm's tests working....


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0e5fd5a5
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0e5fd5a5
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0e5fd5a5

Branch: refs/heads/master-jaxrs-2.1
Commit: 0e5fd5a54cb271ba494e7e30b45d4228b33364a9
Parents: f876459
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue May 17 12:13:14 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue May 17 12:13:33 2016 -0400

----------------------------------------------------------------------
 .../cxf/binding/soap/saaj/SAAJStreamWriter.java       |  4 ++++
 .../apache/cxf/binding/soap/saaj/ParseBodyTest.java   | 14 ++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/0e5fd5a5/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
index 14b5c2e..d29276c 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
@@ -52,6 +52,9 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
             if (namespace != null 
                 && namespace.equals(part.getEnvelope().getElementName().getURI())) {
                 adjustPrefix((SOAPElement)nd2, pfx);
+                if ("Envelope".equals(nd2.getLocalName())) {
+                    adjustPrefix(part.getEnvelope().getHeader(), pfx);
+                }
             }
         } catch (SOAPException e) {
             //ignore, fallback
@@ -146,6 +149,7 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
                     el = ((SOAPElement)cur).addChildElement(local, "", "");
                 } else {
                     el = ((SOAPElement)cur).addChildElement(local, pfx == null ? "" : pfx, ns);
+                    adjustPrefix((SOAPElement)el, pfx);
                 }
                 cur.removeChild(el);
                 return el;

http://git-wip-us.apache.org/repos/asf/cxf/blob/0e5fd5a5/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
index bcdb6f9..1f6eeb4 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
@@ -30,6 +30,7 @@ import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 
 import org.w3c.dom.Document;
@@ -39,6 +40,7 @@ import org.apache.cxf.helpers.DOMUtils.NullResolver;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.staxutils.StaxSource;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.junit.Assert;
 import org.junit.Test;
@@ -87,26 +89,30 @@ public class ParseBodyTest extends Assert {
     
     // TODO - See CXF-6900
     @Test
-    @org.junit.Ignore
     public void testReadSOAPFault() throws Exception {
         InputStream inStream = getClass().getResourceAsStream("soap12-fault.xml");
         Document doc = StaxUtils.read(inStream);
-
+        
         SoapMessage msg = new SoapMessage(new MessageImpl());
         Exchange ex = new ExchangeImpl();
         ex.setInMessage(msg);
         
         SOAPMessage saajMsg = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
         SOAPPart part = saajMsg.getSOAPPart();
-        part.setContent(new DOMSource(doc));
+        SAAJStreamWriter writer = new SAAJStreamWriter(part);
+        StaxUtils.copy(doc, writer);
+        //Source s = new StaxSource(StaxUtils.createXMLStreamReader(doc));
+        //part.setContent(s);
         saajMsg.saveChanges();
-
+        
         msg.setContent(SOAPMessage.class, saajMsg);
         doc = part;
         
         // System.out.println("OUTPUT: " + StaxUtils.toString(doc));
         
         byte[] docbytes = getMessageBytes(doc);
+        
+        // System.out.println("OUTPUT: " + new String(docbytes));
         XMLStreamReader reader = StaxUtils.createXMLStreamReader(new ByteArrayInputStream(docbytes));
 
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();


[47/50] [abbrv] cxf git commit: CXF-5855: Introduce support for Server Sent Events. Initial implementation based on Atmosphere

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/pom.xml b/distribution/src/main/release/samples/pom.xml
index d7c5587..f9c5847 100644
--- a/distribution/src/main/release/samples/pom.xml
+++ b/distribution/src/main/release/samples/pom.xml
@@ -113,6 +113,7 @@
         <module>jax_rs/tracing_htrace</module>
         <module>clustering/failover_jaxws_osgi</module>
         <module>clustering/failover_server</module>
+        <module>jax_rs/sse</module>
         
         <!--
          These are removed from the build as they currently don't inherit the parent from 

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index b6d9000..594213b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -109,7 +109,7 @@
         <cxf.geronimo.transaction.version>1.1.1</cxf.geronimo.transaction.version>
         <cxf.jasypt.bundle.version>1.9.0_1</cxf.jasypt.bundle.version>
         <cxf.javassist.version>3.19.0-GA</cxf.javassist.version>
-        <cxf.javax.ws.rs.version>2.0.1</cxf.javax.ws.rs.version>
+        <cxf.javax.ws.rs.version>2.1-SNAPSHOT</cxf.javax.ws.rs.version>
         <cxf.jaxb.version>2.2.11</cxf.jaxb.version>
         <cxf.jaxb.impl.version>${cxf.jaxb.version}</cxf.jaxb.impl.version>
         <cxf.jaxb.core.version>${cxf.jaxb.version}</cxf.jaxb.core.version>
@@ -2184,4 +2184,19 @@
             </build>
         </profile>
     </profiles>
+
+    <!-- Temporarily only till JAX-RS 2.1 artifacts become available -->
+    <repositories>
+        <repository>
+            <id>maven.java.net</id>
+            <name>java.net snapshots</name>
+            <url>https://maven.java.net/content/repositories/snapshots/</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+    </repositories>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/pom.xml
----------------------------------------------------------------------
diff --git a/rt/rs/pom.xml b/rt/rs/pom.xml
index a79671e..765330d 100644
--- a/rt/rs/pom.xml
+++ b/rt/rs/pom.xml
@@ -37,5 +37,6 @@
         <module>extensions/providers</module>
         <module>extensions/search</module>
         <module>security</module>
+        <module>sse</module>
     </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/pom.xml
----------------------------------------------------------------------
diff --git a/rt/rs/sse/pom.xml b/rt/rs/sse/pom.xml
new file mode 100644
index 0000000..43e5c66
--- /dev/null
+++ b/rt/rs/sse/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>cxf-rt-rs-sse</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache CXF JAX-RS Server-Side Events Support</name>
+    <description>Apache CXF JAX-RS Server-Side Events Support</description>
+    <url>http://cxf.apache.org</url>
+    <parent>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-parent</artifactId>
+        <version>3.2.0-SNAPSHOT</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+    <properties>
+        <cxf.osgi.import>
+            javax.servlet*;version="${cxf.osgi.javax.servlet.version}",
+        </cxf.osgi.import>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+            <version>${project.version}</version>
+        </dependency>    
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${cxf.servlet-api.group}</groupId>
+            <artifactId>${cxf.servlet-api.artifact}</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.atmosphere</groupId>
+            <artifactId>atmosphere-runtime</artifactId>
+            <version>${cxf.atmosphere.version}</version>
+        </dependency>
+    </dependencies>
+    <build>
+    <plugins>
+        <plugin>
+            <artifactId>maven-checkstyle-plugin</artifactId>
+            <configuration>
+                <skip>true</skip>
+            </configuration>
+        </plugin>
+    </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/OutboundSseEventBodyWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/OutboundSseEventBodyWriter.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/OutboundSseEventBodyWriter.java
new file mode 100644
index 0000000..4a9b3aa
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/OutboundSseEventBodyWriter.java
@@ -0,0 +1,139 @@
+/**
+ * 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.jaxrs.sse;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
+
+import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.sse.OutboundSseEvent;
+
+import org.apache.cxf.jaxrs.provider.ServerProviderFactory;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+
+@Provider
+public class OutboundSseEventBodyWriter implements MessageBodyWriter<OutboundSseEvent> {
+    public static final String SERVER_SENT_EVENTS = "text/event-stream";
+    public static final MediaType SERVER_SENT_EVENTS_TYPE = MediaType.valueOf(SERVER_SENT_EVENTS);
+
+    private static final byte[] COMMENT = ": ".getBytes(StandardCharsets.UTF_8);
+    private static final byte[] EVENT = "    ".getBytes(StandardCharsets.UTF_8);
+    private static final byte[] ID = "id: ".getBytes(StandardCharsets.UTF_8);
+    private static final byte[] RETRY = "retry: ".getBytes(StandardCharsets.UTF_8);
+    private static final byte[] DATA = "data: ".getBytes(StandardCharsets.UTF_8);
+    private static final byte[] NEW_LINE = "\n".getBytes(StandardCharsets.UTF_8);
+
+    private ServerProviderFactory factory;
+    private Message message;
+    
+    protected OutboundSseEventBodyWriter() {
+    }
+
+    public OutboundSseEventBodyWriter(final ServerProviderFactory factory, final Exchange exchange) {
+        this.factory = factory;
+        this.message = new MessageImpl();
+        this.message.setExchange(exchange);
+    }
+
+    
+    @Override
+    public boolean isWriteable(Class<?> cls, Type type, Annotation[] anns, MediaType mt) {
+        return OutboundSseEvent.class.isAssignableFrom(cls) || SERVER_SENT_EVENTS_TYPE.isCompatible(mt);
+    }
+    
+    @Override
+    public void writeTo(OutboundSseEvent p, Class<?> cls, Type t, Annotation[] anns,
+            MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os) 
+                throws IOException, WebApplicationException {
+        
+        if (p.getName() != null) {
+            os.write(EVENT);
+            os.write(p.getName().getBytes(StandardCharsets.UTF_8));
+            os.write(NEW_LINE);
+        }
+        
+        if (p.getId() != null) {
+            os.write(ID);
+            os.write(p.getId().getBytes(StandardCharsets.UTF_8));
+            os.write(NEW_LINE);
+        }
+        
+        if (p.getComment() != null) {
+            os.write(COMMENT);
+            os.write(p.getComment().getBytes(StandardCharsets.UTF_8));
+            os.write(NEW_LINE);
+        }
+        
+        if (p.getReconnectDelay() > 0) {
+            os.write(RETRY);
+            os.write(Long.toString(p.getReconnectDelay()).getBytes(StandardCharsets.UTF_8));
+            os.write(NEW_LINE);
+        }
+
+        if (p.getData() != null) {
+            Class<?> payloadClass = p.getType();
+            Type payloadType = p.getGenericType();
+            if (payloadType == null) {
+                payloadType = payloadClass;
+            }
+            
+            if (payloadType == null && payloadClass == null) {
+                payloadType = Object.class;
+                payloadClass = Object.class;
+            }
+            
+            os.write(DATA);
+            writePayloadTo(payloadClass, payloadType, anns, p.getMediaType(), headers, p.getData(), os);
+            os.write(NEW_LINE);
+        }
+    }
+    
+    @SuppressWarnings("unchecked")
+    private<T> void writePayloadTo(Class<T> cls, Type type, Annotation[] anns, MediaType mt, 
+            MultivaluedMap<String, Object> headers, Object data, OutputStream os) 
+                throws IOException, WebApplicationException {
+        
+        MessageBodyWriter<T> writer = null;
+        if (message != null && factory != null) {
+            writer = factory.createMessageBodyWriter(cls, type, anns, mt, message);
+        }
+        
+        if (writer == null) {
+            throw new InternalServerErrorException("No suitable message body writer for class: " + cls.getName());
+        }
+        
+        writer.writeTo((T)data, cls, type, anns, mt, headers, os);
+    }
+    
+    @Override
+    public long getSize(OutboundSseEvent t, Class<?> type, Type genericType, Annotation[] annotations, 
+            MediaType mediaType) {
+        return -1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/OutboundSseEventImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/OutboundSseEventImpl.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/OutboundSseEventImpl.java
new file mode 100644
index 0000000..f852637
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/OutboundSseEventImpl.java
@@ -0,0 +1,171 @@
+/**
+ * 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.jaxrs.sse;
+
+import java.lang.reflect.Type;
+
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.sse.OutboundSseEvent;
+
+public class OutboundSseEventImpl implements OutboundSseEvent {
+    private String id;
+    private String name;
+    private String comment;
+    private long reconnectDelay = -1;
+    private Class<?> type;
+    private Type genericType;
+    private MediaType mediaType;
+    private Object data;
+
+    public static class BuilderImpl implements Builder {
+        private String id;
+        private String name;
+        private String comment;
+        private long reconnectDelay = -1;
+        private Class<?> type;
+        private Type genericType;
+        private MediaType mediaType;
+        private Object data;
+
+        @Override
+        public Builder id(String id) {
+            this.id = id;
+            return this;
+        }
+
+        @Override
+        public Builder name(String name) {
+            this.name = name;
+            return this;
+        }
+
+        @Override
+        public Builder reconnectDelay(long milliseconds) {
+            this.reconnectDelay = milliseconds;
+            return this;
+        }
+
+        @Override
+        public Builder mediaType(MediaType mediaType) {
+            this.mediaType = mediaType;
+            return this;
+        }
+
+        @Override
+        public Builder comment(String comment) {
+            this.comment = comment;
+            return this;
+        }
+
+        @Override
+        @SuppressWarnings("rawtypes")
+        public Builder data(Class type, Object data) {
+            this.type = type;
+            this.data= data;
+            return this;
+        }
+
+        @Override
+        @SuppressWarnings("rawtypes")
+        public Builder data(GenericType type, Object data) {
+            this.genericType = type.getType();
+            this.data= data;
+            return this;
+        }
+
+        @Override
+        public Builder data(Object data) {
+            this.data = data;
+            return this;
+        }
+
+        @Override
+        public OutboundSseEvent build() {
+            return new OutboundSseEventImpl(
+                id,
+                name,
+                comment,
+                reconnectDelay,
+                type,
+                genericType,
+                mediaType,
+                data
+            );
+        }
+        
+    }
+    
+    OutboundSseEventImpl(String id, String name, String comment, long reconnectDelay, 
+            Class<?> type, Type genericType, MediaType mediaType, Object data) {
+        this.id = id;
+        this.name = name;
+        this.comment = comment;
+        this.reconnectDelay = reconnectDelay;
+        this.type = type;
+        this.genericType = genericType;
+        this.mediaType = mediaType;
+        this.data = data;
+    }
+    
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getComment() {
+        return comment;
+    }
+
+    @Override
+    public long getReconnectDelay() {
+        return reconnectDelay;
+    }
+
+    @Override
+    public boolean isReconnectDelaySet() {
+        return reconnectDelay != -1;
+    }
+
+    @Override
+    public Class<?> getType() {
+        return type;
+    }
+
+    @Override
+    public Type getGenericType() {
+        return genericType;
+    }
+
+    @Override
+    public MediaType getMediaType() {
+        return mediaType;
+    }
+
+    @Override
+    public Object getData() {
+        return data;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseBroadcasterImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseBroadcasterImpl.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseBroadcasterImpl.java
new file mode 100644
index 0000000..977a6b2
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseBroadcasterImpl.java
@@ -0,0 +1,65 @@
+/**
+ * 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.jaxrs.sse;
+
+import java.io.IOException;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+import javax.ws.rs.sse.OutboundSseEvent;
+import javax.ws.rs.sse.SseBroadcaster;
+import javax.ws.rs.sse.SseEventOutput;
+
+public class SseBroadcasterImpl implements SseBroadcaster {
+    private final Set<SseEventOutput> outputs = new CopyOnWriteArraySet<>();
+    private final Set<Listener> listeners = new CopyOnWriteArraySet<>();
+            
+    @Override
+    public boolean register(Listener listener) {
+        return listeners.add(listener);
+    }
+
+    @Override
+    public boolean register(SseEventOutput output) {
+        return outputs.add(output);
+    }
+
+    @Override
+    public void broadcast(OutboundSseEvent event) {
+        for (final SseEventOutput output: outputs) {
+            try {
+                output.write(event);
+            } catch (final IOException ex) {
+                listeners.forEach(listener -> listener.onException(output, ex));
+            }
+        }
+    }
+
+    @Override
+    public void close() {
+        for (final SseEventOutput output: outputs) {
+            try {
+                output.close();
+                listeners.forEach(listener -> listener.onClose(output));
+            } catch (final IOException ex) {
+                listeners.forEach(listener -> listener.onException(output, ex));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseEventOutputProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseEventOutputProvider.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseEventOutputProvider.java
new file mode 100644
index 0000000..7f7963f
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseEventOutputProvider.java
@@ -0,0 +1,53 @@
+/**
+ * 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.jaxrs.sse;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.sse.SseEventOutput;
+
+@Provider
+public class SseEventOutputProvider implements MessageBodyWriter<SseEventOutput> {
+    @Override
+    public boolean isWriteable(Class<?> cls, Type type, Annotation[] anns, MediaType mt) {
+        return SseEventOutput.class.isAssignableFrom(cls);
+    }
+    
+    @Override
+    public long getSize(final SseEventOutput output, final Class<?> type, final Type genericType,
+                        final Annotation[] annotations, final MediaType mediaType) {
+        return -1;
+    }
+
+    @Override
+    public void writeTo(final SseEventOutput output, final Class<?> type, final Type genericType,
+                        final Annotation[] annotations, final MediaType mediaType,
+                        final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream)
+            throws IOException, WebApplicationException {
+        // do nothing.
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFeature.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFeature.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFeature.java
new file mode 100644
index 0000000..da682a0
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFeature.java
@@ -0,0 +1,41 @@
+/**
+ * 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.jaxrs.sse;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.jaxrs.provider.ServerProviderFactory;
+import org.apache.cxf.jaxrs.sse.atmosphere.SseAtmosphereContextProvider;
+
+public class SseFeature extends AbstractFeature {
+    @Override
+    public void initialize(Server server, Bus bus) {
+        final List<Object> providers = new ArrayList<>();
+
+        providers.add(new SseAtmosphereContextProvider());
+        providers.add(new SseEventOutputProvider());
+
+        ((ServerProviderFactory) server.getEndpoint().get(
+            ServerProviderFactory.class.getName())).setUserProviders(providers);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereContextProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereContextProvider.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereContextProvider.java
new file mode 100644
index 0000000..de2c3a9
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereContextProvider.java
@@ -0,0 +1,57 @@
+/**
+ * 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.jaxrs.sse.atmosphere;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.sse.SseContext;
+
+import org.apache.cxf.jaxrs.ext.ContextProvider;
+import org.apache.cxf.jaxrs.provider.ServerProviderFactory;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.http.AbstractHTTPDestination;
+import org.atmosphere.cpr.AtmosphereResource;
+import org.atmosphere.cpr.Broadcaster;
+
+@Provider
+public class SseAtmosphereContextProvider implements ContextProvider<SseContext> {
+    @Override
+    public SseContext createContext(Message message) {
+        final HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
+        if (request == null) {
+            throw new IllegalStateException("Unable to retrieve HTTP request from the context");
+        }
+        
+        final AtmosphereResource resource = (AtmosphereResource)request
+            .getAttribute(AtmosphereResource.class.getName());
+        if (resource == null) {
+            throw new IllegalStateException("AtmosphereResource is not present, "
+                    + "is AtmosphereServlet configured properly?");
+        }
+        
+        final Broadcaster broadcaster = resource.getAtmosphereConfig()
+            .getBroadcasterFactory()
+            .lookup(resource.uuid(), true);
+        
+        resource.removeFromAllBroadcasters();
+        resource.setBroadcaster(broadcaster);
+        
+        return new SseAtmosphereResourceContext(ServerProviderFactory.getInstance(message), resource);
+    }
+} 

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereEventOutputImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereEventOutputImpl.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereEventOutputImpl.java
new file mode 100644
index 0000000..dbf15ad
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereEventOutputImpl.java
@@ -0,0 +1,111 @@
+/**
+ * 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.jaxrs.sse.atmosphere;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.sse.OutboundSseEvent;
+import javax.ws.rs.sse.SseEventOutput;
+
+import org.atmosphere.cpr.AtmosphereResource;
+import org.atmosphere.cpr.Broadcaster;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SseAtmosphereEventOutputImpl implements SseEventOutput {
+    private static final Logger LOGGER = LoggerFactory.getLogger(SseAtmosphereEventOutputImpl.class);
+    
+    private final AtmosphereResource resource;
+    private final MessageBodyWriter<OutboundSseEvent> writer;
+    private volatile boolean closed = false;
+    
+    public SseAtmosphereEventOutputImpl(final MessageBodyWriter<OutboundSseEvent> writer, 
+            final AtmosphereResource resource) {
+        this.writer = writer;
+        this.resource = resource;
+        
+        if (!resource.isSuspended()) {
+            resource.suspend();
+        }
+    }
+    
+    @Override
+    public void close() throws IOException {
+        if (!closed) {
+            closed = true;
+
+            if (resource.isSuspended()) {
+                resource.resume();
+            }
+
+            final Broadcaster broadcaster = resource.getBroadcaster();
+            resource.removeFromAllBroadcasters();
+            
+            try {
+                if (!resource.getResponse().isCommitted()) {
+                    resource.getResponse().flushBuffer();
+                }
+            } finally {
+                resource.close();
+                broadcaster.destroy();
+            }
+        }
+    }
+
+    @Override
+    public void write(OutboundSseEvent event) throws IOException {
+        if (!closed && writer != null) {
+            try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
+                writer.writeTo(event, event.getClass(), null, new Annotation [] {}, event.getMediaType(), null, os);
+                
+                // Atmosphere broadcasts asynchronously which is acceptable in most cases.
+                // Unfortunately, calling close() may lead to response stream being closed
+                // while there are still some SSE delivery scheduled.
+                final Future<Object> future = resource
+                    .getBroadcaster()
+                    .broadcast(os.toString(StandardCharsets.UTF_8.name()));
+                
+                try {
+                    if (!future.isDone()) {
+                        // Let us wait at least 200 milliseconds before returning to ensure 
+                        // that SSE had the opportunity to be delivered.
+                        future.get(200, TimeUnit.MILLISECONDS);
+                    }
+                } catch (final ExecutionException | InterruptedException ex) {
+                    throw new IOException(ex);
+                } catch (final TimeoutException ex) {
+                    LOGGER.warn("SSE was not delivered within default timeout");
+                }
+            }
+        }
+    }
+
+    @Override
+    public boolean isClosed() {
+        return closed;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereInterceptor.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereInterceptor.java
new file mode 100644
index 0000000..3b91c83
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereInterceptor.java
@@ -0,0 +1,180 @@
+/**
+ * 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.jaxrs.sse.atmosphere;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+
+import org.atmosphere.cpr.Action;
+import org.atmosphere.cpr.AsyncIOInterceptorAdapter;
+import org.atmosphere.cpr.AsyncIOWriter;
+import org.atmosphere.cpr.AtmosphereInterceptorWriter;
+import org.atmosphere.cpr.AtmosphereRequest;
+import org.atmosphere.cpr.AtmosphereResource;
+import org.atmosphere.cpr.AtmosphereResourceEvent;
+import org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnPreSuspend;
+import org.atmosphere.cpr.AtmosphereResponse;
+import org.atmosphere.interceptor.AllowInterceptor;
+import org.atmosphere.interceptor.SSEAtmosphereInterceptor;
+import org.atmosphere.util.Utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.apache.cxf.jaxrs.sse.OutboundSseEventBodyWriter.SERVER_SENT_EVENTS;
+import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_USE_STREAM;
+import static org.atmosphere.cpr.FrameworkConfig.CALLBACK_JAVASCRIPT_PROTOCOL;
+import static org.atmosphere.cpr.FrameworkConfig.CONTAINER_RESPONSE;
+
+/**
+ * Most of this class implementation is borrowed from SSEAtmosphereInterceptor. The original
+ * implementation does two things which do not fit well into SSE support:
+ *  - closes the response stream (overridden by SseAtmosphereInterceptorWriter)
+ *  - wraps the whatever object is being written to SSE payload (overridden using 
+ *    the complete SSE protocol) 
+ */
+public class SseAtmosphereInterceptor extends SSEAtmosphereInterceptor {
+    private static final Logger LOGGER = LoggerFactory.getLogger(SseAtmosphereInterceptor.class);
+
+    private static final byte[] PADDING;
+    private static final String PADDING_TEXT;
+    private static final byte[] END = "\r\n\r\n".getBytes();
+    
+    static {
+        StringBuffer whitespace = new StringBuffer();
+        for (int i = 0; i < 2000; i++) {
+            whitespace.append(" ");
+        }
+        whitespace.append("\n");
+        PADDING_TEXT = whitespace.toString();
+        PADDING = PADDING_TEXT.getBytes();
+    }
+    
+    private boolean writePadding(AtmosphereResponse response) {
+        if (response.request() != null && response.request().getAttribute("paddingWritten") != null) {
+            return false;
+        }
+
+        response.setContentType(SERVER_SENT_EVENTS);
+        response.setCharacterEncoding("utf-8");
+        boolean isUsingStream = (Boolean) response.request().getAttribute(PROPERTY_USE_STREAM);
+        if (isUsingStream) {
+            try {
+                OutputStream stream = response.getResponse().getOutputStream();
+                try {
+                    stream.write(PADDING);
+                    stream.flush();
+                } catch (IOException ex) {
+                    LOGGER.warn("SSE may not work", ex);
+                }
+            } catch (IOException e) {
+                LOGGER.trace("", e);
+            }
+        } else {
+            try {
+                PrintWriter w = response.getResponse().getWriter();
+                w.println(PADDING_TEXT);
+                w.flush();
+            } catch (IOException e) {
+                LOGGER.trace("", e);
+            }
+        }
+        response.resource().getRequest().setAttribute("paddingWritten", "true");
+        return true;
+    }
+    
+    @Override
+    public Action inspect(final AtmosphereResource r) {
+        if (Utils.webSocketMessage(r)) {
+            return Action.CONTINUE;
+        }
+
+        final AtmosphereRequest request = r.getRequest();
+        final String accept = request.getHeader("Accept") == null ? "text/plain" : request.getHeader("Accept").trim();
+
+        if (r.transport().equals(AtmosphereResource.TRANSPORT.SSE) || SERVER_SENT_EVENTS.equalsIgnoreCase(accept)) {
+            final AtmosphereResponse response = r.getResponse();
+            if (response.getAsyncIOWriter() == null) {
+                response.asyncIOWriter(new SseAtmosphereInterceptorWriter());
+            }
+            
+            r.addEventListener(new P(response));
+
+            AsyncIOWriter writer = response.getAsyncIOWriter();
+            if (AtmosphereInterceptorWriter.class.isAssignableFrom(writer.getClass())) {
+                AtmosphereInterceptorWriter.class.cast(writer).interceptor(new AsyncIOInterceptorAdapter() {
+                    private boolean padding() {
+                        if (!r.isSuspended()) {
+                            return writePadding(response);
+                        }
+                        return false;
+                    }
+
+                    @Override
+                    public void prePayload(AtmosphereResponse response, byte[] data, int offset, int length) {
+                        padding();
+                    }
+
+                    @Override
+                    public void postPayload(AtmosphereResponse response, byte[] data, int offset, int length) {
+                        // The CALLBACK_JAVASCRIPT_PROTOCOL may be called by a framework running on top of Atmosphere
+                        // In that case, we must pad/protocol indenendently of the state of the AtmosphereResource
+                        if (r.isSuspended() || r.getRequest().getAttribute(CALLBACK_JAVASCRIPT_PROTOCOL) != null
+                                || r.getRequest().getAttribute(CONTAINER_RESPONSE) != null) {
+                            response.write(END, true);
+                        }
+
+                        /**
+                         * When used with https://github.com/remy/polyfills/blob/master/EventSource.js , we
+                         * resume after every message.
+                         */
+                        String ua = r.getRequest().getHeader("User-Agent");
+                        if (ua != null && ua.contains("MSIE")) {
+                            try {
+                                response.flushBuffer();
+                            } catch (IOException e) {
+                                LOGGER.trace("", e);
+                            }
+                            r.resume();
+                        }
+                    }
+                });
+            } else {
+                LOGGER.warn("Unable to apply {}. Your AsyncIOWriter must implement {}", 
+                    getClass().getName(), AtmosphereInterceptorWriter.class.getName());
+            }
+        }
+        
+        return Action.CONTINUE;
+    }
+    
+    private final class P extends OnPreSuspend implements AllowInterceptor {
+
+        private final AtmosphereResponse response;
+
+        private P(AtmosphereResponse response) {
+            this.response = response;
+        }
+
+        @Override
+        public void onPreSuspend(AtmosphereResourceEvent event) {
+            writePadding(response);
+        }
+    }    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereInterceptorWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereInterceptorWriter.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereInterceptorWriter.java
new file mode 100644
index 0000000..24ebfd9
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereInterceptorWriter.java
@@ -0,0 +1,30 @@
+/**
+ * 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.jaxrs.sse.atmosphere;
+
+import java.io.IOException;
+
+import org.atmosphere.cpr.AtmosphereInterceptorWriter;
+import org.atmosphere.cpr.AtmosphereResponse;
+
+public class SseAtmosphereInterceptorWriter extends AtmosphereInterceptorWriter {
+    @Override
+    public void close(AtmosphereResponse response) throws IOException {
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereResourceContext.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereResourceContext.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereResourceContext.java
new file mode 100644
index 0000000..c330d6c
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereResourceContext.java
@@ -0,0 +1,60 @@
+/**
+ * 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.jaxrs.sse.atmosphere;
+
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.sse.OutboundSseEvent;
+import javax.ws.rs.sse.OutboundSseEvent.Builder;
+import javax.ws.rs.sse.SseBroadcaster;
+import javax.ws.rs.sse.SseContext;
+import javax.ws.rs.sse.SseEventOutput;
+
+import org.apache.cxf.jaxrs.provider.ServerProviderFactory;
+import org.apache.cxf.jaxrs.sse.OutboundSseEventBodyWriter;
+import org.apache.cxf.jaxrs.sse.OutboundSseEventImpl;
+import org.apache.cxf.jaxrs.sse.SseBroadcasterImpl;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+import org.atmosphere.cpr.AtmosphereResource;
+
+public class SseAtmosphereResourceContext implements SseContext {
+    private final AtmosphereResource resource;
+    private final ServerProviderFactory factory;
+
+    SseAtmosphereResourceContext(final ServerProviderFactory factory, final AtmosphereResource resource) {
+        this.factory = factory;
+        this.resource = resource;
+    }
+    
+    @Override
+    public SseEventOutput newOutput() {
+        final MessageBodyWriter<OutboundSseEvent> writer = new OutboundSseEventBodyWriter(factory, 
+            JAXRSUtils.getCurrentMessage().getExchange());
+        return new SseAtmosphereEventOutputImpl(writer, resource);
+    }
+
+    @Override
+    public Builder newEvent() {
+        return new OutboundSseEventImpl.BuilderImpl();
+    }
+
+    @Override
+    public SseBroadcaster newBroadcaster() {
+        return new SseBroadcasterImpl();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/servlet/CXFSseServlet.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/servlet/CXFSseServlet.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/servlet/CXFSseServlet.java
new file mode 100644
index 0000000..bc87ebf
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/servlet/CXFSseServlet.java
@@ -0,0 +1,41 @@
+/**
+ * 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.jaxrs.sse.servlet;
+
+import org.apache.cxf.jaxrs.sse.atmosphere.SseAtmosphereInterceptor;
+import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
+import org.atmosphere.cpr.ApplicationConfig;
+import org.atmosphere.cpr.AtmosphereServlet;
+import org.atmosphere.handler.ReflectorServletProcessor;
+
+public class CXFSseServlet extends AtmosphereServlet {
+    private static final long serialVersionUID = -874047746532165731L;
+
+    public CXFSseServlet(final CXFNonSpringServlet delegate) {
+        // Register and map the dispatcher servlet
+        super(true);
+        
+        framework().addAtmosphereHandler("/*", new ReflectorServletProcessor(delegate));
+        framework().interceptor(new SseAtmosphereInterceptor());
+        framework().addInitParameter(ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT, "true");
+        framework().addInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT, "true");
+        framework().addInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, "true");
+        framework().addInitParameter(ApplicationConfig.CLOSE_STREAM_ON_CANCEL, "true");
+    }
+}


[34/50] [abbrv] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetQNameTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetQNameTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetQNameTest.java
new file mode 100644
index 0000000..9346dc7
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetQNameTest.java
@@ -0,0 +1,171 @@
+/**
+ * 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.ws.transfer.integration;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ObjectFactory;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentGetQNameTest extends IntegrationBaseTest {
+    
+    @Test
+    public void getTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
+        expression.getContent().add("a");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("a", ((Element)value.getContent().get(0)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getWithNamespaceTest() throws XMLStreamException {
+        String content = "<ns:root xmlns:ns=\"www.example.org\"><ns:a><ns:b>Text</ns:b></ns:a></ns:root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
+        expression.getContent().add("ns:a");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("a", ((Element)value.getContent().get(0)).getLocalName());
+        Assert.assertEquals("www.example.org", ((Element)value.getContent().get(0)).getNamespaceURI());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void qetEmptyResultTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
+        expression.getContent().add("c");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(0, value.getContent().size());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getMoreValuesTest() throws XMLStreamException {
+        String content = "<root><b>Text1</b><b>Text2</b><b>Text3</b></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
+        expression.getContent().add("b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(3, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        Assert.assertEquals("b", ((Element)value.getContent().get(1)).getLocalName());
+        Assert.assertEquals("b", ((Element)value.getContent().get(2)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void getWrongQNameTest() throws XMLStreamException {
+        String content = "<root><a><b>Text1</b><b>Text2</b><b>Text3</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
+        expression.getContent().add("//b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        client.get(request);
+    }
+    
+    private static ValueType getValue(GetResponse response) {
+        @SuppressWarnings("unchecked")
+        JAXBElement<ValueType> jaxb = (JAXBElement<ValueType>) response.getAny().get(0);
+        return jaxb.getValue();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetXPath10Test.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetXPath10Test.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetXPath10Test.java
new file mode 100644
index 0000000..56f8291
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetXPath10Test.java
@@ -0,0 +1,333 @@
+/**
+ * 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.ws.transfer.integration;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.stream.XMLStreamException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ObjectFactory;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentGetXPath10Test extends IntegrationBaseTest {
+    
+    @Test
+    public void getTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a/b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getImpliedLanguageTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.getContent().add("/root/a/b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getWithNamespaceTest() throws XMLStreamException {
+        String content = "<ns:root xmlns:ns=\"www.example.org\"><ns:a><ns:b>Text</ns:b></ns:a></ns:root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/ns:root/ns:a/ns:b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        Assert.assertEquals("www.example.org", ((Element)value.getContent().get(0)).getNamespaceURI());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void qetEmptyResultTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("//c");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(0, value.getContent().size());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getMoreValuesTest() throws XMLStreamException {
+        String content = "<root><a><b>Text1</b><b>Text2</b><b>Text3</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("//b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(3, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        Assert.assertEquals("b", ((Element)value.getContent().get(1)).getLocalName());
+        Assert.assertEquals("b", ((Element)value.getContent().get(2)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getMoreValues2Test() throws XMLStreamException {
+        String content = "<root><a><b>Text1</b><b>Text2</b><b><b>Text3</b></b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("//b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getAttrTest() throws XMLStreamException {
+        String content = "<root><a><b attr1=\"value1\">Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a/b/@attr1");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertTrue(value.getContent().get(0) instanceof Element);
+        Element attrEl = (Element) value.getContent().get(0);
+        Assert.assertEquals(FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME, attrEl.getLocalName());
+        Assert.assertEquals(FragmentDialectConstants.FRAGMENT_2011_03_IRI, attrEl.getNamespaceURI());
+        Assert.assertEquals("attr1", attrEl.getAttribute(FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR));
+        Assert.assertEquals("value1", attrEl.getTextContent());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getAttrNSTest() throws XMLStreamException {
+        String content = "<root xmlns:ns=\"www.example.org\"><a><b ns:attr1=\"value1\">Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a/b/@ns:attr1");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertTrue(value.getContent().get(0) instanceof Element);
+        Element attrEl = (Element) value.getContent().get(0);
+        Assert.assertEquals(FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME, attrEl.getLocalName());
+        Assert.assertEquals(FragmentDialectConstants.FRAGMENT_2011_03_IRI, attrEl.getNamespaceURI());
+        Assert.assertEquals("ns:attr1", attrEl.getAttribute(FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR));
+        Assert.assertEquals("value1", attrEl.getTextContent());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getNumberTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b><b>Text2</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("count(//b)");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("2", value.getContent().get(0));
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getBooleanTrueTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b><b>Text2</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("count(//b) = 2");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("true", value.getContent().get(0));
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getBooleanFalseTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b><b>Text2</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("count(//b) != 2");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("false", value.getContent().get(0));
+        
+        resource.destroy();
+    }
+    
+    private static ValueType getValue(GetResponse response) {
+        @SuppressWarnings("unchecked")
+        JAXBElement<ValueType> jaxb = (JAXBElement<ValueType>) response.getAny().get(0);
+        return jaxb.getValue();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutAddTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutAddTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutAddTest.java
new file mode 100644
index 0000000..e971794
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutAddTest.java
@@ -0,0 +1,238 @@
+/**
+ * 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.ws.transfer.integration;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.Fragment;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentPutAddTest extends IntegrationBaseTest {
+    
+    @Test
+    public void addToEmptyDocumentTest() {
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("a");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void addToNonEmptyDocumentTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void addTextElementTest() throws XMLStreamException {
+        String content = "<a>f</a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/a");
+        ValueType value = new ValueType();
+        value.getContent().add("oo");
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("foo", rootEl.getTextContent());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void addAttributeTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/a");
+
+        Document doc = DOMUtils.createDocument();
+        Element addedAttr = doc.createElementNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME
+        );
+        addedAttr.setAttributeNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR,
+                "foo"
+        );
+        addedAttr.setTextContent("1");
+        ValueType value = new ValueType();
+        value.getContent().add(addedAttr);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element aEl = (Element) response.getRepresentation().getAny();
+        String attribute = aEl.getAttribute("foo");
+        Assert.assertEquals("1", attribute);
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void addExistingAttributeTest() throws XMLStreamException {
+        String content = "<a foo=\"1\"/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/a");
+
+        Document doc = DOMUtils.createDocument();
+        Element addedAttr = doc.createElementNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME
+        );
+        addedAttr.setAttributeNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR,
+                "foo"
+        );
+        addedAttr.setTextContent("2");
+        ValueType value = new ValueType();
+        value.getContent().add(addedAttr);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void addSiblingTest() throws XMLStreamException {
+        String content = "<a><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/a");
+        Element addedElement = DOMUtils.createDocument().createElement("c");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element child0 = (Element) rootEl.getChildNodes().item(0);
+        Element child1 = (Element) rootEl.getChildNodes().item(1);
+        Assert.assertEquals("a", rootEl.getNodeName());
+        Assert.assertEquals("b", child0.getNodeName());
+        Assert.assertEquals("c", child1.getNodeName());
+        
+        resource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertAfterTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertAfterTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertAfterTest.java
new file mode 100644
index 0000000..57e5ed1
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertAfterTest.java
@@ -0,0 +1,194 @@
+/**
+ * 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.ws.transfer.integration;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.Fragment;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentPutInsertAfterTest extends IntegrationBaseTest {
+    
+    @Test
+    public void insertAfter1Test() throws XMLStreamException {
+        String content = "<a><b/><c/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER);
+        expression.getContent().add("/a/b");
+        Element addedElement = DOMUtils.createDocument().createElement("d");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element child0 = (Element) rootEl.getChildNodes().item(0);
+        Element child1 = (Element) rootEl.getChildNodes().item(1);
+        Element child2 = (Element) rootEl.getChildNodes().item(2);
+        Assert.assertEquals("a", rootEl.getNodeName());
+        Assert.assertEquals("b", child0.getNodeName());
+        Assert.assertEquals("d", child1.getNodeName());
+        Assert.assertEquals("c", child2.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void insertAfter2Test() throws XMLStreamException {
+        String content = "<a><b/><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER);
+        expression.getContent().add("/a/b[last()]");
+        Element addedElement = DOMUtils.createDocument().createElement("c");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element child0 = (Element) rootEl.getChildNodes().item(0);
+        Element child1 = (Element) rootEl.getChildNodes().item(1);
+        Element child2 = (Element) rootEl.getChildNodes().item(2);
+        Assert.assertEquals("a", rootEl.getNodeName());
+        Assert.assertEquals("b", child0.getNodeName());
+        Assert.assertEquals("b", child1.getNodeName());
+        Assert.assertEquals("c", child2.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void insertAfterEmptyDocTest() {
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("a");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void insertAfterRootTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void insertAfterAttrTest() throws XMLStreamException {
+        String content = "<a foo=\"1\"/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER);
+        expression.getContent().add("/a/@foo");
+        Element addedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertBeforeTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertBeforeTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertBeforeTest.java
new file mode 100644
index 0000000..4ff59c9
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertBeforeTest.java
@@ -0,0 +1,194 @@
+/**
+ * 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.ws.transfer.integration;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.Fragment;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentPutInsertBeforeTest extends IntegrationBaseTest {
+    
+    @Test
+    public void insertBefore1Test() throws XMLStreamException {
+        String content = "<a><b/><c/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE);
+        expression.getContent().add("/a/b");
+        Element addedElement = DOMUtils.createDocument().createElement("d");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element child0 = (Element) rootEl.getChildNodes().item(0);
+        Element child1 = (Element) rootEl.getChildNodes().item(1);
+        Element child2 = (Element) rootEl.getChildNodes().item(2);
+        Assert.assertEquals("a", rootEl.getNodeName());
+        Assert.assertEquals("d", child0.getNodeName());
+        Assert.assertEquals("b", child1.getNodeName());
+        Assert.assertEquals("c", child2.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void insertBefore2Test() throws XMLStreamException {
+        String content = "<a><b/><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE);
+        expression.getContent().add("/a/b[1]");
+        Element addedElement = DOMUtils.createDocument().createElement("c");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element child0 = (Element) rootEl.getChildNodes().item(0);
+        Element child1 = (Element) rootEl.getChildNodes().item(1);
+        Element child2 = (Element) rootEl.getChildNodes().item(2);
+        Assert.assertEquals("a", rootEl.getNodeName());
+        Assert.assertEquals("c", child0.getNodeName());
+        Assert.assertEquals("b", child1.getNodeName());
+        Assert.assertEquals("b", child2.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void insertBeforeEmptyDocTest() {
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("a");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void insertBeforeRootTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void insertBeforeAttrTest() throws XMLStreamException {
+        String content = "<a foo=\"1\"/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE);
+        expression.getContent().add("/a/@f");
+        Element addedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutRemoveTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutRemoveTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutRemoveTest.java
new file mode 100644
index 0000000..2523011
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutRemoveTest.java
@@ -0,0 +1,113 @@
+/**
+ * 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.ws.transfer.integration;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.Fragment;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentPutRemoveTest extends IntegrationBaseTest {
+    
+    @Test
+    public void removeAttrTest() throws XMLStreamException {
+        String content = "<a foo=\"1\"/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_REMOVE);
+        expression.getContent().add("/a/@foo");
+        fragment.setExpression(expression);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertNull(rootEl.getAttributeNode("foo"));
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void removeElementTest() throws XMLStreamException {
+        String content = "<a><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_REMOVE);
+        expression.getContent().add("/a/b");
+        fragment.setExpression(expression);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals(0, rootEl.getChildNodes().getLength());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void removeElement2Test() throws XMLStreamException {
+        String content = "<a><b/><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_REMOVE);
+        expression.getContent().add("/a/b[1]");
+        fragment.setExpression(expression);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals(1, rootEl.getChildNodes().getLength());
+        
+        resource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutReplaceTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutReplaceTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutReplaceTest.java
new file mode 100644
index 0000000..b2b8072
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutReplaceTest.java
@@ -0,0 +1,419 @@
+/**
+ * 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.ws.transfer.integration;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.Fragment;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentPutReplaceTest extends IntegrationBaseTest {
+    
+    @Test
+    public void replaceElementTest() throws XMLStreamException {
+        String content = "<root><a>Text</a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        replacedElement.setTextContent("Better text");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("b", rootEl.getChildNodes().item(0).getNodeName());
+        Assert.assertEquals("Better text", rootEl.getChildNodes().item(0).getTextContent());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceElement2Test() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("b", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceTextContentTest() throws XMLStreamException {
+        String content = "<root><a>Text</a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        //ObjectFactory objectFactory = new ObjectFactory();
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a/text()");
+        ValueType value = new ValueType();
+        value.getContent().add("Better text");
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getChildNodes().item(0).getNodeName());
+        Assert.assertEquals("Better text", rootEl.getChildNodes().item(0).getTextContent());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceAttributeTest() throws XMLStreamException {
+        String content = "<root><a foo=\"1\">Text</a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a/@foo");
+        Element replacedAttr = DOMUtils.createDocument().createElementNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME
+        );
+        replacedAttr.setAttributeNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR,
+                "bar"
+        );
+        replacedAttr.setTextContent("2");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedAttr);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element aEl = (Element) rootEl.getChildNodes().item(0);
+        Assert.assertNotNull(aEl);
+        String attribute = aEl.getAttribute("bar");
+        Assert.assertEquals("2", attribute);
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceEmptyDocumentTest() {
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/");
+        Element replacedElement = DOMUtils.createDocument().createElement("a");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceDocumentTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("b", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceDocument2Test() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/*");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("b", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceOneElementTest() throws XMLStreamException {
+        String content = "<a><b/><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a/b[1]");
+        Element replacedElement = DOMUtils.createDocument().createElement("c");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("c", ((Element)rootEl.getChildNodes().item(0)).getLocalName());
+        Assert.assertEquals("b", ((Element)rootEl.getChildNodes().item(1)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceAllElementsTest() throws XMLStreamException {
+        String content = "<a><b/><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a/b");
+        Element replacedElement = DOMUtils.createDocument().createElement("c");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals(1, rootEl.getChildNodes().getLength());
+        Assert.assertEquals("c", ((Element)rootEl.getChildNodes().item(0)).getLocalName());
+        
+        resource.destroy();
+    }
+
+    @Test
+    public  void replaceNonExistingElementTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a/b");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals(1, rootEl.getChildNodes().getLength());
+        Assert.assertEquals("b", ((Element)rootEl.getChildNodes().item(0)).getLocalName());
+
+        resource.destroy();
+    }
+
+    @Test
+    public  void replaceNonExistingRootTest() {
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a");
+        Element replacedElement = DOMUtils.createDocument().createElement("a");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getLocalName());
+
+        resource.destroy();
+    }
+
+    @Test(expected = SOAPFaultException.class)
+    public  void replaceNonExistingElementFailTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("//b");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+
+        client.put(request);
+
+        resource.destroy();
+    }
+
+    @Test(expected = SOAPFaultException.class)
+    public  void replaceNonExistingElementFail2Test() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a/[local-name() = 'b'");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+
+        client.put(request);
+
+        resource.destroy();
+    }
+}


[06/50] [abbrv] cxf git commit: Updating Spring + Spring Security

Posted by re...@apache.org.
Updating Spring + Spring Security


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/dfc84b0f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/dfc84b0f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/dfc84b0f

Branch: refs/heads/master-jaxrs-2.1
Commit: dfc84b0fac84e001069800b32f01529d50339cdb
Parents: 2538ae4
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed May 18 00:01:58 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed May 18 00:02:25 2016 +0100

----------------------------------------------------------------------
 parent/pom.xml                                                   | 4 ++--
 .../src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml    | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/dfc84b0f/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 8b270e4..ce1dc37 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -144,9 +144,9 @@
         <cxf.servlet-api-2.5.version>1.1.2</cxf.servlet-api-2.5.version>
         <cxf.slf4j.version>1.7.21</cxf.slf4j.version>
         <cxf.specs.jaxws.api.version>1.2</cxf.specs.jaxws.api.version>
-        <cxf.spring.version>4.1.9.RELEASE</cxf.spring.version>
+        <cxf.spring.version>4.2.6.RELEASE</cxf.spring.version>
         <cxf.spring.boot.version>1.3.4.RELEASE</cxf.spring.boot.version>
-        <cxf.spring.security.version>3.2.9.RELEASE</cxf.spring.security.version>
+        <cxf.spring.security.version>4.1.0.RELEASE</cxf.spring.security.version>
         <cxf.spring.osgi.version>1.2.1</cxf.spring.osgi.version>
         <cxf.spring.ldap.version>1.3.1.RELEASE</cxf.spring.ldap.version>
         <cxf.spring.mock>spring-test</cxf.spring.mock>

http://git-wip-us.apache.org/repos/asf/cxf/blob/dfc84b0f/systests/jaxrs/src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml b/systests/jaxrs/src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml
index 2ac672f..39a5842 100644
--- a/systests/jaxrs/src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml
+++ b/systests/jaxrs/src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml
@@ -52,6 +52,7 @@
     <security:global-method-security secured-annotations="disabled" jsr250-annotations="enabled"/>
     <security:http auto-config="true">
         <security:http-basic/>
+        <security:csrf disabled="true"/>
     </security:http>
     <security:authentication-manager>
 	    <security:authentication-provider>


[30/50] [abbrv] cxf git commit: NPE fix

Posted by re...@apache.org.
NPE fix


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/05b12529
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/05b12529
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/05b12529

Branch: refs/heads/master-jaxrs-2.1
Commit: 05b12529f2bb037aa2c73564455c1b511ef715aa
Parents: 1e4b961
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon May 23 17:11:33 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon May 23 17:13:20 2016 +0100

----------------------------------------------------------------------
 .../rs/security/oauth2/client/MemoryClientCodeStateManager.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/05b12529/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/MemoryClientCodeStateManager.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/MemoryClientCodeStateManager.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/MemoryClientCodeStateManager.java
index 33a95df..90b9e5c 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/MemoryClientCodeStateManager.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/MemoryClientCodeStateManager.java
@@ -56,7 +56,7 @@ public class MemoryClientCodeStateManager implements ClientCodeStateManager {
                                                             MultivaluedMap<String, String> redirectState) {
         String stateParam = redirectState.getFirst(OAuthConstants.STATE);
         String sessionToken = OAuthUtils.getSessionToken(mc, "state");
-        if (!sessionToken.equals(stateParam)) {
+        if (sessionToken == null || !sessionToken.equals(stateParam)) {
             throw new OAuthServiceException("Invalid session token");
         }
         return map.remove(stateParam);


[31/50] [abbrv] cxf git commit: [CXF-6900, CXF-6908] More fixes for namespace issues with decrypted faults and adding faults to SAAJ envelopes

Posted by re...@apache.org.
[CXF-6900, CXF-6908] More fixes for namespace issues with decrypted faults and adding faults to SAAJ envelopes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e158c96d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e158c96d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e158c96d

Branch: refs/heads/master-jaxrs-2.1
Commit: e158c96dc5b1e218cd523c6e2d1232813f8c24f4
Parents: 05b1252
Author: Daniel Kulp <dk...@apache.org>
Authored: Mon May 23 12:21:56 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Mon May 23 12:22:49 2016 -0400

----------------------------------------------------------------------
 .../cxf/binding/soap/saaj/SAAJStreamWriter.java | 24 ++++++++++++++++++++
 rt/ws/security/pom.xml                          |  5 ++++
 .../cxf/ws/security/wss4j/StaxSerializer.java   |  2 +-
 .../systest/ws/security/SecurityPolicyTest.java |  2 --
 4 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e158c96d/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
index 185079b..8c13b1e 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.binding.soap.saaj;
 
+import java.util.Iterator;
+
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPElement;
@@ -26,6 +28,7 @@ import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPPart;
+import javax.xml.stream.XMLStreamException;
 
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
@@ -33,9 +36,11 @@ import org.w3c.dom.Node;
 
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.staxutils.OverlayW3CDOMStreamWriter;
+import org.apache.cxf.staxutils.W3CNamespaceContext;
 
 import static org.apache.cxf.binding.soap.saaj.SAAJUtils.adjustPrefix;
 
+
 public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
     private final SOAPPart part;
     private final SOAPEnvelope envelope;
@@ -69,6 +74,25 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
         isOverlaid = false;
     }
     
+    @Override
+    public String getPrefix(String nsuri) throws XMLStreamException {
+        if (isOverlaid && part != null && getCurrentNode() == null) {
+            Node nd = part.getFirstChild();
+            while (nd != null) {
+                if (nd instanceof Element) {
+                    Iterator<String> it = new W3CNamespaceContext((Element)nd).getPrefixes(nsuri);
+                    if (it.hasNext()) {
+                        return it.next();
+                    } else {
+                        nd = null;
+                    }
+                } else {
+                    nd = nd.getNextSibling();
+                }
+            }
+        }
+        return super.getPrefix(nsuri);
+    }
     private String getEnvelopeURI() throws SOAPException {
         if (uri == null) {
             uri = getEnvelope().getElementName().getURI();

http://git-wip-us.apache.org/repos/asf/cxf/blob/e158c96d/rt/ws/security/pom.xml
----------------------------------------------------------------------
diff --git a/rt/ws/security/pom.xml b/rt/ws/security/pom.xml
index eba4d01..c88110c 100644
--- a/rt/ws/security/pom.xml
+++ b/rt/ws/security/pom.xml
@@ -79,6 +79,11 @@
             <optional>true</optional>
         </dependency>
         <dependency>
+            <groupId>org.codehaus.woodstox</groupId>
+            <artifactId>woodstox-core-asl</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
             <groupId>net.sf.ehcache</groupId>
             <artifactId>ehcache</artifactId>
             <version>${cxf.ehcache.version}</version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/e158c96d/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
index 3acb598..6927500 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
@@ -95,7 +95,7 @@ public class StaxSerializer extends AbstractSerializer {
             }
             return true;
         } catch (Throwable t) {
-            t.printStackTrace();
+            //ignore, not much we can do but hope the decrypted XML is stand alone ok 
         }
         return false;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/e158c96d/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
index 4cd7b66..fb0eea0 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
@@ -68,7 +68,6 @@ import org.example.contract.doubleit.DoubleItPortTypeHeader;
 import org.example.schema.doubleit.DoubleIt;
 
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
@@ -702,7 +701,6 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
     }
     
     @Test
-    @Ignore("CXF-6908")
     public void testFault() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
 


[16/50] [abbrv] cxf git commit: Having code hash reported in Oifc Hybrid authorization endpoint too

Posted by re...@apache.org.
Having code hash reported in Oifc Hybrid authorization endpoint too


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c29c334e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c29c334e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c29c334e

Branch: refs/heads/master-jaxrs-2.1
Commit: c29c334e40cd9c6c846e265993eeda953a4f1d67
Parents: 25a4220
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Fri May 20 12:10:21 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Fri May 20 12:10:21 2016 +0100

----------------------------------------------------------------------
 .../oidc/idp/IdTokenResponseFilter.java         | 17 +++++++--
 .../rs/security/oidc/idp/OidcHybridService.java | 13 ++++---
 .../security/oidc/idp/OidcImplicitService.java  | 37 +++++++++++++++-----
 3 files changed, 51 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c29c334e/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
index c05a9ce..74daf71 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
@@ -89,6 +89,7 @@ public class IdTokenResponseFilter extends OAuthServerJoseJwtProducer implements
             && (rType.equals(OidcUtils.CODE_ID_TOKEN_AT_RESPONSE_TYPE)
                 || rType.equals(OidcUtils.CODE_ID_TOKEN_RESPONSE_TYPE));
         
+        Message m = JAXRSUtils.getCurrentMessage();
         if (atHashRequired || cHashRequired) {
             Properties props = JwsUtils.loadSignatureOutProperties(false);
             SignatureAlgorithm sigAlgo = null;
@@ -103,12 +104,22 @@ public class IdTokenResponseFilter extends OAuthServerJoseJwtProducer implements
                     idToken.setAccessTokenHash(atHash);
                 }
                 if (cHashRequired) {
-                    String cHash = OidcUtils.calculateAuthorizationCodeHash(st.getGrantCode(), sigAlgo);
-                    idToken.setAuthorizationCodeHash(cHash);
+                    // c_hash can be returned from either Authorization or Token endpoints
+                    String code;
+                    if (st.getGrantCode() != null) {
+                        // This is a token endpoint, the code has been exchanged for a token
+                        code = st.getGrantCode();
+                    } else {
+                        // Authorization endpoint: hybrid flow, implicit part
+                        code = (String)m.getExchange().get(OAuthConstants.AUTHORIZATION_CODE_VALUE);
+                    }
+                    if (code != null) {
+                        idToken.setAuthorizationCodeHash(OidcUtils.calculateAuthorizationCodeHash(code, sigAlgo));
+                    }
                 }
             }
         }
-        Message m = JAXRSUtils.getCurrentMessage();
+        
         if (m != null && m.getExchange().containsKey(OAuthConstants.NONCE)) {
             idToken.setNonce((String)m.getExchange().get(OAuthConstants.NONCE));
         } else if (st.getNonce() != null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/c29c334e/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
index 2d93a5c..a77a0e4 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
@@ -26,6 +26,7 @@ import java.util.Set;
 
 import javax.ws.rs.Path;
 
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthRedirectionState;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
@@ -71,13 +72,17 @@ public class OidcHybridService extends OidcImplicitService {
                                    List<String> approvedScope,
                                    UserSubject userSubject,
                                    ServerAccessToken preAuthorizedToken) {
+        String code = null;
+        if (state.getResponseType() != null && state.getResponseType().startsWith(OAuthConstants.CODE_RESPONSE_TYPE)) {
+            code = codeService.getGrantCode(state, client, requestedScope,
+                                                   approvedScope, userSubject, preAuthorizedToken);
+            JAXRSUtils.getCurrentMessage().getExchange().put(OAuthConstants.AUTHORIZATION_CODE_VALUE, code);
+        }
+        
         StringBuilder sb = super.prepareGrant(state, client, requestedScope, 
                                                           approvedScope, userSubject, preAuthorizedToken);
    
-        if (state.getResponseType() != null && state.getResponseType().startsWith(OAuthConstants.CODE_RESPONSE_TYPE)) {
-            String code = codeService.getGrantCode(state, client, requestedScope,
-                                                   approvedScope, userSubject, preAuthorizedToken);
-            
+        if (code != null) {
             sb.append("&");
             sb.append(OAuthConstants.AUTHORIZATION_CODE_VALUE).append("=").append(code);
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c29c334e/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
index 60d1773..558dfd8 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
@@ -21,12 +21,15 @@ package org.apache.cxf.rs.security.oidc.idp;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Properties;
 import java.util.Set;
 
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 
-import org.apache.cxf.rs.security.jose.jwt.JoseJwtProducer;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm;
+import org.apache.cxf.rs.security.jose.jws.JwsUtils;
 import org.apache.cxf.rs.security.jose.jwt.JwtToken;
 import org.apache.cxf.rs.security.oauth2.common.AccessTokenRegistration;
 import org.apache.cxf.rs.security.oauth2.common.Client;
@@ -35,16 +38,18 @@ import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
 import org.apache.cxf.rs.security.oauth2.common.OAuthRedirectionState;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
 import org.apache.cxf.rs.security.oauth2.common.UserSubject;
+import org.apache.cxf.rs.security.oauth2.provider.OAuthJoseJwtProducer;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
 import org.apache.cxf.rs.security.oauth2.services.ImplicitGrantService;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
+import org.apache.cxf.rs.security.oauth2.utils.OAuthUtils;
 import org.apache.cxf.rs.security.oidc.common.IdToken;
 import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
 
 
 public class OidcImplicitService extends ImplicitGrantService {
     private boolean skipAuthorizationWithOidcScope;
-    private JoseJwtProducer idTokenHandler;
+    private OAuthJoseJwtProducer idTokenHandler;
     private IdTokenProvider idTokenProvider;
     
     public OidcImplicitService() {
@@ -118,15 +123,13 @@ public class OidcImplicitService extends ImplicitGrantService {
             return subject.getProperties().get(OidcUtils.ID_TOKEN);
         } else if (idTokenProvider != null) {
             IdToken idToken = idTokenProvider.getIdToken(state.getClientId(), subject, scopes);
-            idToken.setNonce(state.getNonce());
-            return processIdToken(idToken);
+            return processIdToken(state, idToken);
         } else if (subject instanceof OidcUserSubject) {
             OidcUserSubject sub = (OidcUserSubject)subject;
             IdToken idToken = new IdToken(sub.getIdToken());
             idToken.setAudience(state.getClientId());
             idToken.setAuthorizedParty(state.getClientId());
-            idToken.setNonce(state.getNonce());
-            return processIdToken(idToken);
+            return processIdToken(state, idToken);
         } else {
             return null;
         }
@@ -152,12 +155,28 @@ public class OidcImplicitService extends ImplicitGrantService {
         return reg;
     }
     
-    protected String processIdToken(IdToken idToken) {
-        JoseJwtProducer processor = idTokenHandler == null ? new JoseJwtProducer() : idTokenHandler; 
+    protected String processIdToken(OAuthRedirectionState state, IdToken idToken) {
+        OAuthJoseJwtProducer processor = idTokenHandler == null ? new OAuthJoseJwtProducer() : idTokenHandler; 
+        
+        String code = 
+            (String)JAXRSUtils.getCurrentMessage().getExchange().get(OAuthConstants.AUTHORIZATION_CODE_VALUE);
+        if (code != null) {
+            // this service is invoked as part of the hybrid flow
+            Properties props = JwsUtils.loadSignatureOutProperties(false);
+            SignatureAlgorithm sigAlgo = null;
+            if (processor.isSignWithClientSecret()) {
+                sigAlgo = OAuthUtils.getClientSecretSignatureAlgorithm(props);
+            } else {
+                sigAlgo = JwsUtils.getSignatureAlgorithm(props, SignatureAlgorithm.RS256);
+            }
+            idToken.setAuthorizationCodeHash(OidcUtils.calculateAuthorizationCodeHash(code, sigAlgo));
+        }
+        
+        idToken.setNonce(state.getNonce());
         return processor.processJwt(new JwtToken(idToken));
     }
 
-    public void setIdTokenJoseHandler(JoseJwtProducer idTokenJoseHandler) {
+    public void setIdTokenJoseHandler(OAuthJoseJwtProducer idTokenJoseHandler) {
         this.idTokenHandler = idTokenJoseHandler;
     }
     public void setIdTokenProvider(IdTokenProvider idTokenProvider) {


[13/50] [abbrv] cxf git commit: [CXF-6910]don't need setSocketTimeout when create ahc RequestConfig

Posted by re...@apache.org.
[CXF-6910]don't need setSocketTimeout when create ahc RequestConfig


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c681373b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c681373b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c681373b

Branch: refs/heads/master-jaxrs-2.1
Commit: c681373b5068326d272a46b59e2e9394f94e95ec
Parents: bf43b5f
Author: Freeman Fang <fr...@gmail.com>
Authored: Fri May 20 09:58:07 2016 +0800
Committer: Freeman Fang <fr...@gmail.com>
Committed: Fri May 20 09:58:07 2016 +0800

----------------------------------------------------------------------
 .../org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c681373b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
index a3421e3..85d08cc 100644
--- a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
+++ b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
@@ -216,7 +216,6 @@ public class AsyncHTTPConduit extends URLConnectionHTTPConduit {
         e.setEntity(entity);
 
         RequestConfig.Builder b = RequestConfig.custom()
-            .setSocketTimeout((int) csPolicy.getReceiveTimeout())
             .setConnectTimeout((int) csPolicy.getConnectionTimeout());
         Proxy p = proxyFactory.createProxy(csPolicy, uri);
         if (p != null && p.type() != Proxy.Type.DIRECT) {


[08/50] [abbrv] cxf git commit: Updating test

Posted by re...@apache.org.
Updating test


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0879404b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0879404b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0879404b

Branch: refs/heads/master-jaxrs-2.1
Commit: 0879404be5bf124c75f48aa67e4305ad76abd14b
Parents: 9c5bf8a
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed May 18 14:56:08 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed May 18 14:56:08 2016 +0100

----------------------------------------------------------------------
 .../apache/cxf/ws/security/wss4j/AbstractSecurityTest.java    | 7 ++++++-
 .../org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java  | 3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/0879404b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
index 38bc2be..10bb9df 100644
--- a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
+++ b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
@@ -32,6 +32,7 @@ import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConstants;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 import javax.xml.stream.XMLStreamReader;
@@ -81,7 +82,11 @@ public abstract class AbstractSecurityTest extends AbstractCXFTest {
      * @param doc the document containing the SOAP content.
      */
     protected SoapMessage getSoapMessageForDom(Document doc) throws Exception {
-        SOAPMessage saajMsg = MessageFactory.newInstance().createMessage();
+        return getSoapMessageForDom(doc, SOAPConstants.SOAP_1_1_PROTOCOL);
+    }
+    
+    protected SoapMessage getSoapMessageForDom(Document doc, String protocol) throws Exception {
+        SOAPMessage saajMsg = MessageFactory.newInstance(protocol).createMessage();
         SOAPPart part = saajMsg.getSOAPPart();
         SAAJStreamWriter writer = new SAAJStreamWriter(part);
         StaxUtils.copy(doc, writer);

http://git-wip-us.apache.org/repos/asf/cxf/blob/0879404b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
index bd1b526..1393ef8 100644
--- a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
+++ b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
@@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.SOAPConstants;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.stream.XMLStreamReader;
 
@@ -225,7 +226,7 @@ public class WSS4JFaultCodeTest extends AbstractSecurityTest {
     public void testSignedEncryptedSOAP12Fault() throws Exception {
         Document doc = readDocument("wsse-response-fault.xml");
 
-        SoapMessage msg = getSoapMessageForDom(doc);
+        SoapMessage msg = getSoapMessageForDom(doc, SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage saajMsg = msg.getContent(SOAPMessage.class);
         doc = saajMsg.getSOAPPart();
         


[48/50] [abbrv] cxf git commit: CXF-5855: Introduce support for Server Sent Events. Initial implementation based on Atmosphere

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf/blob/23d6d663/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/javascripts/jquery-1.9.0.min.js
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/javascripts/jquery-1.9.0.min.js b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/javascripts/jquery-1.9.0.min.js
new file mode 100644
index 0000000..50d1b22
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/javascripts/jquery-1.9.0.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v1.9.0 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license */(function(e,t){"use strict";function n(e){var t=e.length,n=st.type(e);return st.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}function r(e){var t=Tt[e]={};return st.each(e.match(lt)||[],function(e,n){t[n]=!0}),t}function i(e,n,r,i){if(st.acceptData(e)){var o,a,s=st.expando,u="string"==typeof n,l=e.nodeType,c=l?st.cache:e,f=l?e[s]:e[s]&&s;if(f&&c[f]&&(i||c[f].data)||!u||r!==t)return f||(l?e[s]=f=K.pop()||st.guid++:f=s),c[f]||(c[f]={},l||(c[f].toJSON=st.noop)),("object"==typeof n||"function"==typeof n)&&(i?c[f]=st.extend(c[f],n):c[f].data=st.extend(c[f].data,n)),o=c[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[st.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[st.camelCase(n)])):a=o,a}}function o(e,t,n){if(st.acceptData(e)){var r,i,o,a=e.nodeType,u=a?st.cache:e,l=a?e[st.expando]:st.expando;if(u[l]){if(t&&(r=n?u[l]:u[l].data)){st.isArray(t)?t=t.conc
 at(st.map(t,st.camelCase)):t in r?t=[t]:(t=st.camelCase(t),t=t in r?[t]:t.split(" "));for(i=0,o=t.length;o>i;i++)delete r[t[i]];if(!(n?s:st.isEmptyObject)(r))return}(n||(delete u[l].data,s(u[l])))&&(a?st.cleanData([e],!0):st.support.deleteExpando||u!=u.window?delete u[l]:u[l]=null)}}}function a(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(Nt,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:wt.test(r)?st.parseJSON(r):r}catch(o){}st.data(e,n,r)}else r=t}return r}function s(e){var t;for(t in e)if(("data"!==t||!st.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function u(){return!0}function l(){return!1}function c(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function f(e,t,n){if(t=t||0,st.isFunction(t))return st.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return st.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=st.grep(e,function(e){return 
 1===e.nodeType});if(Wt.test(t))return st.filter(t,r,!n);t=st.filter(t,r)}return st.grep(e,function(e){return st.inArray(e,t)>=0===n})}function p(e){var t=zt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function d(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function h(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function g(e){var t=nn.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function m(e,t){for(var n,r=0;null!=(n=e[r]);r++)st._data(n,"globalEval",!t||st._data(t[r],"globalEval"))}function y(e,t){if(1===t.nodeType&&st.hasData(e)){var n,r,i,o=st._data(e),a=st._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)st.event.add(t,n,s[n][r])}a.data&&(a.data=st.extend({},a.data))}}function v(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!st.support.noCloneEvent&&t[st.ex
 pando]){r=st._data(t);for(i in r.events)st.removeEvent(t,i,r.handle);t.removeAttribute(st.expando)}"script"===n&&t.text!==e.text?(h(t).text=e.text,g(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),st.support.html5Clone&&e.innerHTML&&!st.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Zt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function b(e,n){var r,i,o=0,a=e.getElementsByTagName!==t?e.getElementsByTagName(n||"*"):e.querySelectorAll!==t?e.querySelectorAll(n||"*"):t;if(!a)for(a=[],r=e.childNodes||e;null!=(i=r[o]);o++)!n||st.nodeName(i,n)?a.push(i):st.merge(a,b(i,n));return n===t||n&&st.nodeName(e,n)?st.merge([e],a):a}function x(e){Zt.test(e.type)&&(e.defaultChecked=e.checked)}function T(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Nn.length;i--;)if(t=Nn[i]+n,t in 
 e)return t;return r}function w(e,t){return e=t||e,"none"===st.css(e,"display")||!st.contains(e.ownerDocument,e)}function N(e,t){for(var n,r=[],i=0,o=e.length;o>i;i++)n=e[i],n.style&&(r[i]=st._data(n,"olddisplay"),t?(r[i]||"none"!==n.style.display||(n.style.display=""),""===n.style.display&&w(n)&&(r[i]=st._data(n,"olddisplay",S(n.nodeName)))):r[i]||w(n)||st._data(n,"olddisplay",st.css(n,"display")));for(i=0;o>i;i++)n=e[i],n.style&&(t&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=t?r[i]||"":"none"));return e}function C(e,t,n){var r=mn.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function k(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;4>o;o+=2)"margin"===n&&(a+=st.css(e,n+wn[o],!0,i)),r?("content"===n&&(a-=st.css(e,"padding"+wn[o],!0,i)),"margin"!==n&&(a-=st.css(e,"border"+wn[o]+"Width",!0,i))):(a+=st.css(e,"padding"+wn[o],!0,i),"padding"!==n&&(a+=st.css(e,"border"+wn[o]+"Width",!0,i)));return a}function E(e,t,n){var r=!0,i="width
 "===t?e.offsetWidth:e.offsetHeight,o=ln(e),a=st.support.boxSizing&&"border-box"===st.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=un(e,t,o),(0>i||null==i)&&(i=e.style[t]),yn.test(i))return i;r=a&&(st.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+k(e,t,n||(a?"border":"content"),r,o)+"px"}function S(e){var t=V,n=bn[e];return n||(n=A(e,t),"none"!==n&&n||(cn=(cn||st("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(cn[0].contentWindow||cn[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=A(e,t),cn.detach()),bn[e]=n),n}function A(e,t){var n=st(t.createElement(e)).appendTo(t.body),r=st.css(n[0],"display");return n.remove(),r}function j(e,t,n,r){var i;if(st.isArray(t))st.each(t,function(t,i){n||kn.test(e)?r(e,i):j(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==st.type(t))r(e,t);else for(i in t)j(e+"["+i+"]",t[i],n,r)}function D(e){return fun
 ction(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(lt)||[];if(st.isFunction(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function L(e,n,r,i){function o(u){var l;return a[u]=!0,st.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||s||a[c]?s?!(l=c):t:(n.dataTypes.unshift(c),o(c),!1)}),l}var a={},s=e===$n;return o(n.dataTypes[0])||!a["*"]&&o("*")}function H(e,n){var r,i,o=st.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((o[r]?e:i||(i={}))[r]=n[r]);return i&&st.extend(!0,e,i),e}function M(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(o in c)o in r&&(n[c[o]]=r[o]);for(;"*"===l[0];)l.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("Content-Type"));if(i)for(o in u)if(u[o]&&u[o].test(i)){l.unshift(o);break}if(l[0]in r)a=l[0];else{for(o in r){if(!l[0]||e.converters[o+" "+l[0]]){a=o;break}s||(s=o)}a=a||s}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function q(e,t){var 
 n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=u[++s];)if("*"!==i){if("*"!==l&&l!==i){if(n=a[l+" "+i]||a["* "+i],!n)for(r in a)if(o=r.split(" "),o[1]===i&&(n=a[l+" "+o[0]]||a["* "+o[0]])){n===!0?n=a[r]:a[r]!==!0&&(i=o[0],u.splice(s--,0,i));break}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(c){return{state:"parsererror",error:n?c:"No conversion from "+l+" to "+i}}}l=i}return{state:"success",data:t}}function _(){try{return new e.XMLHttpRequest}catch(t){}}function F(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function O(){return setTimeout(function(){Qn=t}),Qn=st.now()}function B(e,t){st.each(t,function(t,n){for(var r=(rr[t]||[]).concat(rr["*"]),i=0,o=r.length;o>i;i++)if(r[i].call(e,t,n))return})}function P(e,t,n){var r,i,o=0,a=nr.length,s=st.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=Qn||O(),n=Math.m
 ax(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:st.extend({},t),opts:st.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Qn||O(),duration:n.duration,tweens:[],createTween:function(t,n){var r=st.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(R(c,l.opts.specialEasing);a>o;o++)if(r=nr[o].call(l,e,c,l.opts))return r;return B(l,c),st.isFunction(l.opts.start)&&l.opts.start.call(e,l),st.fx.timer(st.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function R(e,t){var n,r,i,o,a;for(n in e)if(r=st.camelCase
 (n),i=t[r],o=e[n],st.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=st.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function W(e,t,n){var r,i,o,a,s,u,l,c,f,p=this,d=e.style,h={},g=[],m=e.nodeType&&w(e);n.queue||(c=st._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,f=c.empty.fire,c.empty.fire=function(){c.unqueued||f()}),c.unqueued++,p.always(function(){p.always(function(){c.unqueued--,st.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===st.css(e,"display")&&"none"===st.css(e,"float")&&(st.support.inlineBlockNeedsLayout&&"inline"!==S(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",st.support.shrinkWrapBlocks||p.done(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(r in t)if(o=t[r],Zn.exec(o)){if(delete t[r],u=u||"toggle"===o,o===(m?
 "hide":"show"))continue;g.push(r)}if(a=g.length){s=st._data(e,"fxshow")||st._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?st(e).show():p.done(function(){st(e).hide()}),p.done(function(){var t;st._removeData(e,"fxshow");for(t in h)st.style(e,t,h[t])});for(r=0;a>r;r++)i=g[r],l=p.createTween(i,m?s[i]:0),h[i]=s[i]||st.style(e,i),i in s||(s[i]=l.start,m&&(l.end=l.start,l.start="width"===i||"height"===i?1:0))}}function $(e,t,n,r,i){return new $.prototype.init(e,t,n,r,i)}function I(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=wn[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function z(e){return st.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var X,U,V=e.document,Y=e.location,J=e.jQuery,G=e.$,Q={},K=[],Z="1.9.0",et=K.concat,tt=K.push,nt=K.slice,rt=K.indexOf,it=Q.toString,ot=Q.hasOwnProperty,at=Z.trim,st=function(e,t){return new st.fn.init(e,t,X)},ut=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,lt=/\S+/g,ct=/^[\s\uFEFF\xA0]+
 |[\s\uFEFF\xA0]+$/g,ft=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,pt=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,dt=/^[\],:{}\s]*$/,ht=/(?:^|:|,)(?:\s*\[)+/g,gt=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,mt=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,yt=/^-ms-/,vt=/-([\da-z])/gi,bt=function(e,t){return t.toUpperCase()},xt=function(){V.addEventListener?(V.removeEventListener("DOMContentLoaded",xt,!1),st.ready()):"complete"===V.readyState&&(V.detachEvent("onreadystatechange",xt),st.ready())};st.fn=st.prototype={jquery:Z,constructor:st,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:ft.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof st?n[0]:n,st.merge(this,st.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:V,!0)),pt.test(i[1])&&st.isPlainObject(n))for(i in n)st.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=V.ge
 tElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=V,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):st.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),st.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return nt.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=st.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return st.each(this,e,t)},ready:function(e){return st.ready.promise().done(e),this},slice:function(){return this.pushStack(nt.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(st.map(this,function(
 t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:tt,sort:[].sort,splice:[].splice},st.fn.init.prototype=st.fn,st.extend=st.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||st.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(e=arguments[u]))for(n in e)r=s[n],i=e[n],s!==i&&(c&&i&&(st.isPlainObject(i)||(o=st.isArray(i)))?(o?(o=!1,a=r&&st.isArray(r)?r:[]):a=r&&st.isPlainObject(r)?r:{},s[n]=st.extend(c,a,i)):i!==t&&(s[n]=i));return s},st.extend({noConflict:function(t){return e.$===st&&(e.$=G),t&&e.jQuery===st&&(e.jQuery=J),st},isReady:!1,readyWait:1,holdReady:function(e){e?st.readyWait++:st.ready(!0)},ready:function(e){if(e===!0?!--st.readyWait:!st.isReady){if(!V.body)return setTimeout(st.ready);st.isReady=!0,e!==!0&&--st.readyWait>0||(U.resolveWith(V,[st]),st.fn.trigger&&st(V).trigger("ready").off("ready"))}},isFunction:
 function(e){return"function"===st.type(e)},isArray:Array.isArray||function(e){return"array"===st.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?Q[it.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==st.type(e)||e.nodeType||st.isWindow(e))return!1;try{if(e.constructor&&!ot.call(e,"constructor")&&!ot.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||ot.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||V;var r=pt.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=st.buildFragment([e],t,i),i&&st(i).remove(),st.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):nu
 ll===n?n:"string"==typeof n&&(n=st.trim(n),n&&dt.test(n.replace(gt,"@").replace(mt,"]").replace(ht,"")))?Function("return "+n)():(st.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||st.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&st.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(yt,"ms-").replace(vt,bt)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,r){var i,o=0,a=e.length,s=n(e);if(r){if(s)for(;a>o&&(i=t.apply(e[o],r),i!==!1);o++);else for(o in e)if(i=t.apply(e[o],r),i===!1)break}else if(s)for(;a>o&&(i=t.call(e[o],o,e[o]),i!==!1);o++);else for(o in e)if(i=t.call(e[o],o,e[o]),i=
 ==!1)break;return e},trim:at&&!at.call("\ufeff\u00a0")?function(e){return null==e?"":at.call(e)}:function(e){return null==e?"":(e+"").replace(ct,"")},makeArray:function(e,t){var r=t||[];return null!=e&&(n(Object(e))?st.merge(r,"string"==typeof e?[e]:e):tt.call(r,e)),r},inArray:function(e,t,n){var r;if(t){if(rt)return rt.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else for(;n[o]!==t;)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,r){var i,o=0,a=e.length,s=n(e),u=[];if(s)for(;a>o;o++)i=t(e[o],o,r),null!=i&&(u[u.length]=i);else for(o in e)i=t(e[o],o,r),null!=i&&(u[u.length]=i);return et.apply([],u)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(r=e[n],n=e,e=r),st.isFunction(e)?(i=nt.call(arguments,2),o=f
 unction(){return e.apply(n||this,i.concat(nt.call(arguments)))},o.guid=e.guid=e.guid||st.guid++,o):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===st.type(r)){o=!0;for(u in r)st.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,st.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(st(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),st.ready.promise=function(t){if(!U)if(U=st.Deferred(),"complete"===V.readyState)setTimeout(st.ready);else if(V.addEventListener)V.addEventListener("DOMContentLoaded",xt,!1),e.addEventListener("load",st.ready,!1);else{V.attachEvent("onreadystatechange",xt),e.attachEvent("onload",st.ready);var n=!1;try{n=null==e.frameElement&&V.documentElement}catch(r){}n&&n.doScroll&&function i(){if(!st.isReady){try{n.doScroll("left")}catch(e){return setTimeout(i,50)}st.ready()}}()}return U.promise(t)},st.each("Boole
 an Number String Function Array Date RegExp Object Error".split(" "),function(e,t){Q["[object "+t+"]"]=t.toLowerCase()}),X=st(V);var Tt={};st.Callbacks=function(e){e="string"==typeof e?Tt[e]||r(e):st.extend({},e);var n,i,o,a,s,u,l=[],c=!e.once&&[],f=function(t){for(n=e.memory&&t,i=!0,u=a||0,a=0,s=l.length,o=!0;l&&s>u;u++)if(l[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}o=!1,l&&(c?c.length&&f(c.shift()):n?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function r(t){st.each(t,function(t,n){var i=st.type(n);"function"===i?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==i&&r(n)})})(arguments),o?s=l.length:n&&(a=t,f(n))}return this},remove:function(){return l&&st.each(arguments,function(e,t){for(var n;(n=st.inArray(t,l,n))>-1;)l.splice(n,1),o&&(s>=n&&s--,u>=n&&u--)}),this},has:function(e){return st.inArray(e,l)>-1},empty:function(){return l=[],this},disable:function(){return l=c=n=t,this},disabled:function(){return!l},lock:function(){return c=t,n||p.disable(),th
 is},locked:function(){return!c},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!l||i&&!c||(o?c.push(t):f(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},st.extend({Deferred:function(e){var t=[["resolve","done",st.Callbacks("once memory"),"resolved"],["reject","fail",st.Callbacks("once memory"),"rejected"],["notify","progress",st.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return st.Deferred(function(n){st.each(t,function(t,o){var a=o[0],s=st.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&st.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?st.extend(e,r):r}},i={};return r.pipe=r.then,st.each(t,function(e,o){var a=o[2],s
 =o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=nt.call(arguments),a=o.length,s=1!==a||e&&st.isFunction(e.promise)?a:0,u=1===s?e:st.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?nt.call(arguments):i,r===t?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(a>1)for(t=Array(a),n=Array(a),r=Array(a);a>i;i++)o[i]&&st.isFunction(o[i].promise)?o[i].promise().done(l(i,r,o)).fail(u.reject).progress(l(i,n,t)):--s;return s||u.resolveWith(r,o),u.promise()}}),st.support=function(){var n,r,i,o,a,s,u,l,c,f,p=V.createElement("div");if(p.setAttribute("className","t"),p.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=p.getElementsByTagName("*"),i=p.getElementsByTagName("a")[0],!r||!i||!r.length)return{};o=V.createElement("select"),a=o.appendChil
 d(V.createElement("option")),s=p.getElementsByTagName("input")[0],i.style.cssText="top:1px;float:left;opacity:.5",n={getSetAttribute:"t"!==p.className,leadingWhitespace:3===p.firstChild.nodeType,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(i.getAttribute("style")),hrefNormalized:"/a"===i.getAttribute("href"),opacity:/^0.5/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:!!s.value,optSelected:a.selected,enctype:!!V.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==V.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===V.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},s.checked=!0,n.noCloneChecked=s.cloneNode(!0).checked,o.disabled=!0,n.optDisabled=!a.disabled;try{delete p.test}catch(d){n.deleteExpando=!1}s=V.createElement("input"),s.setAttribute("value",""),n.input=""===s.getA
 ttribute("value"),s.value="t",s.setAttribute("type","radio"),n.radioValue="t"===s.value,s.setAttribute("checked","t"),s.setAttribute("name","t"),u=V.createDocumentFragment(),u.appendChild(s),n.appendChecked=s.checked,n.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,p.attachEvent&&(p.attachEvent("onclick",function(){n.noCloneEvent=!1}),p.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})p.setAttribute(l="on"+f,"t"),n[f+"Bubbles"]=l in e||p.attributes[l].expando===!1;return p.style.backgroundClip="content-box",p.cloneNode(!0).style.backgroundClip="",n.clearCloneStyle="content-box"===p.style.backgroundClip,st(function(){var r,i,o,a="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",s=V.getElementsByTagName("body")[0];s&&(r=V.createElement("div"),r.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",s.appendChild(r).appendChild(p),p.innerHTML="<
 table><tr><td></td><td>t</td></tr></table>",o=p.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",c=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",n.reliableHiddenOffsets=c&&0===o[0].offsetHeight,p.innerHTML="",p.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",n.boxSizing=4===p.offsetWidth,n.doesNotIncludeMarginInBodyOffset=1!==s.offsetTop,e.getComputedStyle&&(n.pixelPosition="1%"!==(e.getComputedStyle(p,null)||{}).top,n.boxSizingReliable="4px"===(e.getComputedStyle(p,null)||{width:"4px"}).width,i=p.appendChild(V.createElement("div")),i.style.cssText=p.style.cssText=a,i.style.marginRight=i.style.width="0",p.style.width="1px",n.reliableMarginRight=!parseFloat((e.getComputedStyle(i,null)||{}).marginRight)),p.style.zoom!==t&&(p.innerHTML="",p.style.cssText=a+"width:1px;padding:1px;display:inli
 ne;zoom:1",n.inlineBlockNeedsLayout=3===p.offsetWidth,p.style.display="block",p.innerHTML="<div></div>",p.firstChild.style.width="5px",n.shrinkWrapBlocks=3!==p.offsetWidth,s.style.zoom=1),s.removeChild(r),r=p=o=i=null)}),r=o=u=a=i=s=null,n}();var wt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,Nt=/([A-Z])/g;st.extend({cache:{},expando:"jQuery"+(Z+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?st.cache[e[st.expando]]:e[st.expando],!!e&&!s(e)},data:function(e,t,n){return i(e,t,n,!1)},removeData:function(e,t){return o(e,t,!1)},_data:function(e,t,n){return i(e,t,n,!0)},_removeData:function(e,t){return o(e,t,!0)},acceptData:function(e){var t=e.nodeName&&st.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),st.fn.extend({data:function(e,n){var r,i,o=this[0],s=0,u=null;if(e===t){if(this.length&&(u=st.data(o),1===o.nodeType&&!st._data(o,"parsedAttrs"))){for(r=o.attrib
 utes;r.length>s;s++)i=r[s].name,i.indexOf("data-")||(i=st.camelCase(i.substring(5)),a(o,i,u[i]));st._data(o,"parsedAttrs",!0)}return u}return"object"==typeof e?this.each(function(){st.data(this,e)}):st.access(this,function(n){return n===t?o?a(o,e,st.data(o,e)):null:(this.each(function(){st.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){st.removeData(this,e)})}}),st.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=st._data(e,n),r&&(!i||st.isArray(r)?i=st._data(e,n,st.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=st.queue(e,t),r=n.length,i=n.shift(),o=st._queueHooks(e,t),a=function(){st.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return st._data(e,n)||st._data(e,n,{empty:st.Callbacks("once memory").add(function(){st._removeData(e,t
 +"queue"),st._removeData(e,n)})})}}),st.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?st.queue(this[0],e):n===t?this:this.each(function(){var t=st.queue(this,e,n);st._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&st.dequeue(this,e)})},dequeue:function(e){return this.each(function(){st.dequeue(this,e)})},delay:function(e,t){return e=st.fx?st.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=st.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};for("string"!=typeof e&&(n=e,e=t),e=e||"fx";s--;)r=st._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var Ct,kt,Et=/[\t\r\n]/g,St=/\r/g,At=/^(?:input|select|textarea|button|object)$/i,jt=/^(?:a|area)$/i,Dt=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|h
 idden|loop|multiple|open|readonly|required|scoped)$/i,Lt=/^(?:checked|selected)$/i,Ht=st.support.getSetAttribute,Mt=st.support.input;st.fn.extend({attr:function(e,t){return st.access(this,st.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){st.removeAttr(this,e)})},prop:function(e,t){return st.access(this,st.prop,e,t,arguments.length>1)},removeProp:function(e){return e=st.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(st.isFunction(e))return this.each(function(t){st(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(lt)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(Et," "):" ")){for(o=0;i=t[o++];)0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=st.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(st.isFunction
 (e))return this.each(function(t){st(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(lt)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(Et," "):"")){for(o=0;i=t[o++];)for(;r.indexOf(" "+i+" ")>=0;)r=r.replace(" "+i+" "," ");n.className=e?st.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return st.isFunction(e)?this.each(function(n){st(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n)for(var i,o=0,a=st(this),s=t,u=e.match(lt)||[];i=u[o++];)s=r?s:!a.hasClass(i),a[s?"addClass":"removeClass"](i);else("undefined"===n||"boolean"===n)&&(this.className&&st._data(this,"__className__",this.className),this.className=this.className||e===!1?"":st._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(Et," ").indexOf(t)>=0)return!0;return!1},v
 al:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=st.isFunction(e),this.each(function(r){var o,a=st(this);1===this.nodeType&&(o=i?e.call(this,r,a.val()):e,null==o?o="":"number"==typeof o?o+="":st.isArray(o)&&(o=st.map(o,function(e){return null==e?"":e+""})),n=st.valHooks[this.type]||st.valHooks[this.nodeName.toLowerCase()],n&&"set"in n&&n.set(this,o,"value")!==t||(this.value=o))});if(o)return n=st.valHooks[o.type]||st.valHooks[o.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(o,"value"))!==t?r:(r=o.value,"string"==typeof r?r.replace(St,""):null==r?"":r)}}}),st.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(st.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&st.nodeName(n.parentNode,"optgroup")))
 {if(t=st(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=st.makeArray(t);return st(e).find("option").each(function(){this.selected=st.inArray(st(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return e.getAttribute===t?st.prop(e,n,r):(a=1!==s||!st.isXMLDoc(e),a&&(n=n.toLowerCase(),o=st.attrHooks[n]||(Dt.test(n)?kt:Ct)),r===t?o&&a&&"get"in o&&null!==(i=o.get(e,n))?i:(e.getAttribute!==t&&(i=e.getAttribute(n)),null==i?t:i):null!==r?o&&a&&"set"in o&&(i=o.set(e,r,n))!==t?i:(e.setAttribute(n,r+""),r):(st.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(lt);if(o&&1===e.nodeType)for(;n=o[i++];)r=st.propFix[n]||n,Dt.test(n)?!Ht&&Lt.test(n)?e[st.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:st.attr(e,n,""),e.removeAttribute(Ht?n:r)},attrHooks:{type:{set:function(e,t){if(!st.support.radioValue&&"radio"===t&&st.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.va
 lue=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!st.isXMLDoc(e),a&&(n=st.propFix[n]||n,o=st.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):At.test(e.nodeName)||jt.test(e.nodeName)&&e.href?0:t}}}}),kt={get:function(e,n){var r=st.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?Mt&&Ht?null!=i:Lt.test(n)?e[st.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?st.removeAttr(e,n):Mt&&Ht||!Lt.test(n
 )?e.setAttribute(!Ht&&st.propFix[n]||n,n):e[st.camelCase("default-"+n)]=e[n]=!0,n}},Mt&&Ht||(st.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return st.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t
+},set:function(e,n,r){return st.nodeName(e,"input")?(e.defaultValue=n,t):Ct&&Ct.set(e,n,r)}}),Ht||(Ct=st.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},st.attrHooks.contenteditable={get:Ct.get,set:function(e,t,n){Ct.set(e,""===t?!1:t,n)}},st.each(["width","height"],function(e,n){st.attrHooks[n]=st.extend(st.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),st.support.hrefNormalized||(st.each(["href","src","width","height"],function(e,n){st.attrHooks[n]=st.extend(st.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),st.each(["href","src"],function(e,t){st.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),st.support.style||(st.attrHooks.style={get:f
 unction(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),st.support.optSelected||(st.propHooks.selected=st.extend(st.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),st.support.enctype||(st.propFix.enctype="encoding"),st.support.checkOn||st.each(["radio","checkbox"],function(){st.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),st.each(["radio","checkbox"],function(){st.valHooks[this]=st.extend(st.valHooks[this],{set:function(e,n){return st.isArray(n)?e.checked=st.inArray(st(e).val(),n)>=0:t}})});var qt=/^(?:input|select|textarea)$/i,_t=/^key/,Ft=/^(?:mouse|contextmenu)|click/,Ot=/^(?:focusinfocus|focusoutblur)$/,Bt=/^([^.]*)(?:\.(.+)|)$/;st.event={global:{},add:function(e,n,r,i,o){var a,s,u,l,c,f,p,d,h,g,m,y=3!==e.nodeType&&8!==e.nodeType&&st._data(e);if(y){for(r.handler&&(a=r,r=a.handler,o=a.selector),r.guid||(r.guid=st.guid++),(l=
 y.events)||(l=y.events={}),(s=y.handle)||(s=y.handle=function(e){return st===t||e&&st.event.triggered===e.type?t:st.event.dispatch.apply(s.elem,arguments)},s.elem=e),n=(n||"").match(lt)||[""],c=n.length;c--;)u=Bt.exec(n[c])||[],h=m=u[1],g=(u[2]||"").split(".").sort(),p=st.event.special[h]||{},h=(o?p.delegateType:p.bindType)||h,p=st.event.special[h]||{},f=st.extend({type:h,origType:m,data:i,handler:r,guid:r.guid,selector:o,needsContext:o&&st.expr.match.needsContext.test(o),namespace:g.join(".")},a),(d=l[h])||(d=l[h]=[],d.delegateCount=0,p.setup&&p.setup.call(e,i,g,s)!==!1||(e.addEventListener?e.addEventListener(h,s,!1):e.attachEvent&&e.attachEvent("on"+h,s))),p.add&&(p.add.call(e,f),f.handler.guid||(f.handler.guid=r.guid)),o?d.splice(d.delegateCount++,0,f):d.push(f),st.event.global[h]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,m=st.hasData(e)&&st._data(e);if(m&&(u=m.events)){for(t=(t||"").match(lt)||[""],l=t.length;l--;)if(s=Bt.exec(t[l])||[],d=g=s[1],h=(s[2]||"
 ").split(".").sort(),d){for(f=st.event.special[d]||{},d=(r?f.delegateType:f.bindType)||d,p=u[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;o--;)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&f.teardown.call(e,h,m.handle)!==!1||st.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)st.event.remove(e,d+t[l],n,r,!0);st.isEmptyObject(u)&&(delete m.handle,st._removeData(e,"events"))}},trigger:function(n,r,i,o){var a,s,u,l,c,f,p,d=[i||V],h=n.type||n,g=n.namespace?n.namespace.split("."):[];if(s=u=i=i||V,3!==i.nodeType&&8!==i.nodeType&&!Ot.test(h+st.event.triggered)&&(h.indexOf(".")>=0&&(g=h.split("."),h=g.shift(),g.sort()),c=0>h.indexOf(":")&&"on"+h,n=n[st.expando]?n:new st.Event(h,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=g.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"
 +g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:st.makeArray(r,[n]),p=st.event.special[h]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!st.isWindow(i)){for(l=p.delegateType||h,Ot.test(l+h)||(s=s.parentNode);s;s=s.parentNode)d.push(s),u=s;u===(i.ownerDocument||V)&&d.push(u.defaultView||u.parentWindow||e)}for(a=0;(s=d[a++])&&!n.isPropagationStopped();)n.type=a>1?l:p.bindType||h,f=(st._data(s,"events")||{})[n.type]&&st._data(s,"handle"),f&&f.apply(s,r),f=c&&s[c],f&&st.acceptData(s)&&f.apply&&f.apply(s,r)===!1&&n.preventDefault();if(n.type=h,!(o||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===h&&st.nodeName(i,"a")||!st.acceptData(i)||!c||!i[h]||st.isWindow(i))){u=i[c],u&&(i[c]=null),st.event.triggered=h;try{i[h]()}catch(m){}st.event.triggered=t,u&&(i[c]=u)}return n.result}},dispatch:function(e){e=st.event.fix(e);var n,r,i,o,a,s=[],u=nt.call(arguments),l=(st._data(this,"events")||{})[e
 .type]||[],c=st.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){for(s=st.event.handlers.call(this,e,l),n=0;(o=s[n++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,r=0;(a=o.handlers[r++])&&!e.isImmediatePropagationStopped();)(!e.namespace_re||e.namespace_re.test(a.namespace))&&(e.handleObj=a,e.data=a.data,i=((st.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u),i!==t&&(e.result=i)===!1&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(l.disabled!==!0||"click"!==e.type){for(i=[],r=0;u>r;r++)a=n[r],o=a.selector+" ",i[o]===t&&(i[o]=a.needsContext?st(o,this).index(l)>=0:st.find(o,this,null,[l]).length),i[o]&&i.push(a);i.length&&s.push({elem:l,handlers:i})}return n.length>u&&s.push({elem:this,handler
 s:n.slice(u)}),s},fix:function(e){if(e[st.expando])return e;var t,n,r=e,i=st.event.fixHooks[e.type]||{},o=i.props?this.props.concat(i.props):this.props;for(e=new st.Event(r),t=o.length;t--;)n=o[t],e[n]=r[n];return e.target||(e.target=r.srcElement||V),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,i.filter?i.filter(e,r):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,a=n.button,s=n.fromElement;return null==e.pageX&&null!=n.clientX&&(r=e.target.ownerDocument||V,i=r.documentElement,o=r.body,e.pageX=n.clientX+(i&&i.scrollLeft||o&&o.scrollLeft||0)-(i&&i.
 clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(i&&i.scrollTop||o&&o.scrollTop||0)-(i&&i.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&s&&(e.relatedTarget=s===e.target?n.toElement:s),e.which||a===t||(e.which=1&a?1:2&a?3:4&a?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return st.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==V.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===V.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=st.extend(new st.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?st.event.trigger(i,null,t):st.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},st.removeEvent=V.removeEventListener?function(e,t,n){e.removeEventListener&&e.
 removeEventListener(t,n,!1)}:function(e,n,r){var i="on"+n;e.detachEvent&&(e[i]===t&&(e[i]=null),e.detachEvent(i,r))},st.Event=function(e,n){return this instanceof st.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?u:l):this.type=e,n&&st.extend(this,n),this.timeStamp=e&&e.timeStamp||st.now(),this[st.expando]=!0,t):new st.Event(e,n)},st.Event.prototype={isDefaultPrevented:l,isPropagationStopped:l,isImmediatePropagationStopped:l,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=u,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=u,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u,this.stopPropagation()}},st.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){st.eve
 nt.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!st.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),st.support.submitBubbles||(st.event.special.submit={setup:function(){return st.nodeName(this,"form")?!1:(st.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=st.nodeName(n,"input")||st.nodeName(n,"button")?n.form:t;r&&!st._data(r,"submitBubbles")&&(st.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),st._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&st.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return st.nodeName(this,"form")?!1:(st.event.remove(this,"._submit"),t)}}),st.support.changeBubbles||(st.event.special.change={setup:function(){return qt.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(st.event.add
 (this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),st.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),st.event.simulate("change",this,e,!0)})),!1):(st.event.add(this,"beforeactivate._change",function(e){var t=e.target;qt.test(t.nodeName)&&!st._data(t,"changeBubbles")&&(st.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||st.event.simulate("change",this.parentNode,e,!0)}),st._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return st.event.remove(this,"._change"),!qt.test(this.nodeName)}}),st.support.focusinBubbles||st.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){st.event.simulate(t,e.target,st.event.fix(e),!0)};st.event.special[t]={setup:func
 tion(){0===n++&&V.addEventListener(e,r,!0)},teardown:function(){0===--n&&V.removeEventListener(e,r,!0)}}}),st.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(s in e)this.on(s,n,r,e[s],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=l;else if(!i)return this;return 1===o&&(a=i,i=function(e){return st().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=st.guid++)),this.each(function(){st.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,st(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=l),this.each(function(){st.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n
 )},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){st.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?st.event.trigger(e,n,r,!0):t},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),st.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){st.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)},_t.test(t)&&(st.event.fixHooks[t]=st.event.keyHooks),Ft.test(t)&&(st.event.fixHooks[t]=st.event.mouseHooks)}),function(e,t){function n(e){return ht.test(e+"")}function r(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>C.cacheLength&&delete 
 e[t.shift()],e[n]=r}}function i(e){return e[P]=!0,e}function o(e){var t=L.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function a(e,t,n,r){var i,o,a,s,u,l,c,d,h,g;if((t?t.ownerDocument||t:R)!==L&&D(t),t=t||L,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!M&&!r){if(i=gt.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&O(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return Q.apply(n,K.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&W.getByClassName&&t.getElementsByClassName)return Q.apply(n,K.call(t.getElementsByClassName(a),0)),n}if(W.qsa&&!q.test(e)){if(c=!0,d=P,h=t,g=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){for(l=f(e),(c=t.getAttribute("id"))?d=c.replace(vt,"\\$&"):t.setAttribute("id",d),d="[id='"+d+"'] ",u=l.length;u--;)l[u]=d+p(l[u]);h=dt.test(e)&&t.parentNode||t,g=l.join(",")}if(
 g)try{return Q.apply(n,K.call(h.querySelectorAll(g),0)),n}catch(m){}finally{c||t.removeAttribute("id")}}}return x(e.replace(at,"$1"),t,n,r)}function s(e,t){for(var n=e&&t&&e.nextSibling;n;n=n.nextSibling)if(n===t)return-1;return e?1:-1}function u(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function l(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function c(e){return i(function(t){return t=+t,i(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function f(e,t){var n,r,i,o,s,u,l,c=X[e+" "];if(c)return t?0:c.slice(0);for(s=e,u=[],l=C.preFilter;s;){(!n||(r=ut.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(i=[])),n=!1,(r=lt.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(at," ")}),s=s.slice(n.length));for(o in C.filter)!(r=pt[o].exec(s))||l[o]&&!(r=l[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),s=s.slice(n.length));if(!n)break}ret
 urn t?s.length:s?a.error(e):X(e,u).slice(0)}function p(e){for(var t=0,n=e.length,r="";n>t;t++)r+=e[t].value;return r}function d(e,t,n){var r=t.dir,i=n&&"parentNode"===t.dir,o=I++;return t.first?function(t,n,o){for(;t=t[r];)if(1===t.nodeType||i)return e(t,n,o)}:function(t,n,a){var s,u,l,c=$+" "+o;if(a){for(;t=t[r];)if((1===t.nodeType||i)&&e(t,n,a))return!0}else for(;t=t[r];)if(1===t.nodeType||i)if(l=t[P]||(t[P]={}),(u=l[r])&&u[0]===c){if((s=u[1])===!0||s===N)return s===!0}else if(u=l[r]=[c],u[1]=e(t,n,a)||N,u[1]===!0)return!0}}function h(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function g(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function m(e,t,n,r,o,a){return r&&!r[P]&&(r=m(r)),o&&!o[P]&&(o=m(o,a)),i(function(i,a,s,u){var l,c,f,p=[],d=[],h=a.length,m=i||b(t||"*",s.nodeType?[s]:s,[]),y=!e||!i&&t?m:g(m,p,e,s,u),v=n?o||(i?e:h||r)?[]:a:y;if(n&&n(y,v,s,
 u),r)for(l=g(v,d),r(l,[],s,u),c=l.length;c--;)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f));if(i){if(o||e){if(o){for(l=[],c=v.length;c--;)(f=v[c])&&l.push(y[c]=f);o(null,v=[],l,u)}for(c=v.length;c--;)(f=v[c])&&(l=o?Z.call(i,f):p[c])>-1&&(i[l]=!(a[l]=f))}}else v=g(v===a?v.splice(h,v.length):v),o?o(null,a,v,u):Q.apply(a,v)})}function y(e){for(var t,n,r,i=e.length,o=C.relative[e[0].type],a=o||C.relative[" "],s=o?1:0,u=d(function(e){return e===t},a,!0),l=d(function(e){return Z.call(t,e)>-1},a,!0),c=[function(e,n,r){return!o&&(r||n!==j)||((t=n).nodeType?u(e,n,r):l(e,n,r))}];i>s;s++)if(n=C.relative[e[s].type])c=[d(h(c),n)];else{if(n=C.filter[e[s].type].apply(null,e[s].matches),n[P]){for(r=++s;i>r&&!C.relative[e[r].type];r++);return m(s>1&&h(c),s>1&&p(e.slice(0,s-1)).replace(at,"$1"),n,r>s&&y(e.slice(s,r)),i>r&&y(e=e.slice(r)),i>r&&p(e))}c.push(n)}return h(c)}function v(e,t){var n=0,r=t.length>0,o=e.length>0,s=function(i,s,u,l,c){var f,p,d,h=[],m=0,y="0",v=i&&[],b=null!=c,x=j,T=i||o&&C.find.TAG("*",c&&
 s.parentNode||s),w=$+=null==x?1:Math.E;for(b&&(j=s!==L&&s,N=n);null!=(f=T[y]);y++){if(o&&f){for(p=0;d=e[p];p++)if(d(f,s,u)){l.push(f);break}b&&($=w,N=++n)}r&&((f=!d&&f)&&m--,i&&v.push(f))}if(m+=y,r&&y!==m){for(p=0;d=t[p];p++)d(v,h,s,u);if(i){if(m>0)for(;y--;)v[y]||h[y]||(h[y]=G.call(l));h=g(h)}Q.apply(l,h),b&&!i&&h.length>0&&m+t.length>1&&a.uniqueSort(l)}return b&&($=w,j=x),v};return r?i(s):s}function b(e,t,n){for(var r=0,i=t.length;i>r;r++)a(e,t[r],n);return n}function x(e,t,n,r){var i,o,a,s,u,l=f(e);if(!r&&1===l.length){if(o=l[0]=l[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&9===t.nodeType&&!M&&C.relative[o[1].type]){if(t=C.find.ID(a.matches[0].replace(xt,Tt),t)[0],!t)return n;e=e.slice(o.shift().value.length)}for(i=pt.needsContext.test(e)?-1:o.length-1;i>=0&&(a=o[i],!C.relative[s=a.type]);i--)if((u=C.find[s])&&(r=u(a.matches[0].replace(xt,Tt),dt.test(o[0].type)&&t.parentNode||t))){if(o.splice(i,1),e=r.length&&p(o),!e)return Q.apply(n,K.call(r,0)),n;break}}return S(e,l)(r,t,M,n,
 dt.test(e)),n}function T(){}var w,N,C,k,E,S,A,j,D,L,H,M,q,_,F,O,B,P="sizzle"+-new Date,R=e.document,W={},$=0,I=0,z=r(),X=r(),U=r(),V=typeof t,Y=1<<31,J=[],G=J.pop,Q=J.push,K=J.slice,Z=J.indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1},et="[\\x20\\t\\r\\n\\f]",tt="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",nt=tt.replace("w","w#"),rt="([*^$|!~]?=)",it="\\["+et+"*("+tt+")"+et+"*(?:"+rt+et+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+nt+")|)|)"+et+"*\\]",ot=":("+tt+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+it.replace(3,8)+")*)|.*)\\)|)",at=RegExp("^"+et+"+|((?:^|[^\\\\])(?:\\\\.)*)"+et+"+$","g"),ut=RegExp("^"+et+"*,"+et+"*"),lt=RegExp("^"+et+"*([\\x20\\t\\r\\n\\f>+~])"+et+"*"),ct=RegExp(ot),ft=RegExp("^"+nt+"$"),pt={ID:RegExp("^#("+tt+")"),CLASS:RegExp("^\\.("+tt+")"),NAME:RegExp("^\\[name=['\"]?("+tt+")['\"]?\\]"),TAG:RegExp("^("+tt.replace("w","w*")+")"),ATTR:RegExp("^"+it),PSEUDO:RegExp("^"+ot),CHILD:RegExp("^:(only|first|last|nth|nt
 h-last)-(child|of-type)(?:\\("+et+"*(even|odd|(([+-]|)(\\d*)n|)"+et+"*(?:([+-]|)"+et+"*(\\d+)|))"+et+"*\\)|)","i"),needsContext:RegExp("^"+et+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+et+"*((?:-\\d)?\\d*)"+et+"*\\)|)(?=[^-]|$)","i")},dt=/[\x20\t\r\n\f]*[+~]/,ht=/\{\s*\[native code\]\s*\}/,gt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,mt=/^(?:input|select|textarea|button)$/i,yt=/^h\d$/i,vt=/'|\\/g,bt=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,xt=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,Tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{K.call(H.childNodes,0)[0].nodeType}catch(wt){K=function(e){for(var t,n=[];t=this[e];e++)n.push(t);return n}}E=a.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},D=a.setDocument=function(e){var r=e?e.ownerDocument||e:R;return r!==L&&9===r.nodeType&&r.documentElement?(L=r,H=r.documentElement,M=E(r),W.tagNameNoComments=o
 (function(e){return e.appendChild(r.createComment("")),!e.getElementsByTagName("*").length}),W.attributes=o(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),W.getByClassName=o(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),W.getByName=o(function(e){e.id=P+0,e.innerHTML="<a name='"+P+"'></a><div name='"+P+"'></div>",H.insertBefore(e,H.firstChild);var t=r.getElementsByName&&r.getElementsByName(P).length===2+r.getElementsByName(P+0).length;return W.getIdNotName=!r.getElementById(P),H.removeChild(e),t}),C.attrHandle=o(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==V&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){ret
 urn e.getAttribute("type")}},W.getIdNotName?(C.find.ID=function(e,t){if(typeof t.getElementById!==V&&!M){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},C.filter.ID=function(e){var t=e.replace(xt,Tt);return function(e){return e.getAttribute("id")===t}}):(C.find.ID=function(e,n){if(typeof n.getElementById!==V&&!M){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==V&&r.getAttributeNode("id").value===e?[r]:t:[]}},C.filter.ID=function(e){var t=e.replace(xt,Tt);return function(e){var n=typeof e.getAttributeNode!==V&&e.getAttributeNode("id");return n&&n.value===t}}),C.find.TAG=W.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==V?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i];i++)1===n.nodeType&&r.push(n);return r}return o},C.find.NAME=W.getByName&&function(e,n){return typeof n.getElementsByName!==V?n.getElementsByName(name):t},C.find.CLASS=W.getByClassName&&function(e,n){r
 eturn typeof n.getElementsByClassName===V||M?t:n.getElementsByClassName(e)},_=[],q=[":focus"],(W.qsa=n(r.querySelectorAll))&&(o(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||q.push("\\["+et+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||q.push(":checked")}),o(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&q.push("[*^$]="+et+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),q.push(",.*:")})),(W.matchesSelector=n(F=H.matchesSelector||H.mozMatchesSelector||H.webkitMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&o(function(e){W.disconnectedMatch=F.call(e,"div"),F.call(e,"[s!='']:x"),_.push("!=",ot)}),q=RegExp(q.join("|")),_=RegExp(_.join("|")),O=n(H.contains)||H.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.
 parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},B=H.compareDocumentPosition?function(e,t){var n;return e===t?(A=!0,0):(n=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&n||e.parentNode&&11===e.parentNode.nodeType?e===r||O(R,e)?-1:t===r||O(R,t)?1:0:4&n?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var n,i=0,o=e.parentNode,a=t.parentNode,u=[e],l=[t];if(e===t)return A=!0,0;if(e.sourceIndex&&t.sourceIndex)return(~t.sourceIndex||Y)-(O(R,e)&&~e.sourceIndex||Y);if(!o||!a)return e===r?-1:t===r?1:o?-1:a?1:0;if(o===a)return s(e,t);for(n=e;n=n.parentNode;)u.unshift(n);for(n=t;n=n.parentNode;)l.unshift(n);for(;u[i]===l[i];)i++;return i?s(u[i],l[i]):u[i]===R?-1:l[i]===R?1:0},A=!1,[0,0].sort(B),W.detectDuplicates=A,L):L},a.matches=function(e,t){return a(e,null,null,t)},a.matchesSelector=function(e,t){
 if((e.ownerDocument||e)!==L&&D(e),t=t.replace(bt,"='$1']"),!(!W.matchesSelector||M||_&&_.test(t)||q.test(t)))try{var n=F.call(e,t);if(n||W.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return a(t,L,null,[e]).length>0},a.contains=function(e,t){return(e.ownerDocument||e)!==L&&D(e),O(e,t)},a.attr=function(e,t){var n;return(e.ownerDocument||e)!==L&&D(e),M||(t=t.toLowerCase()),(n=C.attrHandle[t])?n(e):M||W.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},a.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},a.uniqueSort=function(e){var t,n=[],r=1,i=0;if(A=!W.detectDuplicates,e.sort(B),A){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));for(;i--;)e.splice(n[i],1)}return e},k=a.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=k(e)}else if(3===i||4===i)re
 turn e.nodeValue}else for(;t=e[r];r++)n+=k(t);return n},C=a.selectors={cacheLength:50,createPseudo:i,match:pt,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(xt,Tt),e[3]=(e[4]||e[5]||"").replace(xt,Tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||a.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&a.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return pt.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&ct.test(n)&&(t=f(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(xt,Tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=z[
 e+" "];return t||(t=RegExp("(^|"+et+")"+e+"("+et+"|$)"))&&z(e,function(e){return t.test(e.className||typeof e.getAttribute!==V&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=a.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.substr(i.length-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){for(;g;){for(f=t;f=f[g];)if(s?f.nodeName.toLowerCase()===y:1===f.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){for(c=m[P]||(m[P]={}),l=c[e]||[],d=l[0]===$&&l[1],p=l[0]===$&&l[2],f=d&&m.c
 hildNodes[d];f=++d&&f&&f[g]||(p=d=0)||h.pop();)if(1===f.nodeType&&++p&&f===t){c[e]=[$,d,p];break}}else if(v&&(l=(t[P]||(t[P]={}))[e])&&l[0]===$)p=l[1];else for(;(f=++d&&f&&f[g]||(p=d=0)||h.pop())&&((s?f.nodeName.toLowerCase()!==y:1!==f.nodeType)||!++p||(v&&((f[P]||(f[P]={}))[e]=[$,p]),f!==t)););return p-=i,p===r||0===p%r&&p/r>=0}}},PSEUDO:function(e,t){var n,r=C.pseudos[e]||C.setFilters[e.toLowerCase()]||a.error("unsupported pseudo: "+e);return r[P]?r(t):r.length>1?(n=[e,e,"",t],C.setFilters.hasOwnProperty(e.toLowerCase())?i(function(e,n){for(var i,o=r(e,t),a=o.length;a--;)i=Z.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:i(function(e){var t=[],n=[],r=S(e.replace(at,"$1"));return r[P]?i(function(e,t,n,i){for(var o,a=r(e,null,i,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:i(function(e){return function(t){return a(e,t).length>0}}),contains:i(function(e){return function(t){return(t.textCon
 tent||t.innerText||k(t)).indexOf(e)>-1}}),lang:i(function(e){return ft.test(e||"")||a.error("unsupported lang: "+e),e=e.replace(xt,Tt).toLowerCase(),function(t){var n;do if(n=M?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===H},focus:function(e){return e===L.activeElement&&(!L.hasFocus||L.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!
 C.pseudos.empty(e)},header:function(e){return yt.test(e.nodeName)},input:function(e){return mt.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:c(function(){return[0]}),last:c(function(e,t){return[t-1]}),eq:c(function(e,t,n){return[0>n?n+t:n]}),even:c(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:c(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:c(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:c(function(e,t,n){for(var r=0>n?n+t:n;t>++r;)e.push(r);return e})}};for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})C.pseudos[w]=u(w);for(w in{submit:!0,reset:!0})C.pseudos[w]=l(w);S=a.compile=function(e,t){var n,r=[],i=[],o=U[e+" "];if(!o){for(t||(t=f(e)),n=t.length;n--;)o=y(t[n]),o[P]?r.push(o):i.push(o);o=U(e,v(i,r))
 }return o},C.pseudos.nth=C.pseudos.eq,C.filters=T.prototype=C.pseudos,C.setFilters=new T,D(),a.attr=st.attr,st.find=a,st.expr=a.selectors,st.expr[":"]=st.expr.pseudos,st.unique=a.uniqueSort,st.text=a.getText,st.isXMLDoc=a.isXML,st.contains=a.contains}(e);var Pt=/Until$/,Rt=/^(?:parents|prev(?:Until|All))/,Wt=/^.[^:#\[\.,]*$/,$t=st.expr.match.needsContext,It={children:!0,contents:!0,next:!0,prev:!0};st.fn.extend({find:function(e){var t,n,r;if("string"!=typeof e)return r=this,this.pushStack(st(e).filter(function(){for(t=0;r.length>t;t++)if(st.contains(r[t],this))return!0}));for(n=[],t=0;this.length>t;t++)st.find(e,this[t],n);return n=this.pushStack(st.unique(n)),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=st(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(st.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(f(this,e,!1))},filter:function(e){return this.pushStack(f(this,e,!0))},is:function(e){return!!e&&("string"=
 =typeof e?$t.test(e)?st(e,this.context).index(this[0])>=0:st.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){for(var n,r=0,i=this.length,o=[],a=$t.test(e)||"string"!=typeof e?st(e,t||this.context):0;i>r;r++)for(n=this[r];n&&n.ownerDocument&&n!==t&&11!==n.nodeType;){if(a?a.index(n)>-1:st.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}return this.pushStack(o.length>1?st.unique(o):o)},index:function(e){return e?"string"==typeof e?st.inArray(this[0],st(e)):st.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?st(e,t):st.makeArray(e&&e.nodeType?[e]:e),r=st.merge(this.get(),n);return this.pushStack(st.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),st.fn.andSelf=st.fn.addBack,st.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return st.dir(e,"parentNode")},parentsUntil:
 function(e,t,n){return st.dir(e,"parentNode",n)},next:function(e){return c(e,"nextSibling")},prev:function(e){return c(e,"previousSibling")
+},nextAll:function(e){return st.dir(e,"nextSibling")},prevAll:function(e){return st.dir(e,"previousSibling")},nextUntil:function(e,t,n){return st.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return st.dir(e,"previousSibling",n)},siblings:function(e){return st.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return st.sibling(e.firstChild)},contents:function(e){return st.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:st.merge([],e.childNodes)}},function(e,t){st.fn[e]=function(n,r){var i=st.map(this,t,n);return Pt.test(e)||(r=n),r&&"string"==typeof r&&(i=st.filter(r,i)),i=this.length>1&&!It[e]?st.unique(i):i,this.length>1&&Rt.test(e)&&(i=i.reverse()),this.pushStack(i)}}),st.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?st.find.matchesSelector(t[0],e)?[t[0]]:[]:st.find.matches(e,t)},dir:function(e,n,r){for(var i=[],o=e[n];o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!st(o).is(r));)1===o.nodeType&&i.push(o),o=o[n];return i},si
 bling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var zt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Xt=/ jQuery\d+="(?:null|\d+)"/g,Ut=RegExp("<(?:"+zt+")[\\s/>]","i"),Vt=/^\s+/,Yt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Jt=/<([\w:]+)/,Gt=/<tbody/i,Qt=/<|&#?\w+;/,Kt=/<(?:script|style|link)/i,Zt=/^(?:checkbox|radio)$/i,en=/checked\s*(?:[^=]|=\s*.checked.)/i,tn=/^$|\/(?:java|ecma)script/i,nn=/^true\/(.*)/,rn=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,on={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_def
 ault:st.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},an=p(V),sn=an.appendChild(V.createElement("div"));on.optgroup=on.option,on.tbody=on.tfoot=on.colgroup=on.caption=on.thead,on.th=on.td,st.fn.extend({text:function(e){return st.access(this,function(e){return e===t?st.text(this):this.empty().append((this[0]&&this[0].ownerDocument||V).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(st.isFunction(e))return this.each(function(t){st(this).wrapAll(e.call(this,t))});if(this[0]){var t=st(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return st.isFunction(e)?this.each(function(t){st(this).wrapInner(e.call(this,t))}):this.each(function(){var t=st(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=st.isFunction(e);return this.each(function(n){st(this).
 wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){st.nodeName(this,"body")||st(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var n,r=0;null!=(n=this[r]);r++)(!e||st.filter(e,[n]).length>0)&&(t||1!==n.nodeType||st.cleanData(b(n)),n.parentNode&&(t&&st.contains(n.ownerDocument,n)&&m(b(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){for(var e,t=0;nul
 l!=(e=this[t]);t++){for(1===e.nodeType&&st.cleanData(b(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&st.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return st.clone(this,e,t)})},html:function(e){return st.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(Xt,""):t;if(!("string"!=typeof e||Kt.test(e)||!st.support.htmlSerialize&&Ut.test(e)||!st.support.leadingWhitespace&&Vt.test(e)||on[(Jt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(Yt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(st.cleanData(b(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=st.isFunction(e);return t||"string"==typeof e||(e=st(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;(n&&1===this.nodeType||11===this.nodeType)&&(s
 t(this).remove(),t?t.parentNode.insertBefore(e,t):n.appendChild(e))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=et.apply([],e);var i,o,a,s,u,l,c=0,f=this.length,p=this,m=f-1,y=e[0],v=st.isFunction(y);if(v||!(1>=f||"string"!=typeof y||st.support.checkClone)&&en.test(y))return this.each(function(i){var o=p.eq(i);v&&(e[0]=y.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(f&&(i=st.buildFragment(e,this[0].ownerDocument,!1,this),o=i.firstChild,1===i.childNodes.length&&(i=o),o)){for(n=n&&st.nodeName(o,"tr"),a=st.map(b(i,"script"),h),s=a.length;f>c;c++)u=i,c!==m&&(u=st.clone(u,!0,!0),s&&st.merge(a,b(u,"script"))),r.call(n&&st.nodeName(this[c],"table")?d(this[c],"tbody"):this[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,st.map(a,g),c=0;s>c;c++)u=a[c],tn.test(u.type||"")&&!st._data(u,"globalEval")&&st.contains(l,u)&&(u.src?st.ajax({url:u.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):st.globalEval((u.text||u.textContent||u.innerHTML||"").r
 eplace(rn,"")));i=o=null}return this}}),st.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){st.fn[e]=function(e){for(var n,r=0,i=[],o=st(e),a=o.length-1;a>=r;r++)n=r===a?this:this.clone(!0),st(o[r])[t](n),tt.apply(i,n.get());return this.pushStack(i)}}),st.extend({clone:function(e,t,n){var r,i,o,a,s,u=st.contains(e.ownerDocument,e);if(st.support.html5Clone||st.isXMLDoc(e)||!Ut.test("<"+e.nodeName+">")?s=e.cloneNode(!0):(sn.innerHTML=e.outerHTML,sn.removeChild(s=sn.firstChild)),!(st.support.noCloneEvent&&st.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||st.isXMLDoc(e)))for(r=b(s),i=b(e),a=0;null!=(o=i[a]);++a)r[a]&&v(o,r[a]);if(t)if(n)for(i=i||b(e),r=r||b(s),a=0;null!=(o=i[a]);a++)y(o,r[a]);else y(e,s);return r=b(s,"script"),r.length>0&&m(r,!u&&b(e,"script")),r=i=o=null,s},buildFragment:function(e,t,n,r){for(var i,o,a,s,u,l,c,f=e.length,d=p(t),h=[],g=0;f>g;g++)if(o=e[g],o||0===o)if("object"===st.typ
 e(o))st.merge(h,o.nodeType?[o]:o);else if(Qt.test(o)){for(s=s||d.appendChild(t.createElement("div")),a=(Jt.exec(o)||["",""])[1].toLowerCase(),u=on[a]||on._default,s.innerHTML=u[1]+o.replace(Yt,"<$1></$2>")+u[2],c=u[0];c--;)s=s.lastChild;if(!st.support.leadingWhitespace&&Vt.test(o)&&h.push(t.createTextNode(Vt.exec(o)[0])),!st.support.tbody)for(o="table"!==a||Gt.test(o)?"<table>"!==u[1]||Gt.test(o)?0:s:s.firstChild,c=o&&o.childNodes.length;c--;)st.nodeName(l=o.childNodes[c],"tbody")&&!l.childNodes.length&&o.removeChild(l);for(st.merge(h,s.childNodes),s.textContent="";s.firstChild;)s.removeChild(s.firstChild);s=d.lastChild}else h.push(t.createTextNode(o));for(s&&d.removeChild(s),st.support.appendChecked||st.grep(b(h,"input"),x),g=0;o=h[g++];)if((!r||-1===st.inArray(o,r))&&(i=st.contains(o.ownerDocument,o),s=b(d.appendChild(o),"script"),i&&m(s),n))for(c=0;o=s[c++];)tn.test(o.type||"")&&n.push(o);return s=null,d},cleanData:function(e,n){for(var r,i,o,a,s=0,u=st.expando,l=st.cache,c=st.su
 pport.deleteExpando,f=st.event.special;null!=(o=e[s]);s++)if((n||st.acceptData(o))&&(i=o[u],r=i&&l[i])){if(r.events)for(a in r.events)f[a]?st.event.remove(o,a):st.removeEvent(o,a,r.handle);l[i]&&(delete l[i],c?delete o[u]:o.removeAttribute!==t?o.removeAttribute(u):o[u]=null,K.push(i))}}});var un,ln,cn,fn=/alpha\([^)]*\)/i,pn=/opacity\s*=\s*([^)]*)/,dn=/^(top|right|bottom|left)$/,hn=/^(none|table(?!-c[ea]).+)/,gn=/^margin/,mn=RegExp("^("+ut+")(.*)$","i"),yn=RegExp("^("+ut+")(?!px)[a-z%]+$","i"),vn=RegExp("^([+-])=("+ut+")","i"),bn={BODY:"block"},xn={position:"absolute",visibility:"hidden",display:"block"},Tn={letterSpacing:0,fontWeight:400},wn=["Top","Right","Bottom","Left"],Nn=["Webkit","O","Moz","ms"];st.fn.extend({css:function(e,n){return st.access(this,function(e,n,r){var i,o,a={},s=0;if(st.isArray(n)){for(i=ln(e),o=n.length;o>s;s++)a[n[s]]=st.css(e,n[s],!1,i);return a}return r!==t?st.style(e,n,r):st.css(e,n)},e,n,arguments.length>1)},show:function(){return N(this,!0)},hide:funct
 ion(){return N(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:w(this))?st(this).show():st(this).hide()})}}),st.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=un(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":st.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=st.camelCase(n),l=e.style;if(n=st.cssProps[u]||(st.cssProps[u]=T(l,u)),s=st.cssHooks[n]||st.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=vn.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(st.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||st.cssNumber[u]||(r+="px"),st.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:funct
 ion(e,n,r,i){var o,a,s,u=st.camelCase(n);return n=st.cssProps[u]||(st.cssProps[u]=T(e.style,u)),s=st.cssHooks[n]||st.cssHooks[u],s&&"get"in s&&(o=s.get(e,!0,r)),o===t&&(o=un(e,n,i)),"normal"===o&&n in Tn&&(o=Tn[n]),r?(a=parseFloat(o),r===!0||st.isNumeric(a)?a||0:o):o},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(ln=function(t){return e.getComputedStyle(t,null)},un=function(e,n,r){var i,o,a,s=r||ln(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||st.contains(e.ownerDocument,e)||(u=st.style(e,n)),yn.test(u)&&gn.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):V.documentElement.currentStyle&&(ln=function(e){return e.currentStyle},un=function(e,n,r){var i,o,a,s=r||ln(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),yn.test(u)&&!dn.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&
 o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u}),st.each(["height","width"],function(e,n){st.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&hn.test(st.css(e,"display"))?st.swap(e,xn,function(){return E(e,n,i)}):E(e,n,i):t},set:function(e,t,r){var i=r&&ln(e);return C(e,t,r?k(e,n,r,st.support.boxSizing&&"border-box"===st.css(e,"boxSizing",!1,i),i):0)}}}),st.support.opacity||(st.cssHooks.opacity={get:function(e,t){return pn.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=st.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===st.trim(o.replace(fn,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=fn.test(o)?o.replace(fn,i):o+" "+i)}}),st(function(){st.support.reliableMarginRight||(st.cssHooks.marginRigh
 t={get:function(e,n){return n?st.swap(e,{display:"inline-block"},un,[e,"marginRight"]):t}}),!st.support.pixelPosition&&st.fn.position&&st.each(["top","left"],function(e,n){st.cssHooks[n]={get:function(e,r){return r?(r=un(e,n),yn.test(r)?st(e).position()[n]+"px":r):t}}})}),st.expr&&st.expr.filters&&(st.expr.filters.hidden=function(e){return 0===e.offsetWidth&&0===e.offsetHeight||!st.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||st.css(e,"display"))},st.expr.filters.visible=function(e){return!st.expr.filters.hidden(e)}),st.each({margin:"",padding:"",border:"Width"},function(e,t){st.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];4>r;r++)i[e+wn[r]+t]=o[r]||o[r-2]||o[0];return i}},gn.test(e)||(st.cssHooks[e+t].set=C)});var Cn=/%20/g,kn=/\[\]$/,En=/\r?\n/g,Sn=/^(?:submit|button|image|reset)$/i,An=/^(?:input|select|textarea|keygen)/i;st.fn.extend({serialize:function(){return st.param(this.serializeArray())},serializeArray:funct
 ion(){return this.map(function(){var e=st.prop(this,"elements");return e?st.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!st(this).is(":disabled")&&An.test(this.nodeName)&&!Sn.test(e)&&(this.checked||!Zt.test(e))}).map(function(e,t){var n=st(this).val();return null==n?null:st.isArray(n)?st.map(n,function(e){return{name:t.name,value:e.replace(En,"\r\n")}}):{name:t.name,value:n.replace(En,"\r\n")}}).get()}}),st.param=function(e,n){var r,i=[],o=function(e,t){t=st.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=st.ajaxSettings&&st.ajaxSettings.traditional),st.isArray(e)||e.jquery&&!st.isPlainObject(e))st.each(e,function(){o(this.name,this.value)});else for(r in e)j(r,e[r],n,o);return i.join("&").replace(Cn,"+")};var jn,Dn,Ln=st.now(),Hn=/\?/,Mn=/#.*$/,qn=/([?&])_=[^&]*/,_n=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Fn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,On=/^(?:GET|HEAD)$/,Bn=/^\/\//,Pn=/^([
 \w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Rn=st.fn.load,Wn={},$n={},In="*/".concat("*");try{Dn=Y.href}catch(zn){Dn=V.createElement("a"),Dn.href="",Dn=Dn.href}jn=Pn.exec(Dn.toLowerCase())||[],st.fn.load=function(e,n,r){if("string"!=typeof e&&Rn)return Rn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),st.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(o="POST"),s.length>0&&st.ajax({url:e,type:o,dataType:"html",data:n}).done(function(e){a=arguments,s.html(i?st("<div>").append(st.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,a||[e.responseText,t,e])}),this},st.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){st.fn[t]=function(e){return this.on(t,e)}}),st.each(["get","post"],function(e,n){st[n]=function(e,r,i,o){return st.isFunction(r)&&(o=o||i,i=r,r=t),st.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),st.extend({active:0,lastModified:{},etag:{},ajaxSettings:{u
 rl:Dn,type:"GET",isLocal:Fn.test(jn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":In,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":st.parseJSON,"text xml":st.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?H(H(e,st.ajaxSettings),t):H(st.ajaxSettings,e)},ajaxPrefilter:D(Wn),ajaxTransport:D($n),ajax:function(e,n){function r(e,n,r,s){var l,f,v,b,T,N=n;2!==x&&(x=2,u&&clearTimeout(u),i=t,a=s||"",w.readyState=e>0?4:0,r&&(b=M(p,w,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=w.getResponseHeader("Last-Modified"),T&&(st.lastModified[o]=T),T=w.getResponseHeader("etag"),T&&(st.etag[o]=T)),304===e?(l=!0,N="notmodified"):(l=q(p,b),N=l.state,f=l.data,v=l.error,l=!v)):(v=N,(e||!N)&&(N="er
 ror",0>e&&(e=0))),w.status=e,w.statusText=(n||N)+"",l?g.resolveWith(d,[f,N,w]):g.rejectWith(d,[w,N,v]),w.statusCode(y),y=t,c&&h.trigger(l?"ajaxSuccess":"ajaxError",[w,p,l?f:v]),m.fireWith(d,[w,N]),c&&(h.trigger("ajaxComplete",[w,p]),--st.active||st.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=t),n=n||{};var i,o,a,s,u,l,c,f,p=st.ajaxSetup({},n),d=p.context||p,h=p.context&&(d.nodeType||d.jquery)?st(d):st.event,g=st.Deferred(),m=st.Callbacks("once memory"),y=p.statusCode||{},v={},b={},x=0,T="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!s)for(s={};t=_n.exec(a);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=b[n]=b[n]||e,v[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)y[t]=[y[t],e[t]];else w.always(e[w.status]);return this},abort
 :function(e){var t=e||T;return i&&i.abort(t),r(0,t),this}};if(g.promise(w).complete=m.add,w.success=w.done,w.error=w.fail,p.url=((e||p.url||Dn)+"").replace(Mn,"").replace(Bn,jn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=st.trim(p.dataType||"*").toLowerCase().match(lt)||[""],null==p.crossDomain&&(l=Pn.exec(p.url.toLowerCase()),p.crossDomain=!(!l||l[1]===jn[1]&&l[2]===jn[2]&&(l[3]||("http:"===l[1]?80:443))==(jn[3]||("http:"===jn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=st.param(p.data,p.traditional)),L(Wn,p,n,w),2===x)return w;c=p.global,c&&0===st.active++&&st.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!On.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(Hn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=qn.test(o)?o.replace(qn,"$1_="+Ln++):o+(Hn.test(o)?"&":"?")+"_="+Ln++)),p.ifModified&&(st.lastModified[o]&&w.setRequestHeader("If-Modified-Since",st.lastModified[o]),st.etag[o]&&w.setRequestHea
 der("If-None-Match",st.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&w.setRequestHeader("Content-Type",p.contentType),w.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+In+"; q=0.01":""):p.accepts["*"]);for(f in p.headers)w.setRequestHeader(f,p.headers[f]);if(p.beforeSend&&(p.beforeSend.call(d,w,p)===!1||2===x))return w.abort();T="abort";for(f in{success:1,error:1,complete:1})w[f](p[f]);if(i=L($n,p,n,w)){w.readyState=1,c&&h.trigger("ajaxSend",[w,p]),p.async&&p.timeout>0&&(u=setTimeout(function(){w.abort("timeout")},p.timeout));try{x=1,i.send(v,r)}catch(N){if(!(2>x))throw N;r(-1,N)}}else r(-1,"No Transport");return w},getScript:function(e,n){return st.get(e,t,n,"script")},getJSON:function(e,t,n){return st.get(e,t,n,"json")}}),st.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},conv
 erters:{"text script":function(e){return st.globalEval(e),e}}}),st.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),st.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=V.head||st("head")[0]||V.documentElement;return{send:function(t,i){n=V.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Xn=[],Un=/(=)\?(?=&|$)|\?\?/;st.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xn.pop()||st.expando+"_"+Ln++;return this[e]=!0,e}}),st.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Un.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-fo
 rm-urlencoded")&&Un.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=st.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Un,"$1"+o):n.jsonp!==!1&&(n.url+=(Hn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||st.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Xn.push(o)),s&&st.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Vn,Yn,Jn=0,Gn=e.ActiveXObject&&function(){var e;for(e in Vn)Vn[e](t,!0)};st.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&_()||F()}:_,Yn=st.ajaxSettings.xhr(),st.support.cors=!!Yn&&"withCredentials"in Yn,Yn=st.support.ajax=!!Yn,Yn&&st.ajaxTransport(function(n){if(!n.crossDomain||st.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFi
 elds)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,f,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=st.noop,Gn&&delete Vn[a]),i)4!==u.readyState&&u.abort();else{f={},s=u.status,p=u.responseXML,c=u.getAllResponseHeaders(),p&&p.documentElement&&(f.xml=p),"string"==typeof u.responseText&&(f.text=u.responseText);try{l=u.statusText}catch(d){l=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=f.text?200:404}}catch(h){i||o(-1,h)}f&&o(s,l,f,c)},n.async?4===u.readyState?setTimeout(r):(a=++Jn,Gn&&(Vn||(Vn={},st(e).unload(Gn)),Vn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Qn,Kn,Zn=/^(?:toggle|show|hide)$/,er=RegExp("^(?:([+-])=|)("+ut+")([a-z%]*)$","i"),tr=/queueHooks$/,nr=[W],rr={"*":[function(e,t)
 {var n,r,i=this.createTween(e,t),o=er.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(st.cssNumber[e]?"":"px"),"px"!==r&&s){s=st.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,st.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};st.Animation=st.extend(P,{tweener:function(e,t){st.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;i>r;r++)n=e[r],rr[n]=rr[n]||[],rr[n].unshift(t)},prefilter:function(e,t){t?nr.unshift(e):nr.push(e)}}),st.Tween=$,$.prototype={constructor:$,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(st.cssNumber[n]?"":"px")},cur:function(){var e=$.propHooks[this.prop];return e&&e.get?e.get(this):$.propHooks._default.get(this)},run:function(e){var t,n=$.propHooks[this.prop];return this.pos=t=this.options.duration?st.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration)
 :e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):$.propHooks._default.set(this),this}},$.prototype.init.prototype=$.prototype,$.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=st.css(e.elem,e.prop,"auto"),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){st.fx.step[e.prop]?st.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[st.cssProps[e.prop]]||st.cssHooks[e.prop])?st.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},$.propHooks.scrollTop=$.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},st.each(["toggle","show","hide"],function(e,t){var n=st.fn[t];st.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(I(t,!0),e,r,i)}}),st.fn.extend({fadeTo:function(e,t,n,r){return this.filter(w).css("opacity",0).show().end().animate({opacity
 :t},e,n,r)},animate:function(e,t,n,r){var i=st.isEmptyObject(e),o=st.speed(t,n,r),a=function(){var t=P(this,st.extend({},e),o);a.finish=function(){t.stop(!0)},(i||st._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=st.timers,a=st._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&tr.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&st.dequeue(this,e)})},finish:func

<TRUNCATED>

[26/50] [abbrv] cxf git commit: [CXF-6725] Removing deprecated JWS JSON properties, likely never used as they were not documented

Posted by re...@apache.org.
[CXF-6725] Removing deprecated JWS JSON properties, likely never used as they were not documented


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5e11c6d9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5e11c6d9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5e11c6d9

Branch: refs/heads/master-jaxrs-2.1
Commit: 5e11c6d98783a2a46e54f67eebe5a1b414414073
Parents: 94b8372
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Mon May 23 13:34:41 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Mon May 23 13:34:41 2016 +0100

----------------------------------------------------------------------
 .../jaxrs/AbstractJwsJsonWriterProvider.java    |  6 -----
 .../rs/security/jose/common/JoseConstants.java  | 23 --------------------
 2 files changed, 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5e11c6d9/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonWriterProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonWriterProvider.java b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonWriterProvider.java
index bae484b..0bbe04c 100644
--- a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonWriterProvider.java
+++ b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonWriterProvider.java
@@ -52,7 +52,6 @@ public class AbstractJwsJsonWriterProvider {
         this.sigProviders = signatureProviders;
     }
     
-    @SuppressWarnings("deprecation")
     protected List<JwsSignatureProvider> getInitializedSigProviders() {
         if (sigProviders != null) {
             return sigProviders;    
@@ -62,11 +61,6 @@ public class AbstractJwsJsonWriterProvider {
             MessageUtils.getContextualProperty(m, JoseConstants.RSSEC_SIGNATURE_OUT_PROPS, 
                                                JoseConstants.RSSEC_SIGNATURE_PROPS);
         if (propLocsProp == null) {
-            propLocsProp = 
-                MessageUtils.getContextualProperty(m, JoseConstants.DEP_RSSEC_SIGNATURE_OUT_LIST_PROPS, 
-                                               JoseConstants.DEP_RSSEC_SIGNATURE_LIST_PROPS);
-        }
-        if (propLocsProp == null) {
             LOG.warning("JWS JSON init properties resource is not identified");
             throw new JwsException(JwsException.Error.NO_INIT_PROPERTIES);
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/5e11c6d9/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
index 7287184..0c198f7 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
@@ -161,29 +161,6 @@ public final class JoseConstants {
     public static final String RSSEC_SIGNATURE_PROPS = "rs.security.signature.properties";
     
     /**
-     * The OLD signature properties file for JSON Serialization signature creation. 
-     * If not specified then it falls back to RSSEC_SIGNATURE_LIST_PROPS.
-     * Use RSSEC_SIGNATURE_OUT_PROPS instead
-     */
-    @Deprecated
-    public static final String DEP_RSSEC_SIGNATURE_OUT_LIST_PROPS = "rs.security.signature.out.list.properties";
-    
-    /**
-     * The OLD signature properties file for JSON Serialization signature verification. 
-     * If not specified then it falls back to RSSEC_SIGNATURE_LIST_PROPS.
-     * Use RSSEC_SIGNATURE_IN_PROPS instead
-     */
-    @Deprecated
-    public static final String DEP_RSSEC_SIGNATURE_IN_LIST_PROPS = "rs.security.signature.in.list.properties";
-    
-    /**
-     * The OLD signature properties file for JSON Serialization signature creation/verification.
-     * Use RSSEC_SIGNATURE_PROPS instead
-     */
-    @Deprecated
-    public static final String DEP_RSSEC_SIGNATURE_LIST_PROPS = "rs.security.signature.list.properties";
-    
-    /**
      * Include the JWK public key for signature in the "jwk" header. 
      */
     public static final String RSSEC_SIGNATURE_INCLUDE_PUBLIC_KEY = "rs.security.signature.include.public.key";


[15/50] [abbrv] cxf git commit: Updating Oidc demo poms

Posted by re...@apache.org.
Updating Oidc demo poms


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/25a42205
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/25a42205
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/25a42205

Branch: refs/heads/master-jaxrs-2.1
Commit: 25a4220507a28ddcf5b381a891f4033b54a35e96
Parents: 2b16078
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Fri May 20 10:33:27 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Fri May 20 10:33:27 2016 +0100

----------------------------------------------------------------------
 distribution/src/main/release/samples/jax_rs/basic_oidc/pom.xml | 3 ---
 distribution/src/main/release/samples/jax_rs/big_query/pom.xml  | 3 ---
 2 files changed, 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/25a42205/distribution/src/main/release/samples/jax_rs/basic_oidc/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/basic_oidc/pom.xml b/distribution/src/main/release/samples/jax_rs/basic_oidc/pom.xml
index 82ba30e..6ff53f4 100644
--- a/distribution/src/main/release/samples/jax_rs/basic_oidc/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/basic_oidc/pom.xml
@@ -59,17 +59,14 @@
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-core</artifactId>
-            <version>4.1.1.RELEASE</version>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
-            <version>4.1.1.RELEASE</version>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-web</artifactId>
-            <version>4.1.1.RELEASE</version>
         </dependency>
     </dependencies>
     <build>

http://git-wip-us.apache.org/repos/asf/cxf/blob/25a42205/distribution/src/main/release/samples/jax_rs/big_query/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/big_query/pom.xml b/distribution/src/main/release/samples/jax_rs/big_query/pom.xml
index 9918996..32767b7 100644
--- a/distribution/src/main/release/samples/jax_rs/big_query/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/big_query/pom.xml
@@ -64,17 +64,14 @@
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-core</artifactId>
-            <version>4.1.1.RELEASE</version>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
-            <version>4.1.1.RELEASE</version>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-web</artifactId>
-            <version>4.1.1.RELEASE</version>
         </dependency>
     </dependencies>
     <build>


[09/50] [abbrv] cxf git commit: Adding a few more OIDC tests

Posted by re...@apache.org.
Adding a few more OIDC tests


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/be273b0e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/be273b0e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/be273b0e

Branch: refs/heads/master-jaxrs-2.1
Commit: be273b0e36831e919ed3f3823165fba74aca8f93
Parents: 0879404
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed May 18 16:47:46 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed May 18 16:47:46 2016 +0100

----------------------------------------------------------------------
 .../jaxrs/security/oidc/OIDCFlowTest.java       |  10 ++
 .../jaxrs/security/oidc/OIDCNegativeTest.java   | 124 +++++++++++++++++++
 2 files changed, 134 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/be273b0e/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
index 2bccdc6..16a37ec 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
@@ -476,6 +476,11 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
         idToken = accessToken.getParameters().get("id_token");
         assertNotNull(idToken);
         validateIdToken(idToken, null);
+        
+        // JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
+        // JwtToken jwt = jwtConsumer.getJwtToken();
+        // TODO Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
+        // TODO Assert.assertNull(jwt.getClaims().getClaim(IdToken.ACCESS_TOKEN_HASH_CLAIM));
     }
     
     @org.junit.Test
@@ -543,6 +548,11 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
         // Check Access Token
         String accessToken = OAuth2TestUtils.getSubstring(location, "access_token");
         assertNotNull(accessToken);
+        
+        JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
+        JwtToken jwt = jwtConsumer.getJwtToken();
+        Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.ACCESS_TOKEN_HASH_CLAIM));
+        // TODO Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
     }
     
     @org.junit.Test

http://git-wip-us.apache.org/repos/asf/cxf/blob/be273b0e/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
index 5538344..ce3dd30 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
@@ -28,15 +28,19 @@ import javax.ws.rs.core.Response;
 
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.rs.security.jose.jws.JwsHeaders;
+import org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer;
 import org.apache.cxf.rs.security.jose.jws.JwsJwtCompactProducer;
 import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
 import org.apache.cxf.rs.security.jose.jwt.JwtToken;
 import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
+import org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData;
+import org.apache.cxf.rs.security.oidc.common.IdToken;
 import org.apache.cxf.rs.security.oidc.common.UserInfo;
 import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
 import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils.AuthorizationCodeParameters;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.TestUtil;
+import org.junit.Assert;
 import org.junit.BeforeClass;
 
 /**
@@ -56,6 +60,126 @@ public class OIDCNegativeTest extends AbstractBusClientServerTestBase {
         );
     }
     
+    // TODO
+    @org.junit.Test
+    @org.junit.Ignore
+    public void testImplicitFlowPromptNone() throws Exception {
+        URL busFile = OIDCFlowTest.class.getResource("client.xml");
+        
+        String address = "https://localhost:" + PORT + "/services/";
+        WebClient client = WebClient.create(address, OAuth2TestUtils.setupProviders(), 
+                                            "alice", "security", busFile.toString());
+        // Save the Cookie for the second request...
+        WebClient.getConfig(client).getRequestContext().put(
+            org.apache.cxf.message.Message.MAINTAIN_SESSION, Boolean.TRUE);
+       
+        // Get Access Token
+        client.type("application/json").accept("application/json");
+        client.query("client_id", "consumer-id");
+        client.query("redirect_uri", "http://www.blah.apache.org");
+        client.query("scope", "openid");
+        client.query("response_type", "id_token");
+        client.query("nonce", "1234565635");
+        client.query("prompt", "none login");
+        client.path("authorize-implicit/");
+        Response response = client.get();
+        
+        try {
+            response.readEntity(OAuthAuthorizationData.class);
+            fail("Failure expected on a bad prompt");
+        } catch (Exception ex) {
+            // expected
+        }
+    }
+    
+    @org.junit.Test
+    @org.junit.Ignore
+    public void testImplicitFlowMaxAge() throws Exception {
+        URL busFile = OIDCFlowTest.class.getResource("client.xml");
+        
+        String address = "https://localhost:" + PORT + "/services/";
+        WebClient client = WebClient.create(address, OAuth2TestUtils.setupProviders(), 
+                                            "alice", "security", busFile.toString());
+        // Save the Cookie for the second request...
+        WebClient.getConfig(client).getRequestContext().put(
+            org.apache.cxf.message.Message.MAINTAIN_SESSION, Boolean.TRUE);
+       
+        // Get Access Token
+        client.type("application/json").accept("application/json");
+        client.query("client_id", "consumer-id");
+        client.query("redirect_uri", "http://www.blah.apache.org");
+        client.query("scope", "openid");
+        client.query("response_type", "id_token");
+        client.query("nonce", "1234565635");
+        client.query("max_age", "300");
+        client.path("authorize-implicit/");
+        Response response = client.get();
+        
+        OAuthAuthorizationData authzData = response.readEntity(OAuthAuthorizationData.class);
+        
+        // Now call "decision" to get the access token
+        client.path("decision");
+        client.type("application/x-www-form-urlencoded");
+        
+        Form form = new Form();
+        form.param("session_authenticity_token", authzData.getAuthenticityToken());
+        form.param("client_id", authzData.getClientId());
+        form.param("redirect_uri", authzData.getRedirectUri());
+        form.param("scope", authzData.getProposedScope());
+        if (authzData.getResponseType() != null) {
+            form.param("response_type", authzData.getResponseType());
+        }
+        if (authzData.getNonce() != null) {
+            form.param("nonce", authzData.getNonce());
+        }
+        form.param("oauthDecision", "allow");
+        
+        response = client.post(form);
+        
+        String location = response.getHeaderString("Location"); 
+        
+        // Check IdToken
+        String idToken = OAuth2TestUtils.getSubstring(location, "id_token");
+        assertNotNull(idToken);
+        
+        JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
+        JwtToken jwt = jwtConsumer.getJwtToken();
+        Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_TIME_CLAIM));
+    }
+    
+    @org.junit.Test
+    public void testImplicitFlowNoNonce() throws Exception {
+        URL busFile = OIDCFlowTest.class.getResource("client.xml");
+        
+        String address = "https://localhost:" + PORT + "/services/";
+        WebClient client = WebClient.create(address, OAuth2TestUtils.setupProviders(), 
+                                            "alice", "security", busFile.toString());
+        // Save the Cookie for the second request...
+        WebClient.getConfig(client).getRequestContext().put(
+            org.apache.cxf.message.Message.MAINTAIN_SESSION, Boolean.TRUE);
+       
+        // Get Access Token
+        client.type("application/json").accept("application/json");
+        client.query("client_id", "consumer-id");
+        client.query("redirect_uri", "http://www.blah.apache.org");
+        client.query("scope", "openid");
+        client.query("response_type", "id_token");
+        client.path("authorize-implicit/");
+        Response response = client.get();
+        
+        try {
+            response.readEntity(OAuthAuthorizationData.class);
+            fail("Failure expected on no nonce");
+        } catch (Exception ex) {
+            // expected
+        }
+
+        // Add a nonce and it should succeed
+        client.query("nonce", "1234565635");
+        response = client.get();
+        response.readEntity(OAuthAuthorizationData.class);
+    }
+    
     @org.junit.Test
     public void testJWTRequestNonmatchingResponseType() throws Exception {
         URL busFile = OIDCNegativeTest.class.getResource("client.xml");


[25/50] [abbrv] cxf git commit: Removing TODOs

Posted by re...@apache.org.
Removing TODOs


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/94b83722
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/94b83722
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/94b83722

Branch: refs/heads/master-jaxrs-2.1
Commit: 94b837228a1d9c706aa235bfe23b827eb04da63c
Parents: 501922f
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon May 23 10:15:30 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon May 23 10:15:30 2016 +0100

----------------------------------------------------------------------
 .../cxf/binding/soap/saaj/ParseBodyTest.java     |  1 -
 .../ws/security/wss4j/WSS4JFaultCodeTest.java    | 19 +++----------------
 2 files changed, 3 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/94b83722/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
index c6b2087..afff3b9 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
@@ -85,7 +85,6 @@ public class ParseBodyTest extends Assert {
         testUsingStaxUtilsCopyWithSAAJWriter(2);
     }
     
-    // TODO - See CXF-6900
     @Test
     public void testReadSOAPFault() throws Exception {
         InputStream inStream = getClass().getResourceAsStream("soap12-fault.xml");

http://git-wip-us.apache.org/repos/asf/cxf/blob/94b83722/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
index 9414679..51824fe 100644
--- a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
+++ b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
@@ -220,9 +220,8 @@ public class WSS4JFaultCodeTest extends AbstractSecurityTest {
         }
     }
     
-    // TODO - See CXF-6900.
+    // See CXF-6900.
     @Test
-    @org.junit.Ignore
     public void testSignedEncryptedSOAP12Fault() throws Exception {
         Document doc = readDocument("wsse-response-fault.xml");
 
@@ -261,20 +260,8 @@ public class WSS4JFaultCodeTest extends AbstractSecurityTest {
             "org.apache.cxf.ws.security.wss4j.TestPwdCallback"
         );
         
-        inmsg.put(SecurityConstants.RETURN_SECURITY_ERROR, Boolean.TRUE);
-        
-        try {
-            inHandler.handleMessage(inmsg);
-            StaxUtils.print(saajMsg.getSOAPPart());
-            
-            fail("Expected failure on a SOAP Fault");
-        } catch (SoapFault fault) {
-            fault.printStackTrace();
-            // TODO assertTrue(fault.getReason().startsWith(
-               // "An error was discovered processing the <wsse:Security> header"));
-            QName faultCode = new QName(WSConstants.WSSE_NS, "InvalidSecurity");
-            assertTrue(fault.getFaultCode().equals(faultCode));
-        }
+        inHandler.handleMessage(inmsg);
+        // StaxUtils.print(saajMsg.getSOAPPart());
     }
     
 }


[35/50] [abbrv] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceRemote.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceRemote.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceRemote.java
new file mode 100644
index 0000000..52916ea
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceRemote.java
@@ -0,0 +1,49 @@
+/**
+ * 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.ws.transfer.resource;
+
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.apache.cxf.ws.transfer.validationtransformation.ValidAndTransformHelper;
+
+/**
+ * Implementation of the Resource interface for resources, which are created remotely.
+ * @see org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceResolver
+ */
+public class ResourceRemote extends ResourceLocal implements ResourceFactory {
+
+    @Override
+    public CreateResponse create(Create body) {
+        Representation representation = body.getRepresentation();
+        ValidAndTransformHelper.validationAndTransformation(
+            getResourceTypeIdentifiers(), representation, null);
+        ReferenceParametersType refParams = getManager().create(representation);
+        CreateResponse response = new CreateResponse();
+        response.setResourceCreated(new EndpointReferenceType());
+        response.getResourceCreated().setReferenceParameters(refParams);
+        response.setRepresentation(body.getRepresentation());
+        return response;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactory.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactory.java
new file mode 100644
index 0000000..da28d43
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactory.java
@@ -0,0 +1,61 @@
+/**
+ * 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.ws.transfer.resourcefactory;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.Action;
+import javax.xml.ws.soap.Addressing;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * The interface definition of a Resource Factory web service, according to the specification.
+ */
+
+@WebService(targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+        name = TransferConstants.NAME_RESOURCE_FACTORY)
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+@Addressing(enabled = true, required = true)
+public interface ResourceFactory {
+    @Action(
+            input = TransferConstants.ACTION_CREATE,
+            output = TransferConstants.ACTION_CREATE_RESPONSE
+    )
+    @WebMethod(operationName = TransferConstants.NAME_OPERATION_CREATE)
+    @WebResult(
+            name = TransferConstants.NAME_MESSAGE_CREATE_RESPONSE,
+            targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+            partName = "Body"
+    )
+    CreateResponse create(
+            @WebParam(
+                    name = TransferConstants.NAME_MESSAGE_CREATE,
+                    targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+                    partName = "Body"
+            )
+            Create body
+    );
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactoryImpl.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactoryImpl.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactoryImpl.java
new file mode 100644
index 0000000..32ca4f6
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactoryImpl.java
@@ -0,0 +1,153 @@
+/**
+ * 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.ws.transfer.resourcefactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.ws.addressing.AttributedURIType;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.Dialect;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceReference;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceResolver;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownDialect;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceTypeIdentifier;
+import org.apache.cxf.ws.transfer.validationtransformation.ValidAndTransformHelper;
+
+/**
+ * ResourceFactory implementation.
+ */
+public class ResourceFactoryImpl implements ResourceFactory {
+
+    protected ResourceResolver resourceResolver;
+    
+    protected List<ResourceTypeIdentifier> resourceTypeIdentifiers;
+    
+    protected Map<String, Dialect> dialects;
+    
+    public ResourceFactoryImpl() {
+        dialects = new HashMap<String, Dialect>();
+    }
+    
+    @Override
+    public CreateResponse create(Create body) {
+        if (body.getDialect() != null && !body.getDialect().isEmpty()) {
+            if (dialects.containsKey(body.getDialect())) {
+                Dialect dialect = dialects.get(body.getDialect());
+                Representation representation = dialect.processCreate(body);
+                body.setRepresentation(representation);
+            } else {
+                throw new UnknownDialect();
+            }
+        }
+        ValidAndTransformHelper.validationAndTransformation(
+                resourceTypeIdentifiers, body.getRepresentation(), null);
+
+        ResourceReference resourceReference = resourceResolver.resolve(body);
+        if (resourceReference.getResourceManager() != null) {
+            return createLocally(body, resourceReference);
+        } else {
+            return createRemotely(body, resourceReference);
+        }
+    }
+
+    public ResourceResolver getResourceResolver() {
+        return resourceResolver;
+    }
+
+    public void setResourceResolver(ResourceResolver resourceResolver) {
+        this.resourceResolver = resourceResolver;
+    }
+
+    public List<ResourceTypeIdentifier> getResourceTypeIdentifiers() {
+        if (resourceTypeIdentifiers == null) {
+            resourceTypeIdentifiers = new ArrayList<>();
+        }
+        return resourceTypeIdentifiers;
+    }
+
+    public void setResourceTypeIdentifiers(List<ResourceTypeIdentifier> resourceTypeIdentifiers) {
+        this.resourceTypeIdentifiers = resourceTypeIdentifiers;
+    }
+    
+    /**
+     * Register Dialect object for URI.
+     * @param uri
+     * @param dialect 
+     */
+    public void registerDialect(String uri, Dialect dialect) {
+        if (dialects.containsKey(uri)) {
+            throw new IllegalArgumentException(String.format("URI \"%s\" is already registered", uri));
+        }
+        dialects.put(uri, dialect);
+    }
+    
+    /**
+     * Unregister dialect URI.
+     * @param uri 
+     */
+    public void unregisterDialect(String uri) {
+        if (!dialects.containsKey(uri)) {
+            throw new IllegalArgumentException(String.format("URI \"%s\" is not registered", uri));
+        }
+        dialects.remove(uri);
+    }
+    
+    private CreateResponse createLocally(Create body, ResourceReference ref) {
+        Representation representation = body.getRepresentation();
+        ReferenceParametersType refParams = ref.getResourceManager().create(representation);
+
+        CreateResponse response = new CreateResponse();
+        response.setResourceCreated(new EndpointReferenceType());
+        response.getResourceCreated().setAddress(new AttributedURIType());
+        response.getResourceCreated()
+                .getAddress()
+                .setValue(ref.getResourceURL());
+        response.getResourceCreated()
+                .setReferenceParameters(refParams);
+        response.setRepresentation(body.getRepresentation());
+
+        return response;
+    }
+    
+    private CreateResponse createRemotely(Create body, ResourceReference ref) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.getInInterceptors().add(new LoggingInInterceptor());
+        factory.getOutInterceptors().add(new LoggingOutInterceptor());
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(ref.getResourceURL() 
+                + TransferConstants.RESOURCE_REMOTE_SUFFIX);
+        ResourceFactory client = (ResourceFactory) factory.create();
+        CreateResponse response = client.create(body);
+        // Adding of endpoint address to the response.
+        response.getResourceCreated().setAddress(new AttributedURIType());
+        response.getResourceCreated().getAddress().setValue(ref.getResourceURL());
+        return response;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceReference.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceReference.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceReference.java
new file mode 100644
index 0000000..1e86030
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceReference.java
@@ -0,0 +1,61 @@
+/**
+ * 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.ws.transfer.resourcefactory.resolver;
+
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+
+/**
+ * Class intended as return value from the ResourceResolver.
+ * @see ResourceResolver
+ */
+public class ResourceReference {
+    
+    private ResourceManager resourceManager;
+    
+    private String resourceURL;
+    
+    public ResourceReference() {
+        
+    }
+    
+    public ResourceReference(
+            String resourceURL,
+            ResourceManager resourceManager) {
+        this.resourceURL = resourceURL;
+        this.resourceManager = resourceManager;
+    }
+
+    public ResourceManager getResourceManager() {
+        return resourceManager;
+    }
+
+    public void setResourceManager(ResourceManager resourceManager) {
+        this.resourceManager = resourceManager;
+    }
+
+    public String getResourceURL() {
+        return resourceURL;
+    }
+
+    public void setResourceURL(String resourceURL) {
+        this.resourceURL = resourceURL;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceResolver.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceResolver.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceResolver.java
new file mode 100644
index 0000000..6e4339c
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceResolver.java
@@ -0,0 +1,39 @@
+/**
+ * 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.ws.transfer.resourcefactory.resolver;
+
+import org.apache.cxf.ws.transfer.Create;
+
+/**
+ * The interface for resolving, where the Resource will be created.
+ */
+public interface ResourceResolver {
+    
+    /**
+     * Method for resolving, where the Resource will be created.
+     * @param body SOAP body
+     * @return ResourceReference object. If the Resource should be created locally,
+     * so the ResourceReference object must contain address and reference to the 
+     * ResourceManager object. Otherwise the ResourceReference must contain only
+     * the address to the ResourceRemote endpoint.
+     */
+    ResourceReference resolve(Create body);
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/SimpleResourceResolver.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/SimpleResourceResolver.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/SimpleResourceResolver.java
new file mode 100644
index 0000000..c988319
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/SimpleResourceResolver.java
@@ -0,0 +1,69 @@
+/**
+ * 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.ws.transfer.resourcefactory.resolver;
+
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+
+/**
+ * The simple ResourceResolver, which always returns a predefined resource
+ * location.
+ */
+public class SimpleResourceResolver implements ResourceResolver {
+
+    protected ResourceManager resourceManager;
+    
+    protected String resourceURL;
+    
+    public SimpleResourceResolver() {
+        
+    }
+    
+    public SimpleResourceResolver(String resourceURL) {
+        this.resourceURL = resourceURL;
+    }
+    
+    public SimpleResourceResolver(String resourceURL, ResourceManager resourceManager) {
+        this.resourceURL = resourceURL;
+        this.resourceManager = resourceManager;
+    }
+    
+    @Override
+    public ResourceReference resolve(Create body) {
+        return new ResourceReference(resourceURL, resourceManager);
+    }
+    
+    public String getResourceURL() {
+        return resourceURL;
+    }
+
+    public void setResourceURL(String resourceURL) {
+        this.resourceURL = resourceURL;
+    }
+
+    public ResourceManager getResourceManager() {
+        return resourceManager;
+    }
+
+    public void setResourceManager(ResourceManager resourceManager) {
+        this.resourceManager = resourceManager;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/TransferConstants.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/TransferConstants.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/TransferConstants.java
new file mode 100644
index 0000000..3da2107
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/TransferConstants.java
@@ -0,0 +1,60 @@
+/**
+ * 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.ws.transfer.shared;
+
+/**
+ * Helper class for holding of constants.
+ */
+public final class TransferConstants {
+    
+    public static final String TRANSFER_2011_03_NAMESPACE = "http://www.w3.org/2011/03/ws-tra";
+    
+    public static final String NAME_RESOURCE = "Resource";
+    public static final String NAME_RESOURCE_FACTORY = "ResourceFactory";
+    
+    public static final String NAME_OPERATION_GET = "Get";
+    public static final String NAME_OPERATION_DELETE = "Delete";
+    public static final String NAME_OPERATION_PUT = "Put";
+    public static final String NAME_OPERATION_CREATE = "Create";
+    
+    public static final String NAME_MESSAGE_GET = "Get";
+    public static final String NAME_MESSAGE_GET_RESPONSE = "GetResponse";
+    public static final String NAME_MESSAGE_DELETE = "Delete";
+    public static final String NAME_MESSAGE_DELETE_RESPONSE = "DeleteResponse";
+    public static final String NAME_MESSAGE_PUT = "Put";
+    public static final String NAME_MESSAGE_PUT_RESPONSE = "PutResponse";
+    public static final String NAME_MESSAGE_CREATE = "Create";
+    public static final String NAME_MESSAGE_CREATE_RESPONSE = "CreateResponse";
+    
+    public static final String ACTION_GET = "http://www.w3.org/2011/03/ws-tra/Get";
+    public static final String ACTION_GET_RESPONSE = "http://www.w3.org/2011/03/ws-tra/GetResponse";
+    public static final String ACTION_DELETE = "http://www.w3.org/2011/03/ws-tra/Delete";
+    public static final String ACTION_DELETE_RESPONSE = "http://www.w3.org/2011/03/ws-tra/DeleteResponse";
+    public static final String ACTION_PUT = "http://www.w3.org/2011/03/ws-tra/Put";
+    public static final String ACTION_PUT_RESPONSE = "http://www.w3.org/2011/03/ws-tra/PutResponse";
+    public static final String ACTION_CREATE = "http://www.w3.org/2011/03/ws-tra/Create";
+    public static final String ACTION_CREATE_RESPONSE = "http://www.w3.org/2011/03/ws-tra/CreateResponse";
+    
+    public static final String RESOURCE_REMOTE_SUFFIX = "_factory";
+    
+    private TransferConstants() {
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/InvalidRepresentation.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/InvalidRepresentation.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/InvalidRepresentation.java
new file mode 100644
index 0000000..21ea6c3
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/InvalidRepresentation.java
@@ -0,0 +1,41 @@
+/**
+ * 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.ws.transfer.shared.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * Definition of the InvalidRepresentation SOAPFault.
+ */
+public class InvalidRepresentation extends WSTransferFault {
+
+    private static final long serialVersionUID = 330259919571428100L;
+
+    private static final String SUBCODE = "InvalidRepresentation";
+
+    private static final String REASON = "The supplied representation is invalid";
+
+    public InvalidRepresentation() {
+        super(REASON, null,
+                new QName(TransferConstants.TRANSFER_2011_03_NAMESPACE, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/PutDenied.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/PutDenied.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/PutDenied.java
new file mode 100644
index 0000000..b0c6ad6
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/PutDenied.java
@@ -0,0 +1,44 @@
+/**
+ * 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.ws.transfer.shared.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * Definition of the PutDenied SOAPFault.
+ */
+public class PutDenied extends WSTransferFault {
+
+    private static final long serialVersionUID = -6644888926499946963L;
+
+    private static final String SUBCODE = "UpdateDenied";
+
+    private static final String REASON = "One or more elements or attributes cannot be updated.";
+
+    private static final String DETAIL =
+            "An OPTIONAL list of the QNames of the elements or attributes that are not allowed to be updated.";
+
+    public PutDenied() {
+        super(REASON, DETAIL,
+                new QName(TransferConstants.TRANSFER_2011_03_NAMESPACE, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownDialect.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownDialect.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownDialect.java
new file mode 100644
index 0000000..5c9f9ea
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownDialect.java
@@ -0,0 +1,43 @@
+/**
+ * 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.ws.transfer.shared.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * Definition of the UnknownDialect SOAPFault.
+ */
+public class UnknownDialect extends WSTransferFault {
+
+    private static final long serialVersionUID = 7139243705016686015L;
+
+    private static final String SUBCODE = "UnknownDialect";
+
+    private static final String REASON = "The specified Dialect IRI is not known.";
+
+    private static final String DETAIL = "The unknown IRI if specified";
+
+    public UnknownDialect() {
+        super(REASON, DETAIL,
+                new QName(TransferConstants.TRANSFER_2011_03_NAMESPACE, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownResource.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownResource.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownResource.java
new file mode 100644
index 0000000..1b3c61d
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownResource.java
@@ -0,0 +1,42 @@
+/**
+ * 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.ws.transfer.shared.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * This fault MUST be generated when a request specifies a resource
+ * that is not known.
+ */
+public class UnknownResource extends WSTransferFault {
+
+    private static final long serialVersionUID = 2925090710469446447L;
+
+    private static final String SUBCODE = "UnknownResource";
+
+    private static final String REASON = "The resource is not known.";
+
+    public UnknownResource() {
+        super(REASON, null,
+                new QName(TransferConstants.TRANSFER_2011_03_NAMESPACE, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/WSTransferFault.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/WSTransferFault.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/WSTransferFault.java
new file mode 100644
index 0000000..673da39
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/WSTransferFault.java
@@ -0,0 +1,45 @@
+/**
+ * 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.ws.transfer.shared.faults;
+
+import javax.xml.namespace.QName;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.helpers.DOMUtils;
+
+/**
+ * The parent for all WS-Transfer-specific faults.
+ */
+public abstract class WSTransferFault extends SoapFault {
+
+    private static final long serialVersionUID = -7603229392321418734L;
+
+    public WSTransferFault(String reason, String detail, QName faultCode) {
+        super(reason, faultCode);
+        if (detail != null) {
+            Document doc = DOMUtils.createDocument();
+            Element detailEl = doc.createElement("detail");
+            detailEl.setTextContent(detail);
+            setDetail(detailEl);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTransformer.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTransformer.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTransformer.java
new file mode 100644
index 0000000..69cdb20
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTransformer.java
@@ -0,0 +1,30 @@
+/**
+ * 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.ws.transfer.validationtransformation;
+
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * The interface for a Transformer objects.
+ */
+public interface ResourceTransformer {
+    
+    ResourceValidator transform(Representation newRepresentation, Representation oldRepresentation);
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifier.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifier.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifier.java
new file mode 100644
index 0000000..f04e774
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifier.java
@@ -0,0 +1,36 @@
+/**
+ * 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.ws.transfer.validationtransformation;
+
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * The interface for TypeIdentifier objects.
+ */
+public interface ResourceTypeIdentifier {
+
+    /**
+     * Returns true if the representation corresponds to type, which object represents.
+     * @param representation
+     * @return
+     */
+    ResourceTypeIdentifierResult identify(Representation representation);
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifierResult.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifierResult.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifierResult.java
new file mode 100644
index 0000000..c8999c0
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifierResult.java
@@ -0,0 +1,56 @@
+/**
+ * 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.ws.transfer.validationtransformation;
+
+/**
+ * This class represents the result from the ResourceTypeIdentifier.
+ */
+public class ResourceTypeIdentifierResult {
+    
+    private boolean correct;
+    
+    private ResourceTransformer transformer;
+    
+    public ResourceTypeIdentifierResult() {
+        
+    }
+    
+    public ResourceTypeIdentifierResult(boolean result, ResourceTransformer transformer) {
+        this.correct = result;
+        this.transformer = transformer;
+    }
+
+    public boolean isCorrect() {
+        return correct;
+    }
+
+    public void setCorrect(boolean correct) {
+        this.correct = correct;
+    }
+
+    public ResourceTransformer getTransformer() {
+        return transformer;
+    }
+
+    public void setTransformer(ResourceTransformer transformer) {
+        this.transformer = transformer;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceValidator.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceValidator.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceValidator.java
new file mode 100644
index 0000000..b31ec29
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceValidator.java
@@ -0,0 +1,31 @@
+/**
+ * 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.ws.transfer.validationtransformation;
+
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * The interface for Validator objects.
+ */
+public interface ResourceValidator {
+    
+    boolean validate(Representation newRepresentation, Representation oldRepresentation);
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ValidAndTransformHelper.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ValidAndTransformHelper.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ValidAndTransformHelper.java
new file mode 100644
index 0000000..4c806ef
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ValidAndTransformHelper.java
@@ -0,0 +1,63 @@
+/**
+ * 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.ws.transfer.validationtransformation;
+
+import java.util.List;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.shared.faults.InvalidRepresentation;
+
+/**
+ * Helper class for validation and transformation.
+ */
+public final class ValidAndTransformHelper {
+    
+    private ValidAndTransformHelper() {
+        
+    }
+    
+    /**
+     * Validation and transformation process.
+     * @param resourceTypeIdentifiers List of resourceTypeIdentifiers.
+     * @param newRepresentation Incoming representation.
+     * @param oldRepresentation Representation stored in the ResourceManager.
+     */
+    public static void validationAndTransformation(
+            List<ResourceTypeIdentifier> resourceTypeIdentifiers,
+            Representation newRepresentation,
+            Representation oldRepresentation) {
+        if (resourceTypeIdentifiers != null && !resourceTypeIdentifiers.isEmpty()) {
+            for (ResourceTypeIdentifier resourceIdentifier : resourceTypeIdentifiers) {
+                ResourceTypeIdentifierResult valResult = resourceIdentifier.identify(newRepresentation);
+                if (valResult.isCorrect()) {
+                    if (valResult.getTransformer() != null) {
+                        ResourceTransformer transformer = valResult.getTransformer();
+                        ResourceValidator validator = transformer.transform(newRepresentation, oldRepresentation);
+                        if (validator != null && !validator.validate(newRepresentation, oldRepresentation)) {
+                            throw new InvalidRepresentation();
+                        }
+                    }
+                    return;
+                }
+            }
+            throw new InvalidRepresentation();
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceTypeIdentifier.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceTypeIdentifier.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceTypeIdentifier.java
new file mode 100644
index 0000000..a6b5505
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceTypeIdentifier.java
@@ -0,0 +1,87 @@
+/**
+ * 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.ws.transfer.validationtransformation;
+
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import javax.xml.ws.WebServiceContext;
+
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * Implementation of the ResourceTypeIdentifier interface using by XSDSchema validation.
+ */
+public class XSDResourceTypeIdentifier implements ResourceTypeIdentifier {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(XSDResourceTypeIdentifier.class);
+
+    protected ResourceTransformer resourceTransformer;
+
+    protected Validator validator;
+
+    @Resource
+    private WebServiceContext context;
+
+    public XSDResourceTypeIdentifier(Source xsd, ResourceTransformer resourceTransformer) {
+        try {
+            this.resourceTransformer = resourceTransformer;
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(xsd);
+            this.validator = schema.newValidator();
+        } catch (SAXException ex) {
+            LOG.severe(ex.getLocalizedMessage());
+            throw new SoapFault("Internal error", getSoapVersion().getReceiver());
+        }
+    }
+
+    @Override
+    public ResourceTypeIdentifierResult identify(Representation representation) {
+        try {
+            validator.validate(new DOMSource((Node) representation.getAny()));
+        } catch (SAXException ex) {
+            return new ResourceTypeIdentifierResult(false, resourceTransformer);
+        } catch (IOException ex) {
+            LOG.severe(ex.getLocalizedMessage());
+            throw new SoapFault("Internal error", getSoapVersion().getReceiver());
+        }
+        return new ResourceTypeIdentifierResult(true, resourceTransformer);
+    }
+
+    private SoapVersion getSoapVersion() {
+        WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
+        SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
+        return message.getVersion();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceValidator.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceValidator.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceValidator.java
new file mode 100644
index 0000000..f5da781
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceValidator.java
@@ -0,0 +1,88 @@
+/**
+ * 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.ws.transfer.validationtransformation;
+
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import javax.xml.ws.WebServiceContext;
+
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * Implementation of the ResourceValidator interface for Schema validation.
+ */
+public class XSDResourceValidator implements ResourceValidator {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(XSDResourceValidator.class);
+
+    protected Validator validator;
+
+    @Resource
+    private WebServiceContext context;
+
+    public XSDResourceValidator(Source xsd, ResourceTransformer resourceTransformer) {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(xsd);
+            this.validator = schema.newValidator();
+        } catch (SAXException ex) {
+            LOG.severe(ex.getLocalizedMessage());
+            throw new SoapFault("Internal error", getSoapVersion().getReceiver());
+        }
+    }
+
+    public XSDResourceValidator(Source xsd) {
+        this(xsd, null);
+    }
+
+    @Override
+    public boolean validate(Representation representation, Representation oldRepresentation) {
+        try {
+            validator.validate(new DOMSource((Node) representation.getAny()));
+        } catch (SAXException ex) {
+            return false;
+        } catch (IOException ex) {
+            LOG.severe(ex.getLocalizedMessage());
+            throw new SoapFault("Internal error", getSoapVersion().getReceiver());
+        }
+        return true;
+    }
+
+    private SoapVersion getSoapVersion() {
+        WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
+        SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
+        return message.getVersion();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSLTResourceTransformer.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSLTResourceTransformer.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSLTResourceTransformer.java
new file mode 100644
index 0000000..0538dd3
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSLTResourceTransformer.java
@@ -0,0 +1,87 @@
+/**
+ * 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.ws.transfer.validationtransformation;
+
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.ws.WebServiceContext;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.feature.transform.XSLTUtils;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * Implementation of the ResourceTransformer for the XSL transformation.
+ */
+public class XSLTResourceTransformer implements ResourceTransformer {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(XSLTResourceTransformer.class);
+
+    protected Templates templates;
+
+    protected ResourceValidator validator;
+
+    @Resource
+    private WebServiceContext context;
+
+    public XSLTResourceTransformer(Source xsl) {
+        this(xsl, null);
+    }
+
+    public XSLTResourceTransformer(Source xsl, ResourceValidator validator) {
+        this.validator = validator;
+        try {
+            templates = TransformerFactory.newInstance().newTemplates(xsl);
+        } catch (TransformerConfigurationException e) {
+            LOG.severe(e.getLocalizedMessage());
+            throw new SoapFault("Internal error", getSoapVersion().getReceiver());
+        }
+    }
+
+    @Override
+    public ResourceValidator transform(Representation newRepresentation, Representation oldRepresentation) {
+        Document doc = DOMUtils.createDocument();
+        Node representation = (Node) newRepresentation.getAny();
+        Node importedNode = doc.importNode(representation, true);
+        doc.appendChild(importedNode);
+        Document result = XSLTUtils.transform(templates, doc);
+        newRepresentation.setAny(result.getDocumentElement());
+        return validator;
+    }
+
+    private SoapVersion getSoapVersion() {
+        WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
+        SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
+        return message.getVersion();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/handler-chains/reference-parameter-parsing.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/handler-chains/reference-parameter-parsing.xml b/rt/ws/transfer/src/main/resources/handler-chains/reference-parameter-parsing.xml
new file mode 100644
index 0000000..e1018f8
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/handler-chains/reference-parameter-parsing.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+  <handler-chain>
+    <handler>
+      <handler-name>ReferenceParameterParsingHandler</handler-name>
+      <handler-class>org.apache.cxf.ws.transfer.shared.handlers.ReferenceParameterParsingHandler</handler-class>
+    </handler>
+  </handler-chain>
+</handler-chains>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/catalog-fragment.cat
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/catalog-fragment.cat b/rt/ws/transfer/src/main/resources/schemas/catalog-fragment.cat
new file mode 100644
index 0000000..6eb029c
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/catalog-fragment.cat
@@ -0,0 +1,21 @@
+--
+  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.
+--
+
+SYSTEM "http://www.w3.org/2011/03/ws-fra" "fragment.xsd"
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/catalog.cat
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/catalog.cat b/rt/ws/transfer/src/main/resources/schemas/catalog.cat
new file mode 100644
index 0000000..22bc651
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/catalog.cat
@@ -0,0 +1,23 @@
+--
+  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.
+--
+
+SYSTEM "http://www.w3.org/2011/03/ws-tra" "transfer.xsd"
+SYSTEM "http://www.w3.org/2005/08/addressing" "ws-addr.xsd"
+SYSTEM "http://www.w3.org/2006/03/addressing/ws-addr.xsd" "ws-addr.xsd"
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/fragment.xsd
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/fragment.xsd b/rt/ws/transfer/src/main/resources/schemas/fragment.xsd
new file mode 100644
index 0000000..519cb3a
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/fragment.xsd
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<xs:schema
+  targetNamespace='http://www.w3.org/2011/03/ws-fra'
+  xmlns:tns='http://www.w3.org/2011/03/ws-fra'
+  xmlns:xs='http://www.w3.org/2001/XMLSchema'
+  elementFormDefault='qualified'
+  blockDefault='#all' >
+ 
+  <xs:complexType name='ExpressionType' mixed="true">
+    <xs:sequence>
+      <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+    </xs:sequence>
+    <xs:attribute name='Language' type='xs:anyURI' use='optional'/>
+    <xs:attribute name='Mode' type='xs:anyURI' use='optional'/>
+    <xs:anyAttribute namespace='##other' processContents='lax'/>
+  </xs:complexType>
+  <xs:element name='Expression' type='tns:ExpressionType'/>
+
+  <xs:complexType name='ValueType' mixed="true">
+    <xs:sequence>
+      <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+    </xs:sequence>
+    <xs:anyAttribute namespace='##other' processContents='lax'/>
+  </xs:complexType>
+  <xs:element name='Value' type='tns:ValueType'/>
+  
+  <xs:element name='Fragment'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Expression' type='tns:ExpressionType'/>
+        <xs:element name='Value' type='tns:ValueType' minOccurs='0'/>
+        <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax'/>
+    </xs:complexType>
+  </xs:element>
+
+  <!-- Policy -->
+  <xs:complexType name='URI'>
+    <xs:simpleContent>
+      <xs:extension base='xs:anyURI'>
+        <xs:anyAttribute namespace='##other' processContents='lax'/>
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+
+  <xs:element name='FragmentAssertion'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Language' minOccurs='0' maxOccurs='unbounded'>
+          <xs:complexType>
+            <xs:sequence>
+              <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                          maxOccurs='0'/>
+            </xs:sequence>
+            <xs:attribute name='URI' type='xs:anyURI' use='required' />
+            <xs:anyAttribute namespace="##other" processContents='lax'/>
+          </xs:complexType>
+        </xs:element>
+        <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                    maxOccurs='unbounded'/>
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+</xs:schema>  

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/transfer.xjb
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/transfer.xjb b/rt/ws/transfer/src/main/resources/schemas/transfer.xjb
new file mode 100644
index 0000000..ea8d17e
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/transfer.xjb
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb"
+          xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+    <bindings schemaLocation="http://www.w3.org/2006/03/addressing/ws-addr.xsd">
+        <schemaBindings map="false"/>
+        <bindings node="//xs:complexType[@name='ReferenceParametersType']">
+            <class ref="org.apache.cxf.ws.addressing.ReferenceParametersType"/>
+        </bindings>
+        <bindings node="//xs:complexType[@name='EndpointReferenceType']">
+            <class ref="org.apache.cxf.ws.addressing.EndpointReferenceType"/>
+        </bindings>
+        <bindings node="//xs:complexType[@name='AttributedURIType']">
+            <class ref="org.apache.cxf.ws.addressing.AttributedURIType"/>
+        </bindings>
+    </bindings>
+</bindings>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/transfer.xsd
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/transfer.xsd b/rt/ws/transfer/src/main/resources/schemas/transfer.xsd
new file mode 100644
index 0000000..de5c48a
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/transfer.xsd
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<xs:schema
+  targetNamespace='http://www.w3.org/2011/03/ws-tra'
+  xmlns:tns='http://www.w3.org/2011/03/ws-tra'
+  xmlns:xs='http://www.w3.org/2001/XMLSchema'
+  xmlns:wsa='http://www.w3.org/2005/08/addressing'
+  elementFormDefault='qualified'
+  blockDefault='#all' >
+ 
+  <xs:import
+    namespace='http://www.w3.org/2005/08/addressing'
+    schemaLocation='http://www.w3.org/2006/03/addressing/ws-addr.xsd' />
+
+  <xs:complexType name='Representation'>
+    <xs:sequence>
+      <xs:any minOccurs='0' processContents='lax'/>
+    </xs:sequence>
+    <xs:anyAttribute namespace='##other' processContents='lax'/>
+  </xs:complexType>
+ 
+  <xs:element name='Get'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:any minOccurs='0' maxOccurs='unbounded' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:attribute name='Dialect' type='xs:anyURI' use='optional' />
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name='GetResponse'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Representation' type='tns:Representation' minOccurs='0'/>
+        <xs:any minOccurs='1' maxOccurs='unbounded' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+ 
+  <xs:element name='Put'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Representation' type='tns:Representation' minOccurs='0'/>
+        <xs:any minOccurs='1' maxOccurs='unbounded' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:attribute name='Dialect' type='xs:anyURI' use='optional' />
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name='PutResponse'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Representation' type='tns:Representation' minOccurs='0'/>
+        <xs:any minOccurs='1' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+ 
+  <xs:element name='Delete'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:any minOccurs='0' maxOccurs='unbounded' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:attribute name='Dialect' type='xs:anyURI' use='optional' />
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name='DeleteResponse'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:any minOccurs='0' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+ 
+  <xs:element name='Create'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Representation' type='tns:Representation' minOccurs='0'/>
+        <xs:any minOccurs='0' maxOccurs='unbounded' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:attribute name='Dialect' type='xs:anyURI' use='optional' />
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+ 
+  <xs:element name='CreateResponse'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='ResourceCreated' type='wsa:EndpointReferenceType' />
+        <xs:element name='Representation' type='tns:Representation' minOccurs='0'/>
+        <xs:any minOccurs='0' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <!-- Policy -->
+  <xs:complexType name='URI'>
+    <xs:simpleContent>
+      <xs:extension base='xs:anyURI'>
+        <xs:anyAttribute namespace='##other' processContents='lax'/>
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+
+  <xs:complexType name='QName'>
+    <xs:simpleContent>
+      <xs:extension base='xs:QName'>
+        <xs:anyAttribute namespace='##other' processContents='lax'/>
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+
+  <xs:complexType name='Empty'>
+    <xs:sequence/>
+    <xs:anyAttribute namespace='##other' processContents='lax'/>
+  </xs:complexType>
+
+  <xs:element name='TransferResource'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='PutOperationSupported' type='tns:Empty'
+                                                 minOccurs='0'/>
+        <xs:element name='DeleteOperationSupported' type='tns:Empty'
+                                                    minOccurs='0'/>
+        <xs:element name='FaultOnPutDenied' type='tns:Empty' minOccurs='0'/>
+        <xs:element name='Dialect' minOccurs='0' maxOccurs='unbounded'>
+          <xs:complexType>
+            <xs:sequence>
+              <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                          maxOccurs='0'/>
+            </xs:sequence>
+            <xs:attribute name='URI' type='xs:anyURI' use='required' />
+            <xs:anyAttribute namespace="##other" processContents='lax'/>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name='Resource' type='tns:QName' minOccurs='0'/>
+        <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                    maxOccurs='unbounded'/>
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name='TransferResourceFactory'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Resource' type='tns:QName' minOccurs='0'/>
+        <xs:element name='Dialect' minOccurs='0' maxOccurs='unbounded'>
+          <xs:complexType>
+            <xs:sequence>
+              <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                          maxOccurs='0'/>
+            </xs:sequence>
+            <xs:attribute name='URI' type='xs:anyURI' use='required' />
+            <xs:anyAttribute namespace="##other" processContents='lax'/>
+          </xs:complexType>
+        </xs:element>
+        <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                    maxOccurs='unbounded'/>
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+ 
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/ws-addr.xsd
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/ws-addr.xsd b/rt/ws/transfer/src/main/resources/schemas/ws-addr.xsd
new file mode 100644
index 0000000..05ca1bc
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/ws-addr.xsd
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  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.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.w3.org/2005/08/addressing" targetNamespace="http://www.w3.org/2005/08/addressing" blockDefault="#all" elementFormDefault="qualified" finalDefault="" attributeFormDefault="unqualified">
+	
+	<!-- Constructs from the WS-Addressing Core -->
+
+	<xs:element name="EndpointReference" type="tns:EndpointReferenceType"/>
+	<xs:complexType name="EndpointReferenceType" mixed="false">
+		<xs:sequence>
+			<xs:element name="Address" type="tns:AttributedURIType"/>
+			<xs:element ref="tns:ReferenceParameters" minOccurs="0"/>
+			<xs:element ref="tns:Metadata" minOccurs="0"/>
+			<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+		</xs:sequence>
+		<xs:anyAttribute namespace="##other" processContents="lax"/>
+	</xs:complexType>
+	
+	<xs:element name="ReferenceParameters" type="tns:ReferenceParametersType"/>
+	<xs:complexType name="ReferenceParametersType" mixed="false">
+		<xs:sequence>
+			<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+		</xs:sequence>
+		<xs:anyAttribute namespace="##other" processContents="lax"/>
+	</xs:complexType>
+	
+	<xs:element name="Metadata" type="tns:MetadataType"/>
+	<xs:complexType name="MetadataType" mixed="false">
+		<xs:sequence>
+			<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+		</xs:sequence>
+		<xs:anyAttribute namespace="##other" processContents="lax"/>
+	</xs:complexType>
+	
+	<xs:element name="MessageID" type="tns:AttributedURIType"/>
+	<xs:element name="RelatesTo" type="tns:RelatesToType"/>
+	<xs:complexType name="RelatesToType" mixed="false">
+		<xs:simpleContent>
+			<xs:extension base="xs:anyURI">
+				<xs:attribute name="RelationshipType" type="tns:RelationshipTypeOpenEnum" use="optional" default="http://www.w3.org/2005/08/addressing/reply"/>
+				<xs:anyAttribute namespace="##other" processContents="lax"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	
+	<xs:simpleType name="RelationshipTypeOpenEnum">
+		<xs:union memberTypes="tns:RelationshipType xs:anyURI"/>
+	</xs:simpleType>
+	
+	<xs:simpleType name="RelationshipType">
+		<xs:restriction base="xs:anyURI">
+			<xs:enumeration value="http://www.w3.org/2005/08/addressing/reply"/>
+		</xs:restriction>
+	</xs:simpleType>
+	
+	<xs:element name="ReplyTo" type="tns:EndpointReferenceType"/>
+	<xs:element name="From" type="tns:EndpointReferenceType"/>
+	<xs:element name="FaultTo" type="tns:EndpointReferenceType"/>
+	<xs:element name="To" type="tns:AttributedURIType"/>
+	<xs:element name="Action" type="tns:AttributedURIType"/>
+
+	<xs:complexType name="AttributedURIType" mixed="false">
+		<xs:simpleContent>
+			<xs:extension base="xs:anyURI">
+				<xs:anyAttribute namespace="##other" processContents="lax"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	
+	<!-- Constructs from the WS-Addressing SOAP binding -->
+
+	<xs:attribute name="IsReferenceParameter" type="xs:boolean"/>
+	
+	<xs:simpleType name="FaultCodesOpenEnumType">
+		<xs:union memberTypes="tns:FaultCodesType xs:QName"/>
+	</xs:simpleType>
+	
+	<xs:simpleType name="FaultCodesType">
+		<xs:restriction base="xs:QName">
+			<xs:enumeration value="tns:InvalidAddressingHeader"/>
+			<xs:enumeration value="tns:InvalidAddress"/>
+			<xs:enumeration value="tns:InvalidEPR"/>
+			<xs:enumeration value="tns:InvalidCardinality"/>
+			<xs:enumeration value="tns:MissingAddressInEPR"/>
+			<xs:enumeration value="tns:DuplicateMessageID"/>
+			<xs:enumeration value="tns:ActionMismatch"/>
+			<xs:enumeration value="tns:MessageAddressingHeaderRequired"/>
+			<xs:enumeration value="tns:DestinationUnreachable"/>
+			<xs:enumeration value="tns:ActionNotSupported"/>
+			<xs:enumeration value="tns:EndpointUnavailable"/>
+		</xs:restriction>
+	</xs:simpleType>
+	
+	<xs:element name="RetryAfter" type="tns:AttributedUnsignedLongType"/>
+	<xs:complexType name="AttributedUnsignedLongType" mixed="false">
+		<xs:simpleContent>
+			<xs:extension base="xs:unsignedLong">
+				<xs:anyAttribute namespace="##other" processContents="lax"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	
+	<xs:element name="ProblemHeaderQName" type="tns:AttributedQNameType"/>
+	<xs:complexType name="AttributedQNameType" mixed="false">
+		<xs:simpleContent>
+			<xs:extension base="xs:QName">
+				<xs:anyAttribute namespace="##other" processContents="lax"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	
+	<xs:element name="ProblemIRI" type="tns:AttributedURIType"/>
+	
+	<xs:element name="ProblemAction" type="tns:ProblemActionType"/>
+	<xs:complexType name="ProblemActionType" mixed="false">
+		<xs:sequence>
+			<xs:element ref="tns:Action" minOccurs="0"/>
+			<xs:element name="SoapAction" minOccurs="0" type="xs:anyURI"/>
+		</xs:sequence>
+		<xs:anyAttribute namespace="##other" processContents="lax"/>
+	</xs:complexType>
+	
+</xs:schema>


[18/50] [abbrv] cxf git commit: Updates to get the transformation stuff to workaround all the bugs/junk in SAAJ for the faults

Posted by re...@apache.org.
Updates to get the transformation stuff to workaround all the bugs/junk in SAAJ for the faults


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e8ea9e74
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e8ea9e74
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e8ea9e74

Branch: refs/heads/master-jaxrs-2.1
Commit: e8ea9e74c09d3313d6353d9914f361105b06128e
Parents: bba546b
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri May 20 11:31:00 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri May 20 11:31:00 2016 -0400

----------------------------------------------------------------------
 .../staxutils/OverlayW3CDOMStreamWriter.java    |  6 ++
 .../cxf/staxutils/W3CDOMStreamWriter.java       |  4 +
 .../cxf/binding/soap/saaj/SAAJStreamWriter.java | 78 ++++++++++++++------
 .../cxf/ws/security/wss4j/StaxSerializer.java   | 60 +++++++++++----
 .../ws/security/wss4j/WSS4JInInterceptor.java   |  2 +-
 .../ws/security/wss4j/WSS4JFaultCodeTest.java   |  2 +
 6 files changed, 115 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e8ea9e74/core/src/main/java/org/apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java b/core/src/main/java/org/apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java
index d30bf4f..475973a 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java
@@ -25,6 +25,7 @@ import java.util.List;
 import javax.xml.stream.XMLStreamException;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.Text;
@@ -53,6 +54,11 @@ public class OverlayW3CDOMStreamWriter extends W3CDOMStreamWriter {
     public OverlayW3CDOMStreamWriter(Document doc, Element e) {
         super(doc, e);
     }
+    public OverlayW3CDOMStreamWriter(Document doc, DocumentFragment frag) {
+        super(doc, frag);
+        isOverlaid = false;
+    }
+
 
     @Override
     protected void createAndAddElement(String prefix, String local, String namespace) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8ea9e74/core/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java b/core/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
index 6903c4c..353da70 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
@@ -60,6 +60,10 @@ public class W3CDOMStreamWriter implements XMLStreamWriter {
         this.document = frag.getOwnerDocument();
         currentNode = frag;
     }
+    public W3CDOMStreamWriter(Document document, DocumentFragment frag) {
+        this.document = document;
+        currentNode = frag;
+    }
 
     public W3CDOMStreamWriter(Element e) {
         this.document = e.getOwnerDocument();

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8ea9e74/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
index 393a553..185079b 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
@@ -21,11 +21,13 @@ package org.apache.cxf.binding.soap.saaj;
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPPart;
 
+import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
@@ -36,7 +38,10 @@ import static org.apache.cxf.binding.soap.saaj.SAAJUtils.adjustPrefix;
 
 public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
     private final SOAPPart part;
-
+    private final SOAPEnvelope envelope;
+    private String uri;
+    
+    
     public SAAJStreamWriter(SOAPPart part) {
         super(part);
         this.part = part;
@@ -44,20 +49,47 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
         if (nd == null) {
             isOverlaid = false;
         }
+        envelope = null;
     }
     public SAAJStreamWriter(SOAPPart part, Element current) {
         super(part, current);
         this.part = part;
+        envelope = null;
     }
-
+    public SAAJStreamWriter(SOAPEnvelope env, DocumentFragment frag) {
+        super(env.getOwnerDocument(), frag);
+        this.part = null;
+        this.envelope = env;
+        isOverlaid = false;
+    }
+    public SAAJStreamWriter(SOAPEnvelope env, Element cur) {
+        super(env.getOwnerDocument(), cur);
+        this.part = null;
+        this.envelope = env;
+        isOverlaid = false;
+    }
+    
+    private String getEnvelopeURI() throws SOAPException {
+        if (uri == null) {
+            uri = getEnvelope().getElementName().getURI();
+        }
+        return uri;
+    }
+    private SOAPEnvelope getEnvelope() throws SOAPException {
+        if (envelope == null) {
+            return part.getEnvelope();
+        }
+        return envelope;
+    }
+    
     protected void adjustOverlaidNode(Node nd2, String pfx) {
         String namespace = nd2.getNamespaceURI();
         try {
             if (namespace != null 
-                && namespace.equals(part.getEnvelope().getElementName().getURI())) {
+                && namespace.equals(getEnvelopeURI())) {
                 adjustPrefix((SOAPElement)nd2, pfx);
                 if ("Envelope".equals(nd2.getLocalName())) {
-                    adjustPrefix(part.getEnvelope().getHeader(), pfx);
+                    adjustPrefix(getEnvelope().getHeader(), pfx);
                 }
             }
         } catch (SOAPException e) {
@@ -67,37 +99,41 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
     }
     
     protected void createAndAddElement(String prefix, String local, String namespace) {
+        if (part == null) {
+            super.createAndAddElement(prefix, local, namespace);
+            return;
+        }
         try {
             if (namespace != null 
-                && namespace.equals(part.getEnvelope().getElementName().getURI())) {
+                && namespace.equals(getEnvelopeURI())) {
                 if ("Envelope".equals(local)) {
-                    setChild(adjustPrefix(part.getEnvelope(), prefix), false);
-                    adjustPrefix(part.getEnvelope().getHeader(), prefix);
-                    adjustPrefix(part.getEnvelope().getBody(), prefix);
-                    part.getEnvelope().removeChild(part.getEnvelope().getHeader());
-                    part.getEnvelope().removeChild(part.getEnvelope().getBody());
+                    setChild(adjustPrefix(getEnvelope(), prefix), false);
+                    adjustPrefix(getEnvelope().getHeader(), prefix);
+                    adjustPrefix(getEnvelope().getBody(), prefix);
+                    getEnvelope().removeChild(getEnvelope().getHeader());
+                    getEnvelope().removeChild(getEnvelope().getBody());
                     return;
                 } else if ("Body".equals(local)) {
-                    if (part.getEnvelope().getBody() == null) {
-                        part.getEnvelope().addBody();
+                    if (getEnvelope().getBody() == null) {
+                        getEnvelope().addBody();
                     }
-                    setChild(adjustPrefix(part.getEnvelope().getBody(), prefix), false);
+                    setChild(adjustPrefix(getEnvelope().getBody(), prefix), false);
                     return;
                 } else if ("Header".equals(local)) {
-                    if (part.getEnvelope().getHeader() == null) {
-                        part.getEnvelope().addHeader();
+                    if (getEnvelope().getHeader() == null) {
+                        getEnvelope().addHeader();
                     }
-                    setChild(adjustPrefix(part.getEnvelope().getHeader(), prefix), false);
+                    setChild(adjustPrefix(getEnvelope().getHeader(), prefix), false);
                     return;
                 } else if ("Fault".equals(local)) {
-                    SOAPFault f = part.getEnvelope().getBody().getFault();
+                    SOAPFault f = getEnvelope().getBody().getFault();
                     if (f == null) {
-                        Element el = part.createElementNS(namespace, 
+                        Element el = getDocument().createElementNS(namespace, 
                                              StringUtils.isEmpty(prefix) ? local : prefix + ":" + local);
-                        part.getEnvelope().getBody().appendChild(el);
-                        f = part.getEnvelope().getBody().getFault();
+                        getEnvelope().getBody().appendChild(el);
+                        f = getEnvelope().getBody().getFault();
                         if (f == null) {
-                            f = part.getEnvelope().getBody().addFault();
+                            f = getEnvelope().getBody().addFault();
                         }
                     }
                     setChild(adjustPrefix(f, prefix), false);

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8ea9e74/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
index cc9045b..cf74c01 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
@@ -22,6 +22,8 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.StringReader;
 
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -35,6 +37,7 @@ import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 
+import org.apache.cxf.binding.soap.saaj.SAAJStreamWriter;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.xml.security.encryption.AbstractSerializer;
 import org.apache.xml.security.encryption.XMLEncryptionException;
@@ -105,26 +108,53 @@ public class StaxSerializer extends AbstractSerializer {
         
         XMLStreamReader reader = StaxUtils.createXMLStreamReader(inputSource);
         
-        // Import to a dummy fragment
-        DocumentFragment dummyFragment = contextDocument.createDocumentFragment();
-        XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(new DOMResult(dummyFragment));
-        
+        XMLStreamWriter writer = null;
         try {
+            if (ctx instanceof SOAPElement) {
+                SOAPElement el = (SOAPElement)ctx;
+                while (el != null && !(el instanceof SOAPEnvelope)) {
+                    el = el.getParentElement();
+                }
+                //cannot load into fragment due to a ClassCastException iwthin SAAJ addChildElement 
+                //which only checks for Document as parent, not DocumentFragment
+                Element element = ctx.getOwnerDocument().createElementNS("dummy", "dummy");
+                writer = new SAAJStreamWriter((SOAPEnvelope)el, element);
+                StaxUtils.copy(reader, writer);
+                
+                DocumentFragment result = contextDocument.createDocumentFragment();
+                Node child = element.getFirstChild().getFirstChild();
+                if (child != null && child.getNextSibling() == null) {
+                    return child;
+                }
+                while (child != null) {
+                    Node nextChild = child.getNextSibling();
+                    result.appendChild(child);
+                    child = nextChild;
+                }
+                
+                return result;
+            }
+            // Import to a dummy fragment
+            DocumentFragment dummyFragment = contextDocument.createDocumentFragment();
+            writer = StaxUtils.createXMLStreamWriter(new DOMResult(dummyFragment));
             StaxUtils.copy(reader, writer);
+            
+            // Remove the "dummy" wrapper
+            DocumentFragment result = contextDocument.createDocumentFragment();
+            Node child = dummyFragment.getFirstChild().getFirstChild();
+            if (child != null && child.getNextSibling() == null) {
+                return child;
+            }
+            while (child != null) {
+                Node nextChild = child.getNextSibling();
+                result.appendChild(child);
+                child = nextChild;
+            }
+            
+            return result;
         } catch (XMLStreamException ex) {
             throw new XMLEncryptionException(ex);
         }
-        
-        // Remove the "dummy" wrapper
-        DocumentFragment result = contextDocument.createDocumentFragment();
-        Node child = dummyFragment.getFirstChild().getFirstChild();
-        while (child != null) {
-            Node nextChild = child.getNextSibling();
-            result.appendChild(child);
-            child = nextChild;
-        }
-        
-        return result;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8ea9e74/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
index b506853..bd90c04 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
@@ -196,7 +196,7 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor {
             config = engine.getWssConfig();
         }
         reqData.setWssConfig(config);
-        // reqData.setEncryptionSerializer(new StaxSerializer());
+        reqData.setEncryptionSerializer(new StaxSerializer());
         
         // Add Audience Restrictions for SAML
         configureAudienceRestriction(msg, reqData);

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8ea9e74/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
index 1393ef8..9414679 100644
--- a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
+++ b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
@@ -265,6 +265,8 @@ public class WSS4JFaultCodeTest extends AbstractSecurityTest {
         
         try {
             inHandler.handleMessage(inmsg);
+            StaxUtils.print(saajMsg.getSOAPPart());
+            
             fail("Expected failure on a SOAP Fault");
         } catch (SoapFault fault) {
             fault.printStackTrace();


[38/50] [abbrv] cxf git commit: Adding @Ignore'd test-case for policy annotation issue

Posted by re...@apache.org.
Adding @Ignore'd test-case for policy annotation issue


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/abc147c8
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/abc147c8
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/abc147c8

Branch: refs/heads/master-jaxrs-2.1
Commit: abc147c8c77a003049b8b6758391e3a1ca568a80
Parents: 49658f9
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue May 24 16:41:50 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue May 24 16:45:56 2016 +0100

----------------------------------------------------------------------
 .../ws/fault/DoubleItPortTypeImplJavaFirst.java | 62 ++++++++++++++++++++
 .../apache/cxf/systest/ws/fault/FaultTest.java  | 37 ++++++++++++
 .../cxf/systest/ws/fault/DoubleItFault.wsdl     |  3 +
 .../systest/ws/fault/SignedEncryptedPolicy.xml  | 13 ++++
 .../cxf/systest/ws/fault/SymmetricUTPolicy.xml  | 42 +++++++++++++
 .../org/apache/cxf/systest/ws/fault/client.xml  | 60 ++++++++++++++++++-
 .../org/apache/cxf/systest/ws/fault/server.xml  |  6 ++
 7 files changed, 221 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/abc147c8/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
new file mode 100644
index 0000000..0d3d6a7
--- /dev/null
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/DoubleItPortTypeImplJavaFirst.java
@@ -0,0 +1,62 @@
+/**
+ * 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.ws.fault;
+
+import java.security.Principal;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.annotations.Policy;
+import org.apache.cxf.feature.Features;
+import org.example.contract.doubleit.DoubleItFault;
+import org.example.contract.doubleit.DoubleItPortType;
+
+@WebService(targetNamespace = "http://www.example.org/contract/DoubleIt", 
+            serviceName = "DoubleItService", 
+            endpointInterface = "org.example.contract.doubleit.DoubleItPortType")
+@Features(features = "org.apache.cxf.feature.LoggingFeature")     
+// @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml")
+public class DoubleItPortTypeImplJavaFirst implements DoubleItPortType {
+    @Resource
+    WebServiceContext wsContext;
+    
+    //@Policies({
+        // @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml")
+        //@Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SignedEncryptedPolicy.xml", 
+         //       placement = Placement.BINDING_OPERATION)
+    //})  
+    
+    @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml")
+    public int doubleIt(int numberToDouble) throws DoubleItFault {
+        
+        Principal pr = wsContext.getUserPrincipal();
+        if (pr == null || "alice".equals(pr.getName())) {
+            return numberToDouble * 2;
+        }
+        
+        org.example.schema.doubleit.DoubleItFault internalFault = 
+            new org.example.schema.doubleit.DoubleItFault();
+        internalFault.setMajor((short)124);
+        internalFault.setMinor((short)1256);
+        throw new DoubleItFault("This is a fault", internalFault);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/abc147c8/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
index 69ad62d..755f11b 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
@@ -259,4 +259,41 @@ public class FaultTest extends AbstractBusClientServerTestBase {
         bus.shutdown(true);
     }
     
+    // TODO - There seems to be a bug when a security policy is applied to a method as opposed to the class
+    // See DoubleItPortTypeImplJavaFirst
+    @org.junit.Test
+    @org.junit.Ignore
+    public void testJavaFirst() throws Exception {
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = FaultTest.class.getResource("client.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+
+        URL wsdl = FaultTest.class.getResource("DoubleItFault.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItJavaFirstPort");
+        DoubleItPortType utPort = 
+                service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(utPort, PORT);
+        
+        // Make a successful invocation
+        ((BindingProvider)utPort).getRequestContext().put("security.username", "alice");
+        utPort.doubleIt(25);
+        /*
+        // Now make an invocation using another username
+        ((BindingProvider)utPort).getRequestContext().put("security.username", "bob");
+        ((BindingProvider)utPort).getRequestContext().put("security.password", "password");
+        try {
+            utPort.doubleIt(25);
+            fail("Expected failure on bob");
+        } catch (Exception ex) {
+            assertTrue(ex.getMessage().contains("This is a fault"));
+        }
+        */
+        ((java.io.Closeable)utPort).close();
+        bus.shutdown(true);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/abc147c8/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl
index df7ffe1..09947df 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl
@@ -128,6 +128,9 @@
             <wsp:PolicyReference URI="#DoubleItPlaintextWithPartsPolicy"/>
             <soap:address location="http://localhost:9009/DoubleItSoap11PolicyWithParts"/>
         </wsdl:port>
+        <wsdl:port name="DoubleItJavaFirstPort" binding="tns:DoubleItSoap11NoPolicyBinding">
+            <soap12:address location="http://localhost:9009/DoubleItJavaFirst"/>
+        </wsdl:port>
     </wsdl:service>
     <wsp:Policy wsu:Id="DoubleItPlaintextPolicy">
         <wsp:ExactlyOne>

http://git-wip-us.apache.org/repos/asf/cxf/blob/abc147c8/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/SignedEncryptedPolicy.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/SignedEncryptedPolicy.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/SignedEncryptedPolicy.xml
new file mode 100644
index 0000000..7ae2212
--- /dev/null
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/SignedEncryptedPolicy.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="SignedEncryptedPolicy">
+    <wsp:ExactlyOne>
+        <wsp:All>
+            <sp:EncryptedParts>
+                <sp:Body/>
+            </sp:EncryptedParts>
+            <sp:SignedParts>
+                <sp:Body/>
+            </sp:SignedParts>
+        </wsp:All>
+    </wsp:ExactlyOne>
+</wsp:Policy>

http://git-wip-us.apache.org/repos/asf/cxf/blob/abc147c8/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml
new file mode 100644
index 0000000..049ca51
--- /dev/null
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="SymmetricUTPolicy">
+    <wsp:ExactlyOne>
+        <wsp:All>
+            <sp:SymmetricBinding>
+                    <wsp:Policy>
+                        <sp:ProtectionToken>
+                            <wsp:Policy>
+                                <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
+                                    <wsp:Policy>
+                                        <sp:WssX509V3Token10/>
+                                        <sp:RequireKeyIdentifierReference/>
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:ProtectionToken>
+                        <sp:Layout>
+                            <wsp:Policy>
+                                <sp:Lax/>
+                            </wsp:Policy>
+                        </sp:Layout>
+                        <sp:IncludeTimestamp/>
+                        <sp:OnlySignEntireHeadersAndBody/>
+                        <sp:AlgorithmSuite>
+                            <wsp:Policy>
+                                <sp:Basic128/>
+                            </wsp:Policy>
+                        </sp:AlgorithmSuite>
+                    </wsp:Policy>
+                </sp:SymmetricBinding>
+                <sp:SupportingTokens>
+                    <wsp:Policy>
+                        <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
+                            <wsp:Policy>
+                                <sp:WssUsernameToken10/>
+                            </wsp:Policy>
+                        </sp:UsernameToken>
+                    </wsp:Policy>
+                </sp:SupportingTokens>
+        </wsp:All>
+    </wsp:ExactlyOne>
+</wsp:Policy>

http://git-wip-us.apache.org/repos/asf/cxf/blob/abc147c8/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml
index b22bb4d..b23a005 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml
@@ -17,7 +17,7 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:p="http://cxf.apache.org/policy" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation="           http://www.springframework.org/schema/beans           http://www.springframework.org/schema/beans/spring-beans.xsd           http://cxf.apache.org/jaxws                           http://cxf.apache.org/schemas/jaxws.xsd           http://cxf.apache.org/transports/http/configuration   http://cxf.apache.org/schemas/configuration/http-conf.xsd           http://cxf.apache.org/configuration/security          http://cxf.apache.org/schemas/configuration/security.xsd           http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd           http://cxf.apache.org/policy http://cxf.apache.org/schemas/poli
 cy.xsd">
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:p="http://cxf.apache.org/policy" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation="           http://www.springframework.org/schema/beans           http://www.springframework.org/schema/beans/spring-beans.xsd           http://cxf.apache.org/jaxws                           http://cxf.apache.org/schemas/jaxws.xsd           http://cxf.apache.org/transports/http/configuration   http://cxf.apache.org/schemas/configuration/http-conf.xsd           http://cxf.apache.org/configuration/security          http://cxf.apache.org/schemas/configuration/security.xsd           http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd           http://cxf.apache.org/policy http://cxf.apache.org/schemas/poli
 cy.xsd           http://www.w3.org/ns/ws-policy  http://www.w3.org/2007/02/ws-policy.xsd">
     <cxf:bus>
         <cxf:features>
             <p:policies/>
@@ -57,11 +57,67 @@
         </jaxws:properties>
     </jaxws:client>
     
-     <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSoap11PolicyWithPartsPort" createdFromAPI="true">
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSoap11PolicyWithPartsPort" createdFromAPI="true">
         <jaxws:properties>
             <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
             <entry key="security.encryption.properties" value="bob.properties"/>
             <entry key="security.encryption.username" value="bob"/>
         </jaxws:properties>
     </jaxws:client>
+    
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItJavaFirstPort" createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+            <entry key="security.encryption.properties" value="bob.properties"/>
+            <entry key="security.encryption.username" value="bob"/>
+        </jaxws:properties>
+        <jaxws:features>
+            <p:policies>
+                <wsp:PolicyReference xmlns:wsp="http://www.w3.org/ns/ws-policy" URI="#SymmetricUTPolicy"/>
+            </p:policies>
+        </jaxws:features>
+    </jaxws:client>
+    
+    <wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="SymmetricUTPolicy">
+    <wsp:ExactlyOne>
+        <wsp:All>
+            <sp:SymmetricBinding>
+                    <wsp:Policy>
+                        <sp:ProtectionToken>
+                            <wsp:Policy>
+                                <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
+                                    <wsp:Policy>
+                                        <sp:WssX509V3Token10/>
+                                        <sp:RequireKeyIdentifierReference/>
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:ProtectionToken>
+                        <sp:Layout>
+                            <wsp:Policy>
+                                <sp:Lax/>
+                            </wsp:Policy>
+                        </sp:Layout>
+                        <sp:IncludeTimestamp/>
+                        <sp:OnlySignEntireHeadersAndBody/>
+                        <sp:AlgorithmSuite>
+                            <wsp:Policy>
+                                <sp:Basic128/>
+                            </wsp:Policy>
+                        </sp:AlgorithmSuite>
+                    </wsp:Policy>
+                </sp:SymmetricBinding>
+                <sp:SupportingTokens>
+                    <wsp:Policy>
+                        <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
+                            <wsp:Policy>
+                                <sp:WssUsernameToken10/>
+                            </wsp:Policy>
+                        </sp:UsernameToken>
+                    </wsp:Policy>
+                </sp:SupportingTokens>
+        </wsp:All>
+    </wsp:ExactlyOne>
+    </wsp:Policy>
+    
 </beans>

http://git-wip-us.apache.org/repos/asf/cxf/blob/abc147c8/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml
index 6fb8461..6085c50 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml
@@ -56,4 +56,10 @@
             <entry key="security.signature.properties" value="bob.properties"/>
         </jaxws:properties>
     </jaxws:endpoint>
+    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="JavaFirst" address="http://localhost:${testutil.ports.fault.Server}/DoubleItJavaFirst" serviceName="s:DoubleItService" endpointName="s:DoubleItJavaFirstPort" implementor="org.apache.cxf.systest.ws.fault.DoubleItPortTypeImplJavaFirst" wsdlLocation="org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl">
+        <jaxws:properties>
+            <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+            <entry key="security.signature.properties" value="bob.properties"/>
+        </jaxws:properties>
+    </jaxws:endpoint>
 </beans>


[43/50] [abbrv] cxf git commit: Minor update to Oidc services

Posted by re...@apache.org.
Minor update to Oidc services


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d243c99d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d243c99d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d243c99d

Branch: refs/heads/master-jaxrs-2.1
Commit: d243c99dbcb3cf3a0b2b5c24615c88324b641dad
Parents: dda4c7b
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed May 25 12:55:35 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed May 25 12:55:35 2016 +0100

----------------------------------------------------------------------
 .../cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java  | 5 ++---
 .../apache/cxf/rs/security/oidc/idp/OidcImplicitService.java    | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d243c99d/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
index 17f595d..519361c 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
@@ -51,14 +51,13 @@ public class OidcAuthorizationCodeService extends AuthorizationCodeGrantService
         // Check the pre-configured consent
         boolean preConfiguredConsentForScopes =
             super.canAuthorizationBeSkipped(params, client, userSubject, requestedScope, permissions);
-        boolean nonePromptRequested = promptValues.contains(OidcUtils.PROMPT_NONE_VALUE);
         
-        if (nonePromptRequested && !preConfiguredConsentForScopes) {
+        if (!preConfiguredConsentForScopes && promptValues.contains(OidcUtils.PROMPT_NONE_VALUE)) {
             // An error is returned if client does not have pre-configured consent for the requested scopes/claims
             LOG.log(Level.FINE, "Prompt 'none' request can not be met");
             throw new OAuthServiceException(new OAuthError(OidcUtils.CONSENT_REQUIRED_ERROR));
         }
-        return !nonePromptRequested && preConfiguredConsentForScopes;
+        return preConfiguredConsentForScopes;
     }
     
     public void setSkipAuthorizationWithOidcScope(boolean skipAuthorizationWithOidcScope) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/d243c99d/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
index b0a8e05..03f626f 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
@@ -99,14 +99,13 @@ public class OidcImplicitService extends ImplicitGrantService {
         // Check the pre-configured consent
         boolean preConfiguredConsentForScopes =
             super.canAuthorizationBeSkipped(params, client, userSubject, requestedScope, permissions);
-        boolean nonePromptRequested = promptValues.contains(OidcUtils.PROMPT_NONE_VALUE);
         
-        if (nonePromptRequested && !preConfiguredConsentForScopes) {
+        if (!preConfiguredConsentForScopes && promptValues.contains(OidcUtils.PROMPT_NONE_VALUE)) {
             // An error is returned if client does not have pre-configured consent for the requested scopes/claims
             LOG.log(Level.FINE, "Prompt 'none' request can not be met");
             throw new OAuthServiceException(new OAuthError(OidcUtils.CONSENT_REQUIRED_ERROR));
         }
-        return !nonePromptRequested && preConfiguredConsentForScopes;
+        return preConfiguredConsentForScopes;
     }
     
     public void setSkipAuthorizationWithOidcScope(boolean skipAuthorizationWithOidcScope) {


[40/50] [abbrv] cxf git commit: Simplifying OIDC services a bit

Posted by re...@apache.org.
Simplifying OIDC services a bit


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0182a290
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0182a290
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0182a290

Branch: refs/heads/master-jaxrs-2.1
Commit: 0182a29027e927abc170a7d6077aedeba7c974fb
Parents: 28f130c
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed May 25 10:59:17 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed May 25 10:59:17 2016 +0100

----------------------------------------------------------------------
 .../services/AbstractImplicitGrantService.java  |  1 +
 .../services/AuthorizationCodeGrantService.java |  1 +
 .../services/RedirectionBasedGrantService.java  |  9 +++++-
 .../oidc/idp/OidcAuthorizationCodeService.java  | 29 +++-----------------
 .../security/oidc/idp/OidcImplicitService.java  | 23 +++-------------
 5 files changed, 18 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/0182a290/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractImplicitGrantService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractImplicitGrantService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractImplicitGrantService.java
index 3a18a66..446f82c 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractImplicitGrantService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractImplicitGrantService.java
@@ -133,6 +133,7 @@ public abstract class AbstractImplicitGrantService extends RedirectionBasedGrant
         reg.setApprovedScope(getApprovedScope(requestedScope, approvedScope));
         reg.setAudiences(Collections.singletonList(state.getAudience()));
         reg.setNonce(state.getNonce());
+        reg.getExtraProperties().putAll(state.getExtraProperties());
         return reg;
     }
     protected void finalizeResponse(StringBuilder sb, OAuthRedirectionState state) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/0182a290/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
index 5ec47d7..36c94f7 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
@@ -158,6 +158,7 @@ public class AuthorizationCodeGrantService extends RedirectionBasedGrantService
         codeReg.setAudience(state.getAudience());
         codeReg.setNonce(state.getNonce());
         codeReg.setClientCodeChallenge(state.getClientCodeChallenge());
+        codeReg.getExtraProperties().putAll(state.getExtraProperties());
         return codeReg;
     }
     protected String processCodeGrant(Client client, String code, UserSubject endUser) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/0182a290/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
index 5ed3e2c..a6d5da8 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
@@ -70,6 +70,7 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
     private boolean matchRedirectUriWithApplicationUri;
     private boolean hidePreauthorizedScopesInForm;
     private AuthorizationRequestFilter authorizationFilter;
+    private List<String> scopesRequiringNoConsent;
     
     protected RedirectionBasedGrantService(String supportedResponseType,
                                            String supportedGrantType) {
@@ -231,7 +232,10 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
                                                 UserSubject userSubject,
                                                 List<String> requestedScope, 
                                                 List<OAuthPermission> permissions) {
-        return false;
+        return scopesRequiringNoConsent != null 
+               && requestedScope != null
+               && requestedScope.size() == scopesRequiringNoConsent.size()
+               && requestedScope.containsAll(scopesRequiringNoConsent);
     }
 
     /**
@@ -554,4 +558,7 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
     public void setAuthorizationFilter(AuthorizationRequestFilter authorizationFilter) {
         this.authorizationFilter = authorizationFilter;
     }
+    public void setScopesRequiringNoConsent(List<String> scopesRequiringNoConsent) {
+        this.scopesRequiringNoConsent = scopesRequiringNoConsent;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/0182a290/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
index a4e9ed5..b616170 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.rs.security.oidc.idp;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.logging.Level;
 
@@ -28,9 +29,7 @@ import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthError;
 import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
 import org.apache.cxf.rs.security.oauth2.common.OAuthRedirectionState;
-import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
 import org.apache.cxf.rs.security.oauth2.common.UserSubject;
-import org.apache.cxf.rs.security.oauth2.grants.code.AuthorizationCodeRegistration;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
 import org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
@@ -39,20 +38,16 @@ import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
 public class OidcAuthorizationCodeService extends AuthorizationCodeGrantService {
     private static final String PROMPT_PARAMETER = "prompt";
     
-    private boolean skipAuthorizationWithOidcScope;
     @Override
     protected boolean canAuthorizationBeSkipped(Client client,
                                                 UserSubject userSubject,
                                                 List<String> requestedScope,
                                                 List<OAuthPermission> permissions) {
-        // No need to challenge the authenticated user with the authorization form 
-        // if all the client application redirecting a user needs is to get this user authenticated
-        // with OIDC IDP
-        return requestedScope.size() == 1 && permissions.size() == 1 && skipAuthorizationWithOidcScope
-            && OidcUtils.OPENID_SCOPE.equals(requestedScope.get(0));
+        return super.canAuthorizationBeSkipped(client, userSubject, requestedScope, permissions);
     }
+    
     public void setSkipAuthorizationWithOidcScope(boolean skipAuthorizationWithOidcScope) {
-        this.skipAuthorizationWithOidcScope = skipAuthorizationWithOidcScope;
+        super.setScopesRequiringNoConsent(Collections.singletonList(OidcUtils.OPENID_SCOPE));
     }
     
     @Override
@@ -76,22 +71,6 @@ public class OidcAuthorizationCodeService extends AuthorizationCodeGrantService
         return super.startAuthorization(params, userSubject, client);
     }
     
-    protected AuthorizationCodeRegistration createCodeRegistration(OAuthRedirectionState state, 
-                                                                   Client client, 
-                                                                   List<String> requestedScope, 
-                                                                   List<String> approvedScope, 
-                                                                   UserSubject userSubject, 
-                                                                   ServerAccessToken preauthorizedToken) {
-        AuthorizationCodeRegistration codeReg = super.createCodeRegistration(state, 
-                                                                             client, 
-                                                                             requestedScope, 
-                                                                             approvedScope, 
-                                                                             userSubject, 
-                                                                             preauthorizedToken);
-        
-        codeReg.getExtraProperties().putAll(state.getExtraProperties());
-        return codeReg;
-    }
     @Override
     protected OAuthRedirectionState recreateRedirectionStateFromParams(
         MultivaluedMap<String, String> params) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/0182a290/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
index c35526c..d689c21 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.rs.security.oidc.idp;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Properties;
@@ -32,7 +33,6 @@ import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm;
 import org.apache.cxf.rs.security.jose.jws.JwsUtils;
 import org.apache.cxf.rs.security.jose.jwt.JwtToken;
-import org.apache.cxf.rs.security.oauth2.common.AccessTokenRegistration;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthError;
 import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
@@ -51,7 +51,6 @@ import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
 public class OidcImplicitService extends ImplicitGrantService {
     private static final String PROMPT_PARAMETER = "prompt";
     
-    private boolean skipAuthorizationWithOidcScope;
     private OAuthJoseJwtProducer idTokenHandler;
     private IdTokenProvider idTokenProvider;
     
@@ -100,14 +99,11 @@ public class OidcImplicitService extends ImplicitGrantService {
                                                 UserSubject userSubject,
                                                 List<String> requestedScope,
                                                 List<OAuthPermission> permissions) {
-        // No need to challenge the authenticated user with the authorization form 
-        // if all the client application redirecting a user needs is to get this user authenticated
-        // with OIDC IDP
-        return requestedScope.size() == 1 && permissions.size() == 1 && skipAuthorizationWithOidcScope
-            && OidcUtils.OPENID_SCOPE.equals(requestedScope.get(0));
+        return super.canAuthorizationBeSkipped(client, userSubject, requestedScope, permissions);
     }
+    
     public void setSkipAuthorizationWithOidcScope(boolean skipAuthorizationWithOidcScope) {
-        this.skipAuthorizationWithOidcScope = skipAuthorizationWithOidcScope;
+        super.setScopesRequiringNoConsent(Collections.singletonList(OidcUtils.OPENID_SCOPE));
     }
     
     @Override
@@ -161,17 +157,6 @@ public class OidcImplicitService extends ImplicitGrantService {
         return state;
     }
     
-    @Override
-    protected AccessTokenRegistration createTokenRegistration(OAuthRedirectionState state, 
-                                                              Client client, 
-                                                              List<String> requestedScope, 
-                                                              List<String> approvedScope, 
-                                                              UserSubject userSubject) {
-        AccessTokenRegistration reg = 
-            super.createTokenRegistration(state, client, requestedScope, approvedScope, userSubject);
-        reg.getExtraProperties().putAll(state.getExtraProperties());
-        return reg;
-    }
     
     protected String processIdToken(OAuthRedirectionState state, IdToken idToken) {
         OAuthJoseJwtProducer processor = idTokenHandler == null ? new OAuthJoseJwtProducer() : idTokenHandler; 


[23/50] [abbrv] cxf git commit: [CXF-6908] Excluding test for still open issue

Posted by re...@apache.org.
[CXF-6908] Excluding test for still open issue


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0c2fb8fe
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0c2fb8fe
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0c2fb8fe

Branch: refs/heads/master-jaxrs-2.1
Commit: 0c2fb8fe7847cc85862ec5e9fec9c7bf9b2c195c
Parents: ffa81f6
Author: Alessio Soldano <as...@redhat.com>
Authored: Fri May 20 21:45:48 2016 +0200
Committer: Alessio Soldano <as...@redhat.com>
Committed: Fri May 20 21:45:48 2016 +0200

----------------------------------------------------------------------
 .../org/apache/cxf/systest/ws/security/SecurityPolicyTest.java     | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/0c2fb8fe/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
index fb0eea0..4cd7b66 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
@@ -68,6 +68,7 @@ import org.example.contract.doubleit.DoubleItPortTypeHeader;
 import org.example.schema.doubleit.DoubleIt;
 
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
@@ -701,6 +702,7 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
     }
     
     @Test
+    @Ignore("CXF-6908")
     public void testFault() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
 


[20/50] [abbrv] cxf git commit: Don't create one big byte[] for the wrapper, use multi streams

Posted by re...@apache.org.
Don't create one big byte[] for the wrapper, use multi streams


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9b21bb98
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9b21bb98
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9b21bb98

Branch: refs/heads/master-jaxrs-2.1
Commit: 9b21bb98025890f77864db2d1f8bea9a07ce1f32
Parents: 2c40937
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri May 20 13:26:40 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri May 20 13:26:40 2016 -0400

----------------------------------------------------------------------
 .../cxf/ws/security/wss4j/StaxSerializer.java   | 57 +++++++++++++++++++-
 1 file changed, 55 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9b21bb98/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
index f3f47f8..3b28754 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
@@ -20,9 +20,15 @@ package org.apache.cxf.ws.security.wss4j;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.SequenceInputStream;
 import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Vector;
 
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.soap.SOAPElement;
@@ -44,6 +50,7 @@ import org.xml.sax.InputSource;
 
 
 import org.apache.cxf.binding.soap.saaj.SAAJStreamWriter;
+import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.xml.security.encryption.AbstractSerializer;
 import org.apache.xml.security.encryption.XMLEncryptionException;
@@ -129,8 +136,54 @@ public class StaxSerializer extends AbstractSerializer {
         if (reader != null) {
             return deserialize(ctx, reader, false);            
         }
-        byte[] fragment = createContext(source, ctx);
-        return deserialize(ctx, new InputSource(new ByteArrayInputStream(fragment)));
+        return deserialize(ctx, new InputSource(createStreamContext(source, ctx)));
+    }
+    
+    InputStream createStreamContext(byte[] source, Node ctx) throws XMLEncryptionException {
+        Vector<InputStream> v = new Vector<>(2);
+
+        LoadingByteArrayOutputStream byteArrayOutputStream = new LoadingByteArrayOutputStream();
+        try {
+            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(byteArrayOutputStream, "UTF-8");
+            outputStreamWriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?><dummy");
+
+            // Run through each node up to the document node and find any xmlns: nodes
+            Map<String, String> storedNamespaces = new HashMap<String, String>();
+            Node wk = ctx;
+            while (wk != null) {
+                NamedNodeMap atts = wk.getAttributes();
+                if (atts != null) {
+                    for (int i = 0; i < atts.getLength(); ++i) {
+                        Node att = atts.item(i);
+                        String nodeName = att.getNodeName();
+                        if ((nodeName.equals("xmlns") || nodeName.startsWith("xmlns:"))
+                                && !storedNamespaces.containsKey(att.getNodeName())) {
+                            outputStreamWriter.write(" ");
+                            outputStreamWriter.write(nodeName);
+                            outputStreamWriter.write("=\"");
+                            outputStreamWriter.write(att.getNodeValue());
+                            outputStreamWriter.write("\"");
+                            storedNamespaces.put(nodeName, att.getNodeValue());
+                        }
+                    }
+                }
+                wk = wk.getParentNode();
+            }
+            outputStreamWriter.write(">");
+            outputStreamWriter.close();
+            v.add(byteArrayOutputStream.createInputStream());
+            v.addElement(new ByteArrayInputStream(source));
+            byteArrayOutputStream = new LoadingByteArrayOutputStream();
+            outputStreamWriter = new OutputStreamWriter(byteArrayOutputStream, "UTF-8");
+            outputStreamWriter.write("</dummy>");
+            outputStreamWriter.close();
+            v.add(byteArrayOutputStream.createInputStream());
+        } catch (UnsupportedEncodingException e) {
+            throw new XMLEncryptionException(e);
+        } catch (IOException e) {
+            throw new XMLEncryptionException(e);
+        }
+        return new SequenceInputStream(v.elements());
     }
 
     /**


[46/50] [abbrv] cxf git commit: Upgrade derby to 10.12.1.1

Posted by re...@apache.org.
Upgrade derby to 10.12.1.1


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ecb6eba5
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ecb6eba5
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ecb6eba5

Branch: refs/heads/master-jaxrs-2.1
Commit: ecb6eba580c81d35991df66681db8dff99b1b087
Parents: e853093
Author: Akitoshi Yoshida <ay...@apache.org>
Authored: Wed May 25 17:10:16 2016 +0200
Committer: Akitoshi Yoshida <ay...@apache.org>
Committed: Wed May 25 17:10:16 2016 +0200

----------------------------------------------------------------------
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ecb6eba5/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 5f256d4..b6d9000 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -80,7 +80,7 @@
         <cxf.commons-collections.version>3.2.2</cxf.commons-collections.version>
         <cxf.commons-lang.version>2.6</cxf.commons-lang.version>
         <cxf.commons-lang3.version>3.4</cxf.commons-lang3.version>
-        <cxf.derby.version>10.2.2.0</cxf.derby.version>
+        <cxf.derby.version>10.12.1.1</cxf.derby.version>
         <cxf.dropwizard.version>3.1.2</cxf.dropwizard.version>
         <cxf.ehcache.version>2.10.1</cxf.ehcache.version>
         <cxf.ehcache3.version>3.0.1</cxf.ehcache3.version>


[05/50] [abbrv] cxf git commit: [CXF-6900] More SAAJ fixes

Posted by re...@apache.org.
[CXF-6900] More SAAJ fixes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2538ae42
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2538ae42
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2538ae42

Branch: refs/heads/master-jaxrs-2.1
Commit: 2538ae42fb0c774023deed5264291b2fe6658cb8
Parents: cf8ac10
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue May 17 13:26:31 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue May 17 13:26:31 2016 -0400

----------------------------------------------------------------------
 .../apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java   |  2 +-
 .../apache/cxf/binding/soap/saaj/SAAJStreamWriter.java    | 10 ++++++++++
 .../cxf/ws/security/wss4j/AbstractPolicySecurityTest.java |  5 ++---
 .../cxf/ws/security/wss4j/AbstractSecurityTest.java       |  8 ++++----
 .../cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java  |  3 +++
 5 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2538ae42/core/src/main/java/org/apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java b/core/src/main/java/org/apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java
index 74de7a3..d30bf4f 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/OverlayW3CDOMStreamWriter.java
@@ -38,9 +38,9 @@ import org.apache.cxf.common.util.StringUtils;
  * location, it will just walk into it instead of creating a new element
  */
 public class OverlayW3CDOMStreamWriter extends W3CDOMStreamWriter {
+    protected boolean isOverlaid = true;
 
     List<Boolean> isOverlaidStack = new LinkedList<Boolean>();
-    boolean isOverlaid = true;
     Boolean textOverlay;
     
     public OverlayW3CDOMStreamWriter(Document document) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2538ae42/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
index d29276c..393a553 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
@@ -40,6 +40,10 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
     public SAAJStreamWriter(SOAPPart part) {
         super(part);
         this.part = part;
+        Node nd = part.getFirstChild();
+        if (nd == null) {
+            isOverlaid = false;
+        }
     }
     public SAAJStreamWriter(SOAPPart part, Element current) {
         super(part, current);
@@ -69,8 +73,14 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
                 if ("Envelope".equals(local)) {
                     setChild(adjustPrefix(part.getEnvelope(), prefix), false);
                     adjustPrefix(part.getEnvelope().getHeader(), prefix);
+                    adjustPrefix(part.getEnvelope().getBody(), prefix);
+                    part.getEnvelope().removeChild(part.getEnvelope().getHeader());
+                    part.getEnvelope().removeChild(part.getEnvelope().getBody());
                     return;
                 } else if ("Body".equals(local)) {
+                    if (part.getEnvelope().getBody() == null) {
+                        part.getEnvelope().addBody();
+                    }
                     setChild(adjustPrefix(part.getEnvelope().getBody(), prefix), false);
                     return;
                 } else if ("Header".equals(local)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2538ae42/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractPolicySecurityTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractPolicySecurityTest.java b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractPolicySecurityTest.java
index 5702b5e..b627081 100644
--- a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractPolicySecurityTest.java
+++ b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractPolicySecurityTest.java
@@ -30,7 +30,6 @@ import java.util.concurrent.Executor;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
 import javax.xml.soap.Node;
-import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
@@ -405,7 +404,7 @@ public abstract class AbstractPolicySecurityTest extends AbstractSecurityTest {
      * @see #getSoapMessageForDom(Document, AssertionInfoMap)
      */
     protected SoapMessage getOutSoapMessageForDom(Document doc, AssertionInfoMap aim)
-        throws SOAPException {
+        throws Exception {
         SoapMessage msg = this.getSoapMessageForDom(doc, aim);
         msg.put(SecurityConstants.SIGNATURE_PROPERTIES, "outsecurity.properties");
         msg.put(SecurityConstants.ENCRYPT_PROPERTIES, "outsecurity.properties");
@@ -421,7 +420,7 @@ public abstract class AbstractPolicySecurityTest extends AbstractSecurityTest {
     }
     
     protected SoapMessage getSoapMessageForDom(Document doc, AssertionInfoMap aim)
-        throws SOAPException {
+        throws Exception {
         
         SoapMessage msg = this.getSoapMessageForDom(doc);
         if (aim != null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2538ae42/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
index e5e531d..38bc2be 100644
--- a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
+++ b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
@@ -32,17 +32,16 @@ import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.dom.DOMSource;
 
 import org.w3c.dom.Document;
 
 import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.saaj.SAAJStreamWriter;
 import org.apache.cxf.helpers.DOMUtils.NullResolver;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
@@ -81,10 +80,11 @@ public abstract class AbstractSecurityTest extends AbstractCXFTest {
      * Creates a {@link SoapMessage} from the contents of a document.
      * @param doc the document containing the SOAP content.
      */
-    protected SoapMessage getSoapMessageForDom(Document doc) throws SOAPException {
+    protected SoapMessage getSoapMessageForDom(Document doc) throws Exception {
         SOAPMessage saajMsg = MessageFactory.newInstance().createMessage();
         SOAPPart part = saajMsg.getSOAPPart();
-        part.setContent(new DOMSource(doc));
+        SAAJStreamWriter writer = new SAAJStreamWriter(part);
+        StaxUtils.copy(doc, writer);
         saajMsg.saveChanges();
 
         MessageImpl message = new MessageImpl();

http://git-wip-us.apache.org/repos/asf/cxf/blob/2538ae42/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
index 71e7bb3..879ec0d 100644
--- a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
+++ b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
@@ -27,6 +27,8 @@ import java.util.Map;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
+import javax.xml.soap.SOAPMessage;
+
 import org.w3c.dom.Document;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor;
@@ -37,6 +39,7 @@ import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptor;
 import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.ws.security.wss4j.CryptoCoverageChecker.XPathExpression;
 import org.apache.cxf.ws.security.wss4j.CryptoCoverageUtil.CoverageScope;
 import org.apache.cxf.ws.security.wss4j.CryptoCoverageUtil.CoverageType;


[42/50] [abbrv] cxf git commit: Checking none and consent prompt values before presenting an authorization consent screen

Posted by re...@apache.org.
Checking none and consent prompt values before presenting an authorization consent screen


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/dda4c7b8
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/dda4c7b8
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/dda4c7b8

Branch: refs/heads/master-jaxrs-2.1
Commit: dda4c7b8298a21e2dce24f72717edf0980285949
Parents: 39b1938
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed May 25 12:47:45 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed May 25 12:47:45 2016 +0100

----------------------------------------------------------------------
 .../services/RedirectionBasedGrantService.java  |  5 +--
 .../oidc/idp/OidcAuthorizationCodeService.java  | 36 +++++++++++--------
 .../security/oidc/idp/OidcImplicitService.java  | 37 ++++++++++++--------
 .../cxf/rs/security/oidc/utils/OidcUtils.java   | 15 ++++++++
 4 files changed, 62 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/dda4c7b8/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
index a6d5da8..8e45c36 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
@@ -200,7 +200,7 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
             }
         }
         final boolean authorizationCanBeSkipped = preAuthorizationComplete 
-            || canAuthorizationBeSkipped(client, userSubject, requestedScope, requestedPermissions);
+            || canAuthorizationBeSkipped(params, client, userSubject, requestedScope, requestedPermissions);
         
         // Populate the authorization challenge data 
         OAuthAuthorizationData data = 
@@ -228,7 +228,8 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
     public Set<String> getSupportedResponseTypes() {
         return supportedResponseTypes;
     }
-    protected boolean canAuthorizationBeSkipped(Client client, 
+    protected boolean canAuthorizationBeSkipped(MultivaluedMap<String, String> params,
+                                                Client client, 
                                                 UserSubject userSubject,
                                                 List<String> requestedScope, 
                                                 List<OAuthPermission> permissions) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/dda4c7b8/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
index b616170..17f595d 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
@@ -36,14 +36,29 @@ import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
 
 public class OidcAuthorizationCodeService extends AuthorizationCodeGrantService {
-    private static final String PROMPT_PARAMETER = "prompt";
     
     @Override
-    protected boolean canAuthorizationBeSkipped(Client client,
+    protected boolean canAuthorizationBeSkipped(MultivaluedMap<String, String> params,
+                                                Client client,
                                                 UserSubject userSubject,
                                                 List<String> requestedScope,
                                                 List<OAuthPermission> permissions) {
-        return super.canAuthorizationBeSkipped(client, userSubject, requestedScope, permissions);
+        List<String> promptValues = OidcUtils.getPromptValues(params);
+        if (promptValues.contains(OidcUtils.PROMPT_CONSENT_VALUE)) {
+            // Displaying the consent screen is preferred by the client
+            return false;
+        }
+        // Check the pre-configured consent
+        boolean preConfiguredConsentForScopes =
+            super.canAuthorizationBeSkipped(params, client, userSubject, requestedScope, permissions);
+        boolean nonePromptRequested = promptValues.contains(OidcUtils.PROMPT_NONE_VALUE);
+        
+        if (nonePromptRequested && !preConfiguredConsentForScopes) {
+            // An error is returned if client does not have pre-configured consent for the requested scopes/claims
+            LOG.log(Level.FINE, "Prompt 'none' request can not be met");
+            throw new OAuthServiceException(new OAuthError(OidcUtils.CONSENT_REQUIRED_ERROR));
+        }
+        return !nonePromptRequested && preConfiguredConsentForScopes;
     }
     
     public void setSkipAuthorizationWithOidcScope(boolean skipAuthorizationWithOidcScope) {
@@ -55,17 +70,10 @@ public class OidcAuthorizationCodeService extends AuthorizationCodeGrantService
                                           UserSubject userSubject,
                                           Client client) {    
         // Validate the prompt - if it contains "none" then an error is returned with any other value
-        String prompt = params.getFirst(PROMPT_PARAMETER);
-        if (prompt != null) {
-            String[] promptValues = prompt.trim().split(" ");
-            if (promptValues.length > 1) {
-                for (String promptValue : promptValues) {
-                    if ("none".equals(promptValue)) {
-                        LOG.log(Level.FINE, "The prompt value {} is invalid", prompt);
-                        throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
-                    }
-                }
-            }
+        List<String> promptValues = OidcUtils.getPromptValues(params);
+        if (promptValues != null && promptValues.size() > 1 && promptValues.contains(OidcUtils.PROMPT_NONE_VALUE)) {
+            LOG.log(Level.FINE, "The prompt value {} is invalid", params.getFirst(OidcUtils.PROMPT_PARAMETER));
+            throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
         }
         
         return super.startAuthorization(params, userSubject, client);

http://git-wip-us.apache.org/repos/asf/cxf/blob/dda4c7b8/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
index d689c21..b0a8e05 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
@@ -49,8 +49,6 @@ import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
 
 
 public class OidcImplicitService extends ImplicitGrantService {
-    private static final String PROMPT_PARAMETER = "prompt";
-    
     private OAuthJoseJwtProducer idTokenHandler;
     private IdTokenProvider idTokenProvider;
     
@@ -78,28 +76,37 @@ public class OidcImplicitService extends ImplicitGrantService {
         }
         
         // Validate the prompt - if it contains "none" then an error is returned with any other value
-        String prompt = params.getFirst(PROMPT_PARAMETER);
-        if (prompt != null) {
-            String[] promptValues = prompt.trim().split(" ");
-            if (promptValues.length > 1) {
-                for (String promptValue : promptValues) {
-                    if ("none".equals(promptValue)) {
-                        LOG.log(Level.FINE, "The prompt value {} is invalid", prompt);
-                        throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
-                    }
-                }
-            }
+        List<String> promptValues = OidcUtils.getPromptValues(params);
+        if (promptValues.size() > 1 && promptValues.contains(OidcUtils.PROMPT_NONE_VALUE)) {
+            LOG.log(Level.FINE, "The prompt value {} is invalid", params.getFirst(OidcUtils.PROMPT_PARAMETER));
+            throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
         }
         
         return super.startAuthorization(params, userSubject, client);
     }
     
     @Override
-    protected boolean canAuthorizationBeSkipped(Client client,
+    protected boolean canAuthorizationBeSkipped(MultivaluedMap<String, String> params,
+                                                Client client,
                                                 UserSubject userSubject,
                                                 List<String> requestedScope,
                                                 List<OAuthPermission> permissions) {
-        return super.canAuthorizationBeSkipped(client, userSubject, requestedScope, permissions);
+        List<String> promptValues = OidcUtils.getPromptValues(params);
+        if (promptValues.contains(OidcUtils.PROMPT_CONSENT_VALUE)) {
+            // Displaying the consent screen is preferred by the client
+            return false;
+        }
+        // Check the pre-configured consent
+        boolean preConfiguredConsentForScopes =
+            super.canAuthorizationBeSkipped(params, client, userSubject, requestedScope, permissions);
+        boolean nonePromptRequested = promptValues.contains(OidcUtils.PROMPT_NONE_VALUE);
+        
+        if (nonePromptRequested && !preConfiguredConsentForScopes) {
+            // An error is returned if client does not have pre-configured consent for the requested scopes/claims
+            LOG.log(Level.FINE, "Prompt 'none' request can not be met");
+            throw new OAuthServiceException(new OAuthError(OidcUtils.CONSENT_REQUIRED_ERROR));
+        }
+        return !nonePromptRequested && preConfiguredConsentForScopes;
     }
     
     public void setSkipAuthorizationWithOidcScope(boolean skipAuthorizationWithOidcScope) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/dda4c7b8/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
index 1f717c1..3bbc63a 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
@@ -20,6 +20,7 @@ package org.apache.cxf.rs.security.oidc.utils;
 
 import java.security.NoSuchAlgorithmException;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -67,6 +68,11 @@ public final class OidcUtils {
     public static final String ENDPOINT_CLAIM_SOURCE_PROPERTY = "endpoint";
     public static final String TOKEN_CLAIM_SOURCE_PROPERTY = "access_token";
     
+    public static final String PROMPT_PARAMETER = "prompt";
+    public static final String PROMPT_NONE_VALUE = "none";
+    public static final String PROMPT_CONSENT_VALUE = "consent";
+    public static final String CONSENT_REQUIRED_ERROR = "consent_required";
+    
     private static final Map<String, List<String>> SCOPES_MAP;
     static {
         SCOPES_MAP = new HashMap<String, List<String>>();
@@ -79,6 +85,15 @@ public final class OidcUtils {
     private OidcUtils() {
         
     }
+    public static List<String> getPromptValues(MultivaluedMap<String, String> params) {
+        String prompt = params.getFirst(PROMPT_PARAMETER);
+        if (prompt != null) {
+            return Arrays.asList(prompt.trim().split(" "));
+        } else {
+            return Collections.emptyList();
+        }
+    }
+    
     public static String getOpenIdScope() {
         return OPENID_SCOPE;
     }


[14/50] [abbrv] cxf git commit: [CXF-6909] Adding JCache OAuth2 providers, patch from Luca Burgazzoli applied with thanks, This closes #137

Posted by re...@apache.org.
[CXF-6909] Adding JCache OAuth2 providers, patch from Luca Burgazzoli applied with thanks, This closes #137


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2b160783
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2b160783
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2b160783

Branch: refs/heads/master-jaxrs-2.1
Commit: 2b1607831ccf97909122eae9247116d9a075c7cf
Parents: c681373
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Fri May 20 09:49:59 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Fri May 20 09:49:59 2016 +0100

----------------------------------------------------------------------
 parent/pom.xml                                  |   2 +
 rt/rs/security/oauth-parent/oauth2/pom.xml      |  29 ++-
 .../grants/code/JCacheCodeDataProvider.java     | 126 +++++++++++
 .../provider/JCacheOAuthDataProvider.java       | 215 ++++++++++++++++++
 .../grants/code/JCacheCodeDataProviderTest.java | 105 +++++++++
 .../provider/JCacheOAuthDataProviderTest.java   | 217 +++++++++++++++++++
 .../src/test/resources/cxf-oauth2-ehcache3.xml  |  27 +++
 7 files changed, 716 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2b160783/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index ce1dc37..5f256d4 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -83,6 +83,7 @@
         <cxf.derby.version>10.2.2.0</cxf.derby.version>
         <cxf.dropwizard.version>3.1.2</cxf.dropwizard.version>
         <cxf.ehcache.version>2.10.1</cxf.ehcache.version>
+        <cxf.ehcache3.version>3.0.1</cxf.ehcache3.version>
         <cxf.fastinfoset.bundle.version>1.2.13_1</cxf.fastinfoset.bundle.version>
         <cxf.guava.version>18.0</cxf.guava.version>
         <cxf.hazelcast.version>1.9.4</cxf.hazelcast.version>
@@ -99,6 +100,7 @@
         <cxf.mina.version>2.0.13</cxf.mina.version>
         <cxf.rx.java.version>1.1.3</cxf.rx.java.version>
         <cxf.javax.annotation-api.version>1.2</cxf.javax.annotation-api.version>
+        <cxf.jcache.version>1.0.0</cxf.jcache.version>
         <cxf.geronimo.jms.version>1.1.1</cxf.geronimo.jms.version>
         <cxf.geronimo.j2ee.management.version>1.0.1</cxf.geronimo.j2ee.management.version>
         <cxf.geronimo.jpa.version>1.0</cxf.geronimo.jpa.version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/2b160783/rt/rs/security/oauth-parent/oauth2/pom.xml
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/pom.xml b/rt/rs/security/oauth-parent/oauth2/pom.xml
index bb8ee54..08f0a1e 100644
--- a/rt/rs/security/oauth-parent/oauth2/pom.xml
+++ b/rt/rs/security/oauth-parent/oauth2/pom.xml
@@ -62,11 +62,18 @@
             <optional>true</optional>
         </dependency>
         <dependency>
-            <groupId>net.sf.ehcache</groupId>
-            <artifactId>ehcache</artifactId>
-            <version>${cxf.ehcache.version}</version>
-            <scope>provided</scope>
-            <optional>true</optional>
+          <groupId>net.sf.ehcache</groupId>
+          <artifactId>ehcache</artifactId>
+          <version>${cxf.ehcache.version}</version>
+          <scope>provided</scope>
+          <optional>true</optional>
+        </dependency>
+        <dependency>
+          <groupId>javax.cache</groupId>
+          <artifactId>cache-api</artifactId>
+          <version>${cxf.jcache.version}</version>
+          <scope>provided</scope>
+          <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
@@ -102,6 +109,12 @@
             <version>${hsqldb.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+          <groupId>org.ehcache</groupId>
+          <artifactId>ehcache</artifactId>
+          <version>${cxf.ehcache3.version}</version>
+          <scope>test</scope>
+        </dependency>
         <!--
         <dependency>
              <groupId>org.apache.openjpa</groupId>
@@ -116,6 +129,12 @@
             <version>${hibernate.em.version}</version>
             <scope>test</scope>
         </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-nop</artifactId>
+        <version>${cxf.slf4j.version}</version>
+        <scope>test</scope>
+      </dependency>
         
      </dependencies>
      <build>

http://git-wip-us.apache.org/repos/asf/cxf/blob/2b160783/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/JCacheCodeDataProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/JCacheCodeDataProvider.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/JCacheCodeDataProvider.java
new file mode 100644
index 0000000..867e99f
--- /dev/null
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/JCacheCodeDataProvider.java
@@ -0,0 +1,126 @@
+/**
+ * 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.rs.security.oauth2.grants.code;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.cache.Cache;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.rs.security.oauth2.common.Client;
+import org.apache.cxf.rs.security.oauth2.common.UserSubject;
+import org.apache.cxf.rs.security.oauth2.provider.JCacheOAuthDataProvider;
+import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
+
+public class JCacheCodeDataProvider extends JCacheOAuthDataProvider
+    implements AuthorizationCodeDataProvider {
+    public static final String CODE_GRANT_CACHE_KEY = "cxf.oauth2.codegrant.cache";
+
+    private long codeLifetime = 10 * 60;
+    private Cache<String, ServerAuthorizationCodeGrant> grantCache;
+
+    protected JCacheCodeDataProvider() throws Exception {
+        this(DEFAULT_CONFIG_URL, BusFactory.getThreadDefaultBus(true));
+    }
+
+    protected JCacheCodeDataProvider(String configFileURL, Bus bus) throws Exception {
+        this(configFileURL, bus, CLIENT_CACHE_KEY, CODE_GRANT_CACHE_KEY,
+             ACCESS_TOKEN_CACHE_KEY, REFRESH_TOKEN_CACHE_KEY);
+    }
+
+    protected JCacheCodeDataProvider(String configFileURL,
+                                     Bus bus,
+                                     String clientCacheKey,
+                                     String codeCacheKey,
+                                     String accessTokenKey,
+                                     String refreshTokenKey) throws Exception {
+        super(configFileURL, bus, clientCacheKey, accessTokenKey, refreshTokenKey);
+        grantCache = createCache(cacheManager, codeCacheKey, String.class, ServerAuthorizationCodeGrant.class);
+    }
+
+    @Override
+    protected void doRemoveClient(Client c) {
+        for (ServerAuthorizationCodeGrant grant : getCodeGrants(c, null)) {
+            removeCodeGrant(grant.getCode());
+        }
+
+        super.doRemoveClient(c);
+    }
+    
+    @Override
+    public ServerAuthorizationCodeGrant createCodeGrant(AuthorizationCodeRegistration reg)
+        throws OAuthServiceException {
+        ServerAuthorizationCodeGrant grant = AbstractCodeDataProvider.initCodeGrant(reg, codeLifetime);
+        grantCache.put(grant.getCode(), grant);
+
+        return grant;
+    }
+
+    @Override
+    public List<ServerAuthorizationCodeGrant> getCodeGrants(Client c, UserSubject sub) {
+        final Set<String> toRemove = new HashSet<>();
+        final List<ServerAuthorizationCodeGrant> grants = new ArrayList<>();
+
+        for (Iterator<Cache.Entry<String, ServerAuthorizationCodeGrant>> it = grantCache.iterator(); it.hasNext();) {
+            Cache.Entry<String, ServerAuthorizationCodeGrant> entry = it.next();
+            ServerAuthorizationCodeGrant grant = entry.getValue();
+
+            if (!isExpired(grant)) {
+                toRemove.add(entry.getKey());
+            } else if (AbstractCodeDataProvider.isCodeMatched(grant, c, sub)) {
+                grants.add(grant);
+            }
+        }
+
+        grantCache.removeAll(toRemove);
+
+        return grants;
+    }
+    
+    @Override
+    public ServerAuthorizationCodeGrant removeCodeGrant(String code) throws OAuthServiceException {
+        ServerAuthorizationCodeGrant grant = getCodeGrant(code);
+        if (grant != null) {
+            grantCache.remove(code);
+        }
+        return grant;
+    }
+
+    public void setCodeLifetime(long codeLifetime) {
+        this.codeLifetime = codeLifetime;
+    }
+
+    protected ServerAuthorizationCodeGrant getCodeGrant(String code) throws OAuthServiceException {
+        ServerAuthorizationCodeGrant grant = grantCache.get(code);
+        if (grant != null && isExpired(grant)) {
+            grantCache.remove(code);
+            grant = null;
+        }
+
+        return grant;
+    }
+
+    protected static boolean isExpired(ServerAuthorizationCodeGrant grant) {
+        return System.currentTimeMillis() < (grant.getIssuedAt() + grant.getExpiresIn());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/2b160783/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProvider.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProvider.java
new file mode 100644
index 0000000..3a2bbb8
--- /dev/null
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProvider.java
@@ -0,0 +1,215 @@
+/**
+ * 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.rs.security.oauth2.provider;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.cache.Cache;
+import javax.cache.CacheManager;
+import javax.cache.Caching;
+import javax.cache.configuration.MutableConfiguration;
+import javax.cache.spi.CachingProvider;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.rs.security.oauth2.common.Client;
+import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
+import org.apache.cxf.rs.security.oauth2.common.UserSubject;
+import org.apache.cxf.rs.security.oauth2.tokens.refresh.RefreshToken;
+
+import static org.apache.cxf.jaxrs.utils.ResourceUtils.getClasspathResourceURL;
+
+public class JCacheOAuthDataProvider extends AbstractOAuthDataProvider {
+    public static final String CLIENT_CACHE_KEY = "cxf.oauth2.client.cache";
+    public static final String ACCESS_TOKEN_CACHE_KEY = "cxf.oauth2.accesstoken.cache";
+    public static final String REFRESH_TOKEN_CACHE_KEY = "cxf.oauth2.refreshtoken.cache";
+    public static final String DEFAULT_CONFIG_URL = "cxf-oauth2-ehcache3.xml";
+
+    protected final CacheManager cacheManager;
+    private final Cache<String, Client> clientCache;
+    private final Cache<String, ServerAccessToken> accessTokenCache;
+    private final Cache<String, RefreshToken> refreshTokenCache;
+
+    public JCacheOAuthDataProvider() throws Exception {
+        this(DEFAULT_CONFIG_URL, BusFactory.getThreadDefaultBus(true));
+    }
+
+    public JCacheOAuthDataProvider(String configFileURL, Bus bus) throws Exception {
+        this(configFileURL, bus, CLIENT_CACHE_KEY, ACCESS_TOKEN_CACHE_KEY, REFRESH_TOKEN_CACHE_KEY);
+    }
+
+    public JCacheOAuthDataProvider(String configFileURL,
+                                          Bus bus,
+                                          String clientCacheKey,
+                                          String accessTokenKey,
+                                          String refreshTokenKey) throws Exception {
+
+        cacheManager = createCacheManager(configFileURL, bus);
+        clientCache = createCache(cacheManager, clientCacheKey, String.class, Client.class);
+        accessTokenCache = createCache(cacheManager, accessTokenKey, String.class, ServerAccessToken.class);
+        refreshTokenCache = createCache(cacheManager, refreshTokenKey, String.class, RefreshToken.class);
+    }
+    
+    @Override
+    public Client getClient(String clientId) throws OAuthServiceException {
+        return clientCache.get(clientId);
+    }
+    
+    public void setClient(Client client) {
+        clientCache.put(client.getClientId(), client);
+    }
+    
+    @Override
+    protected void doRemoveClient(Client c) {
+        clientCache.remove(c.getClientId());
+    }
+
+    @Override
+    public List<Client> getClients(UserSubject resourceOwner) {
+        List<Client> clients = new ArrayList<>();
+        for (Iterator<Cache.Entry<String, Client>> it = clientCache.iterator(); it.hasNext();) {
+            Cache.Entry<String, Client> entry = it.next();
+            Client client = entry.getValue();
+
+            if (isClientMatched(client, resourceOwner)) {
+                clients.add(client);
+            }
+        }
+
+        return clients;
+    }
+
+    @Override
+    public List<ServerAccessToken> getAccessTokens(Client c, UserSubject sub) {
+        return getTokens(accessTokenCache, c, sub);
+    }
+
+    @Override
+    public List<RefreshToken> getRefreshTokens(Client c, UserSubject sub) {
+        return getTokens(refreshTokenCache, c, sub);
+    }
+    
+    @Override
+    public ServerAccessToken getAccessToken(String accessTokenKey) throws OAuthServiceException {
+        return getToken(accessTokenCache, accessTokenKey);
+    }
+
+    @Override
+    protected void doRevokeAccessToken(ServerAccessToken at) {
+        accessTokenCache.remove(at.getTokenKey());
+    }
+
+    @Override
+    protected RefreshToken getRefreshToken(String refreshTokenKey) {
+        return getToken(refreshTokenCache, refreshTokenKey);
+    }
+
+    @Override
+    protected void doRevokeRefreshToken(RefreshToken rt) { 
+        refreshTokenCache.remove(rt.getTokenKey());
+    }
+
+    @Override
+    protected void saveAccessToken(ServerAccessToken serverToken) {
+        accessTokenCache.put(serverToken.getTokenKey(), serverToken);
+    }
+
+    @Override
+    protected void saveRefreshToken(RefreshToken refreshToken) {
+        refreshTokenCache.put(refreshToken.getTokenKey(), refreshToken);
+    }
+
+    @Override
+    public void close() {
+        cacheManager.close();
+    }
+
+    protected static <K, V extends ServerAccessToken> V getToken(Cache<K, V> cache, K key) {
+        V token = cache.get(key);
+        if (token != null && isExpired(token)) {
+            cache.remove(key);
+            token = null;
+        }
+
+        return token;
+    }
+
+    protected static <K, V extends ServerAccessToken> List<V> getTokens(Cache<K, V> cache,
+                                                                      Client client, UserSubject sub) {
+        final Set<K> toRemove = new HashSet<>();
+        final List<V> tokens = new ArrayList<>();
+
+        for (Iterator<Cache.Entry<K, V>> it = cache.iterator(); it.hasNext();) {
+            Cache.Entry<K, V> entry = it.next();
+            V token = entry.getValue();
+
+            if (!isExpired(token)) {
+                toRemove.add(entry.getKey());
+            } else if (isTokenMatched(token, client, sub)) {
+                tokens.add(token);
+            }
+        }
+
+        cache.removeAll(toRemove);
+
+        return tokens;
+    }
+
+    protected static boolean isExpired(ServerAccessToken token) {
+        return System.currentTimeMillis() < (token.getIssuedAt() + token.getExpiresIn());
+    }
+
+    protected static CacheManager createCacheManager(String configFile, Bus bus) throws Exception {
+        if (bus == null) {
+            bus = BusFactory.getThreadDefaultBus(true);
+        }
+
+        CachingProvider provider = Caching.getCachingProvider();
+
+        URI configFileURI;
+        try {
+            configFileURI = getClasspathResourceURL(configFile, JCacheOAuthDataProvider.class, bus).toURI();
+        } catch (Exception ex) {
+            configFileURI = provider.getDefaultURI();
+        }
+
+        return provider.getCacheManager(configFileURI, Thread.currentThread().getContextClassLoader());
+    }
+    
+    protected static <K, V> Cache<K, V> createCache(CacheManager cacheManager,
+                                                    String cacheKey, Class<K> keyType, Class<V> valueType) {
+
+        Cache<K, V> cache = cacheManager.getCache(cacheKey, keyType, valueType);
+        if (cache == null) {
+            cache = cacheManager.createCache(
+                cacheKey,
+                new MutableConfiguration<K, V>()
+                    .setTypes(keyType, valueType)
+                    .setStoreByValue(true)
+                    .setStatisticsEnabled(false)
+            );
+        }
+
+        return cache;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/2b160783/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/grants/code/JCacheCodeDataProviderTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/grants/code/JCacheCodeDataProviderTest.java b/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/grants/code/JCacheCodeDataProviderTest.java
new file mode 100644
index 0000000..eb698b7
--- /dev/null
+++ b/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/grants/code/JCacheCodeDataProviderTest.java
@@ -0,0 +1,105 @@
+/**
+ * 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.rs.security.oauth2.grants.code;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.cxf.rs.security.oauth2.common.Client;
+import org.apache.cxf.rs.security.oauth2.common.UserSubject;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class JCacheCodeDataProviderTest extends Assert {
+    private JCacheCodeDataProvider provider;
+
+    @Before
+    public void setUp() throws Exception {
+        provider = new JCacheCodeDataProvider();
+    }
+
+    @Ignore
+    @Test
+    public void testAddGetDeleteCodeGrants() {
+        Client c = addClient("111", "bob");
+        
+        AuthorizationCodeRegistration atr = new AuthorizationCodeRegistration();
+        atr.setClient(c);
+        atr.setApprovedScope(Collections.singletonList("a"));
+        atr.setSubject(c.getResourceOwnerSubject());
+        
+        ServerAuthorizationCodeGrant grant = provider.createCodeGrant(atr);
+        
+        List<ServerAuthorizationCodeGrant> grants = provider.getCodeGrants(c, c.getResourceOwnerSubject());
+        assertNotNull(grants);
+        assertEquals(1, grants.size());
+        assertEquals(grant.getCode(), grants.get(0).getCode());
+        
+        grants = provider.getCodeGrants(c, null);
+        assertNotNull(grants);
+        assertEquals(1, grants.size());
+        assertEquals(grant.getCode(), grants.get(0).getCode());
+        
+        ServerAuthorizationCodeGrant grant2 = provider.removeCodeGrant(grant.getCode());
+        assertEquals(grant.getCode(), grant2.getCode());
+        
+        grants = provider.getCodeGrants(c, null);
+        assertNotNull(grants);
+        assertEquals(0, grants.size());
+    }
+
+    @Ignore
+    @Test
+    public void testAddGetDeleteCodeGrants2() {
+        Client c = addClient("111", "bob");
+        
+        AuthorizationCodeRegistration atr = new AuthorizationCodeRegistration();
+        atr.setClient(c);
+        atr.setApprovedScope(Collections.singletonList("a"));
+        atr.setSubject(c.getResourceOwnerSubject());
+        
+        provider.createCodeGrant(atr);
+        
+        List<ServerAuthorizationCodeGrant> grants = provider.getCodeGrants(c, c.getResourceOwnerSubject());
+        assertNotNull(grants);
+        assertEquals(1, grants.size());
+        provider.removeClient(c.getClientId());
+        grants = provider.getCodeGrants(c, c.getResourceOwnerSubject());
+        assertNotNull(grants);
+        assertEquals(0, grants.size());
+    }
+    
+    private Client addClient(String clientId, String userLogin) {
+        Client c = new Client();
+        c.setRedirectUris(Collections.singletonList("http://client/redirect"));
+        c.setClientId(clientId);
+        c.setResourceOwnerSubject(new UserSubject(userLogin));
+        provider.setClient(c);
+        return c;
+    }
+    @After
+    public void tearDown() throws Exception {
+        if (provider != null) {
+            provider.close();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/2b160783/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProviderTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProviderTest.java b/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProviderTest.java
new file mode 100644
index 0000000..2ed60ad
--- /dev/null
+++ b/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProviderTest.java
@@ -0,0 +1,217 @@
+/**
+ * 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.rs.security.oauth2.provider;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.cxf.rs.security.oauth2.common.AccessTokenRegistration;
+import org.apache.cxf.rs.security.oauth2.common.Client;
+import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
+import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
+import org.apache.cxf.rs.security.oauth2.common.UserSubject;
+import org.apache.cxf.rs.security.oauth2.tokens.refresh.RefreshToken;
+import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class JCacheOAuthDataProviderTest extends Assert {
+    private JCacheOAuthDataProvider provider;
+
+    @Before
+    public void setUp() throws Exception {
+        provider = new JCacheOAuthDataProvider();
+    }
+
+    @Test
+    public void testAddGetDeleteClient() {
+        Client c = addClient("12345", "alice");
+        Client c2 = provider.getClient(c.getClientId());
+        compareClients(c, c2);
+        
+        c2.setClientSecret("567");
+        provider.setClient(c2);
+        Client c22 = provider.getClient(c.getClientId());
+        compareClients(c2, c22);
+        
+        provider.removeClient(c.getClientId());
+        Client c3 = provider.getClient(c.getClientId());
+        assertNull(c3);
+    }
+    
+    @Test
+    public void testAddGetDeleteClients() {
+        Client c = addClient("12345", "alice");
+        Client c2 = addClient("56789", "alice");
+        Client c3 = addClient("09876", "bob");
+        
+        List<Client> aliceClients = provider.getClients(new UserSubject("alice"));
+        assertNotNull(aliceClients);
+        assertEquals(2, aliceClients.size());
+        compareClients(c, aliceClients.get(0).getClientId().equals("12345") 
+                       ? aliceClients.get(0) : aliceClients.get(1));
+        compareClients(c2, aliceClients.get(0).getClientId().equals("56789") 
+                       ? aliceClients.get(0) : aliceClients.get(1));
+        
+        List<Client> bobClients = provider.getClients(new UserSubject("bob"));
+        assertNotNull(bobClients);
+        assertEquals(1, bobClients.size());
+        Client bobClient = bobClients.get(0);
+        compareClients(c3, bobClient);
+        
+        List<Client> allClients = provider.getClients(null);
+        assertNotNull(allClients);
+        assertEquals(3, allClients.size());
+        provider.removeClient(c.getClientId());
+        provider.removeClient(c2.getClientId());
+        provider.removeClient(c3.getClientId());
+        allClients = provider.getClients(null);
+        assertNotNull(allClients);
+        assertEquals(0, allClients.size());
+    }
+
+    @Ignore
+    @Test
+    public void testAddGetDeleteAccessToken() {
+        Client c = addClient("101", "bob");
+        
+        AccessTokenRegistration atr = new AccessTokenRegistration();
+        atr.setClient(c);
+        atr.setApprovedScope(Collections.singletonList("a"));
+        atr.setSubject(c.getResourceOwnerSubject());
+        
+        ServerAccessToken at = provider.createAccessToken(atr);
+        ServerAccessToken at2 = provider.getAccessToken(at.getTokenKey());
+        assertEquals(at.getTokenKey(), at2.getTokenKey());
+        List<OAuthPermission> scopes = at2.getScopes();
+        assertNotNull(scopes);
+        assertEquals(1, scopes.size());
+        OAuthPermission perm = scopes.get(0);
+        assertEquals("a", perm.getPermission());
+        
+        List<ServerAccessToken> tokens = provider.getAccessTokens(c, c.getResourceOwnerSubject());
+        assertNotNull(tokens);
+        assertEquals(1, tokens.size());
+        assertEquals(at.getTokenKey(), tokens.get(0).getTokenKey());
+        
+        tokens = provider.getAccessTokens(c, null);
+        assertNotNull(tokens);
+        assertEquals(1, tokens.size());
+        assertEquals(at.getTokenKey(), tokens.get(0).getTokenKey());
+        
+        tokens = provider.getAccessTokens(null, c.getResourceOwnerSubject());
+        assertNotNull(tokens);
+        assertEquals(1, tokens.size());
+        assertEquals(at.getTokenKey(), tokens.get(0).getTokenKey());
+        
+        tokens = provider.getAccessTokens(null, null);
+        assertNotNull(tokens);
+        assertEquals(1, tokens.size());
+        assertEquals(at.getTokenKey(), tokens.get(0).getTokenKey());
+        
+        provider.revokeToken(c, at.getTokenKey(), OAuthConstants.ACCESS_TOKEN);
+        assertNull(provider.getAccessToken(at.getTokenKey()));
+    }
+
+    @Ignore
+    @Test
+    public void testAddGetDeleteAccessToken2() {
+        Client c = addClient("102", "bob");
+        
+        AccessTokenRegistration atr = new AccessTokenRegistration();
+        atr.setClient(c);
+        atr.setApprovedScope(Collections.singletonList("a"));
+        atr.setSubject(c.getResourceOwnerSubject());
+        
+        provider.createAccessToken(atr);
+        List<ServerAccessToken> tokens = provider.getAccessTokens(c, null);
+        assertNotNull(tokens);
+        assertEquals(1, tokens.size());
+        
+        provider.removeClient(c.getClientId());
+        
+        tokens = provider.getAccessTokens(c, null);
+        assertNotNull(tokens);
+        assertEquals(0, tokens.size());
+    }
+
+    @Ignore
+    @Test
+    public void testAddGetDeleteRefreshToken() {
+        Client c = addClient("101", "bob");
+        
+        AccessTokenRegistration atr = new AccessTokenRegistration();
+        atr.setClient(c);
+        atr.setApprovedScope(Arrays.asList("a", "refreshToken"));
+        atr.setSubject(c.getResourceOwnerSubject());
+        
+        ServerAccessToken at = provider.createAccessToken(atr);
+        ServerAccessToken at2 = provider.getAccessToken(at.getTokenKey());
+        assertEquals(at.getTokenKey(), at2.getTokenKey());
+        List<OAuthPermission> scopes = at2.getScopes();
+        assertNotNull(scopes);
+        assertEquals(2, scopes.size());
+        OAuthPermission perm = scopes.get(0);
+        assertEquals("a", perm.getPermission());
+        OAuthPermission perm2 = scopes.get(1);
+        assertEquals("refreshToken", perm2.getPermission());
+        
+        RefreshToken rt = provider.getRefreshToken(at2.getRefreshToken());
+        assertNotNull(rt);
+        assertEquals(at2.getTokenKey(), rt.getAccessTokens().get(0));
+        
+        List<RefreshToken> tokens = provider.getRefreshTokens(c, c.getResourceOwnerSubject());
+        assertNotNull(tokens);
+        assertEquals(1, tokens.size());
+        assertEquals(rt.getTokenKey(), tokens.get(0).getTokenKey());
+        
+        provider.revokeToken(c, rt.getTokenKey(), OAuthConstants.REFRESH_TOKEN);
+        
+        assertNull(provider.getRefreshToken(rt.getTokenKey()));
+    }
+    
+    private Client addClient(String clientId, String userLogin) {
+        Client c = new Client();
+        c.setRedirectUris(Collections.singletonList("http://client/redirect"));
+        c.setClientId(clientId);
+        c.setClientSecret("123");
+        c.setResourceOwnerSubject(new UserSubject(userLogin));
+        provider.setClient(c);
+        return c;
+    }
+    private void compareClients(Client c, Client c2) {
+        assertNotNull(c2);
+        assertEquals(c.getClientId(), c2.getClientId());
+        assertEquals(1, c.getRedirectUris().size());
+        assertEquals(1, c2.getRedirectUris().size());
+        assertEquals("http://client/redirect", c.getRedirectUris().get(0));
+        assertEquals(c.getResourceOwnerSubject().getLogin(), c2.getResourceOwnerSubject().getLogin());
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        if (provider != null) {
+            provider.close();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/2b160783/rt/rs/security/oauth-parent/oauth2/src/test/resources/cxf-oauth2-ehcache3.xml
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/test/resources/cxf-oauth2-ehcache3.xml b/rt/rs/security/oauth-parent/oauth2/src/test/resources/cxf-oauth2-ehcache3.xml
new file mode 100644
index 0000000..50ebfae
--- /dev/null
+++ b/rt/rs/security/oauth-parent/oauth2/src/test/resources/cxf-oauth2-ehcache3.xml
@@ -0,0 +1,27 @@
+<config
+    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+    xmlns='http://www.ehcache.org/v3'
+    xmlns:jsr107='http://www.ehcache.org/v3/jsr107'
+    xsi:schemaLocation="
+        http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd">
+
+  <cache alias="cxf.oauth2.client.cache">
+    <key-type>java.lang.String</key-type>
+    <value-type>org.apache.cxf.rs.security.oauth2.common.Client</value-type>
+    <heap unit="entries">100</heap>
+    <jsr107:mbeans enable-management="false" enable-statistics="false"/>
+  </cache>
+  <cache alias="cxf.oauth2.accesstoken.cache">
+    <key-type>java.lang.String</key-type>
+    <value-type>org.apache.cxf.rs.security.oauth2.common.ServerAccessToken</value-type>
+    <heap unit="entries">100</heap>
+    <jsr107:mbeans enable-management="false" enable-statistics="false"/>
+  </cache>
+  <cache alias="cxf.oauth2.refreshtoken.cache">
+    <key-type>java.lang.String</key-type>
+    <value-type>org.apache.cxf.rs.security.oauth2.tokens.refresh.RefreshToken</value-type>
+    <heap unit="entries">100</heap>
+    <jsr107:mbeans enable-management="false" enable-statistics="false"/>
+  </cache>
+
+</config>
\ No newline at end of file


[45/50] [abbrv] cxf git commit: [CXF-6646] CXF 3.x WSRM Replace RewindableInputStream with CachedOutputStream

Posted by re...@apache.org.
[CXF-6646] CXF 3.x WSRM Replace RewindableInputStream with CachedOutputStream


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e8530930
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e8530930
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e8530930

Branch: refs/heads/master-jaxrs-2.1
Commit: e8530930045a5784fb1ed1f5b58658d7baae2238
Parents: 9ea9fac
Author: Kai Rommel <ka...@sap.com>
Authored: Wed May 4 02:45:38 2016 +0200
Committer: Akitoshi Yoshida <ay...@apache.org>
Committed: Wed May 25 16:19:39 2016 +0200

----------------------------------------------------------------------
 .../apache/cxf/ws/rm/DestinationSequence.java   |  7 +--
 .../cxf/ws/rm/RMCaptureInInterceptor.java       |  6 +--
 .../cxf/ws/rm/RMCaptureOutInterceptor.java      | 13 ++++--
 .../apache/cxf/ws/rm/RMMessageConstants.java    |  6 ++-
 .../cxf/ws/rm/persistence/PersistenceUtils.java | 48 +++++++++++++++-----
 .../apache/cxf/ws/rm/persistence/RMMessage.java | 14 +++---
 .../cxf/ws/rm/persistence/jdbc/RMTxStore.java   | 18 +++++++-
 .../cxf/ws/rm/soap/RetransmissionQueueImpl.java | 43 ++++++++++++++----
 .../org/apache/cxf/ws/rm/RMManagerTest.java     | 22 ++++++---
 .../ws/rm/persistence/PersistenceUtilsTest.java | 22 ++++++---
 .../ws/rm/persistence/RMLargeMessageTest.java   |  4 --
 .../cxf/ws/rm/persistence/RMMessageTest.java    | 16 +------
 .../rm/persistence/jdbc/RMTxStoreTestBase.java  | 25 +++++++---
 13 files changed, 167 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
index 2e1a54b..58b7906 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
@@ -33,6 +33,7 @@ import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.continuations.Continuation;
 import org.apache.cxf.continuations.ContinuationProvider;
 import org.apache.cxf.continuations.SuspendedInvocationException;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
@@ -167,9 +168,9 @@ public class DestinationSequence extends AbstractSequence {
             RMMessage msg = null;
             if (!MessageUtils.isTrue(message.getContextualProperty(Message.ROBUST_ONEWAY))) {
                 msg = new RMMessage();
-                RewindableInputStream in = (RewindableInputStream)message.get(RMMessageConstants.SAVED_CONTENT);
-                in.rewind();
-                msg.setContent(in);
+                CachedOutputStream cos = (CachedOutputStream)message.get(RMMessageConstants.SAVED_CONTENT);
+                msg.setContent(cos);
+                msg.setContentType((String) message.get(Message.CONTENT_TYPE));
                 msg.setMessageNumber(st.getMessageNumber());
             }
             store.persistIncoming(this, msg);

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java
index 40b4fab..9d48cbc 100755
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java
@@ -57,9 +57,9 @@ public class RMCaptureInInterceptor extends AbstractRMInterceptor<Message> {
                     saved.lockOutputStream();
 
                     LOG.fine("Capturing the original RM message");
-                    RewindableInputStream ris = RewindableInputStream.makeRewindable(saved.getInputStream());
-                    message.setContent(InputStream.class, ris);
-                    message.put(RMMessageConstants.SAVED_CONTENT, ris);
+                    //RewindableInputStream ris = RewindableInputStream.makeRewindable(saved.getInputStream());
+                    message.setContent(InputStream.class, saved.getInputStream());
+                    message.put(RMMessageConstants.SAVED_CONTENT, saved);
                 } catch (Exception e) {
                     throw new Fault(e);
                 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureOutInterceptor.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureOutInterceptor.java
index c0ca125..4514e03 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureOutInterceptor.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureOutInterceptor.java
@@ -19,8 +19,8 @@
 
 package org.apache.cxf.ws.rm;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -35,10 +35,12 @@ import org.apache.cxf.binding.Binding;
 import org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
 import org.apache.cxf.interceptor.AttachmentOutInterceptor;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.FaultMode;
@@ -255,8 +257,11 @@ public class RMCaptureOutInterceptor extends AbstractRMInterceptor<Message>  {
                 }
                 
                 // save message for potential retransmission
-                ByteArrayInputStream bis = cw.getOutputStream().createInputStream();
-                message.put(RMMessageConstants.SAVED_CONTENT, RewindableInputStream.makeRewindable(bis));
+                CachedOutputStream cos = new CachedOutputStream();
+                IOUtils.copyAndCloseInput(cw.getOutputStream().createInputStream(), cos);
+                cos.flush();
+                InputStream is = cos.getInputStream();
+                message.put(RMMessageConstants.SAVED_CONTENT, cos);
                 RMManager manager = getManager();
                 manager.getRetransmissionQueue().start();
                 manager.getRetransmissionQueue().addUnacknowledged(message);
@@ -276,7 +281,7 @@ public class RMCaptureOutInterceptor extends AbstractRMInterceptor<Message>  {
                     }
                     // serializes the message content and the attachments into
                     // the RMMessage content
-                    PersistenceUtils.encodeRMContent(msg, message, bis);
+                    PersistenceUtils.encodeRMContent(msg, message, is);
                     store.persistOutgoing(ss, msg);
                 }
                     

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMMessageConstants.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMMessageConstants.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMMessageConstants.java
index eb6789c..15999e9 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMMessageConstants.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMMessageConstants.java
@@ -36,8 +36,12 @@ public final class RMMessageConstants {
     
     public static final String ORIGINAL_REQUESTOR_ROLE = "org.apache.cxf.client.original";
     
-    /** Message content (must be an instance of {@link RewindableInputStream}. */
+    /** Message content must be an instance of {@link CachedOutputStream}. */
     public static final String SAVED_CONTENT = "org.apache.cxf.ws.rm.content";
+
+    /** Variable holds reference to source streams of the attachments.
+     * It must be an instance of {@link Closeable}. */
+    public static final String ATTACHMENTS_CLOSEABLE = "org.apache.cxf.ws.rm.attachment.closeable";
     
     /** Retransmission in progress flag (Boolean.TRUE if in progress). */
     public static final String RM_RETRANSMISSION = "org.apache.cxf.ws.rm.retransmitting";

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
index 0981f8e..43f01d9 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.ws.rm.persistence;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -38,7 +39,6 @@ import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.ws.rm.RMMessageConstants;
-import org.apache.cxf.ws.rm.RewindableInputStream;
 import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement;
 
 /**
@@ -105,13 +105,14 @@ public final class PersistenceUtils {
 
     public static void encodeRMContent(RMMessage rmmsg, Message msg, InputStream msgContent)
         throws IOException {
+        CachedOutputStream cos = new CachedOutputStream();
         if (msg.getAttachments() == null) {
             rmmsg.setContentType((String)msg.get(Message.CONTENT_TYPE));
-            rmmsg.setContent(msgContent);
+            IOUtils.copyAndCloseInput(msgContent, cos);
+            cos.flush();
+            rmmsg.setContent(cos);
         } else {
             MessageImpl msgImpl1 = new MessageImpl();
-            // using cached output stream to handle large files
-            CachedOutputStream cos = new CachedOutputStream();
             msgImpl1.setContent(OutputStream.class, cos);
             msgImpl1.setAttachments(msg.getAttachments());
             msgImpl1.put(Message.CONTENT_TYPE, (String) msg.get(Message.CONTENT_TYPE));
@@ -121,26 +122,49 @@ public final class PersistenceUtils {
             serializer.writeProlog();
             // write soap root message into cached output stream
             IOUtils.copyAndCloseInput(msgContent, cos);
+            cos.flush();
             serializer.writeAttachments();
             rmmsg.setContentType((String) msgImpl1.get(Message.CONTENT_TYPE));
-
-            //TODO will pass the cos instance to rmmessage in the future
-            rmmsg.setContent(cos.getInputStream());
+            rmmsg.setContent(cos);
         }
     }
 
     public static void decodeRMContent(RMMessage rmmsg, Message msg) throws IOException {
         String contentType = rmmsg.getContentType();
+        final CachedOutputStream cos = rmmsg.getContent();
         if ((null != contentType) && contentType.startsWith("multipart/related")) {
+            final InputStream is = cos.getInputStream();
             msg.put(Message.CONTENT_TYPE, contentType);
-            msg.setContent(InputStream.class, rmmsg.getContent());
+            msg.setContent(InputStream.class, is);
             AttachmentDeserializer ad = new AttachmentDeserializer(msg);
             ad.initializeAttachments();
+            // create new cos with soap envelope only
+            CachedOutputStream cosSoap = new CachedOutputStream();
+            IOUtils.copy(msg.getContent(InputStream.class), cosSoap);
+            cosSoap.flush();
+            msg.put(RMMessageConstants.SAVED_CONTENT, cosSoap);
+            // REVISIT -- At the moment references must be hold for retransmission
+            // and the final cleanup of the CachedOutputStream.  
+            msg.put(RMMessageConstants.ATTACHMENTS_CLOSEABLE, new Closeable() {
+
+                @Override
+                public void close() throws IOException {
+                    try {
+                        is.close();
+                    } catch (IOException e) {
+                        // Ignore
+                    }
+                    try {
+                        cos.close();
+                    } catch (IOException e) {
+                        // Ignore
+                    }                   
+                }
+                
+            });
         } else {
-            msg.setContent(InputStream.class, rmmsg.getContent());
+            msg.put(RMMessageConstants.SAVED_CONTENT, cos);
         }
-        InputStream is = RewindableInputStream.makeRewindable(msg.getContent(InputStream.class));
-        msg.setContent(InputStream.class, is);
-        msg.put(RMMessageConstants.SAVED_CONTENT, is);
     }
+
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java
index abab221..348117c 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java
@@ -22,9 +22,11 @@ import java.io.InputStream;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.cxf.io.CachedOutputStream;
+
 public class RMMessage {
     
-    private InputStream content;
+    private CachedOutputStream content;
     //TODO remove attachments when we remove the deprecated attachments related methods
     private List<InputStream> attachments = Collections.emptyList();
     private String contentType;
@@ -48,11 +50,11 @@ public class RMMessage {
     }
     
     /**
-     * Sets the message content using the input stream.
+     * Sets the message content using the CachedOutputStream.class.
      * @param in
      */
-    public void setContent(InputStream in) {
-        content = in;
+    public void setContent(CachedOutputStream cos) {
+        content = cos;
     }
     
     /**
@@ -73,11 +75,11 @@ public class RMMessage {
     }
 
     /**
-     * Returns the input stream of this message content.
+     * Returns the CachedOutputStream of this message content.
      * @return
      * @throws IOException
      */
-    public InputStream getContent() {
+    public CachedOutputStream getContent() {
         return content;
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
index 7e626a5..641df46 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
@@ -51,6 +51,8 @@ import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.SystemPropertyAction;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.rm.DestinationSequence;
 import org.apache.cxf.ws.rm.ProtocolVariation;
@@ -599,7 +601,10 @@ public class RMTxStore implements RMStore {
                 RMMessage msg = new RMMessage();
                 msg.setMessageNumber(mn);
                 msg.setTo(to);
-                msg.setContent(blob.getBinaryStream());
+                CachedOutputStream cos = new CachedOutputStream();
+                IOUtils.copyAndCloseInput(blob.getBinaryStream(), cos);
+                cos.flush();
+                msg.setContent(cos);
                 msg.setContentType(contentType);
                 msgs.add(msg);
             }
@@ -607,6 +612,9 @@ public class RMTxStore implements RMStore {
             conex = ex;
             LOG.log(Level.WARNING, new Message(outbound ? "SELECT_OUTBOUND_MSGS_FAILED_MSG"
                 : "SELECT_INBOUND_MSGS_FAILED_MSG", LOG).toString(), ex);
+        } catch (IOException e) {
+            abort(con);
+            throw new RMStoreException(e);
         } finally {
             releaseResources(stmt, res);
             updateConnectionState(con, conex);
@@ -735,8 +743,10 @@ public class RMTxStore implements RMStore {
                     new Object[] {outbound ? "outbound" : "inbound", nr, id, to});
         }
         PreparedStatement stmt = null;
+        CachedOutputStream cos = msg.getContent();
+        InputStream msgin = null;
         try {
-            InputStream msgin = msg.getContent();
+            msgin = cos.getInputStream();
             stmt = getStatement(con, outbound ? CREATE_OUTBOUND_MESSAGE_STMT_STR : CREATE_INBOUND_MESSAGE_STMT_STR);
 
             stmt.setString(1, id);
@@ -751,6 +761,10 @@ public class RMTxStore implements RMStore {
             }
         } finally  {
             releaseResources(stmt, null);
+            if (null != msgin) {
+                msgin.close();
+            }
+            cos.close(); // needed to clean-up tmp file folder
         }
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
index 223430e..5ae80dd 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
@@ -19,6 +19,9 @@
 
 package org.apache.cxf.ws.rm.soap;
 
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
@@ -57,6 +60,7 @@ import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.io.CachedOutputStreamCallback;
 import org.apache.cxf.io.WriteOnCloseOutputStream;
 import org.apache.cxf.message.Message;
@@ -91,7 +95,6 @@ import org.apache.cxf.ws.rm.RMProperties;
 import org.apache.cxf.ws.rm.RMUtils;
 import org.apache.cxf.ws.rm.RetransmissionQueue;
 import org.apache.cxf.ws.rm.RetryStatus;
-import org.apache.cxf.ws.rm.RewindableInputStream;
 import org.apache.cxf.ws.rm.SourceSequence;
 import org.apache.cxf.ws.rm.manager.RetryPolicyType;
 import org.apache.cxf.ws.rm.persistence.RMStore;
@@ -585,10 +588,24 @@ public class RetransmissionQueueImpl implements RetransmissionQueue {
         }
 
         private void releaseSavedMessage() {
-            RewindableInputStream is = (RewindableInputStream)message.get(RMMessageConstants.SAVED_CONTENT);
-            if (is != null) {
-                is.release();
+            CachedOutputStream cos = (CachedOutputStream)message.get(RMMessageConstants.SAVED_CONTENT);
+            if (cos != null) {
+                cos.releaseTempFileHold();
+                try {
+                    cos.close();
+                } catch (IOException e) {
+                    // ignore
+                }
             }
+            // REVISIT -- When reference holder is not needed anymore, code can be removed.
+            Closeable closeable = (Closeable)message.get(RMMessageConstants.ATTACHMENTS_CLOSEABLE);
+            if (closeable != null) {
+                try {
+                    closeable.close();
+                } catch (IOException e) {
+                    // ignore
+                }
+            }           
         }
 
         /**
@@ -760,8 +777,9 @@ public class RetransmissionQueueImpl implements RetransmissionQueue {
             }
             
             // read SOAP headers from saved input stream
-            RewindableInputStream is = (RewindableInputStream)message.get(RMMessageConstants.SAVED_CONTENT);
-            is.rewind();
+            CachedOutputStream cos = (CachedOutputStream)message.get(RMMessageConstants.SAVED_CONTENT);
+            cos.holdTempFile(); // CachedOutputStream is hold until delivering was successful
+            InputStream is = cos.getInputStream(); // instance is needed to close input stream later on
             XMLStreamReader reader = StaxUtils.createXMLStreamReader(is, StandardCharsets.UTF_8.name());
             message.getHeaders().clear();
             if (reader.getEventType() != XMLStreamConstants.START_ELEMENT
@@ -814,7 +832,7 @@ public class RetransmissionQueueImpl implements RetransmissionQueue {
                     retransmitChain.remove(incept);
                 }
             }
-            retransmitChain.add(new CopyOutInterceptor(reader));
+            retransmitChain.add(new CopyOutInterceptor(reader, is));
             
             // restore callbacks on output stream
             if (callbacks != null) {
@@ -922,10 +940,12 @@ public class RetransmissionQueueImpl implements RetransmissionQueue {
     
     public static class CopyOutInterceptor extends AbstractOutDatabindingInterceptor {
         private final XMLStreamReader reader;
+        private InputStream is;
         
-        public CopyOutInterceptor(XMLStreamReader rdr) {
+        public CopyOutInterceptor(XMLStreamReader rdr, InputStream is) {
             super(Phase.MARSHAL);
             reader = rdr;
+            this.is = is;
         }
         
         @Override
@@ -933,6 +953,13 @@ public class RetransmissionQueueImpl implements RetransmissionQueue {
             try {
                 XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
                 StaxUtils.copy(reader, writer);
+                if (is != null) {
+                    try {
+                        is.close();
+                    } catch (IOException e) {
+                        // ignore
+                    }
+                }
             } catch (XMLStreamException e) {
                 throw new Fault("COULD_NOT_READ_XML_STREAM", LOG, e);
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
index 645708a..37fb6ac 100644
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
@@ -41,6 +41,8 @@ import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.Service;
@@ -505,7 +507,7 @@ public class RMManagerTest extends Assert {
     }
     
     @Test
-    public void testRecoverReliableClientEndpoint() throws NoSuchMethodException {
+    public void testRecoverReliableClientEndpoint() throws NoSuchMethodException, IOException {
         Method method = RMManager.class.getDeclaredMethod("createReliableEndpoint", 
             new Class[] {Endpoint.class});
         manager = control.createMock(RMManager.class, new Method[] {method});
@@ -563,7 +565,10 @@ public class RMManagerTest extends Assert {
         DestinationSequence ds = control.createMock(DestinationSequence.class);
         RMMessage m1 = new RMMessage();
         InputStream fis = getClass().getResourceAsStream("persistence/SerializedRMMessage.txt");
-        m1.setContent(fis);
+        CachedOutputStream cos = new CachedOutputStream();
+        IOUtils.copyAndCloseInput(fis, cos);
+        cos.flush();
+        m1.setContent(cos);
         m1.setTo("toAddress");
         m1.setMessageNumber(new Long(10));
         m1.setContentType(MULTIPART_TYPE);
@@ -579,8 +584,8 @@ public class RMManagerTest extends Assert {
         assertNotNull(msg.getExchange());
         assertSame(msg, msg.getExchange().getOutMessage());
 
-        InputStream is = (InputStream) msg.get(RMMessageConstants.SAVED_CONTENT);
-        assertStartsWith(is, "<soap:Envelope");
+        CachedOutputStream cos1 = (CachedOutputStream) msg.get(RMMessageConstants.SAVED_CONTENT);
+        assertStartsWith(cos1.getInputStream(), "<soap:Envelope");
         assertEquals(1, msg.getAttachments().size());
     }
     
@@ -673,7 +678,8 @@ public class RMManagerTest extends Assert {
     void setUpRecoverReliableEndpoint(Endpoint endpoint,
                                       Conduit conduit, 
                                       SourceSequence ss, 
-                                      DestinationSequence ds, RMMessage m, Capture<Message> mc)  {                
+                                      DestinationSequence ds, RMMessage m, Capture<Message> mc) 
+                                          throws IOException  {                
         RMStore store = control.createMock(RMStore.class);
         RetransmissionQueue queue = control.createMock(RetransmissionQueue.class);
         manager.setStore(store);
@@ -735,7 +741,11 @@ public class RMManagerTest extends Assert {
             EasyMock.expect(m.getTo()).andReturn("toAddress");
         }
         InputStream is = new ByteArrayInputStream(new byte[0]);
-        EasyMock.expect(m.getContent()).andReturn(is).anyTimes();
+        CachedOutputStream cos = new CachedOutputStream();
+        IOUtils.copy(is, cos);
+        cos.flush();
+        is.close();
+        EasyMock.expect(m.getContent()).andReturn(cos).anyTimes();
 
         if (mc != null) {
             queue.addUnacknowledged(EasyMock.capture(mc));

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/PersistenceUtilsTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/PersistenceUtilsTest.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/PersistenceUtilsTest.java
index c0667fb..9cccd2a 100644
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/PersistenceUtilsTest.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/PersistenceUtilsTest.java
@@ -29,9 +29,12 @@ import javax.activation.DataHandler;
 import javax.mail.util.ByteArrayDataSource;
 
 import org.apache.cxf.attachment.AttachmentImpl;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.ws.rm.RMMessageConstants;
 import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement;
 import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement.AcknowledgementRange;
 
@@ -76,7 +79,7 @@ public class PersistenceUtilsTest extends Assert {
         // update rmmessage
         PersistenceUtils.encodeRMContent(rmmsg, messageImpl, bis);
 
-        assertStartsWith(rmmsg.getContent(), "<soap:");
+        assertStartsWith(rmmsg.getContent().getInputStream(), "<soap:");
         assertNotNull(rmmsg.getContentType());
         assertTrue(rmmsg.getContentType().startsWith("text/xml"));
     }
@@ -93,7 +96,7 @@ public class PersistenceUtilsTest extends Assert {
         // update rmmessage
         PersistenceUtils.encodeRMContent(rmmsg, messageImpl, bis);
 
-        assertStartsWith(rmmsg.getContent(), "--uuid:");
+        assertStartsWith(rmmsg.getContent().getInputStream(), "--uuid:");
         assertNotNull(rmmsg.getContentType());
         assertTrue(rmmsg.getContentType().startsWith("multipart/related"));
     }
@@ -112,21 +115,26 @@ public class PersistenceUtilsTest extends Assert {
         Message messageImplRestored = new MessageImpl();
         PersistenceUtils.decodeRMContent(rmmsg, messageImplRestored);
         assertEquals(1, messageImplRestored.getAttachments().size());
-
-        assertStartsWith(messageImplRestored.getContent(InputStream.class), SOAP_PART);
+        CachedOutputStream cos = (CachedOutputStream)messageImplRestored.get(RMMessageConstants.SAVED_CONTENT);
+        assertStartsWith(cos.getInputStream(), SOAP_PART);
     }
     
     @Test
     public void testDecodeRMContentWithAttachment() throws Exception {
         InputStream is = getClass().getResourceAsStream("SerializedRMMessage.txt");
+        CachedOutputStream cos = new CachedOutputStream();
+        IOUtils.copyAndCloseInput(is, cos);
+        cos.flush();
         RMMessage msg = new RMMessage();
-        msg.setContent(is);      
+        msg.setContent(cos);      
         msg.setContentType(MULTIPART_TYPE);
         Message messageImpl = new MessageImpl();
         PersistenceUtils.decodeRMContent(msg, messageImpl);
 
         assertEquals(1, messageImpl.getAttachments().size());
-        assertStartsWith(messageImpl.getContent(InputStream.class), "<soap:Envelope");
+        CachedOutputStream cos1 =  (CachedOutputStream)messageImpl
+            .get(RMMessageConstants.SAVED_CONTENT);
+        assertStartsWith(cos1.getInputStream(), "<soap:Envelope");
     }
 
     private static void addAttachment(Message msg) throws IOException {
@@ -137,7 +145,7 @@ public class PersistenceUtilsTest extends Assert {
         msg.setAttachments(attachments);
     }
 
-    // just read the begining of the input and compare it against the specified string
+    // just read the beginning of the input and compare it against the specified string
     private static boolean assertStartsWith(InputStream in, String starting) {
         assertNotNull(in);
         byte[] buf = new byte[starting.length()];

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/RMLargeMessageTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/RMLargeMessageTest.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/RMLargeMessageTest.java
index 5badbe6..bf5c246 100644
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/RMLargeMessageTest.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/RMLargeMessageTest.java
@@ -46,10 +46,6 @@ public class RMLargeMessageTest extends RMMessageTest {
         }
     }
     
-    @Test
-    public void testContentInputStream() throws Exception {
-        super.testContentInputStream();
-    }
     
     @Test
     public void testContentCachedOutputStream() throws Exception {

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/RMMessageTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/RMMessageTest.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/RMMessageTest.java
index 41322ff..1247f80 100644
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/RMMessageTest.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/RMMessageTest.java
@@ -19,8 +19,6 @@
 
 package org.apache.cxf.ws.rm.persistence;
 
-import java.io.ByteArrayInputStream;
-
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.CachedOutputStream;
 
@@ -49,23 +47,13 @@ public class RMMessageTest extends Assert {
     }
     
     @Test
-    public void testContentInputStream() throws Exception {
-        RMMessage msg = new RMMessage();
-        msg.setContent(new ByteArrayInputStream(DATA));
-        
-        byte[] msgbytes = IOUtils.readBytesFromStream(msg.getContent());
-        
-        assertArrayEquals(DATA, msgbytes);
-    }
-    
-    @Test
     public void testContentCachedOutputStream() throws Exception {
         RMMessage msg = new RMMessage();
         CachedOutputStream co = new CachedOutputStream();
         co.write(DATA);
-        msg.setContent(co.getInputStream());
+        msg.setContent(co);
         
-        byte[] msgbytes = IOUtils.readBytesFromStream(msg.getContent());
+        byte[] msgbytes = IOUtils.readBytesFromStream(msg.getContent().getInputStream());
         
         assertArrayEquals(DATA, msgbytes);
         co.close();

http://git-wip-us.apache.org/repos/asf/cxf/blob/e8530930/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTestBase.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTestBase.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTestBase.java
index fb62f34..a5f9723 100644
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTestBase.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTestBase.java
@@ -30,6 +30,7 @@ import java.util.Date;
 import java.util.List;
 
 import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.addressing.Names;
 import org.apache.cxf.ws.rm.DestinationSequence;
@@ -222,8 +223,13 @@ public abstract class RMTxStoreTestBase extends Assert {
         EasyMock.expect(msg1.getMessageNumber()).andReturn(ONE).anyTimes(); 
         EasyMock.expect(msg2.getMessageNumber()).andReturn(ONE).anyTimes(); 
         byte[] bytes = new byte[89];
-        EasyMock.expect(msg1.getContent()).andReturn(new ByteArrayInputStream(bytes)).anyTimes();
-        EasyMock.expect(msg2.getContent()).andReturn(new ByteArrayInputStream(bytes)).anyTimes();
+        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        CachedOutputStream cos = new CachedOutputStream();
+        IOUtils.copy(bais, cos);
+        cos.flush();
+        bais.close();
+        EasyMock.expect(msg1.getContent()).andReturn(cos).anyTimes();
+        EasyMock.expect(msg2.getContent()).andReturn(cos).anyTimes();
         EasyMock.expect(msg1.getContentType()).andReturn("text/xml").times(1);
         control.replay();
 
@@ -241,7 +247,7 @@ public abstract class RMTxStoreTestBase extends Assert {
         
         control.reset();
         EasyMock.expect(msg1.getMessageNumber()).andReturn(ONE); 
-        EasyMock.expect(msg1.getContent()).andReturn(new ByteArrayInputStream(bytes));
+        EasyMock.expect(msg1.getContent()).andReturn(cos);
         
         control.replay();
         con = getConnection();
@@ -260,8 +266,8 @@ public abstract class RMTxStoreTestBase extends Assert {
         control.reset();
         EasyMock.expect(msg1.getMessageNumber()).andReturn(TEN).anyTimes();
         EasyMock.expect(msg2.getMessageNumber()).andReturn(TEN).anyTimes(); 
-        EasyMock.expect(msg1.getContent()).andReturn(new ByteArrayInputStream(bytes)).anyTimes(); 
-        EasyMock.expect(msg2.getContent()).andReturn(new ByteArrayInputStream(bytes)).anyTimes(); 
+        EasyMock.expect(msg1.getContent()).andReturn(cos).anyTimes(); 
+        EasyMock.expect(msg2.getContent()).andReturn(cos).anyTimes(); 
 
         control.replay();
         con = getConnection();
@@ -862,7 +868,12 @@ public abstract class RMTxStoreTestBase extends Assert {
 
         EasyMock.expect(msg.getContentType()).andReturn("text/xml").anyTimes();
         byte[] value = ("Message " + mn.longValue()).getBytes();
-        EasyMock.expect(msg.getContent()).andReturn(new ByteArrayInputStream(value)).anyTimes();
+        ByteArrayInputStream bais = new ByteArrayInputStream(value);
+        CachedOutputStream cos = new CachedOutputStream();
+        IOUtils.copy(bais, cos);
+        cos.flush();
+        bais.close();
+        EasyMock.expect(msg.getContent()).andReturn(cos).anyTimes();
         return msg;
     }
 
@@ -926,7 +937,7 @@ public abstract class RMTxStoreTestBase extends Assert {
                 assertNull(msg.getTo());
             }
             try {
-                InputStream actual = msg.getContent();
+                InputStream actual = msg.getContent().getInputStream();
                 assertEquals(new String("Message " + mn), IOUtils.readStringFromStream(actual));
             } catch (IOException e) {
                 fail("failed to get the input stream");


[22/50] [abbrv] cxf git commit: [CXF-6908] Adding testcase

Posted by re...@apache.org.
[CXF-6908] Adding testcase


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ffa81f69
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ffa81f69
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ffa81f69

Branch: refs/heads/master-jaxrs-2.1
Commit: ffa81f69c90a6287429631b7da2eb0390f5608f4
Parents: e28b6d2
Author: Alessio Soldano <as...@redhat.com>
Authored: Fri May 20 21:36:40 2016 +0200
Committer: Alessio Soldano <as...@redhat.com>
Committed: Fri May 20 21:37:23 2016 +0200

----------------------------------------------------------------------
 .../systest/ws/security/SecurityPolicyTest.java | 68 ++++++++++++++++++++
 .../cxf/systest/ws/security/DoubleIt.wsdl       |  3 +
 2 files changed, 71 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ffa81f69/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
index 4ab13d7..fb0eea0 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
@@ -29,6 +29,8 @@ import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.UnsupportedCallbackException;
 import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.BindingProvider;
@@ -39,6 +41,7 @@ import javax.xml.ws.Service;
 import javax.xml.ws.Service.Mode;
 import javax.xml.ws.ServiceMode;
 import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.soap.SOAPFaultException;
 import javax.xml.xpath.XPathConstants;
 
 import org.w3c.dom.Document;
@@ -79,6 +82,8 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
             + PORT + "/SecPolTestSignThenEncrypt";
     public static final String POLICY_SIGNENC_PROVIDER_ADDRESS 
         = "http://localhost:" + PORT + "/SecPolTestSignThenEncryptProvider";
+    public static final String POLICY_FAULT_SIGNENC_PROVIDER_ADDRESS 
+    = "http://localhost:" + PORT + "/SecPolTestFaultSignThenEncryptProvider";
     public static final String POLICY_SIGN_ADDRESS = "http://localhost:" + PORT + "/SecPolTestSign";
     public static final String POLICY_XPATH_ADDRESS = "http://localhost:" + PORT + "/SecPolTestXPath";
     public static final String POLICY_SIGNONLY_ADDRESS = "http://localhost:" + PORT + "/SecPolTestSignedOnly";
@@ -164,6 +169,12 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
         ei = ep.getServer().getEndpoint().getEndpointInfo(); 
         setCryptoProperties(ei, "bob.properties", "alice.properties");
         
+        ep = (EndpointImpl)Endpoint.publish(POLICY_FAULT_SIGNENC_PROVIDER_ADDRESS,
+                                            new DoubleItFaultProvider());
+        
+        ei = ep.getServer().getEndpoint().getEndpointInfo(); 
+        setCryptoProperties(ei, "bob.properties", "alice.properties");
+        
         ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
         ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortSignedOnly"));
         ep.setWsdlLocation(wsdl.getPath());
@@ -468,6 +479,28 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
         
     }
     
+    @WebServiceProvider(targetNamespace = "http://www.example.org/contract/DoubleIt",
+                        portName = "DoubleItFaultPortSignThenEncrypt",
+                        serviceName = "DoubleItService",
+                        wsdlLocation = "classpath:/org/apache/cxf/systest/ws/security/DoubleIt.wsdl")
+    @ServiceMode(value = Mode.MESSAGE)
+    public static class DoubleItFaultProvider implements Provider<SOAPMessage> {
+
+        public SOAPMessage invoke(SOAPMessage request) {
+            try {
+                MessageFactory messageFactory = MessageFactory.newInstance();
+                SOAPMessage msg = messageFactory.createMessage();
+                msg.getSOAPBody().addFault(new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server"),
+                                           "Foo");
+                return msg;
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            return null;
+        }
+
+    }
+
     @Test
     public void testCXF3041() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
@@ -666,4 +699,39 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
         epBus.shutdown(true);
         bus.shutdown(true);
     }
+    
+    @Test
+    public void testFault() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+
+        URL busFile = SecurityPolicyTest.class.getResource("https_config_client.xml");
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL wsdl = SecurityPolicyTest.class.getResource("DoubleIt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        
+        QName portQName = new QName(NAMESPACE, "DoubleItFaultPortSignThenEncrypt");
+        DoubleItPortType pt = service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(pt, PORT);
+        ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, 
+                                                      new KeystorePasswordCallback());
+        ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
+                                                      "alice.properties");
+        ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, 
+                                                      "bob.properties");
+        
+        // DOM
+        try {
+            pt.doubleIt(5);
+            fail("SOAPFaultException expected!");
+        } catch (SOAPFaultException e) {
+            assertEquals("Foo", e.getFault().getFaultString());
+        } finally {
+            ((java.io.Closeable)pt).close();
+            bus.shutdown(true);
+        }
+    }
+    
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/ffa81f69/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl
index f478fa6..20f2f2e 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl
@@ -246,6 +246,9 @@
         <wsdl:port name="DoubleItPortSignThenEncrypt" binding="tns:DoubleItBindingSignThenEncrypt">
             <soap:address location="http://localhost:9010/SecPolTestSignThenEncrypt"/>
         </wsdl:port>
+        <wsdl:port name="DoubleItFaultPortSignThenEncrypt" binding="tns:DoubleItBindingSignThenEncrypt">
+            <soap:address location="http://localhost:9010/SecPolTestFaultSignThenEncryptProvider"/>
+        </wsdl:port>
         <wsdl:port name="DoubleItPortSign" binding="tns:DoubleItBindingSign">
             <soap:address location="http://localhost:9010/SecPolTestSign"/>
         </wsdl:port>


[24/50] [abbrv] cxf git commit: [ENTESB-6912]introduce CONNECTION_MAX_IDLE property for AHC

Posted by re...@apache.org.
[ENTESB-6912]introduce CONNECTION_MAX_IDLE property for AHC


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/501922f3
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/501922f3
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/501922f3

Branch: refs/heads/master-jaxrs-2.1
Commit: 501922f3722a9cdd9577e253cee3386d40025ea4
Parents: 0c2fb8f
Author: Freeman Fang <fr...@gmail.com>
Authored: Mon May 23 14:50:01 2016 +0800
Committer: Freeman Fang <fr...@gmail.com>
Committed: Mon May 23 14:50:01 2016 +0800

----------------------------------------------------------------------
 .../asyncclient/AsyncHTTPConduitFactory.java    | 38 ++++++++++++++++++++
 1 file changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/501922f3/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
index 6434fec..f905b92 100644
--- a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
+++ b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
@@ -78,6 +78,7 @@ public class AsyncHTTPConduitFactory implements HTTPConduitFactory {
     public static final String MAX_PER_HOST_CONNECTIONS 
         = "org.apache.cxf.transport.http.async.MAX_PER_HOST_CONNECTIONS";
     public static final String CONNECTION_TTL = "org.apache.cxf.transport.http.async.CONNECTION_TTL";
+    public static final String CONNECTION_MAX_IDLE = "org.apache.cxf.transport.http.async.CONNECTION_MAX_IDLE";
     
     //AsycClient specific props
     public static final String THREAD_COUNT = "org.apache.cxf.transport.http.async.ioThreadCount";
@@ -121,6 +122,7 @@ public class AsyncHTTPConduitFactory implements HTTPConduitFactory {
     int maxConnections = 5000;
     int maxPerRoute = 1000;
     int connectionTTL = 60000;
+    int connectionMaxIdle = 60000;
 
     int ioThreadCount = IOReactorConfig.DEFAULT.getIoThreadCount();
     long selectInterval = IOReactorConfig.DEFAULT.getSelectInterval();
@@ -179,6 +181,7 @@ public class AsyncHTTPConduitFactory implements HTTPConduitFactory {
         
         maxConnections = getInt(s.get(MAX_CONNECTIONS), maxConnections);
         connectionTTL = getInt(s.get(CONNECTION_TTL), connectionTTL);
+        connectionMaxIdle = getInt(s.get(CONNECTION_MAX_IDLE), connectionMaxIdle);
         maxPerRoute = getInt(s.get(MAX_PER_HOST_CONNECTIONS), maxPerRoute);
 
         if (connectionManager != null) {
@@ -371,6 +374,11 @@ public class AsyncHTTPConduitFactory implements HTTPConduitFactory {
         client = httpAsyncClientBuilder.build();
         // Start the client thread
         client.start();
+        if (this.connectionTTL == 0) {
+            //if the connection does not have an expiry deadline
+            //use the ConnectionMaxIdle to close the idle connection
+            new CloseIdleConnectionThread(connectionManager, client).start();
+        }
     }
 
     //provide a hook to customize the builder
@@ -384,4 +392,34 @@ public class AsyncHTTPConduitFactory implements HTTPConduitFactory {
         return client;
     }
 
+    public class CloseIdleConnectionThread extends Thread {
+
+        private final PoolingNHttpClientConnectionManager connMgr;
+
+        private final CloseableHttpAsyncClient client;
+
+        public CloseIdleConnectionThread(PoolingNHttpClientConnectionManager connMgr,
+                                     CloseableHttpAsyncClient client) {
+            super();
+            this.connMgr = connMgr;
+            this.client = client;
+        }
+
+        @Override
+        public void run() {
+            try {
+                while (client.isRunning()) {
+                    synchronized (this) {
+                        sleep(connectionMaxIdle);
+                        // close connections
+                        // that have been idle longer than specified connectionMaxIdle
+                        connMgr.closeIdleConnections(connectionMaxIdle, TimeUnit.MILLISECONDS);
+                    }
+                }
+            } catch (InterruptedException ex) {
+                // terminate
+            }
+        }
+        
+    }
 }


[28/50] [abbrv] cxf git commit: Fixing OidcHybridService to return id token (and c_hash claim) in all cases when it is needed

Posted by re...@apache.org.
Fixing OidcHybridService to return id token (and c_hash claim) in all cases when it is needed


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f9a42a52
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f9a42a52
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f9a42a52

Branch: refs/heads/master-jaxrs-2.1
Commit: f9a42a528f4edfa7bcc62d5885eebaeb25224cec
Parents: e2f9b7d
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Mon May 23 16:55:47 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Mon May 23 16:55:47 2016 +0100

----------------------------------------------------------------------
 .../grants/code/AbstractCodeDataProvider.java   |  1 +
 .../code/AuthorizationCodeGrantHandler.java     |  1 +
 .../code/AuthorizationCodeRegistration.java     |  7 +++
 .../code/ServerAuthorizationCodeGrant.java      |  9 +++
 .../services/AuthorizationCodeGrantService.java | 20 +------
 .../oidc/idp/IdTokenResponseFilter.java         |  8 ++-
 .../rs/security/oidc/idp/OidcHybridService.java | 16 +++---
 .../cxf/rs/security/oidc/utils/OidcUtils.java   |  1 +
 .../jaxrs/security/oidc/OIDCFlowTest.java       | 59 ++++++++++++++++----
 9 files changed, 86 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/f9a42a52/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AbstractCodeDataProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AbstractCodeDataProvider.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AbstractCodeDataProvider.java
index 9b5c3df..c69b7bc 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AbstractCodeDataProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AbstractCodeDataProvider.java
@@ -60,6 +60,7 @@ public abstract class AbstractCodeDataProvider extends AbstractOAuthDataProvider
         grant.setRequestedScopes(reg.getRequestedScope());
         grant.setApprovedScopes(reg.getApprovedScope());
         grant.setAudience(reg.getAudience());
+        grant.setResponseType(reg.getResponseType());
         grant.setClientCodeChallenge(reg.getClientCodeChallenge());
         grant.setNonce(reg.getNonce());
         grant.getExtraProperties().putAll(reg.getExtraProperties());

http://git-wip-us.apache.org/repos/asf/cxf/blob/f9a42a52/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AuthorizationCodeGrantHandler.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AuthorizationCodeGrantHandler.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AuthorizationCodeGrantHandler.java
index 8427c7e..7da48ef 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AuthorizationCodeGrantHandler.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AuthorizationCodeGrantHandler.java
@@ -138,6 +138,7 @@ public class AuthorizationCodeGrantHandler extends AbstractGrantHandler {
             reg.setApprovedScope(Collections.emptyList());
         }
         reg.setAudiences(audiences);
+        reg.setResponseType(grant.getResponseType());
         reg.setClientCodeVerifier(codeVerifier);
         reg.setGrantType(OAuthConstants.CODE_RESPONSE_TYPE);
         return getDataProvider().createAccessToken(reg);

http://git-wip-us.apache.org/repos/asf/cxf/blob/f9a42a52/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AuthorizationCodeRegistration.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AuthorizationCodeRegistration.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AuthorizationCodeRegistration.java
index 269e24e..c65cbf7 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AuthorizationCodeRegistration.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/AuthorizationCodeRegistration.java
@@ -38,6 +38,7 @@ public class AuthorizationCodeRegistration {
     private UserSubject subject;
     private String audience;
     private String nonce;
+    private String responseType;
     private String clientCodeChallenge;
     private boolean preauthorizedTokenAvailable;
     private Map<String, String> extraProperties = new LinkedHashMap<String, String>();
@@ -148,4 +149,10 @@ public class AuthorizationCodeRegistration {
     public void setExtraProperties(Map<String, String> extraProperties) {
         this.extraProperties = extraProperties;
     }
+    public String getResponseType() {
+        return responseType;
+    }
+    public void setResponseType(String responseType) {
+        this.responseType = responseType;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f9a42a52/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/ServerAuthorizationCodeGrant.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/ServerAuthorizationCodeGrant.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/ServerAuthorizationCodeGrant.java
index eee307d..932d690 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/ServerAuthorizationCodeGrant.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/ServerAuthorizationCodeGrant.java
@@ -47,6 +47,7 @@ public class ServerAuthorizationCodeGrant extends AuthorizationCodeGrant {
     private List<String> requestedScopes = new LinkedList<String>();
     private UserSubject subject;
     private String audience;
+    private String responseType;
     private String clientCodeChallenge;
     private String nonce;
     private boolean preauthorizedTokenAvailable;
@@ -196,4 +197,12 @@ public class ServerAuthorizationCodeGrant extends AuthorizationCodeGrant {
     public void setExtraProperties(Map<String, String> extraProperties) {
         this.extraProperties = extraProperties;
     }
+
+    public String getResponseType() {
+        return responseType;
+    }
+
+    public void setResponseType(String responseType) {
+        this.responseType = responseType;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f9a42a52/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
index 9efee12..5ec47d7 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
@@ -108,7 +108,7 @@ public class AuthorizationCodeGrantService extends RedirectionBasedGrantService
             OOBAuthorizationResponse oobResponse = new OOBAuthorizationResponse();
             oobResponse.setClientId(client.getClientId());
             oobResponse.setClientDescription(client.getApplicationDescription());
-            oobResponse.setAuthorizationCode(grant.getCode());
+            oobResponse.setAuthorizationCode(grantCode);
             oobResponse.setUserId(userSubject.getLogin());
             oobResponse.setExpiresIn(grant.getExpiresIn());
             return deliverOOBResponse(oobResponse);
@@ -120,7 +120,7 @@ public class AuthorizationCodeGrantService extends RedirectionBasedGrantService
         }
     }
     
-    protected ServerAuthorizationCodeGrant getGrantRepresentation(OAuthRedirectionState state,
+    public ServerAuthorizationCodeGrant getGrantRepresentation(OAuthRedirectionState state,
                            Client client,
                            List<String> requestedScope,
                            List<String> approvedScope,
@@ -141,21 +141,6 @@ public class AuthorizationCodeGrantService extends RedirectionBasedGrantService
         return grant;
     }
     
-    public String getGrantCode(OAuthRedirectionState state,
-                               Client client,
-                               List<String> requestedScope,
-                               List<String> approvedScope,
-                               UserSubject userSubject,
-                               ServerAccessToken preauthorizedToken) {
-        ServerAuthorizationCodeGrant grant =  getGrantRepresentation(state,
-                                      client,
-                                      requestedScope,
-                                      approvedScope,
-                                      userSubject,
-                                      preauthorizedToken);
-        return processCodeGrant(client, grant.getCode(), grant.getSubject());
-    }
-    
     protected AuthorizationCodeRegistration createCodeRegistration(OAuthRedirectionState state, 
                                                                    Client client, 
                                                                    List<String> requestedScope, 
@@ -167,6 +152,7 @@ public class AuthorizationCodeGrantService extends RedirectionBasedGrantService
         codeReg.setClient(client);
         codeReg.setRedirectUri(state.getRedirectUri());
         codeReg.setRequestedScope(requestedScope);
+        codeReg.setResponseType(state.getResponseType());
         codeReg.setApprovedScope(getApprovedScope(requestedScope, approvedScope));
         codeReg.setSubject(userSubject);
         codeReg.setAudience(state.getAudience());

http://git-wip-us.apache.org/repos/asf/cxf/blob/f9a42a52/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
index 74daf71..ecf019b 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
@@ -45,7 +45,11 @@ public class IdTokenResponseFilter extends OAuthServerJoseJwtProducer implements
     @Override
     public void process(ClientAccessToken ct, ServerAccessToken st) {
         if (st.getResponseType() != null
-            && OidcUtils.CODE_AT_RESPONSE_TYPE.equals(st.getResponseType())) {
+            && OidcUtils.CODE_AT_RESPONSE_TYPE.equals(st.getResponseType())
+            && OidcUtils.HYBRID_FLOW.equals(st.getGrantType())) {
+            // token post-processing as part of the current hybrid (implicit) flow
+            // so no id_token is returned now - however when the code gets exchanged later on
+            // this filter will add id_token to the returned access token
             return;
         }
         // Only add an IdToken if the client has the "openid" scope
@@ -84,7 +88,7 @@ public class IdTokenResponseFilter extends OAuthServerJoseJwtProducer implements
         String rType = st.getResponseType();
         boolean atHashRequired = idToken.getAccessTokenHash() == null
             && (rType == null || !rType.equals(OidcUtils.ID_TOKEN_RESPONSE_TYPE));
-        boolean cHashRequired = idToken.getAuthorizationCodeHash() == null && st.getGrantCode() != null 
+        boolean cHashRequired = idToken.getAuthorizationCodeHash() == null 
             && rType != null 
             && (rType.equals(OidcUtils.CODE_ID_TOKEN_AT_RESPONSE_TYPE)
                 || rType.equals(OidcUtils.CODE_ID_TOKEN_RESPONSE_TYPE));

http://git-wip-us.apache.org/repos/asf/cxf/blob/f9a42a52/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
index a77a0e4..c7dca0f 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
@@ -31,6 +31,7 @@ import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthRedirectionState;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
 import org.apache.cxf.rs.security.oauth2.common.UserSubject;
+import org.apache.cxf.rs.security.oauth2.grants.code.ServerAuthorizationCodeGrant;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
 
@@ -42,7 +43,7 @@ public class OidcHybridService extends OidcImplicitService {
         this(false);
     }
     public OidcHybridService(boolean hybridOnly) {
-        super(getResponseTypes(hybridOnly), "hybrid");
+        super(getResponseTypes(hybridOnly), OidcUtils.HYBRID_FLOW);
     }
     
     private static Set<String> getResponseTypes(boolean hybridOnly) {
@@ -72,19 +73,20 @@ public class OidcHybridService extends OidcImplicitService {
                                    List<String> approvedScope,
                                    UserSubject userSubject,
                                    ServerAccessToken preAuthorizedToken) {
-        String code = null;
+        ServerAuthorizationCodeGrant codeGrant = null;
         if (state.getResponseType() != null && state.getResponseType().startsWith(OAuthConstants.CODE_RESPONSE_TYPE)) {
-            code = codeService.getGrantCode(state, client, requestedScope,
-                                                   approvedScope, userSubject, preAuthorizedToken);
-            JAXRSUtils.getCurrentMessage().getExchange().put(OAuthConstants.AUTHORIZATION_CODE_VALUE, code);
+            codeGrant = codeService.getGrantRepresentation(
+                state, client, requestedScope, approvedScope, userSubject, preAuthorizedToken);
+            JAXRSUtils.getCurrentMessage().getExchange().put(OAuthConstants.AUTHORIZATION_CODE_VALUE, 
+                                                             codeGrant.getCode());
         }
         
         StringBuilder sb = super.prepareGrant(state, client, requestedScope, 
                                                           approvedScope, userSubject, preAuthorizedToken);
    
-        if (code != null) {
+        if (codeGrant != null) {
             sb.append("&");
-            sb.append(OAuthConstants.AUTHORIZATION_CODE_VALUE).append("=").append(code);
+            sb.append(OAuthConstants.AUTHORIZATION_CODE_VALUE).append("=").append(codeGrant.getCode());
         }
         return sb;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f9a42a52/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
index b29e16a..1f717c1 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
@@ -46,6 +46,7 @@ public final class OidcUtils {
     public static final String CODE_ID_TOKEN_RESPONSE_TYPE = "code id_token";
     public static final String CODE_ID_TOKEN_AT_RESPONSE_TYPE = "code id_token token";
     
+    public static final String HYBRID_FLOW = "hybrid";
     
     public static final String ID_TOKEN = "id_token";
     public static final String OPENID_SCOPE = "openid";

http://git-wip-us.apache.org/repos/asf/cxf/blob/f9a42a52/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
index bcf0db6..f6f5a39 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
@@ -50,6 +50,7 @@ import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils.Autho
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.TestUtil;
 import org.apache.wss4j.common.util.Loader;
+
 import org.junit.Assert;
 import org.junit.BeforeClass;
 
@@ -438,6 +439,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
         String address = "https://localhost:" + PORT + "/services/";
         WebClient client = WebClient.create(address, OAuth2TestUtils.setupProviders(), 
                                             "alice", "security", busFile.toString());
+        WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(100000000);
         // Save the Cookie for the second request...
         WebClient.getConfig(client).getRequestContext().put(
             org.apache.cxf.message.Message.MAINTAIN_SESSION, Boolean.TRUE);
@@ -461,6 +463,10 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
         String idToken = OAuth2TestUtils.getSubstring(location, "id_token");
         assertNotNull(idToken);
         validateIdToken(idToken, "123456789");
+        // check the code hash is returned from the implicit authorization endpoint
+        JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
+        JwtToken jwt = jwtConsumer.getJwtToken();
+        Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
         
         // Now get the access token
         client = WebClient.create(address, OAuth2TestUtils.setupProviders(), 
@@ -478,10 +484,10 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
         idToken = accessToken.getParameters().get("id_token");
         assertNotNull(idToken);
         validateIdToken(idToken, null);
-        
-        // JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
-        // JwtToken jwt = jwtConsumer.getJwtToken();
-        // TODO Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
+        // check the code hash is returned from the token endpoint
+        jwtConsumer = new JwsJwtCompactConsumer(idToken);
+        jwt = jwtConsumer.getJwtToken();
+        Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
     }
     
     @org.junit.Test
@@ -505,14 +511,42 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
       
         String location = OAuth2TestUtils.getLocation(client, parameters);
         assertNotNull(location);
-        
+                
         // Check code
         String code = OAuth2TestUtils.getSubstring(location, "code");
         assertNotNull(code);
         
+        // Check id_token
+        String idToken = OAuth2TestUtils.getSubstring(location, "id_token");
+        assertNull(idToken);
+        
         // Check Access Token
-        String accessToken = OAuth2TestUtils.getSubstring(location, "access_token");
-        assertNotNull(accessToken);
+        String implicitAccessToken = OAuth2TestUtils.getSubstring(location, "access_token");
+        assertNotNull(implicitAccessToken);
+        
+        idToken = OAuth2TestUtils.getSubstring(location, "id_token");
+        assertNull(idToken);
+        
+        // Now get the access token with the code
+        client = WebClient.create(address, OAuth2TestUtils.setupProviders(), 
+                                  "consumer-id", "this-is-a-secret", busFile.toString());
+        // Save the Cookie for the second request...
+        WebClient.getConfig(client).getRequestContext().put(
+            org.apache.cxf.message.Message.MAINTAIN_SESSION, Boolean.TRUE);
+        
+        ClientAccessToken accessToken = 
+            OAuth2TestUtils.getAccessTokenWithAuthorizationCode(client, code);
+        assertNotNull(accessToken.getTokenKey());
+        assertTrue(accessToken.getApprovedScope().contains("openid"));
+        
+        // Check id_token from the token endpoint
+        idToken = accessToken.getParameters().get("id_token");
+        assertNotNull(idToken);
+        validateIdToken(idToken, null);
+        // check the code hash is returned from the token endpoint
+        JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
+        // returning c_hash in the id_token returned after exchanging the code is optional
+        Assert.assertNull(jwtConsumer.getJwtClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
     }
     
     @org.junit.Test
@@ -546,15 +580,20 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
         assertNotNull(idToken);
         validateIdToken(idToken, "123456789");
         
+        // check the code hash is returned from the implicit authorization endpoint
+        JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
+        JwtToken jwt = jwtConsumer.getJwtToken();
+        Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
+        
         // Check Access Token
         String accessToken = OAuth2TestUtils.getSubstring(location, "access_token");
         assertNotNull(accessToken);
         
-        JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
-        JwtToken jwt = jwtConsumer.getJwtToken();
+        jwtConsumer = new JwsJwtCompactConsumer(idToken);
+        jwt = jwtConsumer.getJwtToken();
         Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.ACCESS_TOKEN_HASH_CLAIM));
         OidcUtils.validateAccessTokenHash(accessToken, jwt, true);
-        // TODO Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
+        Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
     }
     
     @org.junit.Test


[21/50] [abbrv] cxf git commit: Fix pmd errors

Posted by re...@apache.org.
Fix pmd errors


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e28b6d24
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e28b6d24
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e28b6d24

Branch: refs/heads/master-jaxrs-2.1
Commit: e28b6d244e80234e8e7b24eccb0072bcd1d32888
Parents: 9b21bb9
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri May 20 15:16:10 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri May 20 15:16:10 2016 -0400

----------------------------------------------------------------------
 .../java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e28b6d24/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
index 3b28754..3acb598 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
@@ -77,11 +77,11 @@ public class StaxSerializer extends AbstractSerializer {
                         for (int i = 0; i < atts.getLength(); ++i) {
                             Node att = atts.item(i);
                             String nodeName = att.getNodeName();
-                            if ((nodeName.equals("xmlns") || nodeName.startsWith("xmlns:"))
+                            if (("xmlns".equals(nodeName) || nodeName.startsWith("xmlns:"))
                                 && !storedNamespaces.containsKey(att.getNodeName())) {
                                 
                                 String prefix = att.getLocalName();
-                                if (prefix.equals("xmlns")) {
+                                if ("xmlns".equals(prefix)) {
                                     prefix = "";
                                 }
                                 prefix = ic.intern(prefix);
@@ -156,7 +156,7 @@ public class StaxSerializer extends AbstractSerializer {
                     for (int i = 0; i < atts.getLength(); ++i) {
                         Node att = atts.item(i);
                         String nodeName = att.getNodeName();
-                        if ((nodeName.equals("xmlns") || nodeName.startsWith("xmlns:"))
+                        if (("xmlns".equals(nodeName) || nodeName.startsWith("xmlns:"))
                                 && !storedNamespaces.containsKey(att.getNodeName())) {
                             outputStreamWriter.write(" ");
                             outputStreamWriter.write(nodeName);


[12/50] [abbrv] cxf git commit: Checking the access token hash in the tests

Posted by re...@apache.org.
Checking the access token hash in the tests


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/bf43b5f7
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/bf43b5f7
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/bf43b5f7

Branch: refs/heads/master-jaxrs-2.1
Commit: bf43b5f75aff033af98c3f87c65d7e68cba9f5cb
Parents: 3cfc25d
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu May 19 17:15:51 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu May 19 17:15:51 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java   | 5 ++++-
 .../apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java    | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/bf43b5f7/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
index 26e8bcb..b29e16a 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
@@ -114,8 +114,11 @@ public final class OidcUtils {
         validateAccessTokenHash(at, jwt, true);
     }
     public static void validateAccessTokenHash(ClientAccessToken at, JwtToken jwt, boolean required) {
+        validateAccessTokenHash(at.getTokenKey(), jwt, required);
+    }
+    public static void validateAccessTokenHash(String accessToken, JwtToken jwt, boolean required) {
         if (required) {
-            validateHash(at.getTokenKey(),
+            validateHash(accessToken,
                          (String)jwt.getClaims().getClaim(IdToken.ACCESS_TOKEN_HASH_CLAIM),
                          jwt.getJwsHeaders().getSignatureAlgorithm());
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bf43b5f7/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
index d4ebb9c..bcf0db6 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
@@ -44,6 +44,7 @@ import org.apache.cxf.rs.security.jose.jwt.JwtToken;
 import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
 import org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData;
 import org.apache.cxf.rs.security.oidc.common.IdToken;
+import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
 import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
 import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils.AuthorizationCodeParameters;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -368,6 +369,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
         JwtToken jwt = jwtConsumer.getJwtToken();
         Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.ACCESS_TOKEN_HASH_CLAIM));
         Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.NONCE_CLAIM));
+        OidcUtils.validateAccessTokenHash(accessToken, jwt, true);
     }
     
     @org.junit.Test
@@ -551,6 +553,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
         JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
         JwtToken jwt = jwtConsumer.getJwtToken();
         Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.ACCESS_TOKEN_HASH_CLAIM));
+        OidcUtils.validateAccessTokenHash(accessToken, jwt, true);
         // TODO Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
     }
     


[07/50] [abbrv] cxf git commit: Checkstyle fix

Posted by re...@apache.org.
Checkstyle fix


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9c5bf8a0
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9c5bf8a0
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9c5bf8a0

Branch: refs/heads/master-jaxrs-2.1
Commit: 9c5bf8a061bff7cc956d092a1a02261f37aceca2
Parents: dfc84b0
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed May 18 11:16:13 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed May 18 11:16:13 2016 +0100

----------------------------------------------------------------------
 .../apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java   | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9c5bf8a0/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
index 879ec0d..71e7bb3 100644
--- a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
+++ b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
@@ -27,8 +27,6 @@ import java.util.Map;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-import javax.xml.soap.SOAPMessage;
-
 import org.w3c.dom.Document;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor;
@@ -39,7 +37,6 @@ import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptor;
 import org.apache.cxf.phase.PhaseInterceptorChain;
-import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.ws.security.wss4j.CryptoCoverageChecker.XPathExpression;
 import org.apache.cxf.ws.security.wss4j.CryptoCoverageUtil.CoverageScope;
 import org.apache.cxf.ws.security.wss4j.CryptoCoverageUtil.CoverageType;


[44/50] [abbrv] cxf git commit: OAuth2/OIDC authorization endpoint needs to return errors to the client with the redirect URI unless it is invalid

Posted by re...@apache.org.
OAuth2/OIDC authorization endpoint needs to return errors to the client with the redirect URI unless it is invalid


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9ea9fac6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9ea9fac6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9ea9fac6

Branch: refs/heads/master-jaxrs-2.1
Commit: 9ea9fac627efc1255d0ad7723ba1025917b7b37b
Parents: d243c99
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed May 25 14:26:51 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed May 25 14:26:51 2016 +0100

----------------------------------------------------------------------
 .../services/RedirectionBasedGrantService.java  | 79 ++++++++++----------
 .../oidc/idp/OidcAuthorizationCodeService.java  |  7 +-
 .../security/oidc/idp/OidcImplicitService.java  |  9 ++-
 3 files changed, 50 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9ea9fac6/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
index 8e45c36..92f7c1c 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
@@ -38,7 +38,6 @@ import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData;
-import org.apache.cxf.rs.security.oauth2.common.OAuthError;
 import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
 import org.apache.cxf.rs.security.oauth2.common.OAuthRedirectionState;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
@@ -126,20 +125,21 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
         Client client = getClient(params);
         // Create a UserSubject representing the end user 
         UserSubject userSubject = createUserSubject(sc, params);
-        return startAuthorization(params, userSubject, client);
-    }
-        
-    protected Response startAuthorization(MultivaluedMap<String, String> params, 
-                                          UserSubject userSubject,
-                                          Client client) {    
         
         if (authorizationFilter != null) {
             params = authorizationFilter.process(params, userSubject, client);
         }
-        
         // Validate the provided request URI, if any, against the ones Client provided
         // during the registration
-        String redirectUri = validateRedirectUri(client, params.getFirst(OAuthConstants.REDIRECT_URI)); 
+        String redirectUri = validateRedirectUri(client, params.getFirst(OAuthConstants.REDIRECT_URI));
+        
+        return startAuthorization(params, userSubject, client, redirectUri);
+    }
+    
+    protected Response startAuthorization(MultivaluedMap<String, String> params, 
+                                          UserSubject userSubject,
+                                          Client client,
+                                          String redirectUri) {    
         
         // Enforce the client confidentiality requirements
         if (!OAuthUtils.isGrantSupportedForClient(client, canSupportPublicClient(client), supportedGrantType)) {
@@ -156,30 +156,25 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
         // Get the requested scopes
         String providedScope = params.getFirst(OAuthConstants.SCOPE);
         List<String> requestedScope = null;
+        List<OAuthPermission> requestedPermissions = null;
         try {
             requestedScope = OAuthUtils.getRequestedScopes(client, 
                                                            providedScope,
                                                            useAllClientScopes,
                                                            partialMatchScopeValidation);
-        } catch (OAuthServiceException ex) {
-            LOG.log(Level.FINE, "Error parsing scopes", ex);
-            return createErrorResponse(params, redirectUri, OAuthConstants.INVALID_SCOPE);
-        }
-        // Convert the requested scopes to OAuthPermission instances
-        List<OAuthPermission> requestedPermissions = null;
-        try {
             requestedPermissions = getDataProvider().convertScopeToPermissions(client, requestedScope);
         } catch (OAuthServiceException ex) {
-            LOG.log(Level.FINE, "Error converting scopes into OAuthPermissions", ex);
+            LOG.log(Level.FINE, "Error processing scopes", ex);
             return createErrorResponse(params, redirectUri, OAuthConstants.INVALID_SCOPE);
         }
+        
         // Validate the audience
         String clientAudience = params.getFirst(OAuthConstants.CLIENT_AUDIENCE);
         // Right now if the audience parameter is set it is expected to be contained
         // in the list of Client audiences set at the Client registration time.
         if (!OAuthUtils.validateAudience(clientAudience, client.getRegisteredAudiences())) {
             LOG.fine("Error validating audience parameter");
-            throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
+            return createErrorResponse(params, redirectUri, OAuthConstants.INVALID_REQUEST);
         }
     
         // Request a new grant only if no pre-authorized token is available
@@ -199,31 +194,39 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
                 preAuthorizedToken = null;
             }
         }
-        final boolean authorizationCanBeSkipped = preAuthorizationComplete 
-            || canAuthorizationBeSkipped(params, client, userSubject, requestedScope, requestedPermissions);
-        
-        // Populate the authorization challenge data 
-        OAuthAuthorizationData data = 
-            createAuthorizationData(client, params, redirectUri, userSubject,  
-                                    requestedPermissions, 
-                                    alreadyAuthorizedPerms, 
-                                    authorizationCanBeSkipped);
         
-        if (authorizationCanBeSkipped) {
-            getMessageContext().put(AUTHORIZATION_REQUEST_PARAMETERS, params);
-            List<OAuthPermission> approvedScopes = 
-                preAuthorizationComplete ? preAuthorizedToken.getScopes() : requestedPermissions; 
-            return createGrant(data,
-                               client, 
-                               requestedScope,
-                               OAuthUtils.convertPermissionsToScopeList(approvedScopes),
-                               userSubject,
-                               preAuthorizedToken);
+        Response finalResponse = null;
+        try {
+            final boolean authorizationCanBeSkipped = preAuthorizationComplete 
+                || canAuthorizationBeSkipped(params, client, userSubject, requestedScope, requestedPermissions);
+            
+            // Populate the authorization challenge data 
+            OAuthAuthorizationData data = createAuthorizationData(client, params, redirectUri, userSubject,  
+                                        requestedPermissions, 
+                                        alreadyAuthorizedPerms, 
+                                        authorizationCanBeSkipped);
+            
+            if (authorizationCanBeSkipped) {
+                getMessageContext().put(AUTHORIZATION_REQUEST_PARAMETERS, params);
+                List<OAuthPermission> approvedScopes = 
+                    preAuthorizationComplete ? preAuthorizedToken.getScopes() : requestedPermissions; 
+                finalResponse = createGrant(data,
+                                            client, 
+                                            requestedScope,
+                                            OAuthUtils.convertPermissionsToScopeList(approvedScopes),
+                                            userSubject,
+                                            preAuthorizedToken);
+            } else {
+                finalResponse = Response.ok(data).build();
+            }
+        } catch (OAuthServiceException ex) {
+            finalResponse = createErrorResponse(params, redirectUri, ex.getError().getError());
         }
         
-        return Response.ok(data).build();
+        return finalResponse;
         
     }
+    //CHECKSTYLE:OFF
     
     public Set<String> getSupportedResponseTypes() {
         return supportedResponseTypes;

http://git-wip-us.apache.org/repos/asf/cxf/blob/9ea9fac6/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
index 519361c..e44c526 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcAuthorizationCodeService.java
@@ -67,15 +67,16 @@ public class OidcAuthorizationCodeService extends AuthorizationCodeGrantService
     @Override
     protected Response startAuthorization(MultivaluedMap<String, String> params, 
                                           UserSubject userSubject,
-                                          Client client) {    
+                                          Client client,
+                                          String redirectUri) {    
         // Validate the prompt - if it contains "none" then an error is returned with any other value
         List<String> promptValues = OidcUtils.getPromptValues(params);
         if (promptValues != null && promptValues.size() > 1 && promptValues.contains(OidcUtils.PROMPT_NONE_VALUE)) {
             LOG.log(Level.FINE, "The prompt value {} is invalid", params.getFirst(OidcUtils.PROMPT_PARAMETER));
-            throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
+            return createErrorResponse(params, redirectUri, OAuthConstants.INVALID_REQUEST);
         }
         
-        return super.startAuthorization(params, userSubject, client);
+        return super.startAuthorization(params, userSubject, client, redirectUri);
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/9ea9fac6/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
index 03f626f..b5b2a6c 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
@@ -68,21 +68,22 @@ public class OidcImplicitService extends ImplicitGrantService {
     @Override
     protected Response startAuthorization(MultivaluedMap<String, String> params, 
                                           UserSubject userSubject,
-                                          Client client) {    
+                                          Client client,
+                                          String redirectUri) {    
         // Validate the nonce, it must be present for the Implicit flow
         if (params.getFirst(OAuthConstants.NONCE) == null) {
             LOG.fine("A nonce is required for the Implicit flow");
-            throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
+            return createErrorResponse(params, redirectUri, OAuthConstants.INVALID_REQUEST);
         }
         
         // Validate the prompt - if it contains "none" then an error is returned with any other value
         List<String> promptValues = OidcUtils.getPromptValues(params);
         if (promptValues.size() > 1 && promptValues.contains(OidcUtils.PROMPT_NONE_VALUE)) {
             LOG.log(Level.FINE, "The prompt value {} is invalid", params.getFirst(OidcUtils.PROMPT_PARAMETER));
-            throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
+            return createErrorResponse(params, redirectUri, OAuthConstants.INVALID_REQUEST);
         }
         
-        return super.startAuthorization(params, userSubject, client);
+        return super.startAuthorization(params, userSubject, client, redirectUri);
     }
     
     @Override


[10/50] [abbrv] cxf git commit: Another test

Posted by re...@apache.org.
Another test


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/62130bce
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/62130bce
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/62130bce

Branch: refs/heads/master-jaxrs-2.1
Commit: 62130bce80cd5615bfd5e901a35beba50c10be69
Parents: be273b0
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed May 18 17:04:49 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed May 18 17:04:49 2016 +0100

----------------------------------------------------------------------
 .../jaxrs/security/oidc/OIDCFlowTest.java       |  1 -
 .../jaxrs/security/oidc/OIDCNegativeTest.java   | 54 ++++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/62130bce/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
index 16a37ec..d4ebb9c 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
@@ -480,7 +480,6 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
         // JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
         // JwtToken jwt = jwtConsumer.getJwtToken();
         // TODO Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
-        // TODO Assert.assertNull(jwt.getClaims().getClaim(IdToken.ACCESS_TOKEN_HASH_CLAIM));
     }
     
     @org.junit.Test

http://git-wip-us.apache.org/repos/asf/cxf/blob/62130bce/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
index ce3dd30..3f5d247 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
@@ -181,6 +181,60 @@ public class OIDCNegativeTest extends AbstractBusClientServerTestBase {
     }
     
     @org.junit.Test
+    public void testImplicitFlowNoATHash() throws Exception {
+        URL busFile = OIDCFlowTest.class.getResource("client.xml");
+        
+        String address = "https://localhost:" + PORT + "/services/";
+        WebClient client = WebClient.create(address, OAuth2TestUtils.setupProviders(), 
+                                            "alice", "security", busFile.toString());
+        // Save the Cookie for the second request...
+        WebClient.getConfig(client).getRequestContext().put(
+            org.apache.cxf.message.Message.MAINTAIN_SESSION, Boolean.TRUE);
+       
+        // Get Access Token
+        client.type("application/json").accept("application/json");
+        client.query("client_id", "consumer-id");
+        client.query("redirect_uri", "http://www.blah.apache.org");
+        client.query("scope", "openid");
+        client.query("response_type", "id_token");
+        client.query("nonce", "1234565635");
+        client.query("max_age", "300");
+        client.path("authorize-implicit/");
+        Response response = client.get();
+        
+        OAuthAuthorizationData authzData = response.readEntity(OAuthAuthorizationData.class);
+        
+        // Now call "decision" to get the access token
+        client.path("decision");
+        client.type("application/x-www-form-urlencoded");
+        
+        Form form = new Form();
+        form.param("session_authenticity_token", authzData.getAuthenticityToken());
+        form.param("client_id", authzData.getClientId());
+        form.param("redirect_uri", authzData.getRedirectUri());
+        form.param("scope", authzData.getProposedScope());
+        if (authzData.getResponseType() != null) {
+            form.param("response_type", authzData.getResponseType());
+        }
+        if (authzData.getNonce() != null) {
+            form.param("nonce", authzData.getNonce());
+        }
+        form.param("oauthDecision", "allow");
+        
+        response = client.post(form);
+        
+        String location = response.getHeaderString("Location"); 
+        
+        // Check IdToken
+        String idToken = OAuth2TestUtils.getSubstring(location, "id_token");
+        assertNotNull(idToken);
+        
+        JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(idToken);
+        JwtToken jwt = jwtConsumer.getJwtToken();
+        Assert.assertNull(jwt.getClaims().getClaim(IdToken.ACCESS_TOKEN_HASH_CLAIM));
+    }
+    
+    @org.junit.Test
     public void testJWTRequestNonmatchingResponseType() throws Exception {
         URL busFile = OIDCNegativeTest.class.getResource("client.xml");
         


[36/50] [abbrv] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

Posted by re...@apache.org.
Squash commit of ws-transfer implementation from Erich Duda (dudaerich)
This closes #33


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/517ef67f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/517ef67f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/517ef67f

Branch: refs/heads/master-jaxrs-2.1
Commit: 517ef67f1a69d386de44153e5e09d51cb47bf4d7
Parents: e158c96
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue May 24 09:26:41 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue May 24 09:26:41 2016 -0400

----------------------------------------------------------------------
 rt/ws/pom.xml                                   |   1 +
 rt/ws/transfer/pom.xml                          |  91 +++
 .../apache/cxf/ws/transfer/dialect/Dialect.java |  64 ++
 .../dialect/fragment/FragmentDialect.java       | 622 +++++++++++++++++++
 .../fragment/FragmentDialectConstants.java      |  51 ++
 .../dialect/fragment/faults/FragmentFault.java  |  44 ++
 .../fragment/faults/InvalidExpression.java      |  42 ++
 .../fragment/faults/UnsupportedLanguage.java    |  41 ++
 .../fragment/faults/UnsupportedMode.java        |  42 ++
 .../language/FragmentDialectLanguage.java       |  37 ++
 .../language/FragmentDialectLanguageQName.java  | 134 ++++
 .../FragmentDialectLanguageXPath10.java         | 160 +++++
 .../transfer/manager/MemoryResourceManager.java | 160 +++++
 .../ws/transfer/manager/ResourceManager.java    |  59 ++
 .../cxf/ws/transfer/resource/Resource.java      | 101 +++
 .../cxf/ws/transfer/resource/ResourceLocal.java | 191 ++++++
 .../ws/transfer/resource/ResourceRemote.java    |  49 ++
 .../resourcefactory/ResourceFactory.java        |  61 ++
 .../resourcefactory/ResourceFactoryImpl.java    | 153 +++++
 .../resolver/ResourceReference.java             |  61 ++
 .../resolver/ResourceResolver.java              |  39 ++
 .../resolver/SimpleResourceResolver.java        |  69 ++
 .../ws/transfer/shared/TransferConstants.java   |  60 ++
 .../shared/faults/InvalidRepresentation.java    |  41 ++
 .../ws/transfer/shared/faults/PutDenied.java    |  44 ++
 .../transfer/shared/faults/UnknownDialect.java  |  43 ++
 .../transfer/shared/faults/UnknownResource.java |  42 ++
 .../transfer/shared/faults/WSTransferFault.java |  45 ++
 .../ResourceTransformer.java                    |  30 +
 .../ResourceTypeIdentifier.java                 |  36 ++
 .../ResourceTypeIdentifierResult.java           |  56 ++
 .../ResourceValidator.java                      |  31 +
 .../ValidAndTransformHelper.java                |  63 ++
 .../XSDResourceTypeIdentifier.java              |  87 +++
 .../XSDResourceValidator.java                   |  88 +++
 .../XSLTResourceTransformer.java                |  87 +++
 .../reference-parameter-parsing.xml             |  27 +
 .../main/resources/schemas/catalog-fragment.cat |  21 +
 .../src/main/resources/schemas/catalog.cat      |  23 +
 .../src/main/resources/schemas/fragment.xsd     |  87 +++
 .../src/main/resources/schemas/transfer.xjb     |  37 ++
 .../src/main/resources/schemas/transfer.xsd     | 192 ++++++
 .../src/main/resources/schemas/ws-addr.xsd      | 141 +++++
 .../integration/FragmentGetQNameTest.java       | 171 +++++
 .../integration/FragmentGetXPath10Test.java     | 333 ++++++++++
 .../integration/FragmentPutAddTest.java         | 238 +++++++
 .../integration/FragmentPutInsertAfterTest.java | 194 ++++++
 .../FragmentPutInsertBeforeTest.java            | 194 ++++++
 .../integration/FragmentPutRemoveTest.java      | 113 ++++
 .../integration/FragmentPutReplaceTest.java     | 419 +++++++++++++
 .../integration/IntegrationBaseTest.java        | 196 ++++++
 .../integration/ResourceFactoryTest.java        | 135 ++++
 .../ws/transfer/integration/ResourceTest.java   | 168 +++++
 .../unit/MemoryResourceManagerTest.java         | 204 ++++++
 .../transfer/unit/XSDResourceValidatorTest.java |  60 ++
 .../unit/XSLTResourceTransformerTest.java       |  60 ++
 .../invalidRepresentation.xml                   |  26 +
 .../xml/xsdresourcevalidator/schema.xsd         |  35 ++
 .../validRepresentation.xml                     |  27 +
 .../xsltresourcetransformer/representation.xml  |  26 +
 .../xml/xsltresourcetransformer/stylesheet.xsl  |  43 ++
 systests/pom.xml                                |   3 +-
 systests/ws-transfer/pom.xml                    |  61 ++
 .../systest/ws/transfer/CreateStudentTest.java  | 103 +++
 .../systest/ws/transfer/CreateTeacherTest.java  |  91 +++
 .../cxf/systest/ws/transfer/DeleteTest.java     | 118 ++++
 .../apache/cxf/systest/ws/transfer/GetTest.java | 111 ++++
 .../apache/cxf/systest/ws/transfer/PutTest.java | 129 ++++
 .../cxf/systest/ws/transfer/TestUtils.java      | 174 ++++++
 .../cxf/systest/ws/transfer/UIDManager.java     |  40 ++
 .../transfer/resolver/MyResourceResolver.java   |  55 ++
 .../validator/StudentPutResourceValidator.java  |  47 ++
 .../validator/TeacherResourceValidator.java     |  51 ++
 .../src/test/resources/schema/studentCreate.xsd |  46 ++
 .../src/test/resources/schema/studentPut.xsd    |  47 ++
 .../src/test/resources/schema/teacher.xsd       |  47 ++
 .../resources/schema/teacherCreateBasic.xsd     |  35 ++
 .../src/test/resources/xml/createStudent.xml    |  31 +
 .../test/resources/xml/createStudentPartial.xml |  29 +
 .../test/resources/xml/createStudentWrong.xml   |  32 +
 .../src/test/resources/xml/createTeacher.xml    |  31 +
 .../test/resources/xml/createTeacherPartial.xml |  25 +
 .../test/resources/xml/createTeacherWrong.xml   |  32 +
 .../src/test/resources/xml/putStudent.xml       |  32 +
 .../src/test/resources/xml/putTeacher.xml       |  32 +
 .../src/test/resources/xml/random.xml           |  24 +
 .../src/test/resources/xslt/studentCreate.xsl   | 110 ++++
 .../src/test/resources/xslt/studentPut.xsl      | 108 ++++
 .../test/resources/xslt/teacherCreateBasic.xsl  |  45 ++
 .../resources/xslt/teacherDefaultValues.xsl     | 108 ++++
 90 files changed, 7991 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/pom.xml
----------------------------------------------------------------------
diff --git a/rt/ws/pom.xml b/rt/ws/pom.xml
index 0bea25c..70e1c97 100644
--- a/rt/ws/pom.xml
+++ b/rt/ws/pom.xml
@@ -36,5 +36,6 @@
         <module>rm</module>
         <module>mex</module>
         <module>eventing</module>
+        <module>transfer</module>
     </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/pom.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/pom.xml b/rt/ws/transfer/pom.xml
new file mode 100644
index 0000000..d2c1a09
--- /dev/null
+++ b/rt/ws/transfer/pom.xml
@@ -0,0 +1,91 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>cxf-rt-ws-transfer</artifactId>
+  <packaging>jar</packaging>
+  <name>Apache CXF Runtime WS Transfer</name>
+  <url>http://cxf.apache.org</url>
+  
+  <parent>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-parent</artifactId>
+      <version>3.2.0-SNAPSHOT</version>
+      <relativePath>../../../parent/pom.xml</relativePath>
+  </parent>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>cxf-rt-frontend-jaxws</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>cxf-rt-transports-local</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  
+  <build>
+      <plugins>
+          <plugin>
+              <groupId>org.apache.cxf</groupId>
+              <artifactId>cxf-xjc-plugin</artifactId>
+              <version>${cxf.xjc-utils.version}</version>
+              <executions>
+                  <execution>
+                      <id>generate-transfer</id>
+                      <phase>generate-sources</phase>
+                      <goals>
+                          <goal>xsdtojava</goal>
+                      </goals>
+                      <configuration>
+                          <sourceRoot>${basedir}/target/generated-sources/xjc</sourceRoot>
+                          <xsdOptions>
+                              <xsdOption>
+                                  <xsd>${basedir}/src/main/resources/schemas/transfer.xsd</xsd>
+                                  <packagename>org.apache.cxf.ws.transfer</packagename>
+                                  <bindingFile>${basedir}/src/main/resources/schemas/transfer.xjb</bindingFile>
+                                  <catalog>${basedir}/src/main/resources/schemas/catalog.cat</catalog>
+                              </xsdOption>
+                          </xsdOptions>
+                      </configuration>
+                  </execution>
+                  <execution>
+                      <id>generate-fragment</id>
+                      <phase>generate-sources</phase>
+                      <goals>
+                          <goal>xsdtojava</goal>
+                      </goals>
+                      <configuration>
+                          <sourceRoot>${basedir}/target/generated-sources/xjc</sourceRoot>
+                          <xsdOptions>
+                              <xsdOption>
+                                  <xsd>${basedir}/src/main/resources/schemas/fragment.xsd</xsd>
+                                  <packagename>org.apache.cxf.ws.transfer.dialect.fragment</packagename>
+                                  <catalog>${basedir}/src/main/resources/schemas/catalog-fragment.cat</catalog>
+                              </xsdOption>
+                          </xsdOptions>
+                      </configuration>
+                  </execution>
+              </executions>
+          </plugin>
+      </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/Dialect.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/Dialect.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/Dialect.java
new file mode 100644
index 0000000..6ea5208
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/Dialect.java
@@ -0,0 +1,64 @@
+/**
+ * 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.ws.transfer.dialect;
+
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * The interface for a Dialect objects.
+ */
+public interface Dialect {
+    
+    /**
+     * Method for processing incoming Get message by Dialect extension.
+     * @param body Get body
+     * @param representation XML representation stored in the ResourceManager
+     * @return Representation, which will be returned in response.
+     */
+    Object processGet(Get body, Representation representation);
+    
+    /**
+     * Method for processing incoming Put message by Dialect extension.
+     * @param body Put body
+     * @param representation XML representation stored in the ResourceManager
+     * @return Representation, which will be stored in ResourceManager.
+     */
+    Representation processPut(Put body, Representation representation);
+    
+    /**
+     * Method for processing incoming Delete message by Dialect extension.
+     * @param body Delete body
+     * @param representation XML representation stored in the ResourceManager
+     * @return Representation, which will be stored in ResourceManager.
+     */
+    boolean processDelete(Delete body, Representation representation);
+    
+    /**
+     * Method for processing incoming Create message by Dialect extension.
+     * @param body Create body
+     * @return Representation, which will be stored in ResourceManager.
+     */
+    Representation processCreate(Create body);
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialect.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialect.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialect.java
new file mode 100644
index 0000000..8498ff8
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialect.java
@@ -0,0 +1,622 @@
+/**
+ * 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.ws.transfer.dialect.fragment;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import javax.annotation.Resource;
+import javax.xml.bind.JAXBElement;
+import javax.xml.ws.WebServiceContext;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.Dialect;
+import org.apache.cxf.ws.transfer.dialect.fragment.faults.InvalidExpression;
+import org.apache.cxf.ws.transfer.dialect.fragment.faults.UnsupportedLanguage;
+import org.apache.cxf.ws.transfer.dialect.fragment.faults.UnsupportedMode;
+import org.apache.cxf.ws.transfer.dialect.fragment.language.FragmentDialectLanguage;
+import org.apache.cxf.ws.transfer.dialect.fragment.language.FragmentDialectLanguageQName;
+import org.apache.cxf.ws.transfer.dialect.fragment.language.FragmentDialectLanguageXPath10;
+import org.apache.cxf.ws.transfer.shared.faults.InvalidRepresentation;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownDialect;
+
+/**
+ * Implementation of the WS-Fragment dialect.
+ */
+public class FragmentDialect implements Dialect {
+
+    @Resource
+    WebServiceContext context;
+
+    private final Map<String, FragmentDialectLanguage> languages;
+
+    private Pattern badXPathPattern;
+
+    private Pattern goodXPathPattern;
+
+    public FragmentDialect() {
+        languages = new HashMap<String, FragmentDialectLanguage>();
+        languages.put(FragmentDialectConstants.QNAME_LANGUAGE_IRI, new FragmentDialectLanguageQName());
+        languages.put(FragmentDialectConstants.XPATH10_LANGUAGE_IRI, new FragmentDialectLanguageXPath10());
+        if (badXPathPattern == null) {
+            StringBuilder sb = new StringBuilder();
+            sb.append("//@?");
+            sb.append(FragmentDialectLanguageQName.getQNamePatternString());
+            sb.append("$");
+            badXPathPattern = Pattern.compile(sb.toString());
+        }
+        if (goodXPathPattern == null) {
+            StringBuilder sb = new StringBuilder();
+            sb.append("/@?");
+            sb.append(FragmentDialectLanguageQName.getQNamePatternString());
+            sb.append("$");
+            goodXPathPattern = Pattern.compile(sb.toString());
+        }
+    }
+
+    @Override
+    public JAXBElement<ValueType> processGet(Get body, Representation representation) {
+        for (Object o : body.getAny()) {
+            if (o instanceof JAXBElement<?> && ((JAXBElement<?>)o).getDeclaredType() == ExpressionType.class) {
+                ExpressionType expression = (ExpressionType) ((JAXBElement<?>)o).getValue();
+                String languageIRI = expression.getLanguage();
+                languageIRI = languageIRI == null ? FragmentDialectConstants.XPATH10_LANGUAGE_IRI : languageIRI;
+                if (languages.containsKey(languageIRI)) {
+                    FragmentDialectLanguage language = languages.get(languageIRI);
+                    return generateGetResponse(language.getResourceFragment(representation, expression));
+                } else {
+                    throw new UnsupportedLanguage();
+                }
+            }
+        }
+        throw new SoapFault("wsf:Expression is not present.", getSoapVersion().getSender());
+    }
+
+    @Override
+    public Representation processPut(Put body, Representation representation) {
+        for (Object o : body.getAny()) {
+            if (o instanceof Fragment) {
+                Fragment fragment = (Fragment) o;
+                ExpressionType expression = fragment.getExpression();
+                ValueType value = fragment.getValue();
+
+                if (expression == null) {
+                    throw new SoapFault("wsf:Expression is not present.", getSoapVersion().getSender());
+                }
+                if (value == null) {
+                    value = new ValueType();
+                }
+                String languageIRI = expression.getLanguage();
+                languageIRI = languageIRI == null ? FragmentDialectConstants.XPATH10_LANGUAGE_IRI : languageIRI;
+                if (languages.containsKey(languageIRI)) {
+                    FragmentDialectLanguage language = languages.get(languageIRI);
+                    Object resourceFragment = language.getResourceFragment(representation, expression);
+                    String mode = expression.getMode();
+                    mode = mode == null ? FragmentDialectConstants.FRAGMENT_MODE_REPLACE : mode;
+                    if (resourceFragment == null && FragmentDialectConstants.FRAGMENT_MODE_REPLACE.equals(mode)
+                            && FragmentDialectConstants.XPATH10_LANGUAGE_IRI.equals(languageIRI)) {
+                        resourceFragment = language.getResourceFragment(representation, getParentXPath(expression));
+                        mode = FragmentDialectConstants.FRAGMENT_MODE_ADD;
+                    }
+                    return modifyRepresentation(resourceFragment, mode, value);
+                } else {
+                    throw new UnsupportedLanguage();
+                }
+            }
+        }
+        throw new SoapFault("wsf:Fragment is not present.", getSoapVersion().getSender());
+    }
+
+    @Override
+    public boolean processDelete(Delete body, Representation representation) {
+        throw new UnknownDialect();
+    }
+
+    @Override
+    public Representation processCreate(Create body) {
+        throw new UnknownDialect();
+    }
+
+    /**
+     * Register FragmentDialectLanguage object for IRI.
+     * @param iri
+     * @param language
+     */
+    public void registerLanguage(String iri, FragmentDialectLanguage language) {
+        if (languages.containsKey(iri)) {
+            throw new IllegalArgumentException(String.format("IRI \"%s\" is already registered", iri));
+        }
+        languages.put(iri, language);
+    }
+
+    /**
+     * Unregister FragmentDialectLanguage object for IRI.
+     * @param iri
+     */
+    public void unregisterLanguage(String iri) {
+        if (!languages.containsKey(iri)) {
+            throw new IllegalArgumentException(String.format("IRI \"%s\" is not registered", iri));
+        }
+        languages.remove(iri);
+    }
+
+    /**
+     * Generates Value element, which is returned as response to Get request.
+     * @param value Result of the XPath evaluation.
+     * @return
+     */
+    private JAXBElement<ValueType> generateGetResponse(Object value) {
+        if (value instanceof Node) {
+            return generateGetResponseNode((Node) value);
+        } else if (value instanceof NodeList) {
+            return generateGetResponseNodeList((NodeList) value);
+        } else if (value instanceof String) {
+            return generateGetResponseString((String) value);
+        }
+        ObjectFactory objectFactory = new ObjectFactory();
+        return objectFactory.createValue(new ValueType());
+    }
+
+    /**
+     * Generates Value element from NodeList.
+     * @param nodeList
+     * @return
+     */
+    private JAXBElement<ValueType> generateGetResponseNodeList(NodeList nodeList) {
+        ValueType resultValue = new ValueType();
+        for (int i = 0; i < nodeList.getLength(); i++) {
+            resultValue.getContent().add(nodeList.item(i));
+        }
+        ObjectFactory objectFactory = new ObjectFactory();
+        return objectFactory.createValue(resultValue);
+    }
+
+    /**
+     * Generates Value element from Node.
+     * @param node
+     * @return
+     */
+    private JAXBElement<ValueType> generateGetResponseNode(Node node) {
+        Document doc = DOMUtils.createDocument();
+        ValueType resultValue = new ValueType();
+        if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+            Element attrNodeEl = doc.createElementNS(
+                    FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                    FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME);
+            attrNodeEl.setAttribute(
+                    FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR,
+                    node.getNodeName()
+            );
+            attrNodeEl.setTextContent(node.getNodeValue());
+            resultValue.getContent().add(attrNodeEl);
+        } else if (node.getNodeType() == Node.TEXT_NODE) {
+            Element textNodeEl = doc.createElementNS(
+                    FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                    FragmentDialectConstants.FRAGMENT_TEXT_NODE_NAME);
+            textNodeEl.setNodeValue(node.getNodeValue());
+            resultValue.getContent().add(textNodeEl);
+        } else if (node.getNodeType() == Node.ELEMENT_NODE) {
+            resultValue.getContent().add(node);
+        }
+        ObjectFactory objectFactory = new ObjectFactory();
+        return objectFactory.createValue(resultValue);
+    }
+
+    /**
+     * Generates Value element from String.
+     * @param value
+     * @return
+     */
+    private JAXBElement<ValueType> generateGetResponseString(String value) {
+        ValueType resultValue = new ValueType();
+        resultValue.getContent().add(value);
+        ObjectFactory objectFactory = new ObjectFactory();
+        return objectFactory.createValue(resultValue);
+    }
+
+    /**
+     * Returns expression containing XPath, which refers to parent element.
+     * @param expression
+     * @return
+     */
+    private ExpressionType getParentXPath(ExpressionType expression) {
+        String expr;
+        if (expression.getContent().size() == 1) {
+            expr = (String) expression.getContent().get(0);
+        } else {
+            throw new InvalidExpression();
+        }
+        if (badXPathPattern.matcher(expr).find()) {
+            throw new InvalidExpression();
+        }
+        if (goodXPathPattern.matcher(expr).find()) {
+            expression.getContent().clear();
+            expr = expr.replaceFirst(goodXPathPattern.pattern(), "");
+            if (expr.isEmpty()) {
+                expr = "/";
+            }
+            expression.getContent().add(expr);
+            return expression;
+        } else {
+            throw new InvalidExpression();
+        }
+    }
+
+    /**
+     * Process Put requests.
+     * @param resourceFragment Result of the XPath evaluation. It can be Node or NodeList.
+     * @param mode Mode defined in the Mode attribute.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentation(
+            Object resourceFragment,
+            String mode,
+            ValueType value) {
+        if (resourceFragment instanceof Node) {
+            List<Node> nodeList = new ArrayList<Node>();
+            nodeList.add((Node) resourceFragment);
+            return modifyRepresentationMode(nodeList, mode, value);
+        } else if (resourceFragment instanceof NodeList) {
+            NodeList rfNodeList = (NodeList) resourceFragment;
+            List<Node> nodeList = new ArrayList<Node>();
+            for (int i = 0; i < rfNodeList.getLength(); i++) {
+                nodeList.add(rfNodeList.item(i));
+            }
+            return modifyRepresentationMode(nodeList, mode, value);
+        } else {
+            throw new InvalidExpression();
+        }
+    }
+
+    /**
+     * Process Put requests.
+     * @param mode Mode defined in the Mode attribute.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationMode(
+            List<Node> nodeList,
+            String mode,
+            ValueType value) {
+        switch (mode) {
+        case FragmentDialectConstants.FRAGMENT_MODE_REPLACE:
+            return modifyRepresentationModeReplace(nodeList, value);
+        case FragmentDialectConstants.FRAGMENT_MODE_ADD:
+            return modifyRepresentationModeAdd(nodeList, value);
+        case FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE:
+            return modifyRepresentationModeInsertBefore(nodeList, value);
+        case FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER:
+            return modifyRepresentationModeInsertAfter(nodeList, value);
+        case FragmentDialectConstants.FRAGMENT_MODE_REMOVE:
+            return modifyRepresentationModeRemove(nodeList, value);
+        default:
+            throw new UnsupportedMode();
+        }
+    }
+
+    /**
+     * Process Put requests for Replace mode.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationModeReplace(
+            List<Node> nodeList,
+            ValueType value) {
+
+        if (nodeList.isEmpty()) {
+            throw new InvalidExpression();
+        }
+        Node firstNode = nodeList.get(0);
+        Document ownerDocument = firstNode.getOwnerDocument();
+        // if firstNode.getOwnerDocument == null the firstNode is ownerDocument
+        ownerDocument = ownerDocument == null ? (Document) firstNode : ownerDocument;
+        Node nextSibling = null;
+        Node parent = null;
+
+        for (Node node : nodeList) {
+            nextSibling = node.getNextSibling();
+            parent = removeNode(node);
+        }
+
+        addNode(ownerDocument, parent, nextSibling, value);
+
+        Representation representation = new Representation();
+        representation.setAny(ownerDocument.getDocumentElement());
+        return representation;
+    }
+
+    /**
+     * Process Put requests for Add mode.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationModeAdd(
+            List<Node> nodeList,
+            ValueType value) {
+        if (nodeList.isEmpty()) {
+            throw new InvalidExpression();
+        }
+        Node firstNode = nodeList.get(0);
+        Document ownerDocument = firstNode.getOwnerDocument();
+        // if firstNode.getOwnerDocument == null the firstNode is ownerDocument
+        ownerDocument = ownerDocument == null ? (Document) firstNode : ownerDocument;
+
+        for (Node node : nodeList) {
+            addNode(ownerDocument, node, null, value);
+        }
+        Representation representation = new Representation();
+        representation.setAny(ownerDocument.getDocumentElement());
+        return representation;
+    }
+
+    /**
+     * Process Put requests for InsertBefore mode.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationModeInsertBefore(
+            List<Node> nodeList,
+            ValueType value) {
+        if (nodeList.isEmpty()) {
+            throw new InvalidExpression();
+        }
+        Node firstNode = nodeList.get(0);
+        Document ownerDocument = firstNode.getOwnerDocument();
+        // if firstNode.getOwnerDocument == null the firstNode is ownerDocument
+        ownerDocument = ownerDocument == null ? (Document) firstNode : ownerDocument;
+
+        Node parent = firstNode.getParentNode();
+        if (parent == null && firstNode.getNodeType() != Node.DOCUMENT_NODE) {
+            throw new InvalidExpression();
+        }
+        if (parent == null) {
+            parent = firstNode;
+            if (((Document) parent).getDocumentElement() != null) {
+                throw new InvalidExpression();
+            }
+        }
+
+        for (Node node : nodeList) {
+            if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+                throw new InvalidRepresentation();
+            }
+            insertBefore(ownerDocument, parent, node, value);
+        }
+
+        Representation representation = new Representation();
+        representation.setAny(ownerDocument.getDocumentElement());
+        return representation;
+    }
+
+    /**
+     * Process Put requests for InsertAfter mode.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationModeInsertAfter(
+            List<Node> nodeList,
+            ValueType value) {
+        if (nodeList.isEmpty()) {
+            throw new InvalidExpression();
+        }
+        Node firstNode = nodeList.get(0);
+        Document ownerDocument = firstNode.getOwnerDocument();
+        // if firstNode.getOwnerDocument == null the firstNode is ownerDocument
+        ownerDocument = ownerDocument == null ? (Document) firstNode : ownerDocument;
+
+        Node parent = firstNode.getParentNode();
+        if (parent == null && firstNode.getNodeType() != Node.DOCUMENT_NODE) {
+            throw new InvalidExpression();
+        }
+        if (parent == null) {
+            parent = firstNode;
+            if (((Document) parent).getDocumentElement() != null) {
+                throw new InvalidExpression();
+            }
+        }
+
+        for (Node node : nodeList) {
+            if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+                throw new InvalidRepresentation();
+            }
+            insertAfter(ownerDocument, parent, node, value);
+        }
+
+        Representation representation = new Representation();
+        representation.setAny(ownerDocument.getDocumentElement());
+        return representation;
+    }
+
+    /**
+     * Process Put requests for Remove mode.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationModeRemove(
+            List<Node> nodeList,
+            ValueType value) {
+        if (nodeList.isEmpty()) {
+            throw new InvalidExpression();
+        }
+        Node firstNode = nodeList.get(0);
+        Document ownerDocument = firstNode.getOwnerDocument();
+        // if firstNode.getOwnerDocument == null the firstNode is ownerDocument
+        ownerDocument = ownerDocument == null ? (Document) firstNode : ownerDocument;
+
+        for (Node node : nodeList) {
+            removeNode(node);
+        }
+
+        Representation representation = new Representation();
+        representation.setAny(ownerDocument.getDocumentElement());
+        return representation;
+    }
+
+    /**
+     * Helper method. It removes Node and returns its parent.
+     * @param resourceFragment Node to remove.
+     * @return Parent of removed Node.
+     */
+    private Node removeNode(Node resourceFragment) {
+        Node parent = null;
+        if (resourceFragment.getNodeType() == Node.ATTRIBUTE_NODE) {
+            parent = ((Attr)resourceFragment).getOwnerElement();
+        } else {
+            parent = resourceFragment.getParentNode();
+        }
+        if (parent == null) {
+            // resourceFragment is Document Node
+            parent = resourceFragment;
+        }
+        if (resourceFragment.getNodeType() == Node.ATTRIBUTE_NODE) {
+            ((Element)parent).removeAttributeNode((Attr)resourceFragment);
+        } else {
+            if (parent != resourceFragment) {
+                parent.removeChild(resourceFragment);
+            } else {
+                // Both parent and resourceFragment are Document
+                Document doc = (Document) parent;
+                if (doc.getDocumentElement() != null) {
+                    doc.removeChild(doc.getDocumentElement());
+                }
+            }
+        }
+
+        return parent;
+    }
+
+    private void insertAfter(Document ownerDocument, Node parent, Node refChild, ValueType value) {
+        for (Object o : value.getContent()) {
+            if (o instanceof Node) {
+                Node node = (Node) o;
+
+                if (
+                        FragmentDialectConstants.FRAGMENT_2011_03_IRI.equals(node.getNamespaceURI())
+                                && FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME.equals(node.getLocalName())) {
+                    throw new InvalidRepresentation();
+                }
+
+                Node importedNode = ownerDocument.importNode(node, true);
+                if (parent.getNodeType() == Node.DOCUMENT_NODE) {
+                    parent.appendChild(importedNode);
+                } else {
+                    Node nextSibling = refChild.getNextSibling();
+                    if (nextSibling == null) {
+                        parent.appendChild(importedNode);
+                    } else {
+                        parent.insertBefore(importedNode, nextSibling);
+                    }
+                }
+            } else {
+                throw new InvalidExpression();
+            }
+        }
+    }
+
+    private void insertBefore(Document ownerDocument, Node parent, Node refChild, ValueType value) {
+        for (Object o : value.getContent()) {
+            if (o instanceof Node) {
+                Node node = (Node) o;
+
+                if (
+                        FragmentDialectConstants.FRAGMENT_2011_03_IRI.equals(node.getNamespaceURI())
+                                && FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME.equals(node.getLocalName())) {
+                    throw new InvalidRepresentation();
+                }
+
+                Node importedNode = ownerDocument.importNode(node, true);
+                if (parent.getNodeType() == Node.DOCUMENT_NODE) {
+                    parent.appendChild(importedNode);
+                } else {
+                    parent.insertBefore(importedNode, refChild);
+                }
+            } else {
+                throw new InvalidExpression();
+            }
+        }
+    }
+
+    /**
+     * Helper method. It adds new Node as the last child of parent.
+     * @param ownerDocument Document, where the Node is added.
+     * @param parent Parent, where the Node is added.
+     * @param value Value defined in the Value element. It represents newly added Node.
+     */
+    private void addNode(Document ownerDocument, Node parent, Node nextSibling, ValueType value) {
+        if (ownerDocument == parent && ownerDocument.getDocumentElement() != null) {
+            throw new InvalidRepresentation();
+        }
+        for (Object o : value.getContent()) {
+            if (o instanceof String) {
+                parent.setTextContent(parent.getTextContent() + ((String) o));
+            } else if (o instanceof Node) {
+                Node node = (Node) o;
+                if (
+                        FragmentDialectConstants.FRAGMENT_2011_03_IRI.equals(node.getNamespaceURI())
+                                && FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME.equals(node.getLocalName())) {
+                    String attrName = ((Element)node).getAttributeNS(
+                            FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                            FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR);
+                    String attrValue = node.getTextContent();
+                    if (attrName == null) {
+                        throw new SoapFault("wsf:AttributeNode@name is not present.", getSoapVersion().getSender());
+                    }
+                    if (((Element) parent).hasAttribute(attrName)) {
+                        throw new InvalidRepresentation();
+                    }
+                    ((Element) parent).setAttribute(attrName, attrValue);
+                } else {
+                    // import the node to the ownerDocument
+                    Node importedNode = ownerDocument.importNode((Node) o, true);
+                    if (nextSibling == null) {
+                        parent.appendChild(importedNode);
+                    } else {
+                        parent.insertBefore(importedNode, nextSibling);
+                    }
+                }
+            } else {
+                throw new InvalidExpression();
+            }
+        }
+    }
+
+    private SoapVersion getSoapVersion() {
+        WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
+        SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
+        return message.getVersion();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialectConstants.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialectConstants.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialectConstants.java
new file mode 100644
index 0000000..6ffd009
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialectConstants.java
@@ -0,0 +1,51 @@
+/**
+ * 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.ws.transfer.dialect.fragment;
+
+/**
+ * Helper class for holding of constants.
+ */
+public final class FragmentDialectConstants {
+    
+    public static final String FRAGMENT_2011_03_IRI = "http://www.w3.org/2011/03/ws-fra";
+    
+    public static final String QNAME_LANGUAGE_IRI = "http://www.w3.org/2011/03/ws-fra/QName";
+    
+    public static final String XPATH10_LANGUAGE_IRI = "http://www.w3.org/2011/03/ws-fra/XPath10";
+    
+    public static final String FRAGMENT_TEXT_NODE_NAME = "TextNode";
+    
+    public static final String FRAGMENT_ATTR_NODE_NAME = "AttributeNode";
+    
+    public static final String FRAGMENT_ATTR_NODE_NAME_ATTR = "name";
+    
+    public static final String FRAGMENT_MODE_REPLACE = "http://www.w3.org/2011/03/ws-fra/Modes/Replace";
+    
+    public static final String FRAGMENT_MODE_ADD = "http://www.w3.org/2011/03/ws-fra/Modes/Add";
+    
+    public static final String FRAGMENT_MODE_INSERT_BEFORE = "http://www.w3.org/2011/03/ws-fra/Modes/InsertBefore";
+    
+    public static final String FRAGMENT_MODE_INSERT_AFTER = "http://www.w3.org/2011/03/ws-fra/Modes/InsertAfter";
+    
+    public static final String FRAGMENT_MODE_REMOVE = "http://www.w3.org/2011/03/ws-fra/Modes/Remove";
+    
+    private FragmentDialectConstants() {
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/FragmentFault.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/FragmentFault.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/FragmentFault.java
new file mode 100644
index 0000000..3777238
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/FragmentFault.java
@@ -0,0 +1,44 @@
+/**
+ * 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.ws.transfer.dialect.fragment.faults;
+
+import javax.xml.namespace.QName;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.helpers.DOMUtils;
+
+/**
+ * The parent for all WS-Fragment-specific faults.
+ */
+public abstract class FragmentFault extends SoapFault {
+
+    private static final long serialVersionUID = 2111286624025926462L;
+
+    public FragmentFault(String reason, String detail, QName faultCode) {
+        super(reason, faultCode);
+        if (detail != null) {
+            Document doc = DOMUtils.createDocument();
+            Element detailEl = doc.createElement("detail");
+            detailEl.setTextContent(detail);
+            setDetail(detailEl);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/InvalidExpression.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/InvalidExpression.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/InvalidExpression.java
new file mode 100644
index 0000000..23da1bc
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/InvalidExpression.java
@@ -0,0 +1,42 @@
+/**
+ * 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.ws.transfer.dialect.fragment.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+
+/**
+ * Definition of the InvalidExpression SOAPFault.
+ */
+public class InvalidExpression extends FragmentFault {
+
+    private static final long serialVersionUID = -1920756304737648952L;
+
+    private static final String SUBCODE = "InvalidExpression";
+
+    private static final String REASON = "The specified Language expression is invalid.";
+
+    private static final String DETAIL = "The invalid language expression.";
+
+    public InvalidExpression() {
+        super(REASON, DETAIL,
+                new QName(FragmentDialectConstants.FRAGMENT_2011_03_IRI, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedLanguage.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedLanguage.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedLanguage.java
new file mode 100644
index 0000000..bb13b4c
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedLanguage.java
@@ -0,0 +1,41 @@
+/**
+ * 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.ws.transfer.dialect.fragment.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+
+/**
+ * Definition of the UnsupportedLanguage SOAPFault.
+ */
+public class UnsupportedLanguage extends FragmentFault {
+
+    private static final long serialVersionUID = 7627652802987243575L;
+
+    private static final String SUBCODE = "UnsupportedLanguage";
+
+    private static final String REASON = "The specified Language IRI is not supported.";
+
+    private static final String DETAIL = "The unsupported Language IRI.";
+
+    public UnsupportedLanguage() {
+        super(REASON, DETAIL,
+                new QName(FragmentDialectConstants.FRAGMENT_2011_03_IRI, SUBCODE));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedMode.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedMode.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedMode.java
new file mode 100644
index 0000000..f38b912
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedMode.java
@@ -0,0 +1,42 @@
+/**
+ * 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.ws.transfer.dialect.fragment.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+
+/**
+ * Definition of the UnsupportedMode SOAPFault.
+ */
+public class UnsupportedMode extends FragmentFault {
+
+    private static final long serialVersionUID = -5824904523582078377L;
+
+    private static final String SUBCODE = "UnsupportedMode";
+
+    private static final String REASON = "The specified mode is not supported.";
+
+    private static final String DETAIL = "The unsupported Mode.";
+
+    public UnsupportedMode() {
+        super(REASON, DETAIL,
+                new QName(FragmentDialectConstants.FRAGMENT_2011_03_IRI, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguage.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguage.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguage.java
new file mode 100644
index 0000000..8ff8018
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguage.java
@@ -0,0 +1,37 @@
+/**
+ * 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.ws.transfer.dialect.fragment.language;
+
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+
+/**
+ * Interface for FragmentDialect languages.
+ */
+public interface FragmentDialectLanguage {
+    
+    /**
+     * Returns fragment of resource, which is described by expression.
+     * @param representation Resource, from which is fragment computed.
+     * @param expression Expression written in the language.
+     * @return It can return org.w3c.dom.Node | org.w3c.dom.NodeList | String
+     */
+    Object getResourceFragment(Representation representation, ExpressionType expression);
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageQName.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageQName.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageQName.java
new file mode 100644
index 0000000..a5d78ad
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageQName.java
@@ -0,0 +1,134 @@
+/**
+ * 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.ws.transfer.dialect.fragment.language;
+
+import java.util.Iterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.xml.namespace.NamespaceContext;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.apache.cxf.helpers.XPathUtils;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.faults.InvalidExpression;
+
+/**
+ * Implementation of the QName language.
+ */
+public class FragmentDialectLanguageQName implements FragmentDialectLanguage {
+
+    private static Pattern qNamePattern;
+    
+    public FragmentDialectLanguageQName() {
+        if (qNamePattern == null) {
+            String qName = getQNamePatternString();
+            qNamePattern = Pattern.compile("^" + qName);
+        }
+    }
+
+    /**
+     * Returns regex string, which describes QName format.
+     * @return
+     */
+    public static String getQNamePatternString() {
+        // See http://www.w3.org/TR/REC-xml-names/#NT-PrefixedName
+        // NCNameStartChar
+        // see http://www.w3.org/TR/REC-xml-names/#NT-NCName
+        // and http://www.w3.org/TR/REC-xml/#NT-NameStartChar
+        String ncNameStartChar = "[A-Z]|_|[a-z]|[\\x{c0}-\\x{d6}]|[\\x{d8}-\\x{f6}]|[\\x{f8}-\\x{2ff}]|"
+                + "[\\x{370}-\\x{37d}]|[\\x{37f}-\\x{1fff}]|[\\x{200c}-\\x{200d}]|"
+                + "[\\x{2070}-\\x{218f}]|[\\x{2c00}-\\x{2fef}]|[\\x{3001}-\\x{d7ff}]|"
+                + "[\\x{f900}-\\x{fdcf}]|[\\x{fdf0}-\\x{fffd}]|[\\x{10000}-\\x{effff}]";
+        // NCNameChar
+        // see http://www.w3.org/TR/REC-xml/#NT-NameChar
+        String ncNameChar = ncNameStartChar
+                + "|-|\\.|[0-9]|\\x{b7}|[\\x{0300}-\\x{036f}]|[\\x{203f}-\\x{2040}]";
+        // NCName
+        // see http://www.w3.org/TR/REC-xml/#NT-Name
+        String ncName = String.format("(%s)(%s)*", ncNameStartChar, ncNameChar);
+        // QName
+        // see http://www.w3.org/TR/REC-xml-names/#NT-QName
+        return String.format("((%s):)?(%s)", ncName, ncName);
+    }
+    
+    @Override
+    public Object getResourceFragment(final Representation representation, ExpressionType expression) {
+        String expressionStr = getXPathFromQNameExpression(expression);
+        // Evaluate XPath
+        XPathUtils xu = new XPathUtils(new NamespaceContext() {
+            @Override
+            public String getNamespaceURI(String prefix) {
+                if (prefix != null && !prefix.isEmpty()) {
+                    Element resource = (Element) representation.getAny();
+                    return resource.getAttribute("xmlns:" + prefix);
+                } else {
+                    return null;
+                }
+            }
+
+            @Override
+            public String getPrefix(String s) {
+                throw new UnsupportedOperationException();
+            }
+
+            @Override
+            public Iterator<String> getPrefixes(String s) {
+                throw new UnsupportedOperationException();
+            }
+        });
+        Node resource = (Node) representation.getAny();
+        if (resource == null) {
+            // Returns empty NodeList
+            return new NodeList() {
+                @Override
+                public Node item(int i) {
+                    return null;
+                }
+
+                @Override
+                public int getLength() {
+                    return 0;
+                }
+            };
+        }
+        return xu.getValueList(expressionStr, resource);
+    }
+    
+    /**
+     * Converts expression in QName language to XPath expression.
+     * @param expression Expression in QName language.
+     * @return Expression in XPath language.
+     */
+    private String getXPathFromQNameExpression(ExpressionType expression) {
+        if (expression.getContent().size() == 1) {
+            String expressionValue = (String) expression.getContent().get(0);
+            Matcher m = qNamePattern.matcher(expressionValue);
+            if (m.matches()) {
+                return "/node()/" + expressionValue;
+            } else {
+                throw new InvalidExpression();
+            }
+        } else {
+            throw new InvalidExpression();
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageXPath10.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageXPath10.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageXPath10.java
new file mode 100644
index 0000000..86bddab
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageXPath10.java
@@ -0,0 +1,160 @@
+/**
+ * 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.ws.transfer.dialect.fragment.language;
+
+import java.util.Iterator;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathException;
+import javax.xml.xpath.XPathFactory;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.faults.InvalidExpression;
+
+/**
+ * Implementation of the XPath 1.0 language.
+ */
+public class FragmentDialectLanguageXPath10 implements FragmentDialectLanguage {
+
+    private static XPathFactory xpathFactory = XPathFactory.newInstance();
+
+    @Override
+    public Object getResourceFragment(final Representation representation, ExpressionType expression) {
+        String expressionStr = getXPathFromExpression(expression);
+        // Evaluate XPath
+        XPath xPath = xpathFactory.newXPath();
+        xPath.setNamespaceContext(new NamespaceContext() {
+
+            @Override
+            public String getNamespaceURI(String prefix) {
+                if (prefix != null && !prefix.isEmpty()) {
+                    Element resource = (Element) representation.getAny();
+                    return resource.getAttribute("xmlns:" + prefix);
+                } else {
+                    return null;
+                }
+            }
+
+            @Override
+            public String getPrefix(String string) {
+                throw new UnsupportedOperationException();
+            }
+
+            @Override
+            public Iterator<String> getPrefixes(String string) {
+                throw new UnsupportedOperationException();
+            }
+        });
+        try {
+            Object resource = representation.getAny();
+            if (resource == null) {
+                resource = DOMUtils.createDocument();
+            }
+            NodeList result = (NodeList) xPath.evaluate(
+                expressionStr, resource, XPathConstants.NODESET);
+            if (checkResultConstraints(result)) {
+                if (result.getLength() == 0) {
+                    return  null;
+                } else {
+                    return result;
+                }
+            } else {
+                return result.item(0);
+            }
+        } catch (XPathException ex) {
+            // See https://www.java.net/node/681793
+        }
+
+        try {
+            return (String) xPath.evaluate(
+                expressionStr, representation.getAny(), XPathConstants.STRING);
+        } catch (XPathException ex) {
+            throw new InvalidExpression();
+        }
+    }
+    
+    /**
+     * Get XPath from the Expression element.
+     * @param expression
+     * @return 
+     */
+    private String getXPathFromExpression(ExpressionType expression) {
+        if (expression.getContent().size() == 1) {
+            return (String) expression.getContent().get(0);
+        } else {
+            throw new InvalidExpression();
+        }
+    }
+    
+    /**
+     * Check if result from evaluation of XPath expression fullfils constraints
+     * defined in the specification.
+     * See http://www.w3.org/TR/ws-fragment/#IdResSubset
+     * @param result
+     * @return If the result is true, the server should return all sequence of elements,
+     *         otherwise it should return only the first element.
+     */
+    private boolean checkResultConstraints(NodeList result) {
+        if (result.getLength() > 0) {
+            Node firstNode = result.item(0);
+            if (firstNode.getNodeType() == Node.ELEMENT_NODE) {
+                Element firstEl = (Element) firstNode;
+                // QName attributes
+                String localName = firstEl.getLocalName();
+                String namespace = firstEl.getNamespaceURI();
+                Node parent = firstEl.getParentNode();
+                for (int i = 1; i < result.getLength(); i++) {
+                    Node node = result.item(i);
+                    if (node.getNodeType() == Node.ELEMENT_NODE) {
+                        Element element = (Element) node;
+                        if (!stringEquals(element.getLocalName(), localName)) {
+                            return false;
+                        }
+                        if (!stringEquals(element.getNamespaceURI(), namespace)) {
+                            return false;
+                        }
+                        if (element.getParentNode() != parent) {
+                            return false;
+                        }
+                    } else {
+                        return false;
+                    }
+                }
+            } else {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    /**
+     * Helper method for equation two strings, which can be nullable.
+     * @param str1
+     * @param str2
+     * @return 
+     */
+    private boolean stringEquals(String str1, String str2) {
+        return str1 == null ? str2 == null : str1.equals(str2);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/MemoryResourceManager.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/MemoryResourceManager.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/MemoryResourceManager.java
new file mode 100644
index 0000000..9609013e
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/MemoryResourceManager.java
@@ -0,0 +1,160 @@
+/**
+ * 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.ws.transfer.manager;
+
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.WebServiceContext;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownResource;
+
+/**
+ * In memory implementation for ResourceManager interface.
+ */
+public class MemoryResourceManager implements ResourceManager {
+
+    public static final String REF_NAMESPACE = "http://cxf.apache.org/rt/ws/transfer/MemoryResourceManager";
+
+    public static final String REF_LOCAL_NAME = "uuid";
+
+    private static final Logger LOG = LogUtils.getL7dLogger(MemoryResourceManager.class);
+
+    protected Map<String, String> storage;
+
+    @Resource
+    private WebServiceContext context;
+
+    public MemoryResourceManager() {
+        storage = new HashMap<String, String>();
+    }
+
+    @Override
+    public Representation get(ReferenceParametersType ref) {
+        String uuid = getUUID(ref);
+        if (!storage.containsKey(uuid)) {
+            throw new UnknownResource();
+        }
+        String resource = storage.get(uuid);
+        if (resource.isEmpty()) {
+            return new Representation();
+        } else {
+            Document doc = null;
+            try {
+                doc = StaxUtils.read(new StringReader(storage.get(uuid)));
+            } catch (XMLStreamException e) {
+                LOG.severe(e.getLocalizedMessage());
+                throw new SoapFault("Internal Error", getSoapVersion().getReceiver());
+            }
+            Representation representation = new Representation();
+            representation.setAny(doc.getDocumentElement());
+            return representation;
+        }
+    }
+
+    @Override
+    public void delete(ReferenceParametersType ref) {
+        String uuid = getUUID(ref);
+        if (!storage.containsKey(uuid)) {
+            throw new UnknownResource();
+        }
+        storage.remove(uuid);
+    }
+
+    @Override
+    public void put(ReferenceParametersType ref, Representation newRepresentation) {
+        String uuid = getUUID(ref);
+        if (!storage.containsKey(uuid)) {
+            throw new UnknownResource();
+        }
+        Element representationEl = (Element) newRepresentation.getAny();
+        if (representationEl == null) {
+            storage.put(uuid, "");
+        } else {
+            storage.put(uuid, StaxUtils.toString(representationEl));
+        }
+    }
+
+    @Override
+    public ReferenceParametersType create(Representation initRepresentation) {
+        // Store xmlResource
+        String uuid = UUID.randomUUID().toString();
+        Element representationEl = (Element) initRepresentation.getAny();
+        if (representationEl == null) {
+            storage.put(uuid, "");
+        } else {
+            storage.put(uuid, StaxUtils.toString(representationEl));
+        }
+
+        Element uuidEl = DOMUtils.createDocument().createElementNS(REF_NAMESPACE, REF_LOCAL_NAME);
+        uuidEl.setTextContent(uuid);
+
+        // Create referenceParameter
+        ReferenceParametersType refParam = new ReferenceParametersType();
+        refParam.getAny().add(uuidEl);
+        return refParam;
+    }
+
+    private String getUUID(ReferenceParametersType ref) {
+        for (Object object : ref.getAny()) {
+            if (object instanceof JAXBElement) {
+                JAXBElement<?> element = (JAXBElement<?>) object;
+                QName qName = element.getName();
+                if (
+                        REF_NAMESPACE.equals(qName.getNamespaceURI())
+                                && REF_LOCAL_NAME.equals(qName.getLocalPart())) {
+                    return (String) element.getValue();
+                }
+            } else if (object instanceof Element) {
+                Element element = (Element) object;
+                if (
+                        REF_NAMESPACE.equals(element.getNamespaceURI())
+                                && REF_LOCAL_NAME.equals(element.getLocalName())) {
+                    return element.getTextContent();
+                }
+            }
+        }
+        throw new UnknownResource();
+    }
+
+    private SoapVersion getSoapVersion() {
+        WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
+        SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
+        return message.getVersion();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/ResourceManager.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/ResourceManager.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/ResourceManager.java
new file mode 100644
index 0000000..7dbc6ac
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/ResourceManager.java
@@ -0,0 +1,59 @@
+/**
+ * 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.ws.transfer.manager;
+
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * Interface for managing resource representations.
+ */
+public interface ResourceManager {
+    
+    /**
+     * Returns Representation object given by reference parameter.
+     * @param ref Reference parameter returned by create method.
+     * @return Representation object containing the XML resource.
+     * @see ResourceManager#create(org.apache.cxf.ws.transfer.Representation) 
+     */
+    Representation get(ReferenceParametersType ref);
+    
+    /**
+     * Deletes Representation object given by reference parameter.
+     * @param ref Reference parameter returned by create method.
+     * @see ResourceManager#create(org.apache.cxf.ws.transfer.Representation)
+     */
+    void delete(ReferenceParametersType ref);
+    
+    /**
+     * Replaces Representation object given by reference parameter with newRepresentation.
+     * @param ref Reference parameter returned by create method.
+     * @param newRepresentation New Representation object, which will replace the old one.
+     * @see ResourceManager#create(org.apache.cxf.ws.transfer.Representation)
+     */
+    void put(ReferenceParametersType ref, Representation newRepresentation);
+    
+    /**
+     * Creates new Representation object from initRepresenation.
+     * @param initRepresentation Representation object containing initial XML resource.
+     * @return Reference parameter for newly created Representation object.
+     */
+    ReferenceParametersType create(Representation initRepresentation);
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/Resource.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/Resource.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/Resource.java
new file mode 100644
index 0000000..3280e39
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/Resource.java
@@ -0,0 +1,101 @@
+/**
+ * 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.ws.transfer.resource;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.Action;
+import javax.xml.ws.soap.Addressing;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.DeleteResponse;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * The interface definition of a Resource web service, according to the specification.
+ */
+@WebService(targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+        name = TransferConstants.NAME_RESOURCE)
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+@Addressing(enabled = true, required = true)
+public interface Resource {
+
+    @Action(
+            input = TransferConstants.ACTION_GET,
+            output = TransferConstants.ACTION_GET_RESPONSE)
+    @WebMethod(operationName = TransferConstants.NAME_OPERATION_GET)
+    @WebResult(
+            name = TransferConstants.NAME_MESSAGE_GET_RESPONSE,
+            targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+            partName = "Body"
+    )
+    GetResponse get(
+        @WebParam(
+                name = TransferConstants.NAME_MESSAGE_GET,
+                targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+                partName = "Body"
+        )
+        Get body
+    );
+
+    @Action(
+            input = TransferConstants.ACTION_DELETE,
+            output = TransferConstants.ACTION_DELETE_RESPONSE
+    )
+    @WebMethod(operationName = TransferConstants.NAME_OPERATION_DELETE)
+    @WebResult(
+            name = TransferConstants.NAME_MESSAGE_DELETE_RESPONSE,
+            targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+            partName = "Body"
+    )
+    DeleteResponse delete(
+        @WebParam(
+                name = TransferConstants.NAME_MESSAGE_DELETE,
+                targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+                partName = "Body"
+        )
+        Delete body
+    );
+
+    @Action(
+            input = TransferConstants.ACTION_PUT,
+            output = TransferConstants.ACTION_PUT_RESPONSE
+    )
+    @WebMethod(operationName = TransferConstants.NAME_OPERATION_PUT)
+    @WebResult(
+            name = TransferConstants.NAME_MESSAGE_PUT_RESPONSE,
+            targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+            partName = "Body"
+    )
+    PutResponse put(
+        @WebParam(
+                name = TransferConstants.NAME_MESSAGE_PUT,
+                targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+                partName = "Body"
+        )
+        Put body
+    );
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceLocal.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceLocal.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceLocal.java
new file mode 100644
index 0000000..49333d6
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceLocal.java
@@ -0,0 +1,191 @@
+/**
+ * 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.ws.transfer.resource;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.ws.WebServiceContext;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.DeleteResponse;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.Dialect;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialect;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownDialect;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceTypeIdentifier;
+import org.apache.cxf.ws.transfer.validationtransformation.ValidAndTransformHelper;
+
+/**
+ * Implementation of the Resource interface for resources, which are created locally.
+ * @see org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceResolver
+ */
+public class ResourceLocal implements Resource {
+    
+    @javax.annotation.Resource
+    protected WebServiceContext context;
+    
+    protected ResourceManager manager;
+    
+    protected List<ResourceTypeIdentifier> resourceTypeIdentifiers;
+    
+    protected Map<String, Dialect> dialects;
+
+    public ResourceLocal() {
+        dialects = new HashMap<String, Dialect>();
+        dialects.put(FragmentDialectConstants.FRAGMENT_2011_03_IRI, new FragmentDialect());
+    }
+    
+    public ResourceManager getManager() {
+        return manager;
+    }
+
+    public void setManager(ResourceManager manager) {
+        this.manager = manager;
+    }
+
+    public List<ResourceTypeIdentifier> getResourceTypeIdentifiers() {
+        if (resourceTypeIdentifiers == null) {
+            resourceTypeIdentifiers = new ArrayList<>();
+        }
+        return resourceTypeIdentifiers;
+    }
+
+    public void setResourceTypeIdentifiers(List<ResourceTypeIdentifier> resourceTypeIdentifiers) {
+        this.resourceTypeIdentifiers = resourceTypeIdentifiers;
+    }
+    
+    /**
+     * Register Dialect object for URI.
+     * @param iri
+     * @param dialect 
+     */
+    public void registerDialect(String iri, Dialect dialect) {
+        if (dialects.containsKey(iri)) {
+            throw new IllegalArgumentException(String.format("IRI \"%s\" is already registered", iri));
+        }
+        dialects.put(iri, dialect);
+    }
+    
+    /**
+     * Unregister dialect URI.
+     * @param iri 
+     */
+    public void unregisterDialect(String iri) {
+        if (!dialects.containsKey(iri)) {
+            throw new IllegalArgumentException(String.format("IRI \"%s\" is not registered", iri));
+        }
+        dialects.remove(iri);
+    }
+    
+    @Override
+    public GetResponse get(Get body) {
+        // Getting reference paramaters
+        AddressingProperties addrProps = (AddressingProperties) ((WrappedMessageContext) context
+                .getMessageContext()).getWrappedMessage()
+                .getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
+        ReferenceParametersType refParams = addrProps
+                .getToEndpointReference()
+                .getReferenceParameters();
+        GetResponse response = new GetResponse();
+        // Getting representation from the ResourceManager
+        Representation representation = manager.get(refParams);
+        // Dialect processing
+        if (body.getDialect() != null && !body.getDialect().isEmpty()) {
+            if (dialects.containsKey(body.getDialect())) {
+                Dialect dialect = dialects.get(body.getDialect());
+                // Send fragment of resource instead it's representation.
+                response.getAny().add(dialect.processGet(body, representation));
+            } else {
+                throw new UnknownDialect();
+            }
+        } else {
+            // Send representation obtained from ResourceManager.
+            response.setRepresentation(representation);
+        }
+        return response;
+    }
+
+    @Override
+    public DeleteResponse delete(Delete body) {
+        // Getting reference paramaters
+        AddressingProperties addrProps = (AddressingProperties) ((WrappedMessageContext) context
+                .getMessageContext()).getWrappedMessage()
+                .getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
+        ReferenceParametersType refParams = addrProps
+                .getToEndpointReference()
+                .getReferenceParameters();
+        boolean delete = true;
+        // Dialect processing
+        if (body.getDialect() != null && !body.getDialect().isEmpty()) {
+            if (dialects.containsKey(body.getDialect())) {
+                Dialect dialect = dialects.get(body.getDialect());
+                delete = dialect.processDelete(body, manager.get(refParams));
+            } else {
+                throw new UnknownDialect();
+            }
+        }
+        if (delete) {
+            manager.delete(refParams);
+        }
+        return new DeleteResponse();
+    }
+
+    @Override
+    public PutResponse put(Put body) {
+        // Getting reference paramaters
+        AddressingProperties addrProps = (AddressingProperties) ((WrappedMessageContext) context
+                .getMessageContext()).getWrappedMessage()
+                .getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
+        ReferenceParametersType refParams = addrProps
+                .getToEndpointReference()
+                .getReferenceParameters();
+        // Getting representation from the ResourceManager
+        Representation storedRepresentation = manager.get(refParams);
+        // Getting representation from the incoming SOAP message. This representation will be stored.
+        Representation putRepresentation = body.getRepresentation();
+        // Dialect processing
+        if (body.getDialect() != null && !body.getDialect().isEmpty()) {
+            if (dialects.containsKey(body.getDialect())) {
+                Dialect dialect = dialects.get(body.getDialect());
+                putRepresentation = dialect.processPut(body, storedRepresentation);
+            } else {
+                throw new UnknownDialect();
+            }
+        }
+        ValidAndTransformHelper.validationAndTransformation(
+                resourceTypeIdentifiers, putRepresentation, storedRepresentation);
+        manager.put(refParams, putRepresentation);
+        PutResponse response = new PutResponse();
+        response.setRepresentation(putRepresentation);
+        return response;
+    }
+    
+}