summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest')
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/README37
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/pom.xml111
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/ClientJavaTestService.java29
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/ClientTestServiceWebapp.java108
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/HelloWorldService.java13
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/HelloWorldServiceImpl.java44
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/resources/rest.composite37
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/HelloWorldJSONRPC.html75
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/WEB-INF/web.xml35
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/style.css22
-rw-r--r--tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/target/classes/rest.composite37
12 files changed, 574 insertions, 0 deletions
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/README b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/README
new file mode 100644
index 0000000000..00568d9bb0
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/README
@@ -0,0 +1,37 @@
+Hello World REST Sample
+=======================
+
+Sample Overview
+---------------
+The service 'HelloWorldService' is exposed using the REST binding.
+
+helloworld-jsonrpc-webapp/
+ src/
+ main/
+ java/
+ helloworldjsonrpc/
+ HelloWorldService.java - service interface
+ HelloWorldServiceImpl.java - service implementation
+ ClientTestServiceWebapp.java - Test class; uses java.net.HttpURLConnection to make 'GET', 'PUT', 'POST requests
+ resources/
+ rest.composite - the SCA assembly for this sample
+ webapp
+ META-INF/
+ sca-contribution.xml - specifies the composite to be deployed
+ WEB-INF/
+ web.xml - defines the listener that starts up the
+ Tuscany SCA runtime
+ pom.xml - the Maven build file
+
+Build the sample using Maven.
+A war 'helloworld-rest-webapp.war' will be created in the target directory. Deploy it in your web container.
+You can access the service from the browser by making a simple GET request using the following URL:
+http://<host>:<port>/helloworld-rest-webapp/HelloWorldService/helloworld/getname
+
+Use the test class 'ClientTestServiceWebapp' to test PUT, POST operations.
+
+
+
+
+
+
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/pom.xml b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/pom.xml
new file mode 100644
index 0000000000..ce70092d3d
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/pom.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>2.0-M4</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>helloworld-rest</artifactId>
+ <packaging>war</packaging>
+ <name>HelloWorld RESTFul Web Application</name>
+
+ <repositories>
+ <repository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Repository for Maven</name>
+ <url>http://download.java.net/maven/2/</url>
+ <layout>default</layout>
+ </repository>
+ <repository>
+ <id>maven-repository.dev.java.net</id>
+ <name>Java.net Maven 1 Repository (legacy)</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>2.0-M4</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>2.0-M4</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-M4</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-web-runtime</artifactId>
+ <version>2.0-M4</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rest-runtime</artifactId>
+ <version>2.0-M4</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-bundle</artifactId>
+ <version>1.0.3</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/ClientJavaTestService.java b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/ClientJavaTestService.java
new file mode 100644
index 0000000000..8b19af7a52
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/ClientJavaTestService.java
@@ -0,0 +1,29 @@
+package helloworldrest;
+
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+
+/*
+ * To test, simply run the program
+ * Access the service by invoking the getName() method of HelloWorldService
+ */
+
+public class ClientJavaTestService {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ NodeFactory factory = NodeFactory.newInstance();
+ Node node = factory.createNode("rest.composite", ClientJavaTestService.class.getClassLoader()).start();
+ HelloWorldService helloService = node.getService(HelloWorldService.class, "HelloWorldRESTServiceComponent");
+
+ //HelloWorldService helloService = new HelloWorldServiceImpl();
+ System.out.println("### Message from REST service " + helloService.getName());
+
+ node.stop();
+ node.destroy();
+ factory.destroy();
+ }
+
+}
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/ClientTestServiceWebapp.java b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/ClientTestServiceWebapp.java
new file mode 100644
index 0000000000..fb83b26315
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/ClientTestServiceWebapp.java
@@ -0,0 +1,108 @@
+package helloworldrest;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Formatter;
+
+/**
+ *
+ * To test, deploy the application as a webapp.
+ * Then, run this file to access the REST web service by making HTTP GET/POST requests
+ *
+ */
+public class ClientTestServiceWebapp {
+
+ final static String UrlBase = "http://localhost:8080/helloworld-rest-webapp/HelloWorldService";
+
+ final static class HttpResponse {
+ Object content;
+ int code;
+ String message;
+ }
+
+ static HttpResponse makeHttpGetRequest(String method, String url, String contentType) throws Exception {
+ HttpResponse response = new HttpResponse();
+ URL urlAddress = new URL(url);
+ HttpURLConnection huc = (HttpURLConnection)urlAddress.openConnection();
+ huc.setRequestMethod(method);
+ huc.setRequestProperty("Content-type", contentType);
+ huc.connect();
+ InputStreamReader isr = new InputStreamReader(huc.getInputStream());
+
+ BufferedReader in = new BufferedReader(isr);
+ String uline = in.readLine();
+ response.content = uline;
+
+ // huc.disconnect();
+ // System.out.println("#### huc disconnected ###");
+
+ return response;
+ }
+
+ static HttpResponse makeHttpRequest(String method, String url, String contentType, InputStream is) throws Exception {
+ HttpResponse response = new HttpResponse();
+ URL urlAddress = new URL(url);
+ HttpURLConnection huc = (HttpURLConnection)urlAddress.openConnection();
+ huc.setRequestMethod(method);
+ if (null != is) {
+ huc.setDoOutput(true);
+ huc.setRequestProperty("Content-Type", contentType);
+ OutputStream os = huc.getOutputStream();
+ byte[] buf = new byte[1024];
+ int read;
+ while ((read = is.read(buf)) != -1) {
+ os.write(buf, 0, read);
+ }
+ }
+ InputStreamReader isr = new InputStreamReader(huc.getInputStream());
+ BufferedReader in = new BufferedReader(isr);
+ String uline = in.readLine();
+ response.content = uline;
+ return response;
+ }
+
+ static HttpResponse makeHttpGetRequest(String method, String url, String contentType, String content)
+ throws Exception {
+ return makeHttpRequest(method, url, contentType, new ByteArrayInputStream(content.getBytes("UTF-8")));
+ }
+
+ static HttpResponse makeHttpRequest(String method, String url) throws Exception {
+ return makeHttpRequest(method, url, null, (InputStream)null);
+ }
+
+ public static void main(String[] args) {
+ try {
+
+ HttpResponse response;
+
+ System.out.println("Getting the name *BEFORE* setting it:");
+ response = makeHttpGetRequest("GET", UrlBase + "/helloworld/getname", "text/plain");
+ System.out.println(new Formatter().format("---- Received String:\n%s", response.content.toString()));
+
+ System.out.println("Setting the name:");
+ String newText = "Morpheus";
+ InputStream inputStream = new ByteArrayInputStream(newText.getBytes());
+ response = makeHttpRequest("PUT", UrlBase + "/helloworld/setname", "text/plain", inputStream);
+
+ System.out.println("Getting the name *AFTER* setting it:");
+ response = makeHttpGetRequest("GET", UrlBase + "/helloworld/getname", "text/plain");
+ System.out.println(new Formatter().format("---- Received String:\n%s", response.content.toString()));
+
+ System.out.println("POST Operation:");
+ response = makeHttpGetRequest("POST", UrlBase + "/helloworld/postoperation/prateek", "text/plain");
+ //System.out.println(new Formatter().format("---- Received String:\n%s", response.content.toString()));
+
+ System.out.println("Getting the name *AFTER* the POST operation:");
+ response = makeHttpGetRequest("GET", UrlBase + "/helloworld/getname", "text/plain");
+ System.out.println(new Formatter().format("---- Received String:\n%s", response.content.toString()));
+ } catch (Exception e) {
+ System.out.println("TEST FAILED! :-(");
+ e.printStackTrace(System.out);
+ }
+ }
+}
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/HelloWorldService.java b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/HelloWorldService.java
new file mode 100644
index 0000000000..fb9d3e2f82
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/HelloWorldService.java
@@ -0,0 +1,13 @@
+package helloworldrest;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface HelloWorldService {
+
+ public void setName(String name);
+
+ public String getName();
+
+ public void postOperationTest(String name);
+}
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..cacb88b5e3
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/java/helloworldrest/HelloWorldServiceImpl.java
@@ -0,0 +1,44 @@
+package helloworldrest;
+
+import javax.ws.rs.Consumes;
+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.Produces;
+
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.Service;
+
+@Service(HelloWorldService.class)
+@Scope("Composite")
+@Path("/helloworld")
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ private String name = new String("original!");
+
+ @Path("/setname")
+ @PUT
+ @Consumes("text/plain")
+ public void setName(String name) {
+ this.name = name;
+
+ }
+
+ //http://<host>:<port>/helloworld-rest-webapp/HelloWorldService/helloworld/getname
+ @Path("/getname")
+ @GET
+ @Produces("text/plain")
+ public String getName() {
+ return this.name;
+ }
+
+ @POST
+ @Path("/postoperation/{name}/")
+ @Consumes("text/plain")
+ public void postOperationTest(@PathParam("name") String name) {
+ this.name = name;
+ }
+
+}
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/resources/rest.composite b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/resources/rest.composite
new file mode 100644
index 0000000000..7f76f5946d
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/resources/rest.composite
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="helloworldrest">
+
+ <service name="HelloWorldService" promote="HelloWorldRESTServiceComponent/HelloWorldService">
+ <interface.java interface="helloworldrest.HelloWorldService"/>
+ <tuscany:binding.rest />
+ </service>
+
+ <component name="HelloWorldRESTServiceComponent">
+ <implementation.java class="helloworldrest.HelloWorldServiceImpl"/>
+ </component>
+
+</composite>
+
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/HelloWorldJSONRPC.html b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/HelloWorldJSONRPC.html
new file mode 100644
index 0000000000..745164bf8d
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/HelloWorldJSONRPC.html
@@ -0,0 +1,75 @@
+<html>
+<!--
+ * 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.
+ -->
+ <head>
+ <title>Tuscany JSON-RPC HelloWorld Example</TITLE>
+
+ <script type="text/javascript" src="SCADomain/scaDomain.js"></script>
+
+ <script language="JavaScript">
+
+ function getGreeting() {
+ var name = document.getElementById("name").value;
+ HelloWorldService.getGreetings(name, handleResponse);
+ }
+
+ function handleResponse(result) {
+ document.getElementById('greeting').innerHTML=result;
+ }
+
+ </script>
+
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ </head>
+
+ <body>
+
+ <h2>Tuscany JSON-RPC HelloWorld Sample</h2>
+
+ <table>
+ <tr>
+ <th colspan="2">Non-Dojo Example</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ This example uses the JavaScript served from
+ <a href="SCADomain/scaDomain.js">SCADomain/scaDomain.js</a>
+ to make JSON-RPC requests to the SCA service 'HelloWorldService'
+ </tr>
+ <tr>
+ <td>Request</td>
+ <td>Response</td>
+ </tr>
+ <tr>
+ <td>
+ <p>
+ Name please: &nbsp;&nbsp;&nbsp;
+ <input type="text" id="name" size="30" value="World" />
+ <input type="button" value="Submit" onclick="getGreeting()" />
+ </p>
+
+ </td>
+ <td>
+ <div id='greeting'>None Yet.</div>
+ </td>
+ </tr>
+ </table>
+
+ </body>
+</html>
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..9fc16372b3
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/META-INF/sca-contribution.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+-->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:helloworldrest"/>
+</contribution>
+
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..3a670696e4
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * 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.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+</web-app>
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/style.css b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/style.css
new file mode 100644
index 0000000000..0f1cea3aaf
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/src/main/webapp/style.css
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+* { font-family: arial; }
+
+table, th, td { border: 2px solid blue; border-collapse: collapse; }
+th { color: white; background-color: blue; }
diff --git a/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/target/classes/rest.composite b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/target/classes/rest.composite
new file mode 100644
index 0000000000..70b83fd986
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC1/samples/webapps/helloworld-rest/target/classes/rest.composite
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="helloworldrest">
+
+ <service name="HelloWorldService" promote="HelloWorldRESTServiceComponent/HelloWorldService">
+ <interface.java interface="helloworldrest.HelloWorldService"/>
+ <tuscany:binding.rest />
+ </service>
+
+ <component name="HelloWorldRESTServiceComponent">
+ <implementation.java class="helloworldrest.HelloWorldServiceImpl"/>
+ </component>
+
+</composite>
+