You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2018/07/17 22:30:08 UTC
[openwebbeans-meecrowave-examples] branch master updated: add an
example about how Meecrowave can get configured
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
The following commit(s) were added to refs/heads/master by this push:
new bdf3ecf add an example about how Meecrowave can get configured
bdf3ecf is described below
commit bdf3ecf7d199c7d297a8b2d95a6ede499e82ebf6
Author: Mark Struberg <st...@apache.org>
AuthorDate: Wed Jul 18 00:29:47 2018 +0200
add an example about how Meecrowave can get configured
---
mw_bundle_config/README.adoc | 17 +++++
mw_bundle_config/pom.xml | 77 ++++++++++++++++++++++
.../main/resources/META-INF/resources/index.html | 8 +++
.../src/main/resources/meecrowave.properties | 20 ++++++
pom.xml | 1 +
5 files changed, 123 insertions(+)
diff --git a/mw_bundle_config/README.adoc b/mw_bundle_config/README.adoc
new file mode 100644
index 0000000..cae240c
--- /dev/null
+++ b/mw_bundle_config/README.adoc
@@ -0,0 +1,17 @@
+= Apache Meecrowave
+
+== Bundle Configuration
+
+This example shows how to configure Meecrowave via a property file in a distribution bundle
+
+=== Serving static resources
+The sample contains a link:src/main/resources/META-INF/resources/index.html[static index.html file].
+Since we do not package a WAR file but a simple jar we have to provide the file as a WebResource.
+Since JavaEE 6 (Servlets-3.0) every file under META-INF/resources/ is served as a WebResource.
+If you start up Meecrowave then you can browse this file under http://localhost:8090/index.html
+
+=== meecrowave.properties
+To configure Apache Meecrowave you can leverage the provided meecrowave.properties file support.
+This file can either reside in `src/main/meecrowave/conf` or in the ClassPath.
+Please see the documentation in the link:src/main/resources/meecrowave.properties[meecrowave.properties] file for more explanation about what can get configured.
+
diff --git a/mw_bundle_config/pom.xml b/mw_bundle_config/pom.xml
new file mode 100644
index 0000000..8b36824
--- /dev/null
+++ b/mw_bundle_config/pom.xml
@@ -0,0 +1,77 @@
+<?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: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.meecrowave</groupId>
+ <artifactId>meecrowave-examples</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>samples-bundle-config</artifactId>
+ <name>Bundle Config Example</name>
+
+ <dependencies>
+ <!-- this package contains the javax APIs for CDI, JAX-RS, JSONP, JSONB and Servlet4 -->
+ <dependency>
+ <groupId>org.apache.meecrowave</groupId>
+ <artifactId>meecrowave-specs-api</artifactId>
+ <version>${meecrowave.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.meecrowave</groupId>
+ <artifactId>meecrowave-core</artifactId>
+ <version>${meecrowave.version}</version>
+ </dependency>
+
+ <!-- our test dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit4.version}</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>
+ <!--
+ For starting meecrowave via Maven. Just run
+ $> mvn clean install meecrowave:run
+ -->
+ <groupId>org.apache.meecrowave</groupId>
+ <artifactId>meecrowave-maven-plugin</artifactId>
+ <version>${meecrowave.version}</version>
+ </plugin>
+
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
diff --git a/mw_bundle_config/src/main/resources/META-INF/resources/index.html b/mw_bundle_config/src/main/resources/META-INF/resources/index.html
new file mode 100644
index 0000000..5805907
--- /dev/null
+++ b/mw_bundle_config/src/main/resources/META-INF/resources/index.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+ <title>Apache Meecrowave bundleconfig example</title>
+</head>
+<body>
+Yikes this is a sample page.
+</body>
+</html>
\ No newline at end of file
diff --git a/mw_bundle_config/src/main/resources/meecrowave.properties b/mw_bundle_config/src/main/resources/meecrowave.properties
new file mode 100644
index 0000000..62a8c96
--- /dev/null
+++ b/mw_bundle_config/src/main/resources/meecrowave.properties
@@ -0,0 +1,20 @@
+# We serve on port 8090
+http=8090
+
+# And use a specific tempDir
+tempDir=target/mwtmp
+
+# Default but set again
+jsonbEncoding = UTF-8
+jsonb-binary-strategy=BASE_64
+
+# Set the session timeout to 20 minutes:
+web-session-timeout=20
+
+
+# And now also configure a Valve, e.g. the built-in ErrorHandlerValve
+# Disable showing the Tomcat version number:
+properties.valves.errorreport._className=org.apache.catalina.valves.ErrorReportValve
+properties.valves.errorreport._order=1
+properties.valves.errorreport.showReport=false
+properties.valves.errorreport.showServerInfo=false
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 1d45f39..bd2b650 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,6 +39,7 @@
<module>rest-trivial</module>
<module>rest</module>
<module>servlet-trivial</module>
+ <module>mw_bundle_config</module>
<module>servlet-vaadin-v08</module>
<module>servlet-vaadin-v10</module>
</modules>