This is an automated email from the ASF dual-hosted git repository. struberg pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openwebbeans-meecrowave-examples.git
commit 207eaa3daf78af7ea4d7651ab88ce9424ba74cb6 Author: Sven Ruppert <[email protected]> AuthorDate: Fri Jun 29 12:38:30 2018 +0200 added vaadin examples, extended pom.xml files.. --- pom.xml | 202 ++++++++++++++------- rest-trivial/pom.xml | 4 +- rest/pom.xml | 4 +- servlet-trivial/pom.xml | 34 ++++ .../com/superbiz/servlet/HelloWorldServlet.java | 50 +++++ .../com/superbiz/servlet/UpperCaseService.java | 29 +++ .../src/main/resources/WEB-INF/beans.xml | 27 +++ .../superbiz/servlet/HelloWorldServletTest.java | 53 ++++++ .../com/superbiz/servlet/UpperCaseServiceTest.java | 32 ++++ servlet-vaadin-v08/pom.xml | 64 +++++++ .../com/superbiz/servlet/vaadin/HelloVaadin.java | 61 +++++++ .../src/main/resources/WEB-INF/beans.xml | 27 +++ servlet-vaadin-v10/pom.xml | 118 ++++++++++++ .../superbiz/servlet/vaadin/HelloVaadinV10.java | 41 +++++ 14 files changed, 678 insertions(+), 68 deletions(-) diff --git a/pom.xml b/pom.xml index 152d160..abe342c 100644 --- a/pom.xml +++ b/pom.xml @@ -19,68 +19,142 @@ --> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache</groupId> - <artifactId>apache</artifactId> - <version>18</version> - </parent> - - <groupId>org.apache.meecrowave</groupId> - <artifactId>meecrowave-examples</artifactId> - <packaging>pom</packaging> - <name>Apache Meecrowave Examples</name> - <description>A project showing some of the Apache Meecrowave features.</description> - - <modules> - <module>rest-trivial</module> - <module>rest</module> - </modules> - - <properties> - <meecrowave.version>1.2.2-SNAPSHOT</meecrowave.version> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.meecrowave</groupId> - <artifactId>meecrowave-core</artifactId> - <version>${meecrowave.version}</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.meecrowave</groupId> - <artifactId>meecrowave-junit</artifactId> - <version>${meecrowave.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.meecrowave</groupId> - <artifactId>meecrowave-maven-plugin</artifactId> - <version>${meecrowave.version}</version> - </plugin> - </plugins> - </build> - - <distributionManagement> - <repository> - <id>localhost</id> - <url>file://${basedir}/target/repo/</url> - </repository> - <snapshotRepository> - <id>localhost</id> - <url>file://${basedir}/target/snapshot-repo/</url> - </snapshotRepository> - </distributionManagement> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache</groupId> + <artifactId>apache</artifactId> + <version>18</version> + </parent> + + <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-examples</artifactId> + <version>1.2.2-SNAPSHOT</version> + + <packaging>pom</packaging> + <name>Apache Meecrowave Examples</name> + <description>A project showing some of the Apache Meecrowave features.</description> + + <modules> + <module>rest-trivial</module> + <module>rest</module> + <module>servlet-trivial</module> + <module>servlet-vaadin-v08</module> + <module>servlet-vaadin-v10</module> + </modules> + + <properties> + <meecrowave.version>1.2.2-SNAPSHOT</meecrowave.version> + + <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + + <slf4j.version>1.7.25</slf4j.version> + <log4j-api.version>2.11.0</log4j-api.version> + + <jacoco.version>0.8.1</jacoco.version> + <pitest.version>1.4.0</pitest.version> + <pitest-junit5-plugin.version>0.5</pitest-junit5-plugin.version> + + <junit.version>4.12</junit.version> + <junit.jupiter.version>5.1.1</junit.jupiter.version> + <junit.platform.version>1.1.1</junit.platform.version> + + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-core</artifactId> + <version>${meecrowave.version}</version> + </dependency> + + <!--jUnit5--> + + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <version>${junit.jupiter.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-params</artifactId> + <version>${junit.jupiter.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-launcher</artifactId> + <version>${junit.platform.version}</version> + <scope>test</scope> + </dependency> + <!-- Only required to run tests in an IDE that bundles an older version --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>${junit.jupiter.version}</version> + <scope>test</scope> + </dependency> + <!-- Only required to run tests in an IDE that bundles an older version --> + <dependency> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + <version>${junit.jupiter.version}</version> + <scope>test</scope> + </dependency> + + <!--Meecrowave--> + <dependency> + <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-junit</artifactId> + <version>${meecrowave.version}</version> + <scope>test</scope> + </dependency> + + <!--Logger--> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.7.25</version> + <!--<scope>test</scope>--> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>1.7.25</version> + <!--<scope>test</scope>--> + </dependency> + + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-web</artifactId> + <version>2.11.0</version> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-maven-plugin</artifactId> + <version>${meecrowave.version}</version> + </plugin> + </plugins> + </build> + + <distributionManagement> + <repository> + <id>localhost</id> + <url>file://${basedir}/target/repo/</url> + </repository> + <snapshotRepository> + <id>localhost</id> + <url>file://${basedir}/target/snapshot-repo/</url> + </snapshotRepository> + </distributionManagement> </project> diff --git a/rest-trivial/pom.xml b/rest-trivial/pom.xml index addad78..296d21f 100644 --- a/rest-trivial/pom.xml +++ b/rest-trivial/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> - <artifactId>samples</artifactId> <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-examples</artifactId> <version>1.2.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>samples-rest-trivial</artifactId> - <name>Meecrowave Samples - REST (trivial)</name> + <name>REST (trivial)</name> </project> \ No newline at end of file diff --git a/rest/pom.xml b/rest/pom.xml index 0d27b79..6bf61b2 100644 --- a/rest/pom.xml +++ b/rest/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> - <artifactId>samples</artifactId> <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-examples</artifactId> <version>1.2.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>samples-rest</artifactId> - <name>Meecrowave Samples - REST</name> + <name>REST</name> </project> \ No newline at end of file diff --git a/servlet-trivial/pom.xml b/servlet-trivial/pom.xml new file mode 100644 index 0000000..d66302a --- /dev/null +++ b/servlet-trivial/pom.xml @@ -0,0 +1,34 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-examples</artifactId> + <version>1.2.2-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>samples-servlet-trivial</artifactId> + <name>Servlet (trivial)</name> + + +</project> \ No newline at end of file diff --git a/servlet-trivial/src/main/java/com/superbiz/servlet/HelloWorldServlet.java b/servlet-trivial/src/main/java/com/superbiz/servlet/HelloWorldServlet.java new file mode 100644 index 0000000..aeb902b --- /dev/null +++ b/servlet-trivial/src/main/java/com/superbiz/servlet/HelloWorldServlet.java @@ -0,0 +1,50 @@ +/* + * 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 com.superbiz.servlet; + +import javax.inject.Inject; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + + +/** + * request with curl would look like + * + * http://localhost:8080/?value=HalloNase + * + */ +@WebServlet("/*") +public class HelloWorldServlet extends HttpServlet { + + + @Inject private UpperCaseService service; + + public void doGet(HttpServletRequest request, + HttpServletResponse response) + throws IOException { + response.setContentType("text/plain; charset=utf-8"); + + String value = request.getParameter("value"); + + response.getWriter().println(service.upperCase(value)); + } +} diff --git a/servlet-trivial/src/main/java/com/superbiz/servlet/UpperCaseService.java b/servlet-trivial/src/main/java/com/superbiz/servlet/UpperCaseService.java new file mode 100644 index 0000000..dae7e20 --- /dev/null +++ b/servlet-trivial/src/main/java/com/superbiz/servlet/UpperCaseService.java @@ -0,0 +1,29 @@ +/* + * 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 com.superbiz.servlet; + +import javax.enterprise.context.Dependent; + +@Dependent +public class UpperCaseService{ + + public String upperCase(String txt) { + return txt.toUpperCase(); + } +} diff --git a/servlet-trivial/src/main/resources/WEB-INF/beans.xml b/servlet-trivial/src/main/resources/WEB-INF/beans.xml new file mode 100644 index 0000000..42a24b5 --- /dev/null +++ b/servlet-trivial/src/main/resources/WEB-INF/beans.xml @@ -0,0 +1,27 @@ +<?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://xmlns.jcp.org/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" + bean-discovery-mode="all"> + +</beans> \ No newline at end of file diff --git a/servlet-trivial/src/test/java/junit/com/superbiz/servlet/HelloWorldServletTest.java b/servlet-trivial/src/test/java/junit/com/superbiz/servlet/HelloWorldServletTest.java new file mode 100644 index 0000000..2bfce55 --- /dev/null +++ b/servlet-trivial/src/test/java/junit/com/superbiz/servlet/HelloWorldServletTest.java @@ -0,0 +1,53 @@ +/* + * 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 junit.com.superbiz.servlet; + +import org.apache.meecrowave.junit.MeecrowaveRule; +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; + +import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE; +import static org.junit.Assert.assertEquals; + + +public class HelloWorldServletTest { + + @Rule // started once for the class, @Rule would be per method + public final MeecrowaveRule rule = new MeecrowaveRule(); + + @Test + public void test001() { + final Client client = ClientBuilder.newClient(); + try { + assertEquals("HALLONASE", client.target("http://127.0.0.1:" + rule.getConfiguration().getHttpPort()) + .queryParam("value", "HalloNase") + .request(APPLICATION_JSON_TYPE) + .get(String.class) + .trim()); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } finally { + client.close(); + } + } +} diff --git a/servlet-trivial/src/test/java/junit/com/superbiz/servlet/UpperCaseServiceTest.java b/servlet-trivial/src/test/java/junit/com/superbiz/servlet/UpperCaseServiceTest.java new file mode 100644 index 0000000..aa56d7c --- /dev/null +++ b/servlet-trivial/src/test/java/junit/com/superbiz/servlet/UpperCaseServiceTest.java @@ -0,0 +1,32 @@ +/* + * 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 junit.com.superbiz.servlet; + + +import com.superbiz.servlet.UpperCaseService; +import org.junit.Assert; +import org.junit.Test; + +public class UpperCaseServiceTest { + + @Test + public void test001() { + Assert.assertEquals("HALLO", new UpperCaseService().upperCase("hallo")); + } +} diff --git a/servlet-vaadin-v08/pom.xml b/servlet-vaadin-v08/pom.xml new file mode 100644 index 0000000..1aefb84 --- /dev/null +++ b/servlet-vaadin-v08/pom.xml @@ -0,0 +1,64 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-examples</artifactId> + <version>1.2.2-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>samples-servlet-vaadin-v08</artifactId> + <name>Servlet (Vaadin - V08)</name> + + <dependencyManagement> + <dependencies> + <!--Vaadin --> + <dependency> + <groupId>com.vaadin</groupId> + <artifactId>vaadin-bom</artifactId> + <version>8.4.2</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + + <!--Vaadin --> + <dependency> + <groupId>com.vaadin</groupId> + <artifactId>vaadin-server</artifactId> + </dependency> + <dependency> + <groupId>com.vaadin</groupId> + <artifactId>vaadin-themes</artifactId> + </dependency> + <dependency> + <groupId>com.vaadin</groupId> + <artifactId>vaadin-client-compiled</artifactId> + </dependency> + + </dependencies> + +</project> \ No newline at end of file diff --git a/servlet-vaadin-v08/src/main/java/com/superbiz/servlet/vaadin/HelloVaadin.java b/servlet-vaadin-v08/src/main/java/com/superbiz/servlet/vaadin/HelloVaadin.java new file mode 100644 index 0000000..d8f88f0 --- /dev/null +++ b/servlet-vaadin-v08/src/main/java/com/superbiz/servlet/vaadin/HelloVaadin.java @@ -0,0 +1,61 @@ +/* + * 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 com.superbiz.servlet.vaadin; + +import com.vaadin.annotations.VaadinServletConfiguration; +import com.vaadin.server.VaadinRequest; +import com.vaadin.server.VaadinServlet; +import com.vaadin.ui.*; + +import javax.servlet.annotation.WebServlet; + + +public class HelloVaadin { + + public static class MyUI extends UI { + + /** + * Start editing here to create your + * POC based on a Vaadin App. + * To start the app, -> start the main Method. + * <p> + * You will see in the log“s the randomly used port. + * + * @param request that is created by the first request to init the app + */ + @Override + protected void init(VaadinRequest request) { + + //create the components you want to use + // and set the main component with setContent(..) + final Layout layout = new VerticalLayout(); + layout + .addComponent(new Button("click me", + event -> layout.addComponents(new Label("clicked again")) + )); + + //set the main Component + setContent(layout); + } + + @WebServlet("/*") + @VaadinServletConfiguration(productionMode = false, ui = MyUI.class) + public static class MyProjectServlet extends VaadinServlet { } + } +} diff --git a/servlet-vaadin-v08/src/main/resources/WEB-INF/beans.xml b/servlet-vaadin-v08/src/main/resources/WEB-INF/beans.xml new file mode 100644 index 0000000..42a24b5 --- /dev/null +++ b/servlet-vaadin-v08/src/main/resources/WEB-INF/beans.xml @@ -0,0 +1,27 @@ +<?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://xmlns.jcp.org/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" + bean-discovery-mode="all"> + +</beans> \ No newline at end of file diff --git a/servlet-vaadin-v10/pom.xml b/servlet-vaadin-v10/pom.xml new file mode 100644 index 0000000..8fec11b --- /dev/null +++ b/servlet-vaadin-v10/pom.xml @@ -0,0 +1,118 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-examples</artifactId> + <version>1.2.2-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>samples-servlet-vaadin-v10</artifactId> + <name>Servlet (Vaadin - V10)</name> + + + <properties> + <transpilation.output>${project.build.directory}/build</transpilation.output> + <vaadin.version>10.0.1</vaadin.version> + </properties> + + <pluginRepositories> + <pluginRepository> + <id>vaadin-prereleases</id> + <url>https://maven.vaadin.com/vaadin-prereleases</url> + </pluginRepository> + </pluginRepositories> + + <repositories> + <!--Releases--> + <repository> + <id>vaadin-addons</id> + <url>http://maven.vaadin.com/vaadin-addons</url> + </repository> + + <!--Pre-Releases--> + <repository> + <id>vaadin-prereleases</id> + <url>http://maven.vaadin.com/vaadin-prereleases</url> + </repository> + </repositories> + + + <dependencyManagement> + <dependencies> + <!--Vaadin --> + <dependency> + <groupId>com.vaadin</groupId> + <artifactId>vaadin-bom</artifactId> + <version>${vaadin.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <!--Vaadin --> + <dependency> + <groupId>com.vaadin</groupId> + <artifactId>vaadin-core</artifactId> + </dependency> + </dependencies> + + + + <build> + <plugins> + <plugin> + <groupId>com.vaadin</groupId> + <artifactId>vaadin-maven-plugin</artifactId> + <version>${vaadin.version}</version> + <executions> + <execution> + <goals> + <goal>copy-production-files</goal> + <goal>package-for-production</goal> + </goals> + <configuration> + <transpileOutputDirectory>${transpilation.output}</transpileOutputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>3.1.0</version> + <configuration> + <webResources> + <resource> + <directory>${transpilation.output}</directory> + </resource> + </webResources> + </configuration> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file diff --git a/servlet-vaadin-v10/src/main/java/com/superbiz/servlet/vaadin/HelloVaadinV10.java b/servlet-vaadin-v10/src/main/java/com/superbiz/servlet/vaadin/HelloVaadinV10.java new file mode 100644 index 0000000..31ea511 --- /dev/null +++ b/servlet-vaadin-v10/src/main/java/com/superbiz/servlet/vaadin/HelloVaadinV10.java @@ -0,0 +1,41 @@ +/* + * 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 com.superbiz.servlet.vaadin; + +import com.vaadin.flow.component.Composite; +import com.vaadin.flow.component.button.Button; +import com.vaadin.flow.component.html.Div; +import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.Route; + +@Route("") +public class HelloVaadinV10 extends Composite<Div> { + + public HelloVaadinV10() { + final VerticalLayout layout = new VerticalLayout(); + layout + .add(new Button("click me", + event -> layout.add(new Label("clicked again")) + )); + //set the main Component + getContent().add(layout); + + } +}
