cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r609875 [2/2] - in /incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https: ./ bin/ certs/ certs/demoCA/ certs/demoCA/newcerts/ src/ src/demo/ src/demo/jaxrs/ src/demo/jaxrs/client/ src/demo/jaxrs/server/
Date Tue, 08 Jan 2008 05:39:44 GMT
Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/AuthSSLProtocolSocketFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/AuthSSLProtocolSocketFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/AuthSSLX509TrustManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/AuthSSLX509TrustManager.java?rev=609875&view=auto
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/AuthSSLX509TrustManager.java
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/AuthSSLX509TrustManager.java
Mon Jan  7 21:39:40 2008
@@ -0,0 +1,106 @@
+/**
+ * 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.commons.httpclient.contrib.ssl;
+
+import java.security.cert.X509Certificate;
+
+import javax.net.ssl.X509TrustManager;
+import java.security.cert.CertificateException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * <p>
+ * AuthSSLX509TrustManager can be used to extend the default
+ * {@link X509TrustManager} with additional trust decisions.
+ * </p>
+ * 
+ * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
+ *         <p>
+ *         DISCLAIMER: HttpClient developers DO NOT actively support this
+ *         component. The component is provided as a reference material, which
+ *         may be inappropriate for use without additional customization.
+ *         </p>
+ */
+
+public class AuthSSLX509TrustManager implements X509TrustManager {
+    private X509TrustManager defaultTrustManager = null;
+
+    /** Log object for this class. */
+    private static final Log LOG = LogFactory.getLog(AuthSSLX509TrustManager.class);
+
+    /**
+     * Constructor for AuthSSLX509TrustManager.
+     */
+    public AuthSSLX509TrustManager(final X509TrustManager defaultTrustManager) {
+        super();
+        if (defaultTrustManager == null) {
+            throw new IllegalArgumentException("Trust manager may not be null");
+        }
+        this.defaultTrustManager = defaultTrustManager;
+    }
+
+    /**
+     * @see javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[],String
+     *      authType)
+     */
+    public void checkClientTrusted(X509Certificate[] certificates, String authType)
+        throws CertificateException {
+        if (LOG.isInfoEnabled() && certificates != null) {
+            for (int c = 0; c < certificates.length; c++) {
+                X509Certificate cert = certificates[c];
+                LOG.info(" Client certificate " + (c + 1) + ":");
+                LOG.info("  Subject DN: " + cert.getSubjectDN());
+                LOG.info("  Signature Algorithm: " + cert.getSigAlgName());
+                LOG.info("  Valid from: " + cert.getNotBefore());
+                LOG.info("  Valid until: " + cert.getNotAfter());
+                LOG.info("  Issuer: " + cert.getIssuerDN());
+            }
+        }
+        defaultTrustManager.checkClientTrusted(certificates, authType);
+    }
+
+    /**
+     * @see javax.net.ssl.X509TrustManager#checkServerTrusted(X509Certificate[],String
+     *      authType)
+     */
+    public void checkServerTrusted(X509Certificate[] certificates, String authType)
+        throws CertificateException {
+        if (LOG.isInfoEnabled() && certificates != null) {
+            for (int c = 0; c < certificates.length; c++) {
+                X509Certificate cert = certificates[c];
+                LOG.info(" Server certificate " + (c + 1) + ":");
+                LOG.info("  Subject DN: " + cert.getSubjectDN());
+                LOG.info("  Signature Algorithm: " + cert.getSigAlgName());
+                LOG.info("  Valid from: " + cert.getNotBefore());
+                LOG.info("  Valid until: " + cert.getNotAfter());
+                LOG.info("  Issuer: " + cert.getIssuerDN());
+            }
+        }
+        defaultTrustManager.checkServerTrusted(certificates, authType);
+    }
+
+    /**
+     * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers()
+     */
+    public X509Certificate[] getAcceptedIssuers() {
+        return this.defaultTrustManager.getAcceptedIssuers();
+    }
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/AuthSSLX509TrustManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/AuthSSLX509TrustManager.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/Client.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/Client.java?rev=609875&view=auto
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/Client.java
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/Client.java
Mon Jan  7 21:39:40 2008
@@ -0,0 +1,124 @@
+/**
+ * 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 demo.jaxrs.client;
+
+import java.io.File;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.contrib.ssl.AuthSSLProtocolSocketFactory;
+import org.apache.commons.httpclient.methods.FileRequestEntity;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+import org.apache.commons.httpclient.protocol.Protocol;
+
+public final class Client {
+
+    private Client() {
+    }
+
+    public static void main(String args[]) throws Exception {
+        File wibble = new File(args[0]);
+        File truststore = new File(args[1]);
+
+        Protocol authhttps = new Protocol("https",
+                                          new AuthSSLProtocolSocketFactory(wibble.toURL(),
"password",
+                                                                           truststore.toURL(),
"password"),
+                                          9000);
+        Protocol.registerProtocol("https", authhttps);
+
+        // Sent HTTP GET request to query customer info
+        System.out.println("Sent HTTPS GET request to query customer info");
+        HttpClient httpclient = new HttpClient();
+        GetMethod httpget = new GetMethod("https://localhost:9000/customerservice/customers/123");
+        try {
+            httpclient.executeMethod(httpget);
+            System.out.println(httpget.getResponseBodyAsString());
+        } finally {
+            httpget.releaseConnection();
+        }
+
+        // Sent HTTP GET request to query sub resource product info
+        System.out.println("\n");
+        System.out.println("Sent HTTPS GET request to query sub resource product info");
+
+        httpget = new GetMethod("https://localhost:9000/customerservice/orders/223/products/323");
+        try {
+            httpclient.executeMethod(httpget);
+            System.out.println(httpget.getResponseBodyAsString());
+        } finally {
+            httpget.releaseConnection();
+        }
+
+        // Sent HTTP PUT request to update customer info
+        System.out.println("\n");
+        System.out.println("Sent HTTPS PUT request to update customer info");
+        Client client = new Client();
+        String inputFile = client.getClass().getResource("update_customer.txt").getFile();
+        File input = new File(inputFile);
+        PutMethod put = new PutMethod("https://localhost:9000/customerservice/customers");
+        RequestEntity entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1");
+        put.setRequestEntity(entity);
+
+        try {
+            int result = httpclient.executeMethod(put);
+            System.out.println("Response status code: " + result);
+            System.out.println("Response body: ");
+            System.out.println(put.getResponseBodyAsString());
+        } finally {
+            put.releaseConnection();
+        }
+
+        // Sent HTTP POST request to add customer
+        System.out.println("Sent HTTPS POST request to add customer");
+        inputFile = client.getClass().getResource("add_customer.txt").getFile();
+        input = new File(inputFile);
+        PostMethod post = new PostMethod("https://localhost:9000/customerservice/customers");
+        entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1");
+        post.setRequestEntity(entity);
+
+        try {
+            int result = httpclient.executeMethod(post);
+            System.out.println("Response status code: " + result);
+            System.out.println("Response body: ");
+            System.out.println(post.getResponseBodyAsString());
+        } finally {
+            // Release current connection to the connection pool once you are
+            // done
+            post.releaseConnection();
+        }
+
+        // Sent HTTP GET request to query customer info, expect JSON.
+        System.out.println("\n");
+        System.out.println("Sent HTTPS GET request to query customer info in JSON");
+
+        httpget = new GetMethod("https://localhost:9000/customerservice/customersjson/123");
+        try {
+            httpclient.executeMethod(httpget);
+            System.out.println(httpget.getResponseBodyAsString());
+        } finally {
+            httpget.releaseConnection();
+        }
+
+        System.out.println("Client Invoking is succeeded!");
+        System.exit(0);
+    }
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/Client.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/Client.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/add_customer.txt
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/add_customer.txt?rev=609875&view=auto
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/add_customer.txt
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/add_customer.txt
Mon Jan  7 21:39:40 2008
@@ -0,0 +1,3 @@
+<Customer>
+  <name>Jack</name>
+</Customer> 
\ No newline at end of file

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/add_customer.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/add_customer.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/update_customer.txt
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/update_customer.txt?rev=609875&view=auto
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/update_customer.txt
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/update_customer.txt
Mon Jan  7 21:39:40 2008
@@ -0,0 +1,4 @@
+<Customer>
+  <name>Mary</name>
+  <id>123</id>
+</Customer> 
\ No newline at end of file

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/update_customer.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/client/update_customer.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Customer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Customer.java?rev=609875&view=auto
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Customer.java
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Customer.java
Mon Jan  7 21:39:40 2008
@@ -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 demo.jaxrs.server;
+
+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;
+    }
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Customer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Customer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/CustomerService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/CustomerService.java?rev=609875&view=auto
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/CustomerService.java
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/CustomerService.java
Mon Jan  7 21:39:40 2008
@@ -0,0 +1,128 @@
+/**
+ * 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 demo.jaxrs.server;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.ProduceMime;
+import javax.ws.rs.UriParam;
+import javax.ws.rs.UriTemplate;
+import javax.ws.rs.core.HttpContext;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@UriTemplate("/customerservice/")
+public class CustomerService {
+    @HttpContext UriInfo uriInfo;
+
+    long currentId = 123;
+    Map<Long, Customer> customers = new HashMap<Long, Customer>();
+    Map<Long, Order> orders = new HashMap<Long, Order>();
+
+    public CustomerService() {
+        init();
+    }
+
+    @HttpMethod("GET")
+    @UriTemplate("/customers/{id}/")
+    public Customer getCustomer(@UriParam("id") String id) {
+        System.out.println("----invoking getCustomer, Customer id is: " + id);
+        long idNumber = Long.parseLong(id);
+        Customer c = customers.get(idNumber);
+        return c;
+    }
+
+    @HttpMethod("GET")
+    @UriTemplate("/customersjson/{id}/")
+    @ProduceMime("application/json")
+    public Customer getCustomerJSON(@UriParam("id") String id) {
+        System.out.println("----invoking getCustomerJSON, Customer id is: " + id);
+        long idNumber = Long.parseLong(id);
+        Customer c = customers.get(idNumber);
+        return c;
+    }
+
+    @HttpMethod("PUT")
+    @UriTemplate("/customers/")
+    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.Builder.ok().build();
+        } else {
+            r = Response.Builder.notModified().build();
+        }
+
+        return r;
+    }
+
+    @HttpMethod("POST")
+    @UriTemplate("/customers/")
+    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.Builder.ok(customer).build();
+    }
+
+    @HttpMethod("DELETE")
+    @UriTemplate("/customers/{id}/")
+    public Response deleteCustomer(@UriParam("id") 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.Builder.ok().build();
+            customers.remove(idNumber);
+        } else {
+            r = Response.Builder.notModified().build();
+        }
+
+        return r;
+    }
+
+    @UriTemplate("/orders/{orderId}/")
+    public Order getOrder(@UriParam("orderId") String orderId) {
+        System.out.println("----invoking getOrder, Order id is: " + orderId);
+        long idNumber = Long.parseLong(orderId);
+        Order c = orders.get(idNumber);
+        return c;
+    }
+
+    final void init() {
+        Customer c = new Customer();
+        c.setName("John");
+        c.setId(123);
+        customers.put(c.getId(), c);
+
+        Order o = new Order();
+        o.setDescription("order 223");
+        o.setId(223);
+        orders.put(o.getId(), o);
+    }
+
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/CustomerService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/CustomerService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Order.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Order.java?rev=609875&view=auto
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Order.java
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Order.java
Mon Jan  7 21:39:40 2008
@@ -0,0 +1,68 @@
+/**
+ * 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 demo.jaxrs.server;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.UriParam;
+import javax.ws.rs.UriTemplate;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "Order")
+public class Order {
+    private long id;
+    private String description;
+    private Map<Long, Product> products = new HashMap<Long, Product>();
+
+    public Order() {
+        init();
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String d) {
+        this.description = d;
+    }
+
+    @HttpMethod("GET")
+    @UriTemplate("products/{productId}/")
+    public Product getProduct(@UriParam("productId")int productId) {
+        System.out.println("----invoking getProduct with id: " + productId);
+        Product p = products.get(new Long(productId));
+        return p;
+    }
+
+    final void init() {
+        Product p = new Product();
+        p.setId(323);
+        p.setDescription("product 323");
+        products.put(p.getId(), p);
+    }
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Order.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Order.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Product.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Product.java?rev=609875&view=auto
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Product.java
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Product.java
Mon Jan  7 21:39:40 2008
@@ -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 demo.jaxrs.server;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "Product")
+public class Product {
+    private long id;
+    private String description;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String d) {
+        this.description = d;
+    }
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Product.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Product.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Server.java?rev=609875&view=auto
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Server.java
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Server.java
Mon Jan  7 21:39:40 2008
@@ -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 demo.jaxrs.server;
+
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+
+public class Server {
+
+    protected Server() throws Exception {
+        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+        sf.setResourceClasses(CustomerService.class);
+        sf.setResourceProvider(CustomerService.class, new SingletonResourceProvider());
+        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);
+    }
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Server.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/jax-rs/basic_https/src/demo/jaxrs/server/Server.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message