You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by gm...@apache.org on 2012/08/09 19:56:34 UTC

svn commit: r1371345 - in /cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https: ./ certs/ src/main2/ src/main2/config/ src/main2/java/ src/main2/java/httpsdemo/ src/main2/java/httpsdemo/client/ src/main2/java/httpsdemo/com...

Author: gmazza
Date: Thu Aug  9 17:56:33 2012
New Revision: 1371345

URL: http://svn.apache.org/viewvc?rev=1371345&view=rev
Log:
Updated basic_https sample to use HTTPComponents, no longer disabling CN check by default (backport from CXF 2.7/trunk branch.)

Added:
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/KeyREADME.txt
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/clientKeystore.jks   (with props)
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/serviceKeystore.jks   (with props)
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/client/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/client/Client.java
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/Customer.java
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/CustomerService.java
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/CustomerServiceImpl.java
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/Server.java
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/ClientConfig.xml
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/ServerConfig.xml
Removed:
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/certs/
Modified:
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/README.txt
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/pom.xml

Modified: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/README.txt
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/README.txt?rev=1371345&r1=1371344&r2=1371345&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/README.txt (original)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/README.txt Thu Aug  9 17:56:33 2012
@@ -9,40 +9,36 @@ requires client authentication so the cl
 credentials. The listener configuration is taken from the 
 "ServerConfig.xml" file located under demo directory.  
 
-The client is configured to provide its certificate "CN=Wibble" and
-chain stored in the Java KeyStore "certs/clientKeystore.jks" to the server. 
-The server authenticates the client's certificate using the truststore
-"certs/commonstore.jks", which holds the Certificate Authorities'
-certificates.
-
-Likewise the client authenticates the server's certificate "CN=Cherry"
-and chain against the same trust store.  Note also the usage of the
-cipherSuitesFilter configuration in the configuration files,
-where each party imposes different ciphersuites constraints, so that the
-ciphersuite eventually negotiated during the TLS handshake is acceptable
-to both sides. This may be viewed by adding a -Djavax.net.debug=all 
-argument to the JVM.
+The client is configured to provide its certificate
+from its keystore "config/clientKeystore.jks" to the server. 
+The server authenticates the client's certificate using its own 
+keystore "config/serviceKeystore.jks", which contains the 
+public cert of the client.  The client makes HTTPS calls using
+three methods: the portable Apache HttpComponents' HttpClient object,
+CXF's WebClient object, and CXF's JAXRSClientFactory object.
+
+Likewise the client authenticates the server's certificate "CN=localhost"
+using its keystore.  Note also the usage of the cipherSuitesFilter 
+configuration in the configuration files, where each party imposes 
+different ciphersuites constraints, so that the ciphersuite eventually
+negotiated during the TLS handshake is acceptable to both sides. 
+This may be viewed by adding a -Djavax.net.debug=all argument to the JVM.
 
-But please note that it is not adviseable to store sensitive data such
+But please note that it is not advisable to store sensitive data such
 as passwords stored in a clear text configuration file, unless the
 file is sufficiently protected by OS level permissions. The KeyStores
 may be configured programmatically so using user interaction may be
 employed to keep passwords from being stored in configuration files.
 The approach taken here is for demonstration reasons only. 
 
-NOTE: Classes AuthSSLInitializationError, AuthSSLProtocolSocketFactory, 
-and AuthSSLX509TrustManager are files copied from the Apache HTTP Client
-project and used by the client for certificate validation.
-
 Please review the README in the samples directory before
 continuing.
 
 
-Building and running the demo using maven
----------------------------------------
-
+Building and running the demo using Maven
+-----------------------------------------
 From the base directory of this sample (i.e., where this README file is
-located), the maven pom.xml file can be used to build and run the demo. 
+located), the Maven pom.xml file can be used to build and run the demo. 
 
 
 Using either UNIX or Windows:
@@ -56,10 +52,5 @@ To remove the target dir, run "mvn clean
 
 Certificates
 ------------
-
-If the certificates are expired or unusable for some reason, a shell 
-script in the certs folder will generate a new set of certificates 
-needed for this sample. Just do the following:
-
-  cd certs
-  sh gencerts.sh
+See the src/main/config folder for the sample keys used (don't use
+these keys in production!) as well as scripts used for their creation.

Modified: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/pom.xml?rev=1371345&r1=1371344&r2=1371345&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/pom.xml (original)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/pom.xml Thu Aug  9 17:56:33 2012
@@ -30,9 +30,10 @@
         <version>2.6.2-SNAPSHOT</version>
         <relativePath>../..</relativePath>
     </parent>
+
     <properties>
         <cxf.version>${project.version}</cxf.version>
-        <httpclient.version>3.1</httpclient.version>
+        <httpclient.version>4.2.1</httpclient.version>
     </properties>
 
     <build>
@@ -98,22 +99,21 @@
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-frontend-jaxrs</artifactId>
-            <version>2.6.2-SNAPSHOT</version>
+            <version>${cxf.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-http-jetty</artifactId>
-            <version>2.6.2-SNAPSHOT</version>
+            <version>${cxf.version}</version>
         </dependency>
         <dependency>
-            <groupId>commons-httpclient</groupId>
-            <artifactId>commons-httpclient</artifactId>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
             <version>${httpclient.version}</version>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
         </dependency>
-
     </dependencies>
 </project>

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/KeyREADME.txt
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/KeyREADME.txt?rev=1371345&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/KeyREADME.txt (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/KeyREADME.txt Thu Aug  9 17:56:33 2012
@@ -0,0 +1,19 @@
+# The below scripts show the commands used to generate the self-signed keys for this sample.
+# If you use the below script to create your own keys be sure to change the passwords used here
+# DO NOT USE THE SUPPLIED KEYS IN PRODUCTION--everyone has them!!
+# For production recommended to use keys signed by a third-party certificate authority (CA)
+
+# Create the combination keystore/truststore for the client and service.
+# Note you can create separate keystores/truststores for both if desired
+keytool -genkeypair -validity 730 -alias myservicekey -keystore serviceKeystore.jks -dname "cn=localhost" -keypass skpass -storepass sspass
+keytool -genkeypair -validity 730 -alias myclientkey -keystore clientKeystore.jks -keypass ckpass -storepass cspass
+
+# Place server public cert in client key/truststore
+keytool -export -rfc -keystore serviceKeystore.jks -alias myservicekey -file MyService.cer -storepass sspass
+keytool -import -noprompt -trustcacerts -file MyService.cer -alias myservicekey -keystore clientKeystore.jks -storepass cspass
+
+# Place client public cert in service key/truststore
+# Note this needs to be done only if you're requiring client authentication
+# as configured in resources/ServerConfig.xml
+keytool -export -rfc -keystore clientKeystore.jks -alias myclientkey -file MyClient.cer -storepass cspass
+keytool -import -noprompt -trustcacerts -file MyClient.cer -alias myclientkey -keystore serviceKeystore.jks -storepass sspass

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/clientKeystore.jks
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/clientKeystore.jks?rev=1371345&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/clientKeystore.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/serviceKeystore.jks
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/serviceKeystore.jks?rev=1371345&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/config/serviceKeystore.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/client/Client.java?rev=1371345&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/client/Client.java (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/client/Client.java Thu Aug  9 17:56:33 2012
@@ -0,0 +1,100 @@
+/**
+ * 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 httpsdemo.client;
+
+import java.io.FileInputStream;
+import java.security.KeyStore;
+
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicHeader;
+import httpsdemo.common.Customer;
+import httpsdemo.common.CustomerService;
+
+public final class Client {
+
+    private static final String CLIENT_CONFIG_FILE = "ClientConfig.xml";
+    private static final String BASE_SERVICE_URL = 
+        "https://localhost:9000/customerservice/customers";
+    
+    private Client() {
+    }
+
+    public static void main(String args[]) throws Exception {       
+        String keyStoreLoc = "src/main/config/clientKeystore.jks";
+
+        KeyStore keyStore = KeyStore.getInstance("JKS");
+        keyStore.load(new FileInputStream(keyStoreLoc), "cspass".toCharArray());
+
+        /* 
+         * Send HTTP GET request to query customer info using portable HttpClient
+         * object from Apache HttpComponents
+         */
+        SSLSocketFactory sf = new SSLSocketFactory(keyStore, "ckpass", keyStore); 
+        Scheme httpsScheme = new Scheme("https", 9000, sf);
+
+        System.out.println("Sending HTTPS GET request to query customer info");
+        DefaultHttpClient httpclient = new DefaultHttpClient();
+        httpclient.getConnectionManager().getSchemeRegistry().register(httpsScheme);
+        HttpGet httpget = new HttpGet(BASE_SERVICE_URL + "/123");
+        BasicHeader bh = new BasicHeader("Accept" , "text/xml");
+        httpget.addHeader(bh);
+        HttpResponse response = httpclient.execute(httpget);
+        HttpEntity entity = response.getEntity();
+        entity.writeTo(System.out);
+        httpclient.getConnectionManager().shutdown();
+        
+        /*
+         *  Send HTTP PUT request to update customer info, using CXF WebClient method
+         *  Note: if need to use basic authentication, use the WebClient.create(baseAddress,
+         *  username,password,configFile) variant, where configFile can be null if you're
+         *  not using certificates.
+         */
+        System.out.println("\n\nSending HTTPS PUT to update customer name");
+        WebClient wc = WebClient.create(BASE_SERVICE_URL, CLIENT_CONFIG_FILE);
+        Customer customer = new Customer();
+        customer.setId(123);
+        customer.setName("Mary");
+        Response resp = wc.put(customer);
+
+        /*
+         *  Send HTTP POST request to add customer, using JAXRSClientProxy
+         *  Note: if need to use basic authentication, use the JAXRSClientFactory.create(baseAddress,
+         *  username,password,configFile) variant, where configFile can be null if you're
+         *  not using certificates.
+         */
+        System.out.println("\n\nSending HTTPS POST request to add customer");
+        CustomerService proxy = JAXRSClientFactory.create(BASE_SERVICE_URL, CustomerService.class,
+              CLIENT_CONFIG_FILE);
+        customer = new Customer();
+        customer.setName("Jack");
+        resp = wc.post(customer);
+        
+        System.out.println("\n");
+        System.exit(0);
+    }
+}

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/Customer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/Customer.java?rev=1371345&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/Customer.java (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/Customer.java Thu Aug  9 17:56:33 2012
@@ -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 httpsdemo.common;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "Customer")
+public class Customer {
+    private long id;
+    private String name;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/CustomerService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/CustomerService.java?rev=1371345&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/CustomerService.java (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/common/CustomerService.java Thu Aug  9 17:56:33 2012
@@ -0,0 +1,52 @@
+/**
+ * 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 httpsdemo.common;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+
+/**
+ * This interface describes a JAX-RS root resource. All the JAXRS annotations (except those overridden) will
+ * be inherited by classes implementing it.
+ */
+@Path("/customerservice/")
+public interface CustomerService {
+
+    @GET
+    @Path("/customers/{id}/")
+    Customer getCustomer(@PathParam("id") String id);
+    
+    @PUT
+    @Path("/customers/")
+    Response updateCustomer(Customer customer);
+     
+    @POST
+    @Path("/customers/")
+    Response addCustomer(Customer customer);
+
+    @DELETE
+    @Path("/customers/{id}/")
+    Response deleteCustomer(@PathParam("id") String id);
+
+}

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/CustomerServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/CustomerServiceImpl.java?rev=1371345&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/CustomerServiceImpl.java (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/CustomerServiceImpl.java Thu Aug  9 17:56:33 2012
@@ -0,0 +1,89 @@
+/**
+ * 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 httpsdemo.server;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.core.Response;
+import httpsdemo.common.Customer;
+import httpsdemo.common.CustomerService;
+
+public class CustomerServiceImpl implements CustomerService {
+    long currentId = 123;
+    Map<Long, Customer> customers = new HashMap<Long, Customer>();
+
+    public CustomerServiceImpl() {
+        init();
+    }
+
+    public Customer getCustomer(String id) {
+        System.out.println("----invoking getCustomer, Customer id is: " + id);
+        long idNumber = Long.parseLong(id);
+        Customer c = customers.get(idNumber);
+        return c;
+    }
+
+    public Response updateCustomer(Customer customer) {
+        System.out.println("----invoking updateCustomer, Customer name is: " + customer.getName());
+        Customer c = customers.get(customer.getId());
+        Response r;
+        if (c != null) {
+            customers.put(customer.getId(), customer);
+            r = Response.ok().build();
+        } else {
+            r = Response.notModified().build();
+        }
+
+        return r;
+    }
+
+    public Response addCustomer(Customer customer) {
+        System.out.println("----invoking addCustomer, Customer name is: " + customer.getName());
+        customer.setId(++currentId);
+
+        customers.put(customer.getId(), customer);
+
+        return Response.ok(customer).build();
+    }
+
+    public Response deleteCustomer(String id) {
+        System.out.println("----invoking deleteCustomer, Customer id is: " + id);
+        long idNumber = Long.parseLong(id);
+        Customer c = customers.get(idNumber);
+
+        Response r;
+        if (c != null) {
+            r = Response.ok().build();
+            customers.remove(idNumber);
+        } else {
+            r = Response.notModified().build();
+        }
+
+        return r;
+    }
+
+    final void init() {
+        Customer c = new Customer();
+        c.setName("John");
+        c.setId(123);
+        customers.put(c.getId(), c);
+    }
+
+}

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/Server.java?rev=1371345&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/Server.java (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/java/httpsdemo/server/Server.java Thu Aug  9 17:56:33 2012
@@ -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 httpsdemo.server;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+
+public class Server {
+
+    static {
+        // set the configuration file
+        SpringBusFactory factory = new SpringBusFactory();
+        Bus bus = factory.createBus("ServerConfig.xml");
+        BusFactory.setDefaultBus(bus);
+    }
+   
+    protected Server() throws Exception {
+        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+        sf.setResourceClasses(CustomerServiceImpl.class);
+        sf.setResourceProvider(CustomerServiceImpl.class, 
+            new SingletonResourceProvider(new CustomerServiceImpl()));
+        sf.setAddress("https://localhost:9000/");
+
+        sf.create();
+    }
+
+    public static void main(String args[]) throws Exception {
+        new Server();
+        System.out.println("Server ready...");
+
+        Thread.sleep(5 * 60 * 1000);
+        System.out.println("Server exiting");
+        System.exit(0);
+    }
+}

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/ClientConfig.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/ClientConfig.xml?rev=1371345&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/ClientConfig.xml (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/ClientConfig.xml Thu Aug  9 17:56:33 2012
@@ -0,0 +1,49 @@
+<?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.
+-->
+<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:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+       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/transports/http/configuration         http://cxf.apache.org/schemas/configuration/http-conf.xsd
+        http://cxf.apache.org/transports/http-jetty/configuration   http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+        http://cxf.apache.org/configuration/security                http://cxf.apache.org/schemas/configuration/security.xsd
+        ">
+   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+    <!-- -->
+    <!-- HTTP/S configuration for proxy & web clients -->
+    <!-- -->
+    <http:conduit name="https://localhost:.*/customerservice/.*">
+        <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
+        <http:tlsClientParameters>
+            <sec:keyManagers keyPassword="ckpass">
+                <sec:keyStore file="src/main/config/clientKeystore.jks" password="cspass" type="JKS"/>
+            </sec:keyManagers>
+            <sec:trustManagers>
+                <sec:keyStore file="src/main/config/clientKeystore.jks" password="cspass" type="JKS"/>
+            </sec:trustManagers>
+        </http:tlsClientParameters>
+    </http:conduit>
+
+</beans>
+

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/ServerConfig.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/ServerConfig.xml?rev=1371345&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/ServerConfig.xml (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/jax_rs/basic_https/src/main2/resources/ServerConfig.xml Thu Aug  9 17:56:33 2012
@@ -0,0 +1,65 @@
+<?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.
+-->
+
+<!-- 
+  ** This file configures the Server which exposes the REST endpoint.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:sec="http://cxf.apache.org/configuration/security"
+  xmlns:http="http://cxf.apache.org/transports/http/configuration"
+  xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+  xsi:schemaLocation="
+       http://cxf.apache.org/configuration/security  		      
+       http://cxf.apache.org/schemas/configuration/security.xsd
+       http://cxf.apache.org/transports/http/configuration
+       http://cxf.apache.org/schemas/configuration/http-conf.xsd
+       http://cxf.apache.org/transports/http-jetty/configuration
+       http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+       http://www.springframework.org/schema/beans
+       http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+  <httpj:engine-factory bus="cxf">
+   <httpj:engine port="9000">
+    <httpj:tlsServerParameters>
+      <sec:keyManagers keyPassword="skpass">
+           <sec:keyStore file="src/main/config/serviceKeystore.jks" password="sspass" type="JKS"/>
+      </sec:keyManagers>
+      <sec:trustManagers>
+           <sec:keyStore file="src/main/config/serviceKeystore.jks" password="sspass" type="JKS"/>
+      </sec:trustManagers>
+      <sec:cipherSuitesFilter>
+        <!-- these filters ensure that a ciphersuite with
+          export-suitable or null encryption is used,
+          but exclude anonymous Diffie-Hellman key change as
+          this is vulnerable to man-in-the-middle attacks -->
+        <sec:include>.*_EXPORT_.*</sec:include>
+        <sec:include>.*_EXPORT1024_.*</sec:include>
+        <sec:include>.*_WITH_DES_.*</sec:include>
+        <sec:include>.*_WITH_AES_.*</sec:include>
+        <sec:include>.*_WITH_NULL_.*</sec:include>
+        <sec:exclude>.*_DH_anon_.*</sec:exclude>
+      </sec:cipherSuitesFilter>
+      <sec:clientAuthentication want="true" required="true"/>
+    </httpj:tlsServerParameters>
+   </httpj:engine>
+  </httpj:engine-factory>
+  
+</beans>