From 2f775bb75905bd1d526f75a9495f0afb8865a5e7 Mon Sep 17 00:00:00 2001 From: fmoga Date: Mon, 20 Sep 2010 14:05:48 +0000 Subject: Moved more samples. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@998937 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/sample/HelloWorldController.java | 56 ++++++ .../src/main/java/sample/HelloworldService.java | 25 +++ .../main/java/sample/HelloworldServiceImpl.java | 27 +++ .../src/main/webapp/WEB-INF/faces-config.xml | 51 ++++++ .../src/main/webapp/WEB-INF/web.composite | 34 ++++ .../helloworld-jsf/src/main/webapp/WEB-INF/web.xml | 191 +++++++++++++++++++++ .../helloworld-jsf/src/main/webapp/helloWorld.jsp | 40 +++++ .../helloworld-jsf/src/main/webapp/index.jsp | 23 +++ .../helloworld-jsf/src/main/webapp/page2.jsp | 38 ++++ 9 files changed, 485 insertions(+) create mode 100644 sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloWorldController.java create mode 100644 sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloworldService.java create mode 100644 sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloworldServiceImpl.java create mode 100644 sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/faces-config.xml create mode 100644 sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/web.composite create mode 100644 sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/web.xml create mode 100644 sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/helloWorld.jsp create mode 100644 sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/index.jsp create mode 100644 sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/page2.jsp (limited to 'sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main') diff --git a/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloWorldController.java b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloWorldController.java new file mode 100644 index 0000000000..9c9f541997 --- /dev/null +++ b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloWorldController.java @@ -0,0 +1,56 @@ +/* + * 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 sample; + +import org.oasisopen.sca.annotation.Reference; + +/** + * + */ +public class HelloWorldController { + + @Reference + protected HelloworldService service; + + private String name; + + public HelloWorldController() { + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Method that is backed to a submit button of a form. + */ + public String send() { + if (service == null) { + name = "reference not injected!"; + } else { + name = service.sayHello(name); + } + return "success"; + } + +} diff --git a/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloworldService.java b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloworldService.java new file mode 100644 index 0000000000..53ff7a5ca1 --- /dev/null +++ b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloworldService.java @@ -0,0 +1,25 @@ +/* + * 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 sample; + +public interface HelloworldService { + + String sayHello(String name); + +} diff --git a/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloworldServiceImpl.java b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloworldServiceImpl.java new file mode 100644 index 0000000000..23925d6c69 --- /dev/null +++ b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/java/sample/HelloworldServiceImpl.java @@ -0,0 +1,27 @@ +/* + * 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 sample; + +public class HelloworldServiceImpl implements HelloworldService { + + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/faces-config.xml b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 0000000000..99cee9faeb --- /dev/null +++ b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,51 @@ + + + + + + + helloWorld + sample.HelloWorldController + request + + + + + /helloWorld.jsp + + success + /page2.jsp + + + + + + /page2.jsp + + back + /helloWorld.jsp + + + + diff --git a/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/web.composite b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/web.composite new file mode 100644 index 0000000000..8976adde3c --- /dev/null +++ b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/web.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/web.xml b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..fecbd7c79b --- /dev/null +++ b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,191 @@ + + + + + MyProject web.xml + + + + org.apache.tuscany.sca.host.webapp.TuscanyContextListener + + + org.apache.myfaces.config.annotation.LifecycleProvider + org.apache.tuscany.sca.myfaces.TuscanyAnnotationLifecycleProvider + + + + + State saving method: "client" or "server" (= default) + See JSF Specification 2.5.3 + javax.faces.STATE_SAVING_METHOD + client + + + Only applicable if state saving method is "server" (= default). + Defines the amount (default = 20) of the latest views are stored in session. + org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION + 20 + + + Only applicable if state saving method is "server" (= default). + If true (default) the state will be serialized to a byte stream before it + is written to the session. + If false the state will not be serialized to a byte stream. + org.apache.myfaces.SERIALIZE_STATE_IN_SESSION + true + + + Only applicable if state saving method is "server" (= default) and if + org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (= default) + If true (default) the serialized state will be compressed before it + is written to the session. If false the state will not be compressed. + org.apache.myfaces.COMPRESS_STATE_IN_SESSION + true + + + This parameter tells MyFaces if javascript code should be allowed in the + rendered HTML output. + If javascript is allowed, command_link anchors will have javascript code + that submits the corresponding form. + If javascript is not allowed, the state saving info and nested parameters + will be added as url parameters. + Default: "true" + org.apache.myfaces.ALLOW_JAVASCRIPT + true + + + org.apache.myfaces.DETECT_JAVASCRIPT + false + + + If true, rendered HTML code will be formatted, so that it is "human readable". + i.e. additional line separators and whitespace will be written, that do not + influence the HTML code. + Default: "true" + org.apache.myfaces.PRETTY_HTML + true + + + If true, a javascript function will be rendered that is able to restore the + former vertical scroll on every request. Convenient feature if you have pages + with long lists and you do not want the browser page to always jump to the top + if you trigger a link or button action that stays on the same page. + Default: "false" + org.apache.myfaces.AUTO_SCROLL + true + + + + Used for encrypting view state. Only relevant for client side + state saving. See MyFaces wiki/web site documentation for instructions + on how to configure an application for diffenent encryption strengths. + + org.apache.myfaces.SECRET + NzY1NDMyMTA= + + + + + Validate managed beans, navigation rules and ensure that forms are not nested. + + org.apache.myfaces.VALIDATE + true + + + + + Treat readonly same as if disabled attribute was set for select elements. + + org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS + true + + + + + Use the defined class as the class which will be called when a resource is added to the + ExtensionFilter handling. Using StreamingAddResource here helps with performance. If you want to add + custom components and want to use the ExtensionFilter, you need to provide your custom implementation here. + + org.apache.myfaces.ADD_RESOURCE_CLASS + org.apache.myfaces.renderkit.html.util.DefaultAddResource + + + + + Virtual path in the URL which triggers loading of resources for the MyFaces extended components + in the ExtensionFilter. + + org.apache.myfaces.RESOURCE_VIRTUAL_PATH + /faces/myFacesExtensionResource + + + + + Check if the extensions-filter has been properly configured. + + org.apache.myfaces.CHECK_EXTENSIONS_FILTER + true + + + + + Define partial state saving as true/false. + + javax.faces.PARTIAL_STATE_SAVING_METHOD + false + + + + + org.apache.myfaces.webapp.StartupServletContextListener + + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + + + Faces Servlet + *.jsf + + + + + index.jsp + index.html + + + diff --git a/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/helloWorld.jsp b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/helloWorld.jsp new file mode 100644 index 0000000000..189c142c99 --- /dev/null +++ b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/helloWorld.jsp @@ -0,0 +1,40 @@ + + +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> + + + + Apache Tuscany Helloworld JSF sample + + +

Apache Tuscany Helloworld JSF sample

+ + + + + + + + + + + + diff --git a/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/index.jsp b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/index.jsp new file mode 100644 index 0000000000..5ca296e115 --- /dev/null +++ b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/index.jsp @@ -0,0 +1,23 @@ + + +<%@ page session="false"%> +<% +response.sendRedirect("helloWorld.jsf"); +%> diff --git a/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/page2.jsp b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/page2.jsp new file mode 100644 index 0000000000..89259021c7 --- /dev/null +++ b/sandbox/samples/sca-features/implementation-web/helloworld-jsf/src/main/webapp/page2.jsp @@ -0,0 +1,38 @@ + + +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> + + + Apache Tuscany Helloworld JSF sample + + +

Apache Tuscany Helloworld JSF sample

+ + + +
+ + + +
+
+ + -- cgit v1.2.3