You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by cs...@apache.org on 2016/05/09 14:48:28 UTC

[09/35] karaf-boot git commit: Fix Maven coordonates in README. Add servlet sample

Fix Maven coordonates in README.
Add servlet sample


Project: http://git-wip-us.apache.org/repos/asf/karaf-boot/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-boot/commit/eb034f88
Tree: http://git-wip-us.apache.org/repos/asf/karaf-boot/tree/eb034f88
Diff: http://git-wip-us.apache.org/repos/asf/karaf-boot/diff/eb034f88

Branch: refs/heads/master
Commit: eb034f882affdf895de7bc6306de7bcbebaa1223
Parents: 1ea096c
Author: Jean-Baptiste Onofr� <jb...@apache.org>
Authored: Wed Oct 14 16:45:25 2015 +0200
Committer: Jean-Baptiste Onofr� <jb...@apache.org>
Committed: Wed Oct 14 16:45:25 2015 +0200

----------------------------------------------------------------------
 .../karaf-boot-sample-config/README.md          |  2 +-
 .../README.md                                   |  2 +-
 .../README.md                                   |  2 +-
 .../README.md                                   |  2 +-
 .../README.md                                   |  2 +-
 .../karaf-boot-sample-servlet/README.md         | 30 +++++++++++++
 .../karaf-boot-sample-servlet/pom.xml           | 47 ++++++++++++++++++++
 .../main/java/sample/servlet/SampleServlet.java | 44 ++++++++++++++++++
 .../karaf-boot-sample-shell/README.md           |  2 +-
 .../karaf-boot-starter-web/pom.xml              | 41 +++++++++++++++++
 karaf-boot-starters/pom.xml                     |  1 +
 pom.xml                                         |  8 ++--
 12 files changed, 174 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-samples/karaf-boot-sample-config/README.md
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-config/README.md b/karaf-boot-samples/karaf-boot-sample-config/README.md
index 6f571d5..1c8dbc5 100644
--- a/karaf-boot-samples/karaf-boot-sample-config/README.md
+++ b/karaf-boot-samples/karaf-boot-sample-config/README.md
@@ -28,4 +28,4 @@ Once scr feature installed:
 Karaf deploy folder
 * in the Karaf shell console, do:
 
-  bundle:install -s mvn:karaf-boot-samples/karaf-boot-sample-config/1.0
\ No newline at end of file
+  bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-config/1.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-samples/karaf-boot-sample-service-consumer-ds/README.md
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-consumer-ds/README.md b/karaf-boot-samples/karaf-boot-sample-service-consumer-ds/README.md
index f1f6370..ae04875 100644
--- a/karaf-boot-samples/karaf-boot-sample-service-consumer-ds/README.md
+++ b/karaf-boot-samples/karaf-boot-sample-service-consumer-ds/README.md
@@ -33,4 +33,4 @@ Once the service provider is installed:
 Karaf deploy folder
 * in the Karaf shell console, do:
 
-  bundle:install -s mvn:karaf-boot-samples/karaf-boot-sample-service-consumer-ds/1.0
\ No newline at end of file
+  bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-service-consumer-ds/1.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-samples/karaf-boot-sample-service-consumer-osgi/README.md
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-consumer-osgi/README.md b/karaf-boot-samples/karaf-boot-sample-service-consumer-osgi/README.md
index 02523d8..062348f 100644
--- a/karaf-boot-samples/karaf-boot-sample-service-consumer-osgi/README.md
+++ b/karaf-boot-samples/karaf-boot-sample-service-consumer-osgi/README.md
@@ -27,4 +27,4 @@ To deploy in Karaf:
 Karaf deploy folder
 * in the Karaf shell console, do:
 
-  bundle:install -s mvn:karaf-boot-samples/karaf-boot-sample-service-consumer-osgi/1.0
\ No newline at end of file
+  bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-service-consumer-osgi/1.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-samples/karaf-boot-sample-service-provider-ds/README.md
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-provider-ds/README.md b/karaf-boot-samples/karaf-boot-sample-service-provider-ds/README.md
index 0206a7b..94066f1 100644
--- a/karaf-boot-samples/karaf-boot-sample-service-provider-ds/README.md
+++ b/karaf-boot-samples/karaf-boot-sample-service-provider-ds/README.md
@@ -32,4 +32,4 @@ Once scr feature installed:
 Karaf deploy folder
 * in the Karaf shell console, do:
 
-  bundle:install -s mvn:karaf-boot-samples/karaf-boot-sample-service-provider-ds/1.0
\ No newline at end of file
+  bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-service-provider-ds/1.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-samples/karaf-boot-sample-service-provider-osgi/README.md
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-provider-osgi/README.md b/karaf-boot-samples/karaf-boot-sample-service-provider-osgi/README.md
index 3cd81c6..092d350 100644
--- a/karaf-boot-samples/karaf-boot-sample-service-provider-osgi/README.md
+++ b/karaf-boot-samples/karaf-boot-sample-service-provider-osgi/README.md
@@ -30,4 +30,4 @@ To deploy in Karaf:
 Karaf deploy folder
 * in the Karaf shell console, do:
 
-  bundle:install -s mvn:karaf-boot-samples/karaf-boot-sample-service-provider-osgi/1.0
\ No newline at end of file
+  bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-service-provider-osgi/1.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-samples/karaf-boot-sample-servlet/README.md
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-servlet/README.md b/karaf-boot-samples/karaf-boot-sample-servlet/README.md
new file mode 100644
index 0000000..75f940f
--- /dev/null
+++ b/karaf-boot-samples/karaf-boot-sample-servlet/README.md
@@ -0,0 +1,30 @@
+== karaf-boot-sample-servlet ==
+
+This sample shows how to easily create a servlet, ready to be deployed in Karaf.
+
+= Design
+
+The SampleServlet is servlet containing the @WebServlet annotation.
+
+This servlet is directly deployed by Karaf as soon as it's deployed.
+
+= Build
+
+To build, simply do:
+
+  mvn clean install
+
+= Deploy
+
+To deploy in Karaf, you have to enable the web support by installing the http and http-whiteboard features:
+
+  feature:install http
+  feature:install http-whiteboard
+
+Once http features installed:
+
+* you can drop the generated jar file (target/karaf-boot-sample-servlet-1.0.jar) in the
+Karaf deploy folder
+* in the Karaf shell console, do:
+
+  bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-servlet/1.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-samples/karaf-boot-sample-servlet/pom.xml
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-servlet/pom.xml b/karaf-boot-samples/karaf-boot-sample-servlet/pom.xml
new file mode 100644
index 0000000..773b00a
--- /dev/null
+++ b/karaf-boot-samples/karaf-boot-sample-servlet/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.karaf.boot</groupId>
+    <artifactId>karaf-boot-sample-servlet</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.karaf.boot</groupId>
+            <artifactId>karaf-boot-starter-web</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.boot</groupId>
+                <artifactId>karaf-boot-maven-plugin</artifactId>
+                <version>${project.version}</version>
+                <extensions>true</extensions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-samples/karaf-boot-sample-servlet/src/main/java/sample/servlet/SampleServlet.java
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-servlet/src/main/java/sample/servlet/SampleServlet.java b/karaf-boot-samples/karaf-boot-sample-servlet/src/main/java/sample/servlet/SampleServlet.java
new file mode 100644
index 0000000..d0069af
--- /dev/null
+++ b/karaf-boot-samples/karaf-boot-sample-servlet/src/main/java/sample/servlet/SampleServlet.java
@@ -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 sample.servlet;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+@WebServlet(name = "SampleServlet", urlPatterns = {"/sample"})
+public class SampleServlet extends HttpServlet {
+
+    @Override
+    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        final PrintWriter writer = response.getWriter();
+        writer.println("<html>");
+        writer.println("<head>");
+        writer.println("<title>Sample</title>");
+        writer.println("</head>");
+        writer.println("<body align='center'>");
+        writer.println("<h1>Sample karaf-boot</h1>");
+        writer.println("</body>");
+        writer.println("</html>");
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-samples/karaf-boot-sample-shell/README.md
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-shell/README.md b/karaf-boot-samples/karaf-boot-sample-shell/README.md
index 5c9e40b..dc6b380 100644
--- a/karaf-boot-samples/karaf-boot-sample-shell/README.md
+++ b/karaf-boot-samples/karaf-boot-sample-shell/README.md
@@ -28,7 +28,7 @@ To deploy in Karaf:
 Karaf deploy folder
 * in the Karaf shell console, do:
 
-  bundle:install -s mvn:karaf-boot-samples/karaf-boot-sample-shell/1.0
+  bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-shell/1.0
 
 = Usage
 

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-starters/karaf-boot-starter-web/pom.xml
----------------------------------------------------------------------
diff --git a/karaf-boot-starters/karaf-boot-starter-web/pom.xml b/karaf-boot-starters/karaf-boot-starter-web/pom.xml
new file mode 100644
index 0000000..54bc3c5
--- /dev/null
+++ b/karaf-boot-starters/karaf-boot-starter-web/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.karaf.boot</groupId>
+        <artifactId>karaf-boot-starters</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>karaf-boot-starter-web</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.1.0</version>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/karaf-boot-starters/pom.xml
----------------------------------------------------------------------
diff --git a/karaf-boot-starters/pom.xml b/karaf-boot-starters/pom.xml
index 379f140..caa5d44 100644
--- a/karaf-boot-starters/pom.xml
+++ b/karaf-boot-starters/pom.xml
@@ -35,6 +35,7 @@
         <module>karaf-boot-starter</module>
         <module>karaf-boot-starter-ds</module>
         <module>karaf-boot-starter-shell</module>
+        <module>karaf-boot-starter-web</module>
     </modules>
 
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/eb034f88/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b1bab33..8a42a00 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,12 +35,13 @@
     </properties>
 
     <modules>
+        <!-- Core karaf-boot -->
         <module>karaf-boot-starters</module>
         <module>karaf-boot-tools</module>
-
-        <!-- TODO reuse @Services & @Reference shell annotations for generic use cases -->
+        <!-- embedded mode -->
 
         <!-- Archetypes -->
+        <!-- TODO archetypes -->
 
         <!-- Samples -->
         <!-- services -->
@@ -56,13 +57,14 @@
         <module>karaf-boot-samples/karaf-boot-sample-config</module>
         <!-- jpa -->
         <!-- servlet -->
+        <module>karaf-boot-samples/karaf-boot-sample-servlet</module>
         <!-- webui / angular -->
         <!-- test -->
         <!-- rest & soap -->
         <!-- camel -->
  
         <!-- Demos -->
-        <!-- complete library demos -->
+        <!-- TODO complete library demos -->
     </modules>
 
 </project>