cxf git commit: [CXF-6861] Prototyping JAXBElementTypedProvider
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 8cfbd97e0 -> 6c8d2ba81 [CXF-6861] Prototyping JAXBElementTypedProvider Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/6c8d2ba8 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6c8d2ba8 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6c8d2ba8 Branch: refs/heads/3.1.x-fixes Commit: 6c8d2ba818713be47a26541a22a67470235daf96 Parents: 8cfbd97 Author: Sergey BeryozkinAuthored: Thu Apr 7 18:13:30 2016 +0100 Committer: Sergey Beryozkin Committed: Thu Apr 7 18:15:33 2016 +0100 -- .../provider/JAXBElementTypedProvider.java | 48 +++ .../cxf/jaxrs/provider/ProviderFactory.java | 3 +- .../cxf/jaxrs/provider/ProviderFactoryTest.java | 50 ++-- 3 files changed, 75 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/6c8d2ba8/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementTypedProvider.java -- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementTypedProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementTypedProvider.java new file mode 100644 index 000..388035f --- /dev/null +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementTypedProvider.java @@ -0,0 +1,48 @@ +/** + * 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.provider; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyReader; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.xml.bind.JAXBElement; + +@SuppressWarnings("rawtypes") +public class JAXBElementTypedProvider extends JAXBElementProvider +implements MessageBodyWriter, MessageBodyReader { + +public JAXBElement readFrom(Class type, Type genericType, Annotation[] anns, MediaType mt, +MultivaluedMap headers, InputStream is) +throws IOException { +return super.readFrom(type, genericType, anns, mt, headers, is); +} +public void writeTo(JAXBElement obj, Class cls, Type genericType, Annotation[] anns, +MediaType m, MultivaluedMap headers, OutputStream os) +throws IOException { +super.writeTo(obj, cls, genericType, anns, m, headers, os); +} +} http://git-wip-us.apache.org/repos/asf/cxf/blob/6c8d2ba8/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java -- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java index c0bdd1f..f89c6fb 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java @@ -134,7 +134,8 @@ public abstract class ProviderFactory { new FormEncodingProvider(), new StringTextProvider(), new PrimitiveTextProvider(), - createProvider(JAXB_PROVIDER_NAME), + new JAXBElementProvider(), + new JAXBElementTypedProvider(), new MultipartProvider()); Object prop = factory.getBus().getProperty("skip.default.json.provider.registration"); if (!PropertyUtils.isTrue(prop)) { http://git-wip-us.apache.org/repos/asf/cxf/blob/6c8d2ba8/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java -- diff
[2/2] cxf git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cxf
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cxf Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/55976e14 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/55976e14 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/55976e14 Branch: refs/heads/master Commit: 55976e149cb082d6b0fc1e35dc13f10406204b94 Parents: ade81e3 53d7ad0 Author: Sergey BeryozkinAuthored: Thu Apr 7 18:14:00 2016 +0100 Committer: Sergey Beryozkin Committed: Thu Apr 7 18:14:00 2016 +0100 -- .../oauth2/filters/OAuthRequestFilter.java | 2 +- .../jaxrs/JAXRSClientServerSpringBookTest.java | 35 ++-- 2 files changed, 19 insertions(+), 18 deletions(-) --
[1/2] cxf git commit: [CXF-6861] Prototyping JAXBElementTypedProvider
Repository: cxf Updated Branches: refs/heads/master 53d7ad07c -> 55976e149 [CXF-6861] Prototyping JAXBElementTypedProvider Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ade81e37 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ade81e37 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ade81e37 Branch: refs/heads/master Commit: ade81e37b5172085b35b92f33a28f99832c968da Parents: 7cccdcf Author: Sergey BeryozkinAuthored: Thu Apr 7 18:13:30 2016 +0100 Committer: Sergey Beryozkin Committed: Thu Apr 7 18:13:30 2016 +0100 -- .../provider/JAXBElementTypedProvider.java | 48 +++ .../cxf/jaxrs/provider/ProviderFactory.java | 3 +- .../cxf/jaxrs/provider/ProviderFactoryTest.java | 50 ++-- 3 files changed, 75 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/ade81e37/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementTypedProvider.java -- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementTypedProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementTypedProvider.java new file mode 100644 index 000..388035f --- /dev/null +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementTypedProvider.java @@ -0,0 +1,48 @@ +/** + * 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.provider; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyReader; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.xml.bind.JAXBElement; + +@SuppressWarnings("rawtypes") +public class JAXBElementTypedProvider extends JAXBElementProvider +implements MessageBodyWriter, MessageBodyReader { + +public JAXBElement readFrom(Class type, Type genericType, Annotation[] anns, MediaType mt, +MultivaluedMap headers, InputStream is) +throws IOException { +return super.readFrom(type, genericType, anns, mt, headers, is); +} +public void writeTo(JAXBElement obj, Class cls, Type genericType, Annotation[] anns, +MediaType m, MultivaluedMap headers, OutputStream os) +throws IOException { +super.writeTo(obj, cls, genericType, anns, m, headers, os); +} +} http://git-wip-us.apache.org/repos/asf/cxf/blob/ade81e37/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java -- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java index c0bdd1f..f89c6fb 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java @@ -134,7 +134,8 @@ public abstract class ProviderFactory { new FormEncodingProvider(), new StringTextProvider(), new PrimitiveTextProvider(), - createProvider(JAXB_PROVIDER_NAME), + new JAXBElementProvider(), + new JAXBElementTypedProvider(), new MultipartProvider()); Object prop = factory.getBus().getProperty("skip.default.json.provider.registration"); if (!PropertyUtils.isTrue(prop)) { http://git-wip-us.apache.org/repos/asf/cxf/blob/ade81e37/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java -- diff --git
cxf-fediz git commit: Fixing build
Repository: cxf-fediz Updated Branches: refs/heads/1.2.x-fixes dffcc9e03 -> ba7dfac54 Fixing build Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/ba7dfac5 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/ba7dfac5 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/ba7dfac5 Branch: refs/heads/1.2.x-fixes Commit: ba7dfac54e2c061eae8a04c84438c23758215123 Parents: dffcc9e Author: Colm O hEigeartaighAuthored: Thu Apr 7 18:02:32 2016 +0100 Committer: Colm O hEigeartaigh Committed: Thu Apr 7 18:02:32 2016 +0100 -- .../java/org/apache/cxf/fediz/integrationtests/Spring2Test.java| 2 -- 1 file changed, 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/ba7dfac5/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java -- diff --git a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java index d9e77ab..d763132 100644 --- a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java +++ b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java @@ -232,8 +232,6 @@ public class Spring2Test extends AbstractTests { // || ex.getMessage().contains("401 Authentication Failed") // || ex.getMessage().contains("403 Forbidden")); } - -webClient.close(); } @Override
[1/2] cxf-fediz git commit: Consolidate Tomcat shutdown code + avoid a NPE
Repository: cxf-fediz Updated Branches: refs/heads/1.2.x-fixes 54ad62c98 -> dffcc9e03 Consolidate Tomcat shutdown code + avoid a NPE Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/0c2deab1 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/0c2deab1 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/0c2deab1 Branch: refs/heads/1.2.x-fixes Commit: 0c2deab10236639ea30e5b5362fca407eb321f4e Parents: 54ad62c Author: Colm O hEigeartaighAuthored: Thu Apr 7 12:03:49 2016 +0100 Committer: Colm O hEigeartaigh Committed: Thu Apr 7 17:03:46 2016 +0100 -- .../federation/FederationTest.java | 28 +++ .../cxf/fediz/integrationtests/SAMLSSOTest.java | 27 +++--- .../cxf/fediz/integrationtests/WSFedTest.java | 27 +++--- .../apache/cxf/fediz/systests/idp/IdpTest.java | 14 ++ .../fediz/integrationtests/KerberosTest.java| 27 +++--- .../cxf/fediz/integrationtests/Spring2Test.java | 28 --- .../cxf/fediz/integrationtests/SpringTest.java | 27 +++--- .../integrationtests/ClientCertificateTest.java | 27 +++--- .../fediz/integrationtests/HolderOfKeyTest.java | 29 .../cxf/fediz/integrationtests/TomcatTest.java | 27 +++--- .../cxf/fediz/integrationtests/WReqTest.java| 27 +++--- 11 files changed, 111 insertions(+), 177 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java -- diff --git a/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java b/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java index 5404e49..937d5af 100644 --- a/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java +++ b/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java @@ -134,30 +134,22 @@ public class FederationTest extends AbstractTests { @AfterClass public static void cleanup() { +shutdownServer(idpServer); +shutdownServer(rpServer); +} + +private static void shutdownServer(Tomcat server) { try { -if (idpServer.getServer() != null -&& idpServer.getServer().getState() != LifecycleState.DESTROYED) { -if (idpServer.getServer().getState() != LifecycleState.STOPPED) { -idpServer.stop(); -} -idpServer.destroy(); -} -} catch (Exception e) { -e.printStackTrace(); -} - -try { -if (rpServer.getServer() != null -&& rpServer.getServer().getState() != LifecycleState.DESTROYED) { -if (rpServer.getServer().getState() != LifecycleState.STOPPED) { -rpServer.stop(); +if (server != null && server.getServer() != null +&& server.getServer().getState() != LifecycleState.DESTROYED) { +if (server.getServer().getState() != LifecycleState.STOPPED) { +server.stop(); } -rpServer.destroy(); +server.destroy(); } } catch (Exception e) { e.printStackTrace(); } - } public String getIdpHttpsPort() { http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java -- diff --git a/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java b/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java index 64e6b52..b42d4b5 100644 --- a/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java +++ b/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java @@ -204,25 +204,18 @@ public class SAMLSSOTest { @AfterClass public static void cleanup() { +shutdownServer(idpServer); +shutdownServer(rpServer); +} + +private static void shutdownServer(Tomcat server) { try { -if (idpServer.getServer() != null -&& idpServer.getServer().getState() != LifecycleState.DESTROYED) { -if (idpServer.getServer().getState() !=
[2/2] cxf-fediz git commit: Consolidate test launch code and avoid stacktraces when launching Tomcat servers
Consolidate test launch code and avoid stacktraces when launching Tomcat servers Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/dffcc9e0 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/dffcc9e0 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/dffcc9e0 Branch: refs/heads/1.2.x-fixes Commit: dffcc9e03ede3fa13d8c671f4cbc641264cff9b6 Parents: 0c2deab Author: Colm O hEigeartaighAuthored: Thu Apr 7 17:02:40 2016 +0100 Committer: Colm O hEigeartaigh Committed: Thu Apr 7 17:04:34 2016 +0100 -- .../cxf/fediz/integrationtests/SAMLSSOTest.java | 329 --- .../cxf/fediz/integrationtests/WSFedTest.java | 162 - .../fediz/integrationtests/KerberosTest.java| 119 +++ .../cxf/fediz/integrationtests/Spring2Test.java | 121 +++ .../cxf/fediz/integrationtests/SpringTest.java | 120 +++ .../integrationtests/ClientCertificateTest.java | 116 +++ .../fediz/integrationtests/HolderOfKeyTest.java | 118 +++ .../cxf/fediz/integrationtests/TomcatTest.java | 120 +++ .../cxf/fediz/integrationtests/WReqTest.java| 119 +++ .../src/main/webapp/META-INF/context.xml| 22 -- .../src/main/webapp/META-INF/context.xml| 22 -- 11 files changed, 406 insertions(+), 962 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java -- diff --git a/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java b/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java deleted file mode 100644 index b42d4b5..000 --- a/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java +++ /dev/null @@ -1,329 +0,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. - */ - -package org.apache.cxf.fediz.integrationtests; - - -import java.io.File; -import java.io.IOException; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.gargoylesoftware.htmlunit.CookieManager; -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.HtmlForm; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; -import com.gargoylesoftware.htmlunit.xml.XmlPage; - -import org.apache.catalina.Context; -import org.apache.catalina.LifecycleState; -import org.apache.catalina.connector.Connector; -import org.apache.catalina.startup.Tomcat; -import org.apache.cxf.fediz.core.ClaimTypes; -import org.apache.cxf.fediz.core.util.DOMUtils; -import org.apache.cxf.fediz.tomcat.FederationAuthenticator; -import org.apache.http.auth.AuthScope; -import org.apache.http.auth.UsernamePasswordCredentials; -import org.apache.xml.security.keys.KeyInfo; -import org.apache.xml.security.signature.XMLSignature; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * This is a test for federation in the IdP. The RP application is configured to use a home realm of "realm b". The - * client gets redirected to the IdP for "realm a", which in turn redirects to the IdP for "realm b", which is a - * SAML SSO IdP. The IdP for "realm a" will convert the signin request to a SAML SSO sign in request. The IdP for - * realm b authenticates the user, who is then redirected back to the IdP for "realm a" to get a SAML token from - * the STS + then back to the application. - */ -public class SAMLSSOTest { - -static String idpHttpsPort; -static String idpSamlSSOHttpsPort; -static String rpHttpsPort; - -private static Tomcat idpServer; -private static Tomcat idpSamlSSOServer; -private static Tomcat rpServer; - -@BeforeClass -public static void init() { -
[2/3] cxf-fediz git commit: Consolidate test launch code and avoid stacktraces when launching Tomcat servers
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a2e10b87/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java -- diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java index 9b996cf..915744e 100644 --- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java +++ b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java @@ -20,6 +20,9 @@ package org.apache.cxf.fediz.integrationtests; import java.io.File; +import java.io.IOException; + +import javax.servlet.ServletException; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.DomElement; @@ -29,6 +32,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; import org.apache.catalina.Context; +import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleState; import org.apache.catalina.connector.Connector; import org.apache.catalina.startup.Tomcat; @@ -53,7 +57,7 @@ public class HolderOfKeyTest { private static Tomcat rpServer; @BeforeClass -public static void init() { +public static void init() throws Exception { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info"); @@ -68,83 +72,61 @@ public class HolderOfKeyTest { rpHttpsPort = System.getProperty("rp.https.port"); Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort); -initIdp(); -initRp(); +idpServer = startServer(true, idpHttpsPort); +rpServer = startServer(false, rpHttpsPort); } -private static void initIdp() { -try { -idpServer = new Tomcat(); -idpServer.setPort(0); -String currentDir = new File(".").getCanonicalPath(); -idpServer.setBaseDir(currentDir + File.separator + "target"); - -idpServer.getHost().setAppBase("tomcat/idp/webapps"); -idpServer.getHost().setAutoDeploy(true); -idpServer.getHost().setDeployOnStartup(true); - -Connector httpsConnector = new Connector(); -httpsConnector.setPort(Integer.parseInt(idpHttpsPort)); -httpsConnector.setSecure(true); -httpsConnector.setScheme("https"); -//httpsConnector.setAttribute("keyAlias", keyAlias); -httpsConnector.setAttribute("keystorePass", "tompass"); -httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks"); -httpsConnector.setAttribute("truststorePass", "tompass"); -httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks"); -httpsConnector.setAttribute("clientAuth", "want"); -httpsConnector.setAttribute("sslProtocol", "TLS"); -httpsConnector.setAttribute("SSLEnabled", true); - -idpServer.getService().addConnector(httpsConnector); - -idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts"); -idpServer.addWebapp("/fediz-idp", "fediz-idp"); - -idpServer.start(); -} catch (Exception e) { -e.printStackTrace(); +private static Tomcat startServer(boolean idp, String port) +throws ServletException, LifecycleException, IOException { +Tomcat server = new Tomcat(); +server.setPort(0); +String currentDir = new File(".").getCanonicalPath(); +String baseDir = currentDir + File.separator + "target"; +server.setBaseDir(baseDir); + +if (idp) { +server.getHost().setAppBase("tomcat/idp/webapps"); +} else { +server.getHost().setAppBase("tomcat/rp/webapps"); } -} +server.getHost().setAutoDeploy(true); +server.getHost().setDeployOnStartup(true); + +Connector httpsConnector = new Connector(); +httpsConnector.setPort(Integer.parseInt(port)); +httpsConnector.setSecure(true); +httpsConnector.setScheme("https"); +//httpsConnector.setAttribute("keyAlias", keyAlias); +httpsConnector.setAttribute("keystorePass", "tompass"); +httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks"); +httpsConnector.setAttribute("truststorePass", "tompass"); +httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks"); +httpsConnector.setAttribute("clientAuth", "want"); +//
[3/3] cxf-fediz git commit: Consolidate test launch code and avoid stacktraces when launching Tomcat servers
Consolidate test launch code and avoid stacktraces when launching Tomcat servers Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/a2e10b87 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/a2e10b87 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/a2e10b87 Branch: refs/heads/master Commit: a2e10b8734db855026a2154ac5aaace7ec4959d3 Parents: 953282b Author: Colm O hEigeartaighAuthored: Thu Apr 7 17:02:40 2016 +0100 Committer: Colm O hEigeartaigh Committed: Thu Apr 7 17:02:40 2016 +0100 -- .../cxf/fediz/integrationtests/OIDCTest.java| 157 +++--- .../integrationtests/SAMLSSOFedizTest.java | 164 +++--- .../cxf/fediz/integrationtests/SAMLSSOTest.java | 165 +++ .../cxf/fediz/integrationtests/WSFedTest.java | 162 +++--- .../fediz/integrationtests/KerberosTest.java| 119 ++--- systests/oidc/pom.xml | 20 +++ .../cxf/fediz/systests/oidc/OIDCTest.java | 116 ++--- .../apache/cxf/fediz/systests/idp/IdpTest.java | 78 + .../cxf/fediz/integrationtests/Spring2Test.java | 121 ++ .../cxf/fediz/integrationtests/SpringTest.java | 120 ++ .../integrationtests/ClientCertificateTest.java | 116 ++--- .../fediz/integrationtests/HolderOfKeyTest.java | 118 ++--- .../cxf/fediz/integrationtests/TomcatTest.java | 120 ++ .../cxf/fediz/integrationtests/WReqTest.java| 119 ++--- .../integrationtests/ClientCertificateTest.java | 116 ++--- .../fediz/integrationtests/HolderOfKeyTest.java | 118 ++--- .../cxf/fediz/integrationtests/TomcatTest.java | 120 ++ .../cxf/fediz/integrationtests/WReqTest.java| 119 ++--- .../src/main/webapp/META-INF/context.xml| 22 --- .../src/main/webapp/META-INF/context.xml| 22 --- 20 files changed, 886 insertions(+), 1326 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a2e10b87/systests/federation/oidc/src/test/java/org/apache/cxf/fediz/integrationtests/OIDCTest.java -- diff --git a/systests/federation/oidc/src/test/java/org/apache/cxf/fediz/integrationtests/OIDCTest.java b/systests/federation/oidc/src/test/java/org/apache/cxf/fediz/integrationtests/OIDCTest.java index d1ba012..4110355 100644 --- a/systests/federation/oidc/src/test/java/org/apache/cxf/fediz/integrationtests/OIDCTest.java +++ b/systests/federation/oidc/src/test/java/org/apache/cxf/fediz/integrationtests/OIDCTest.java @@ -24,6 +24,9 @@ import java.io.File; import java.io.IOException; import java.net.URL; import java.util.ArrayList; + +import javax.servlet.ServletException; + import org.w3c.dom.Element; import com.gargoylesoftware.htmlunit.CookieManager; @@ -37,6 +40,7 @@ import com.gargoylesoftware.htmlunit.util.NameValuePair; import com.gargoylesoftware.htmlunit.xml.XmlPage; import org.apache.catalina.Context; +import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleState; import org.apache.catalina.connector.Connector; import org.apache.catalina.startup.Tomcat; @@ -66,7 +70,7 @@ public class OIDCTest { private static Tomcat rpServer; @BeforeClass -public static void init() { +public static void init() throws Exception { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info"); @@ -83,124 +87,73 @@ public class OIDCTest { rpHttpsPort = System.getProperty("rp.https.port"); Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort); -initIdp(); -initOIDCIdp(); -initRp(); +idpServer = startServer(true, false, idpHttpsPort); +idpOIDCServer = startServer(false, true, idpOIDCHttpsPort); +rpServer = startServer(false, false, rpHttpsPort); } -private static void initIdp() { -try { -idpServer = new Tomcat(); -idpServer.setPort(0); -String currentDir = new File(".").getCanonicalPath(); -idpServer.setBaseDir(currentDir + File.separator + "target"); - -idpServer.getHost().setAppBase("tomcat/idp/webapps"); -idpServer.getHost().setAutoDeploy(true); -idpServer.getHost().setDeployOnStartup(true); - -Connector httpsConnector = new Connector(); -httpsConnector.setPort(Integer.parseInt(idpHttpsPort)); -
[1/3] cxf-fediz git commit: Consolidate Tomcat shutdown code + avoid a NPE
Repository: cxf-fediz Updated Branches: refs/heads/master 4c20cefb8 -> a2e10b873 Consolidate Tomcat shutdown code + avoid a NPE Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/953282b3 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/953282b3 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/953282b3 Branch: refs/heads/master Commit: 953282b320e5342020fe8b77e62715b617877479 Parents: 4c20cef Author: Colm O hEigeartaighAuthored: Thu Apr 7 12:03:49 2016 +0100 Committer: Colm O hEigeartaigh Committed: Thu Apr 7 12:03:49 2016 +0100 -- .../federation/FederationTest.java | 28 +++ .../cxf/fediz/integrationtests/OIDCTest.java| 27 +++--- .../integrationtests/SAMLSSOFedizTest.java | 27 +++--- .../cxf/fediz/integrationtests/SAMLSSOTest.java | 27 +++--- .../cxf/fediz/integrationtests/WSFedTest.java | 27 +++--- .../apache/cxf/fediz/systests/idp/IdpTest.java | 14 ++ .../fediz/integrationtests/KerberosTest.java| 27 +++--- .../cxf/fediz/systests/oidc/OIDCTest.java | 27 ++ .../apache/cxf/fediz/systests/idp/IdpTest.java | 14 ++ .../cxf/fediz/integrationtests/Spring2Test.java | 28 --- .../cxf/fediz/integrationtests/SpringTest.java | 27 +++--- .../integrationtests/ClientCertificateTest.java | 27 +++--- .../fediz/integrationtests/HolderOfKeyTest.java | 29 .../cxf/fediz/integrationtests/TomcatTest.java | 27 +++--- .../cxf/fediz/integrationtests/WReqTest.java| 27 +++--- .../integrationtests/ClientCertificateTest.java | 27 +++--- .../fediz/integrationtests/HolderOfKeyTest.java | 27 +++--- .../cxf/fediz/integrationtests/TomcatTest.java | 27 +++--- .../cxf/fediz/integrationtests/WReqTest.java| 29 19 files changed, 189 insertions(+), 304 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/953282b3/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java -- diff --git a/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java b/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java index 5404e49..937d5af 100644 --- a/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java +++ b/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java @@ -134,30 +134,22 @@ public class FederationTest extends AbstractTests { @AfterClass public static void cleanup() { +shutdownServer(idpServer); +shutdownServer(rpServer); +} + +private static void shutdownServer(Tomcat server) { try { -if (idpServer.getServer() != null -&& idpServer.getServer().getState() != LifecycleState.DESTROYED) { -if (idpServer.getServer().getState() != LifecycleState.STOPPED) { -idpServer.stop(); -} -idpServer.destroy(); -} -} catch (Exception e) { -e.printStackTrace(); -} - -try { -if (rpServer.getServer() != null -&& rpServer.getServer().getState() != LifecycleState.DESTROYED) { -if (rpServer.getServer().getState() != LifecycleState.STOPPED) { -rpServer.stop(); +if (server != null && server.getServer() != null +&& server.getServer().getState() != LifecycleState.DESTROYED) { +if (server.getServer().getState() != LifecycleState.STOPPED) { +server.stop(); } -rpServer.destroy(); +server.destroy(); } } catch (Exception e) { e.printStackTrace(); } - } public String getIdpHttpsPort() { http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/953282b3/systests/federation/oidc/src/test/java/org/apache/cxf/fediz/integrationtests/OIDCTest.java -- diff --git a/systests/federation/oidc/src/test/java/org/apache/cxf/fediz/integrationtests/OIDCTest.java b/systests/federation/oidc/src/test/java/org/apache/cxf/fediz/integrationtests/OIDCTest.java index 0a7e83a..d1ba012 100644 --- a/systests/federation/oidc/src/test/java/org/apache/cxf/fediz/integrationtests/OIDCTest.java +++
[2/2] cxf git commit: Recording .gitmergeinfo Changes
Recording .gitmergeinfo Changes Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ad60c676 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ad60c676 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ad60c676 Branch: refs/heads/3.0.x-fixes Commit: ad60c67686a54bf42a3a9e7be4bc44b85cc97673 Parents: 258e846 Author: Colm O hEigeartaighAuthored: Thu Apr 7 12:25:49 2016 +0100 Committer: Colm O hEigeartaigh Committed: Thu Apr 7 12:25:49 2016 +0100 -- .gitmergeinfo | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/ad60c676/.gitmergeinfo -- diff --git a/.gitmergeinfo b/.gitmergeinfo index 95e999e..12255bf 100644 --- a/.gitmergeinfo +++ b/.gitmergeinfo @@ -483,6 +483,7 @@ B 8c09f501af1d7fe77219396f1e0a5de65146bbe6 B 8c4dab45a2b6286e80986c892d4e9ed9b4dc66d5 B 8c7a97734fd3db3423bf359d4fdb44305ef45cc4 B 8c7e2493dc26e1df4a16168a5491ac96509549d6 +B 8cfbd97e0e394dca4f67b4d9bef92380f839f23b B 8e028a617f026fca2499f850bb680ada0692d681 B 8e930bcfc6e68775db59957df8ee38d73499a6f4 B 8e9c9571f256ddbe06514ccc0c2f232218f905d6
[2/2] cxf git commit: Close a socket
Close a socket Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8cfbd97e Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8cfbd97e Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8cfbd97e Branch: refs/heads/3.1.x-fixes Commit: 8cfbd97e0e394dca4f67b4d9bef92380f839f23b Parents: c57a949 Author: Colm O hEigeartaighAuthored: Thu Apr 7 11:50:54 2016 +0100 Committer: Colm O hEigeartaigh Committed: Thu Apr 7 11:52:02 2016 +0100 -- .../jaxrs/JAXRSClientServerSpringBookTest.java | 35 ++-- 1 file changed, 18 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/8cfbd97e/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java -- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java index f15c640..5994269 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java @@ -785,24 +785,25 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest @Test public void testRetrieveBookAegis3() throws Exception { -Socket s = new Socket("localhost", Integer.parseInt(PORT)); - -InputStream is = this.getClass().getResourceAsStream("resources/retrieveRequest.txt"); -byte[] bytes = IOUtils.readBytesFromStream(is); -s.getOutputStream().write(bytes); -s.getOutputStream().flush(); - -BufferedReader r = new BufferedReader(new InputStreamReader(s.getInputStream())); -StringBuilder sb = new StringBuilder(); -String str = null; -while ((str = r.readLine()) != null) { -sb.append(str); -} +try (Socket s = new Socket("localhost", Integer.parseInt(PORT)); +InputStream is = this.getClass().getResourceAsStream("resources/retrieveRequest.txt")) { + +byte[] bytes = IOUtils.readBytesFromStream(is); +s.getOutputStream().write(bytes); +s.getOutputStream().flush(); + +BufferedReader r = new BufferedReader(new InputStreamReader(s.getInputStream())); +StringBuilder sb = new StringBuilder(); +String str = null; +while ((str = r.readLine()) != null) { +sb.append(str); +} -String aegisData = sb.toString(); -s.getInputStream().close(); -s.close(); -assertTrue(aegisData.contains("CXF in Action - 2")); +String aegisData = sb.toString(); +s.getInputStream().close(); +s.close(); +assertTrue(aegisData.contains("CXF in Action - 2")); +} }
[2/2] cxf git commit: Using equals instead of matches
Using equals instead of matches Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5fc95af7 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5fc95af7 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5fc95af7 Branch: refs/heads/master Commit: 5fc95af7f7f0d9ac232eed3dd80a574bc320fee8 Parents: 7cccdcf Author: Colm O hEigeartaighAuthored: Thu Apr 7 11:50:46 2016 +0100 Committer: Colm O hEigeartaigh Committed: Thu Apr 7 11:51:09 2016 +0100 -- .../apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/5fc95af7/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java -- diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java index 457beae..1416dd4 100644 --- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java +++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java @@ -134,7 +134,7 @@ public class OAuthRequestFilter extends AbstractAccessTokenValidator if (accessTokenV.getClientIpAddress() != null) { String remoteAddress = getMessageContext().getHttpServletRequest().getRemoteAddr(); -if (remoteAddress == null || accessTokenV.getClientIpAddress().matches(remoteAddress)) { +if (remoteAddress == null || accessTokenV.getClientIpAddress().equals(remoteAddress)) { String message = "Client IP Address is invalid"; LOG.warning(message); throw ExceptionUtils.toForbiddenException(null, null);
cxf git commit: [CXF-6729] Not quoting Path with forward slash characters
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 708f53f7a -> 3f4457435 [CXF-6729] Not quoting Path with forward slash characters Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3f445743 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3f445743 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3f445743 Branch: refs/heads/3.1.x-fixes Commit: 3f4457435ddadd77761a43e97fdc008ac0325196 Parents: 708f53f Author: Sergey BeryozkinAuthored: Thu Apr 7 10:37:42 2016 +0100 Committer: Sergey Beryozkin Committed: Thu Apr 7 10:38:54 2016 +0100 -- .../cxf/jaxrs/impl/CookieHeaderProvider.java| 6 +-- .../cxf/jaxrs/impl/NewCookieHeaderProvider.java | 40 +++- .../jaxrs/impl/NewCookieHeaderProviderTest.java | 6 +++ 3 files changed, 32 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/3f445743/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java -- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java index f0a3b3e..89df061 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java @@ -75,12 +75,12 @@ public class CookieHeaderProvider implements HeaderDelegate { if (c.getVersion() != 0) { sb.append(VERSION).append('=').append(c.getVersion()).append(';'); } - sb.append(c.getName()).append('=').append(NewCookieHeaderProvider.maybeQuote(c.getValue())); + sb.append(c.getName()).append('=').append(NewCookieHeaderProvider.maybeQuoteAll(c.getValue())); if (c.getPath() != null) { - sb.append(';').append(PATH).append('=').append(NewCookieHeaderProvider.maybeQuote(c.getPath())); + sb.append(';').append(PATH).append('=').append(NewCookieHeaderProvider.maybeQuotePath(c.getPath())); } if (c.getDomain() != null) { - sb.append(';').append(DOMAIN).append('=').append(NewCookieHeaderProvider.maybeQuote(c.getDomain())); + sb.append(';').append(DOMAIN).append('=').append(NewCookieHeaderProvider.maybeQuoteAll(c.getDomain())); } return sb.toString(); } http://git-wip-us.apache.org/repos/asf/cxf/blob/3f445743/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java -- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java index 4bcfd5e..601edb8 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java @@ -39,7 +39,9 @@ public class NewCookieHeaderProvider implements HeaderDelegate { private static final String HTTP_ONLY = "HttpOnly"; /** from RFC 2068, token special case characters */ -private static final String TSPECIALS = "\"()<>@,;:\\/[]?={} \t"; + +private static final String TSPECIALS_PATH = "\"()<>@,;:\\[]?={} \t"; +private static final String TSPECIALS_ALL = TSPECIALS_PATH + "/"; private static final String DOUBLE_QUOTE = "\""; public NewCookie fromString(String c) { @@ -108,18 +110,18 @@ public class NewCookieHeaderProvider implements HeaderDelegate { } StringBuilder sb = new StringBuilder(); - sb.append(value.getName()).append('=').append(maybeQuote(value.getValue())); + sb.append(value.getName()).append('=').append(maybeQuoteAll(value.getValue())); if (value.getComment() != null) { - sb.append(';').append(COMMENT).append('=').append(maybeQuote(value.getComment())); + sb.append(';').append(COMMENT).append('=').append(maybeQuoteAll(value.getComment())); } if (value.getDomain() != null) { - sb.append(';').append(DOMAIN).append('=').append(maybeQuote(value.getDomain())); + sb.append(';').append(DOMAIN).append('=').append(maybeQuoteAll(value.getDomain())); } if (value.getMaxAge() != -1) { sb.append(';').append(MAX_AGE).append('=').append(value.getMaxAge()); } if (value.getPath() != null) { - sb.append(';').append(PATH).append('=').append(maybeQuote(value.getPath())); +
cxf git commit: [CXF-6729] Not quoting Path with forward slash characters
Repository: cxf Updated Branches: refs/heads/master 3a461f1db -> 7cccdcf53 [CXF-6729] Not quoting Path with forward slash characters Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/7cccdcf5 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7cccdcf5 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7cccdcf5 Branch: refs/heads/master Commit: 7cccdcf53220a8611fe6475d15acd6bc968349f3 Parents: 3a461f1 Author: Sergey BeryozkinAuthored: Thu Apr 7 10:37:42 2016 +0100 Committer: Sergey Beryozkin Committed: Thu Apr 7 10:37:42 2016 +0100 -- .../cxf/jaxrs/impl/CookieHeaderProvider.java| 6 +-- .../cxf/jaxrs/impl/NewCookieHeaderProvider.java | 40 +++- .../jaxrs/impl/NewCookieHeaderProviderTest.java | 6 +++ 3 files changed, 32 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/7cccdcf5/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java -- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java index f0a3b3e..89df061 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java @@ -75,12 +75,12 @@ public class CookieHeaderProvider implements HeaderDelegate { if (c.getVersion() != 0) { sb.append(VERSION).append('=').append(c.getVersion()).append(';'); } - sb.append(c.getName()).append('=').append(NewCookieHeaderProvider.maybeQuote(c.getValue())); + sb.append(c.getName()).append('=').append(NewCookieHeaderProvider.maybeQuoteAll(c.getValue())); if (c.getPath() != null) { - sb.append(';').append(PATH).append('=').append(NewCookieHeaderProvider.maybeQuote(c.getPath())); + sb.append(';').append(PATH).append('=').append(NewCookieHeaderProvider.maybeQuotePath(c.getPath())); } if (c.getDomain() != null) { - sb.append(';').append(DOMAIN).append('=').append(NewCookieHeaderProvider.maybeQuote(c.getDomain())); + sb.append(';').append(DOMAIN).append('=').append(NewCookieHeaderProvider.maybeQuoteAll(c.getDomain())); } return sb.toString(); } http://git-wip-us.apache.org/repos/asf/cxf/blob/7cccdcf5/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java -- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java index 4bcfd5e..601edb8 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java @@ -39,7 +39,9 @@ public class NewCookieHeaderProvider implements HeaderDelegate { private static final String HTTP_ONLY = "HttpOnly"; /** from RFC 2068, token special case characters */ -private static final String TSPECIALS = "\"()<>@,;:\\/[]?={} \t"; + +private static final String TSPECIALS_PATH = "\"()<>@,;:\\[]?={} \t"; +private static final String TSPECIALS_ALL = TSPECIALS_PATH + "/"; private static final String DOUBLE_QUOTE = "\""; public NewCookie fromString(String c) { @@ -108,18 +110,18 @@ public class NewCookieHeaderProvider implements HeaderDelegate { } StringBuilder sb = new StringBuilder(); - sb.append(value.getName()).append('=').append(maybeQuote(value.getValue())); + sb.append(value.getName()).append('=').append(maybeQuoteAll(value.getValue())); if (value.getComment() != null) { - sb.append(';').append(COMMENT).append('=').append(maybeQuote(value.getComment())); + sb.append(';').append(COMMENT).append('=').append(maybeQuoteAll(value.getComment())); } if (value.getDomain() != null) { - sb.append(';').append(DOMAIN).append('=').append(maybeQuote(value.getDomain())); + sb.append(';').append(DOMAIN).append('=').append(maybeQuoteAll(value.getDomain())); } if (value.getMaxAge() != -1) { sb.append(';').append(MAX_AGE).append('=').append(value.getMaxAge()); } if (value.getPath() != null) { - sb.append(';').append(PATH).append('=').append(maybeQuote(value.getPath())); +