From 56ec5091c8e6a0c689919bf28585feca2050a0d3 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 2 Dec 2010 07:37:39 +0000 Subject: Start bringing up eightball app in trunk git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1041296 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/demo/EightBall.java | 28 ++++++++++++ .../src/main/java/demo/EightBallServlet.java | 52 ++++++++++++++++++++++ .../src/main/webapp/WEB-INF/web.composite | 30 +++++++++++++ .../src/main/webapp/WEB-INF/web.xml | 41 +++++++++++++++++ .../src/main/webapp/eightball.html | 48 ++++++++++++++++++++ 5 files changed, 199 insertions(+) create mode 100644 sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBall.java create mode 100644 sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java create mode 100644 sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.composite create mode 100644 sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/eightball.html (limited to 'sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main') diff --git a/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBall.java b/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBall.java new file mode 100644 index 0000000000..88f8b67abb --- /dev/null +++ b/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBall.java @@ -0,0 +1,28 @@ +/* + * 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; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface EightBall { + + String askQuestion(String question); + +} diff --git a/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java b/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java new file mode 100644 index 0000000000..d6c3103281 --- /dev/null +++ b/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java @@ -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 demo; + +import java.io.IOException; +import java.io.Writer; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.oasisopen.sca.annotation.Reference; + +/** + */ +public class EightBallServlet extends HttpServlet { + + @Reference + protected EightBall eightball; + + @Override + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { + String question = request.getParameter("question"); + String answer = eightball.askQuestion(question); + Writer out = response.getWriter(); + out.write("The Magic Eight Ball"); + out.write("

The Magic Eight Ball

"); + out.write("

You ask:"); + out.write("
" + question + ""); + out.write("

Eight Ball says:"); + out.write("
" + answer + ""); + out.write(""); + out.flush(); + out.close(); + } +} diff --git a/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.composite b/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.composite new file mode 100644 index 0000000000..88bd46e866 --- /dev/null +++ b/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.composite @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml b/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..f828db7a81 --- /dev/null +++ b/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + eightball-webapp + + + EightBallServlet + demo.EightBallServlet + + + + EightBallServlet + /EightBallServlet + + + + eightball.html + + + diff --git a/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/eightball.html b/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/eightball.html new file mode 100644 index 0000000000..e22cc81c83 --- /dev/null +++ b/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/eightball.html @@ -0,0 +1,48 @@ + + + + +The Magic Eight Ball + + + + +

The Magic Eight Ball

+ +The Tuscany Magic Eight Ball reaches into the future to find the answers to your questions. It knows what will be, and is willing to share this with you.

+Just type in your question that can be answered "Yes" or "No", concentrate very, very hard, and click on the "Ask" button.

+ +

+ + + + + + + +
+ +
+ +
+
+ + + \ No newline at end of file -- cgit v1.2.3