http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/rest-example.adoc
----------------------------------------------------------------------
diff --git a/src/main/jbake/content/examples/rest-example.adoc 
b/src/main/jbake/content/examples/rest-example.adoc
new file mode 100755
index 0000000..c62eecb
--- /dev/null
+++ b/src/main/jbake/content/examples/rest-example.adoc
@@ -0,0 +1,641 @@
+= REST Example
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example rest-example can be browsed at 
https://github.com/apache/tomee/tree/master/examples/rest-example
+
+
+*Help us document this example! Click the blue pencil icon in the upper right 
to edit this page.*
+
+==  CommentDAO
+
+
+[source,java]
+----
+package org.superbiz.rest.dao;
+
+import org.superbiz.rest.model.Comment;
+import org.superbiz.rest.model.Post;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import java.util.Collections;
+import java.util.List;
+
+@Stateless
+public class CommentDAO extends DAO {
+    @EJB
+    private DAO dao;
+
+    public List<Comment> list(long postId) {
+        Post post = dao.find(Post.class, postId);
+        if (post == null) {
+            throw new IllegalArgumentException("post with id " + postId + " 
not found");
+        }
+        return Collections.unmodifiableList(post.getComments());
+    }
+
+    public Comment create(String author, String content, long postId) {
+        Post post = dao.find(Post.class, postId);
+        if (post == null) {
+            throw new IllegalArgumentException("post with id " + postId + " 
not found");
+        }
+
+        Comment comment = new Comment();
+        comment.setAuthor(author);
+        comment.setContent(content);
+        dao.create(comment);
+        comment.setPost(post);
+        return comment;
+    }
+
+    public void delete(long id) {
+        dao.delete(Comment.class, id);
+    }
+
+    public Comment update(long id, String author, String content) {
+        Comment comment = dao.find(Comment.class, id);
+        if (comment == null) {
+            throw new IllegalArgumentException("comment with id " + id + " not 
found");
+        }
+
+        comment.setAuthor(author);
+        comment.setContent(content);
+        return dao.update(comment);
+    }
+}
+----
+
+
+==  DAO
+
+
+[source,java]
+----
+package org.superbiz.rest.dao;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import java.util.List;
+
+/**
+ * Simply maps the entitymanager.
+ * It simplifies refactoring (unitName change) and wraps some logic (limited 
queries).
+ *
+ */
+@Stateless
+public class DAO {
+    @PersistenceContext(unitName = "blog")
+    private EntityManager em;
+
+    public <E> E create(E e) {
+        em.persist(e);
+        return e;
+    }
+
+    public <E> E update(E e) {
+        return em.merge(e);
+    }
+
+    public <E> void delete(Class<E> clazz, long id) {
+        em.remove(em.find(clazz, id));
+    }
+
+    public <E> E find(Class<E> clazz, long id) {
+        return em.find(clazz, id);
+    }
+
+    public <E> List<E> find(Class<E> clazz, String query, int min, int max) {
+        return queryRange(em.createQuery(query, clazz), min, 
max).getResultList();
+    }
+
+    public <E> List<E> namedFind(Class<E> clazz, String query, int min, int 
max) {
+        return queryRange(em.createNamedQuery(query, clazz), min, 
max).getResultList();
+    }
+
+    private static Query queryRange(Query query, int min, int max) {
+        if (max >= 0) {
+            query.setMaxResults(max);
+        }
+        if (min >= 0) {
+            query.setFirstResult(min);
+        }
+        return query;
+    }
+}
+----
+
+
+==  PostDAO
+
+
+[source,java]
+----
+package org.superbiz.rest.dao;
+
+import org.superbiz.rest.model.Post;
+import org.superbiz.rest.model.User;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import java.util.List;
+
+@Stateless
+public class PostDAO {
+    @EJB
+    private DAO dao;
+
+    public Post create(String title, String content, long userId) {
+        User user = dao.find(User.class, userId);
+        Post post = new Post();
+        post.setTitle(title);
+        post.setContent(content);
+        post.setUser(user);
+        return dao.create(post);
+    }
+
+    public Post find(long id) {
+        return dao.find(Post.class, id);
+    }
+
+    public List<Post> list(int first, int max) {
+        return dao.namedFind(Post.class, "post.list", first, max);
+    }
+
+    public void delete(long id) {
+        dao.delete(Post.class, id);
+    }
+
+    public Post update(long id, long userId, String title, String content) {
+        User user = dao.find(User.class, userId);
+        if (user == null) {
+            throw new IllegalArgumentException("user id " + id + " not found");
+        }
+
+        Post post = dao.find(Post.class, id);
+        if (post == null) {
+            throw new IllegalArgumentException("post id " + id + " not found");
+        }
+
+        post.setTitle(title);
+        post.setContent(content);
+        post.setUser(user);
+        return dao.update(post);
+    }
+}
+----
+
+
+==  UserDAO
+
+
+[source,java]
+----
+package org.superbiz.rest.dao;
+
+import org.superbiz.rest.model.User;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import java.util.List;
+
+@Stateless
+public class UserDAO {
+    @EJB
+    private DAO dao;
+
+    public User create(String name, String pwd, String mail) {
+        User user = new User();
+        user.setFullname(name);
+        user.setPassword(pwd);
+        user.setEmail(mail);
+        return dao.create(user);
+    }
+
+    public List<User> list(int first, int max) {
+        return dao.namedFind(User.class, "user.list", first, max);
+    }
+
+    public User find(long id) {
+        return dao.find(User.class, id);
+    }
+
+    public void delete(long id) {
+        dao.delete(User.class, id);
+    }
+
+    public User update(long id, String name, String pwd, String mail) {
+        User user = dao.find(User.class, id);
+        if (user == null) {
+            throw new IllegalArgumentException("setUser id " + id + " not 
found");
+        }
+
+        user.setFullname(name);
+        user.setPassword(pwd);
+        user.setEmail(mail);
+        return dao.update(user);
+    }
+}
+----
+
+
+==  Comment
+
+
+[source,java]
+----
+package org.superbiz.rest.model;
+
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+@Entity
+@NamedQueries({
+        @NamedQuery(name = "comment.list", query = "select c from Comment c")
+}
+----
+
+
+==  DatedModel
+
+
+[source,java]
+----
+package org.superbiz.rest.model;
+
+import javax.persistence.MappedSuperclass;
+import javax.persistence.PrePersist;
+import java.util.Date;
+
+@MappedSuperclass
+public abstract class DatedModel extends Model {
+    private Date created;
+
+    @PrePersist
+    public void create() {
+        created = new Date();
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+}
+----
+
+
+==  Model
+
+
+[source,java]
+----
+package org.superbiz.rest.model;
+
+import javax.persistence.Access;
+import javax.persistence.AccessType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+@MappedSuperclass
+@Access(AccessType.FIELD)
+@XmlAccessorType(XmlAccessType.FIELD)
+public abstract class Model {
+
+    @Id
+    @GeneratedValue
+    protected long id;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+}
+----
+
+
+==  Post
+
+
+[source,java]
+----
+package org.superbiz.rest.model;
+
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+@Entity
+@NamedQueries({
+        @NamedQuery(name = "post.list", query = "select p from Post p")
+}
+----
+
+
+==  User
+
+
+[source,java]
+----
+package org.superbiz.rest.model;
+
+import javax.persistence.Entity;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@Entity
+@NamedQueries({
+        @NamedQuery(name = "user.list", query = "select u from User u")
+}
+----
+
+
+==  CommentService
+
+
+[source,java]
+----
+package org.superbiz.rest.service;
+
+import org.superbiz.rest.dao.CommentDAO;
+import org.superbiz.rest.model.Comment;
+
+import javax.ejb.EJB;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import java.util.List;
+
+@Path("/api/comment")
+@Produces({"text/xml", "application/json"})
+public class CommentService {
+    @EJB
+    private CommentDAO commentDao;
+
+    @Path("/create")
+    @PUT
+    public Comment create(@QueryParam("author") String author,
+                          @QueryParam("content") String content,
+                          @QueryParam("postId") long postId) {
+        return commentDao.create(author, content, postId);
+    }
+
+    @Path("/list/{postId}")
+    @GET
+    public List<Comment> list(@PathParam("postId") long postId) {
+        return commentDao.list(postId);
+    }
+
+    @Path("/delete/{id}")
+    @DELETE
+    public void delete(@PathParam("id") long id) {
+        commentDao.delete(id);
+    }
+
+    @Path("/update/{id}")
+    @POST
+    public Comment update(@PathParam("id") long id,
+                          @QueryParam("author") String author,
+                          @QueryParam("content") String content) {
+        return commentDao.update(id, author, content);
+    }
+}
+----
+
+
+==  PostService
+
+
+[source,java]
+----
+package org.superbiz.rest.service;
+
+import org.superbiz.rest.dao.PostDAO;
+import org.superbiz.rest.model.Post;
+
+import javax.ejb.EJB;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import java.util.List;
+
+@Path("/api/post")
+@Produces({"text/xml", "application/json"})
+public class PostService {
+    @EJB
+    private PostDAO dao;
+
+    @Path("/create")
+    @PUT
+    public Post create(@QueryParam("title") String title,
+                       @QueryParam("content") String content,
+                       @QueryParam("userId") long userId) {
+        return dao.create(title, content, userId);
+    }
+
+    @Path("/list")
+    @GET
+    public List<Post> list(@QueryParam("first") @DefaultValue("0") int first,
+                           @QueryParam("max") @DefaultValue("20") int max) {
+        return dao.list(first, max);
+    }
+
+    @Path("/show/{id}")
+    @GET
+    public Post show(@PathParam("id") long id) {
+        return dao.find(id);
+    }
+
+    @Path("/delete/{id}")
+    @DELETE
+    public void delete(@PathParam("id") long id) {
+        dao.delete(id);
+    }
+
+    @Path("/update/{id}")
+    @POST
+    public Post update(@PathParam("id") long id,
+                       @QueryParam("userId") long userId,
+                       @QueryParam("title") String title,
+                       @QueryParam("content") String content) {
+        return dao.update(id, userId, title, content);
+    }
+}
+----
+
+
+==  UserService
+
+
+[source,java]
+----
+package org.superbiz.rest.service;
+
+import org.superbiz.rest.dao.UserDAO;
+import org.superbiz.rest.model.User;
+
+import javax.ejb.EJB;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import java.util.List;
+
+@Path("/api/user")
+@Produces({"text/xml", "application/json"})
+public class UserService {
+    @EJB
+    private UserDAO dao;
+
+    @Path("/create")
+    @PUT
+    public User create(@QueryParam("name") String name,
+                       @QueryParam("pwd") String pwd,
+                       @QueryParam("mail") String mail) {
+        return dao.create(name, pwd, mail);
+    }
+
+    @Path("/list")
+    @GET
+    public List<User> list(@QueryParam("first") @DefaultValue("0") int first,
+                           @QueryParam("max") @DefaultValue("20") int max) {
+        return dao.list(first, max);
+    }
+
+    @Path("/show/{id}")
+    @GET
+    public User show(@PathParam("id") long id) {
+        return dao.find(id);
+    }
+
+    @Path("/delete/{id}")
+    @DELETE
+    public void delete(@PathParam("id") long id) {
+        dao.delete(id);
+    }
+
+    @Path("/update/{id}")
+    @POST
+    public User update(@PathParam("id") long id,
+                       @QueryParam("name") String name,
+                       @QueryParam("pwd") String pwd,
+                       @QueryParam("mail") String mail) {
+        return dao.update(id, name, pwd, mail);
+    }
+}
+----
+
+
+==  persistence.xml
+
+
+[source,xml]
+----
+<persistence version="2.0"
+             xmlns="http://java.sun.com/xml/ns/persistence";
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+                       
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
+  <persistence-unit name="blog">
+    <jta-data-source>My DataSource</jta-data-source>
+    <non-jta-data-source>My Unmanaged DataSource</non-jta-data-source>
+    <class>org.superbiz.rest.model.User</class>
+    <class>org.superbiz.rest.model.Post</class>
+    <class>org.superbiz.rest.model.Comment</class>
+    <class>org.superbiz.rest.model.Model</class>
+    <class>org.superbiz.rest.model.DatedModel</class>
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" 
value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+</persistence>
+----
+
+
+==  web.xml
+
+
+[source,xml]
+----
+<web-app xmlns="http://java.sun.com/xml/ns/javaee";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
+         metadata-complete="false"
+         version="2.5">
+
+  <display-name>OpenEJB REST Example</display-name>
+</web-app>
+----
+
+    
+
+==  UserDaoTest
+
+
+[source,java]
+----
+packagenull
+}
+----
+
+
+==  UserServiceTest
+
+
+[source,java]
+----
+packagenull
+}
+----
+

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/rest-jaas.adoc
----------------------------------------------------------------------
diff --git a/src/main/jbake/content/examples/rest-jaas.adoc 
b/src/main/jbake/content/examples/rest-jaas.adoc
new file mode 100755
index 0000000..7587b09
--- /dev/null
+++ b/src/main/jbake/content/examples/rest-jaas.adoc
@@ -0,0 +1,9 @@
+= rest-jaas
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example rest-jaas can be browsed at 
https://github.com/apache/tomee/tree/master/examples/rest-jaas
+
+No README.md yet, be the first to contribute one!

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/rest-on-ejb.adoc
----------------------------------------------------------------------
diff --git a/src/main/jbake/content/examples/rest-on-ejb.adoc 
b/src/main/jbake/content/examples/rest-on-ejb.adoc
new file mode 100755
index 0000000..a9f344b
--- /dev/null
+++ b/src/main/jbake/content/examples/rest-on-ejb.adoc
@@ -0,0 +1,360 @@
+= REST on EJB
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example rest-on-ejb can be browsed at 
https://github.com/apache/tomee/tree/master/examples/rest-on-ejb
+
+
+*Help us document this example! Click the blue pencil icon in the upper right 
to edit this page.*
+
+==  User
+
+
+[source,java]
+----
+package org.superbiz.rest;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@Entity
+@NamedQueries({
+        @NamedQuery(name = "user.list", query = "select u from User u")
+}
+----
+
+
+==  UserService
+
+
+[source,java]
+----
+package org.superbiz.rest;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Singleton;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Outputs are copied because of the enhancement of OpenJPA.
+ *
+ */
+@Singleton
+@Lock(LockType.WRITE)
+@Path("/user")
+@Produces(MediaType.APPLICATION_XML)
+public class UserService {
+    @PersistenceContext
+    private EntityManager em;
+
+    @Path("/create")
+    @PUT
+    public User create(@QueryParam("name") String name,
+                       @QueryParam("pwd") String pwd,
+                       @QueryParam("mail") String mail) {
+        User user = new User();
+        user.setFullname(name);
+        user.setPassword(pwd);
+        user.setEmail(mail);
+        em.persist(user);
+        return user;
+    }
+
+    @Path("/list")
+    @GET
+    public List<User> list(@QueryParam("first") @DefaultValue("0") int first,
+                           @QueryParam("max") @DefaultValue("20") int max) {
+        List<User> users = new ArrayList<User>();
+        List<User> found = em.createNamedQuery("user.list", 
User.class).setFirstResult(first).setMaxResults(max).getResultList();
+        for (User u : found) {
+            users.add(u.copy());
+        }
+        return users;
+    }
+
+    @Path("/show/{id}")
+    @GET
+    public User find(@PathParam("id") long id) {
+        User user = em.find(User.class, id);
+        if (user == null) {
+            return null;
+        }
+        return user.copy();
+    }
+
+    @Path("/delete/{id}")
+    @DELETE
+    public void delete(@PathParam("id") long id) {
+        User user = em.find(User.class, id);
+        if (user != null) {
+            em.remove(user);
+        }
+    }
+
+    @Path("/update/{id}")
+    @POST
+    public Response update(@PathParam("id") long id,
+                           @QueryParam("name") String name,
+                           @QueryParam("pwd") String pwd,
+                           @QueryParam("mail") String mail) {
+        User user = em.find(User.class, id);
+        if (user == null) {
+            throw new IllegalArgumentException("user id " + id + " not found");
+        }
+
+        user.setFullname(name);
+        user.setPassword(pwd);
+        user.setEmail(mail);
+        em.merge(user);
+
+        return Response.ok(user.copy()).build();
+    }
+}
+----
+
+
+==  persistence.xml
+
+
+[source,xml]
+----
+<persistence version="2.0"
+             xmlns="http://java.sun.com/xml/ns/persistence";
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+                       
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
+  <persistence-unit name="user">
+    <jta-data-source>My DataSource</jta-data-source>
+    <non-jta-data-source>My Unmanaged DataSource</non-jta-data-source>
+    <class>org.superbiz.rest.User</class>
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" 
value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+</persistence>
+----
+
+
+==  UserServiceTest
+
+
+[source,java]
+----
+package org.superbiz.rest;
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.openejb.OpenEjbContainer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.fail;
+
+public class UserServiceTest {
+    private static Context context;
+    private static UserService service;
+    private static List<User> users = new ArrayList<User>();
+
+    @BeforeClass
+    public static void start() throws NamingException {
+        Properties properties = new Properties();
+        properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, 
"true");
+        context = EJBContainer.createEJBContainer(properties).getContext();
+
+        // create some records
+        service = (UserService) 
context.lookup("java:global/rest-on-ejb/UserService");
+        users.add(service.create("foo", "foopwd", "f...@foo.com"));
+        users.add(service.create("bar", "barpwd", "b...@bar.com"));
+    }
+
+    @AfterClass
+    public static void close() throws NamingException {
+        if (context != null) {
+            context.close();
+        }
+    }
+
+    @Test
+    public void create() {
+        int expected = service.list(0, 100).size() + 1;
+        Response response = WebClient.create("http://localhost:4204";)
+                .path("/user/create")
+                .query("name", "dummy")
+                .query("pwd", "unbreakable")
+                .query("mail", "f...@bar.fr")
+                .put(null);
+        List<User> list = service.list(0, 100);
+        for (User u : list) {
+            if (!users.contains(u)) {
+                service.delete(u.getId());
+                return;
+            }
+        }
+        fail("user was not added");
+    }
+
+    @Test
+    public void delete() throws Exception {
+        User user = service.create("todelete", "dontforget", "del...@me.com");
+
+        WebClient.create("http://localhost:4204";).path("/user/delete/" + 
user.getId()).delete();
+
+        user = service.find(user.getId());
+        assertNull(user);
+    }
+
+    @Test
+    public void show() {
+        User user = WebClient.create("http://localhost:4204";)
+                .path("/user/show/" + users.iterator().next().getId())
+                .get(User.class);
+        assertEquals("foo", user.getFullname());
+        assertEquals("foopwd", user.getPassword());
+        assertEquals("f...@foo.com", user.getEmail());
+    }
+
+    @Test
+    public void list() throws Exception {
+        String users = WebClient.create("http://localhost:4204";)
+                .path("/user/list")
+                .get(String.class);
+        assertEquals(
+                "<users>" +
+                        "<user>" +
+                        "<email>f...@foo.com</email>" +
+                        "<fullname>foo</fullname>" +
+                        "<id>1</id>" +
+                        "<password>foopwd</password>" +
+                        "</user>" +
+                        "<user>" +
+                        "<email>b...@bar.com</email>" +
+                        "<fullname>bar</fullname>" +
+                        "<id>2</id>" +
+                        "<password>barpwd</password>" +
+                        "</user>" +
+                        "</users>", users);
+    }
+
+    @Test
+    public void update() throws Exception {
+        User created = service.create("name", "pwd", "mail");
+        Response response = WebClient.create("http://localhost:4204";)
+                .path("/user/update/" + created.getId())
+                .query("name", "corrected")
+                .query("pwd", "userpwd")
+                .query("mail", "i...@is.ok")
+                .post(null);
+
+        JAXBContext ctx = JAXBContext.newInstance(User.class);
+        Unmarshaller unmarshaller = ctx.createUnmarshaller();
+        User modified = (User) 
unmarshaller.unmarshal(InputStream.class.cast(response.getEntity()));
+
+        assertEquals("corrected", modified.getFullname());
+        assertEquals("userpwd", modified.getPassword());
+        assertEquals("i...@is.ok", modified.getEmail());
+    }
+}
+----
+
+
+=  Running
+
+    
+
+[source]
+----
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.rest.UserServiceTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/rest-on-ejb
+INFO - openejb.base = /Users/dblevins/examples/rest-on-ejb
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/rest-on-ejb/target/classes
+INFO - Beginning load: /Users/dblevins/examples/rest-on-ejb/target/classes
+INFO - Configuring enterprise application: /Users/dblevins/examples/rest-on-ejb
+INFO - Configuring Service(id=Default Singleton Container, type=Container, 
provider-id=Default Singleton Container)
+INFO - Auto-creating a container for bean UserService: 
Container(type=SINGLETON, id=Default Singleton Container)
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean org.superbiz.rest.UserServiceTest: 
Container(type=MANAGED, id=Default Managed Container)
+INFO - Configuring PersistenceUnit(name=user)
+INFO - Configuring Service(id=Default JDBC Database, type=Resource, 
provider-id=Default JDBC Database)
+INFO - Auto-creating a Resource with id 'Default JDBC Database' of type 
'DataSource for 'user'.
+INFO - Configuring Service(id=Default Unmanaged JDBC Database, type=Resource, 
provider-id=Default Unmanaged JDBC Database)
+INFO - Auto-creating a Resource with id 'Default Unmanaged JDBC Database' of 
type 'DataSource for 'user'.
+INFO - Adjusting PersistenceUnit user <jta-data-source> to Resource ID 
'Default JDBC Database' from 'My DataSource'
+INFO - Adjusting PersistenceUnit user <non-jta-data-source> to Resource ID 
'Default Unmanaged JDBC Database' from 'My Unmanaged DataSource'
+INFO - Enterprise application "/Users/dblevins/examples/rest-on-ejb" loaded.
+INFO - Assembling app: /Users/dblevins/examples/rest-on-ejb
+INFO - PersistenceUnit(name=user, 
provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider 
time 407ms
+INFO - 
Jndi(name="java:global/rest-on-ejb/UserService!org.superbiz.rest.UserService")
+INFO - Jndi(name="java:global/rest-on-ejb/UserService")
+INFO - 
Jndi(name="java:global/EjbModule1789767313/org.superbiz.rest.UserServiceTest!org.superbiz.rest.UserServiceTest")
+INFO - 
Jndi(name="java:global/EjbModule1789767313/org.superbiz.rest.UserServiceTest")
+INFO - Created Ejb(deployment-id=org.superbiz.rest.UserServiceTest, 
ejb-name=org.superbiz.rest.UserServiceTest, container=Default Managed Container)
+INFO - Created Ejb(deployment-id=UserService, ejb-name=UserService, 
container=Default Singleton Container)
+INFO - Started Ejb(deployment-id=org.superbiz.rest.UserServiceTest, 
ejb-name=org.superbiz.rest.UserServiceTest, container=Default Managed Container)
+INFO - Started Ejb(deployment-id=UserService, ejb-name=UserService, 
container=Default Singleton Container)
+INFO - Deployed Application(path=/Users/dblevins/examples/rest-on-ejb)
+INFO - Initializing network services
+INFO - Creating ServerService(id=httpejbd)
+INFO - Creating ServerService(id=admin)
+INFO - Creating ServerService(id=ejbd)
+INFO - Creating ServerService(id=ejbds)
+INFO - Creating ServerService(id=cxf-rs)
+INFO - Initializing network services
+  ** Starting Services **
+  NAME                 IP              PORT  
+  httpejbd             127.0.0.1       4204  
+  admin thread         127.0.0.1       4200  
+  ejbd                 127.0.0.1       4201  
+  ejbd                 127.0.0.1       4203  
+-------
+Ready!
+WARN - Query "select u from User u" is removed from cache  excluded 
permanently. Query "select u from User u" is not cached because it uses 
pagination..
+Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.102 sec
+
+Results :
+
+Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
+----
+
+    

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/rest-xml-json.adoc
----------------------------------------------------------------------
diff --git a/src/main/jbake/content/examples/rest-xml-json.adoc 
b/src/main/jbake/content/examples/rest-xml-json.adoc
new file mode 100755
index 0000000..5628b87
--- /dev/null
+++ b/src/main/jbake/content/examples/rest-xml-json.adoc
@@ -0,0 +1,394 @@
+= Simple REST
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example rest-xml-json can be browsed at 
https://github.com/apache/tomee/tree/master/examples/rest-xml-json
+
+
+Defining a REST service is pretty easy, simply ad @Path annotation to a class 
then define on methods
+the HTTP method to use (@GET, @POST, ...).
+
+= The Code
+
+==  The REST service: @Path, @Produces, @Consumes
+
+Here we see a bean that uses the Bean-Managed Concurrency option as well as 
the @Startup annotation which causes the bean to be instantiated by the 
container when the application starts. Singleton beans with 
@ConcurrencyManagement(BEAN) are responsible for their own thread-safety. The 
bean shown is a simple properties "registry" and provides a place where options 
could be set and retrieved by all beans in the application.
+
+Actually lines:
+
+
+[source,java]
+----
+@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+
+are optional since it is the default configuration. And these lines can be 
configured by method too
+if you need to be more precise.
+
+@Path("/greeting")
+@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+public class GreetingService {
+    @GET
+    public Response message() {
+        return new Response("Hi REST!");
+    }
+
+    @POST
+    public Response lowerCase(final Request message) {
+        return new Response(message.getValue().toLowerCase());
+    }
+}
+----
+
+
+=  Testing
+
+==  Test for the JAXRS service
+
+The test uses the OpenEJB ApplicationComposer to make it trivial.
+
+The idea is first to activate the jaxrs services. This is done using 
@EnableServices annotation.
+
+Then we create on the fly the application simply returning an object 
representing the web.xml. Here we simply
+use it to define the context root but you can use it to define your REST 
Application too. And to complete the
+application definition we add @Classes annotation to define the set of classes 
to use in this app.
+
+Finally to test it we use cxf client API to call the REST service in get() and 
post() methods.
+
+Side note: to show we use JSON or XML depending on the test method we 
activated on EnableServices the attribute httpDebug
+which prints the http messages in the logs.
+
+
+[source,java]
+----
+package org.superbiz.rest;
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.openejb.jee.WebApp;
+import org.apache.openejb.junit.ApplicationComposer;
+import org.apache.openejb.junit.Classes;
+import org.apache.openejb.junit.EnableServices;
+import org.apache.openejb.junit.Module;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.ws.rs.core.MediaType;
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+@EnableServices(value = "jaxrs", httpDebug = true)
+@RunWith(ApplicationComposer.class)
+public class GreetingServiceTest {
+    @Module
+    @Classes(GreetingService.class)
+    public WebApp app() {
+        return new WebApp().contextRoot("test");
+    }
+
+    @Test
+    public void getXml() throws IOException {
+        final String message = 
WebClient.create("http://localhost:4204";).path("/test/greeting/")
+                .accept(MediaType.APPLICATION_XML_TYPE)
+                .get(Response.class).getValue();
+        assertEquals("Hi REST!", message);
+    }
+
+    @Test
+    public void postXml() throws IOException {
+        final String message = 
WebClient.create("http://localhost:4204";).path("/test/greeting/")
+                .accept(MediaType.APPLICATION_XML_TYPE)
+                .post(new Request("Hi REST!"), Response.class).getValue();
+        assertEquals("hi rest!", message);
+    }
+
+    @Test
+    public void getJson() throws IOException {
+        final String message = 
WebClient.create("http://localhost:4204";).path("/test/greeting/")
+                .accept(MediaType.APPLICATION_JSON_TYPE)
+                .get(Response.class).getValue();
+        assertEquals("Hi REST!", message);
+    }
+
+    @Test
+    public void postJson() throws IOException {
+        final String message = 
WebClient.create("http://localhost:4204";).path("/test/greeting/")
+                .accept(MediaType.APPLICATION_JSON_TYPE)
+                .post(new Request("Hi REST!"), Response.class).getValue();
+        assertEquals("hi rest!", message);
+    }
+}
+----
+
+
+
+= Running
+
+Running the example is fairly simple. In the "rest-xml-json" directory run:
+
+    $ mvn clean install
+
+Which should create output like the following.
+
+    /opt/softs/java/jdk1.6.0_30/bin/java -ea -Didea.launcher.port=7534 
-Didea.launcher.bin.path=/opt/softs/idea/bin -Dfile.encoding=UTF-8 -classpath 
/opt/softs/idea/lib/idea_rt.jar:/opt/softs/idea/plugins/junit/lib/junit-rt.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/plugin.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/javaws.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/jce.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/charsets.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/resources.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/deploy.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/management-agent.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/jsse.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/rt.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/ext/localedata.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/ext/sunjce_provider.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/ext/sunpkcs11.jar:/opt/softs/java/jdk1.6.0_30/jre/lib/ext/dnsns.jar:/opt/dev/openejb/openejb-trunk/examples/rest-xml-json/target/test-classes:/opt/dev/openejb/openejb-trunk/examples/rest-xm
 
l-json/target/classes:/home/rmannibucau/.m2/repository/org/apache/openejb/javaee-api/6.0-4/javaee-api-6.0-4.jar:/home/rmannibucau/.m2/repository/junit/junit/4.10/junit-4.10.jar:/home/rmannibucau/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-cxf-rs/4.5.1/openejb-cxf-rs-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-http/4.5.1/openejb-http-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-core/4.5.1/openejb-core-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/mbean-annotation-api/4.5.1/mbean-annotation-api-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-jpa-integration/4.5.1/openejb-jpa-integration-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-api/4.5.1/openejb-api-4.5.1.jar:/home/rmannibucau/.m2/repository/org/a
 
pache/openejb/openejb-loader/4.5.1/openejb-loader-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-javaagent/4.5.1/openejb-javaagent-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-jee/4.5.1/openejb-jee-4.5.1.jar:/home/rmannibucau/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.13/jaxb-impl-2.1.13.jar:/home/rmannibucau/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar:/home/rmannibucau/.m2/repository/org/apache/activemq/activemq-ra/5.7.0/activemq-ra-5.7.0.jar:/home/rmannibucau/.m2/repository/org/apache/activemq/activemq-core/5.7.0/activemq-core-5.7.0.jar:/home/rmannibucau/.m2/repository/org/slf4j/slf4j-api/1.7.2/slf4j-api-1.7.2.jar:/home/rmannibucau/.m2/repository/org/apache/activemq/kahadb/5.7.0/kahadb-5.7.0.jar:/home/rmannibucau/.m2/repository/org/apache/activemq/protobuf/activemq-protobuf/1.1/activemq-protobuf-1.1.jar:/home/rmannibucau/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/home/rmannib
 
ucau/.m2/repository/commons-net/commons-net/3.1/commons-net-3.1.jar:/home/rmannibucau/.m2/repository/org/apache/geronimo/components/geronimo-connector/3.1.1/geronimo-connector-3.1.1.jar:/home/rmannibucau/.m2/repository/org/apache/geronimo/components/geronimo-transaction/3.1.1/geronimo-transaction-3.1.1.jar:/home/rmannibucau/.m2/repository/org/apache/geronimo/specs/geronimo-j2ee-connector_1.6_spec/1.0/geronimo-j2ee-connector_1.6_spec-1.0.jar:/home/rmannibucau/.m2/repository/org/objectweb/howl/howl/1.0.1-1/howl-1.0.1-1.jar:/home/rmannibucau/.m2/repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/1.8.2/geronimo-javamail_1.4_mail-1.8.2.jar:/home/rmannibucau/.m2/repository/org/apache/xbean/xbean-asm-shaded/3.12/xbean-asm-shaded-3.12.jar:/home/rmannibucau/.m2/repository/org/apache/xbean/xbean-finder-shaded/3.12/xbean-finder-shaded-3.12.jar:/home/rmannibucau/.m2/repository/org/apache/xbean/xbean-reflect/3.12/xbean-reflect-3.12.jar:/home/rmannibucau/.m2/repository/org/apache/
 
xbean/xbean-naming/3.12/xbean-naming-3.12.jar:/home/rmannibucau/.m2/repository/org/apache/xbean/xbean-bundleutils/3.12/xbean-bundleutils-3.12.jar:/home/rmannibucau/.m2/repository/org/hsqldb/hsqldb/2.2.8/hsqldb-2.2.8.jar:/home/rmannibucau/.m2/repository/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar:/home/rmannibucau/.m2/repository/commons-pool/commons-pool/1.5.7/commons-pool-1.5.7.jar:/home/rmannibucau/.m2/repository/org/codehaus/swizzle/swizzle-stream/1.6.1/swizzle-stream-1.6.1.jar:/home/rmannibucau/.m2/repository/wsdl4j/wsdl4j/1.6.2/wsdl4j-1.6.2.jar:/home/rmannibucau/.m2/repository/org/quartz-scheduler/quartz/2.1.6/quartz-2.1.6.jar:/home/rmannibucau/.m2/repository/org/slf4j/slf4j-jdk14/1.7.2/slf4j-jdk14-1.7.2.jar:/home/rmannibucau/.m2/repository/org/apache/openwebbeans/openwebbeans-impl/1.1.6/openwebbeans-impl-1.1.6.jar:/home/rmannibucau/.m2/repository/org/apache/openwebbeans/openwebbeans-spi/1.1.6/openwebbeans-spi-1.1.6.jar:/home/rmannibucau/.m2/repository/org/apache/openwebb
 
eans/openwebbeans-ejb/1.1.6/openwebbeans-ejb-1.1.6.jar:/home/rmannibucau/.m2/repository/org/apache/openwebbeans/openwebbeans-ee/1.1.6/openwebbeans-ee-1.1.6.jar:/home/rmannibucau/.m2/repository/org/apache/openwebbeans/openwebbeans-ee-common/1.1.6/openwebbeans-ee-common-1.1.6.jar:/home/rmannibucau/.m2/repository/org/apache/openwebbeans/openwebbeans-web/1.1.6/openwebbeans-web-1.1.6.jar:/home/rmannibucau/.m2/repository/org/javassist/javassist/3.15.0-GA/javassist-3.15.0-GA.jar:/home/rmannibucau/.m2/repository/org/apache/openjpa/openjpa/2.2.0/openjpa-2.2.0.jar:/home/rmannibucau/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar:/home/rmannibucau/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/home/rmannibucau/.m2/repository/net/sourceforge/serp/serp/1.13.1/serp-1.13.1.jar:/home/rmannibucau/.m2/repository/asm/asm/3.2/asm-3.2.jar:/home/rmannibucau/.m2/repository/org/apache/bval/bval-core/0.5/bval-core-0.5.jar:/home/rmannibucau/.m2/r
 
epository/commons-beanutils/commons-beanutils-core/1.8.3/commons-beanutils-core-1.8.3.jar:/home/rmannibucau/.m2/repository/org/apache/bval/bval-jsr303/0.5/bval-jsr303-0.5.jar:/home/rmannibucau/.m2/repository/org/fusesource/jansi/jansi/1.8/jansi-1.8.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-server/4.5.1/openejb-server-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-client/4.5.1/openejb-client-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-ejbd/4.5.1/openejb-ejbd-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-rest/4.5.1/openejb-rest-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/openejb/openejb-cxf-transport/4.5.1/openejb-cxf-transport-4.5.1.jar:/home/rmannibucau/.m2/repository/org/apache/cxf/cxf-rt-transports-http/2.7.0/cxf-rt-transports-http-2.7.0.jar:/home/rmannibucau/.m2/repository/org/apache/cxf/cxf-api/2.7.0/cxf-api-2.7.0.jar:/home/rmannibucau/.m2/repository/org/apache/ws/xmlschema/x
 
mlschema-core/2.0.3/xmlschema-core-2.0.3.jar:/home/rmannibucau/.m2/repository/org/apache/cxf/cxf-rt-core/2.7.0/cxf-rt-core-2.7.0.jar:/home/rmannibucau/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/2.7.0/cxf-rt-frontend-jaxrs-2.7.0.jar:/home/rmannibucau/.m2/repository/javax/ws/rs/javax.ws.rs-api/2.0-m10/javax.ws.rs-api-2.0-m10.jar:/home/rmannibucau/.m2/repository/org/apache/cxf/cxf-rt-bindings-xml/2.7.0/cxf-rt-bindings-xml-2.7.0.jar:/home/rmannibucau/.m2/repository/org/apache/cxf/cxf-rt-rs-extension-providers/2.7.0/cxf-rt-rs-extension-providers-2.7.0.jar:/home/rmannibucau/.m2/repository/org/apache/cxf/cxf-rt-rs-extension-search/2.7.0/cxf-rt-rs-extension-search-2.7.0.jar:/home/rmannibucau/.m2/repository/org/apache/cxf/cxf-rt-rs-security-cors/2.7.0/cxf-rt-rs-security-cors-2.7.0.jar:/home/rmannibucau/.m2/repository/org/apache/cxf/cxf-rt-rs-security-oauth2/2.7.0/cxf-rt-rs-security-oauth2-2.7.0.jar:/home/rmannibucau/.m2/repository/org/codehaus/jettison/jettison/1.3/jettison-1.3.jar:
 /home/rmannibucau/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar 
com.intellij.rt.execution.application.AppMain 
com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 
org.superbiz.rest.GreetingServiceTest
+    INFO - Cannot find the configuration file [conf/openejb.xml].  Will 
attempt to create one for the beans deployed.
+    INFO - Configuring Service(id=Default Security Service, 
type=SecurityService, provider-id=Default Security Service)
+    INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+    INFO - Creating TransactionManager(id=Default Transaction Manager)
+    INFO - Creating SecurityService(id=Default Security Service)
+    INFO - Initializing network services
+    INFO - Creating ServerService(id=httpejbd)
+    INFO - Using 'print=true'
+    INFO - Using 'indent.xml=true'
+    INFO - Creating ServerService(id=cxf-rs)
+    INFO - Initializing network services
+    INFO - Starting service httpejbd
+    INFO - Started service httpejbd
+    INFO - Starting service cxf-rs
+    INFO - Started service cxf-rs
+    INFO -   ** Bound Services **
+    INFO -   NAME                 IP              PORT  
+    INFO -   httpejbd             127.0.0.1       4204  
+    INFO - -------
+    INFO - Ready!
+    INFO - Configuring enterprise application: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+    INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+    INFO - Auto-creating a container for bean 
org.superbiz.rest.GreetingServiceTest: Container(type=MANAGED, id=Default 
Managed Container)
+    INFO - Creating Container(id=Default Managed Container)
+    INFO - Using directory /tmp for stateful session passivation
+    INFO - Enterprise application 
"/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest" loaded.
+    INFO - Assembling app: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+    INFO - Existing thread singleton service in SystemInstance() null
+    INFO - Created new singletonService 
org.apache.openejb.cdi.ThreadSingletonServiceImpl@54128635
+    INFO - Succeeded in installing singleton service
+    INFO - OpenWebBeans Container is starting...
+    INFO - Adding OpenWebBeansPlugin : [CdiPlugin]
+    INFO - All injection points are validated successfully.
+    INFO - OpenWebBeans Container has started, it took 102 ms.
+    INFO - Deployed 
Application(path=/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest)
+    INFO - Setting the server's publish address to be 
http://127.0.0.1:4204/test
+    INFO - REST Service: http://127.0.0.1:4204/test/greeting/.*  -> Pojo 
org.superbiz.rest.GreetingService
+    FINE - ******************* REQUEST ******************
+    GET http://localhost:4204/test/greeting/
+    Host=localhost:4204
+    User-Agent=Apache CXF 2.7.0
+    Connection=keep-alive
+    Accept=application/xml
+    Content-Type=*/*
+    Pragma=no-cache
+    Cache-Control=no-cache
+    
+    
+    **********************************************
+    
+    FINE - HTTP/1.1 200 OK
+    Date: Fri, 09 Nov 2012 11:59:00 GMT
+    Content-Length: 44
+    Set-Cookie: EJBSESSIONID=fc5037fa-641c-495d-95ca-0755cfa50beb; Path=/
+    Content-Type: application/xml
+    Connection: close
+    Server: OpenEJB/4.5.1 Linux/3.2.0-23-generic (amd64)
+    
+
+[source,xml]
+----
+<response><value>Hi REST!</value></response>
+INFO - Undeploying app: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+INFO - Stopping network services
+INFO - Stopping server services
+INFO - Cannot find the configuration file [conf/openejb.xml].  Will attempt to 
create one for the beans deployed.
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Creating TransactionManager(id=Default Transaction Manager)
+INFO - Creating SecurityService(id=Default Security Service)
+INFO - Initializing network services
+INFO - Creating ServerService(id=httpejbd)
+INFO - Using 'print=true'
+INFO - Using 'indent.xml=true'
+INFO - Creating ServerService(id=cxf-rs)
+INFO - Initializing network services
+INFO - Starting service httpejbd
+INFO - Started service httpejbd
+INFO - Starting service cxf-rs
+INFO - Started service cxf-rs
+INFO -   ** Bound Services **
+INFO -   NAME                 IP              PORT  
+INFO -   httpejbd             127.0.0.1       4204  
+INFO - -------
+INFO - Ready!
+INFO - Configuring enterprise application: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean 
org.superbiz.rest.GreetingServiceTest: Container(type=MANAGED, id=Default 
Managed Container)
+INFO - Creating Container(id=Default Managed Container)
+INFO - Using directory /tmp for stateful session passivation
+INFO - Enterprise application 
"/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest" loaded.
+INFO - Assembling app: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+INFO - Existing thread singleton service in SystemInstance() null
+INFO - Created new singletonService 
org.apache.openejb.cdi.ThreadSingletonServiceImpl@54128635
+INFO - Succeeded in installing singleton service
+INFO - OpenWebBeans Container is starting...
+INFO - Adding OpenWebBeansPlugin : [CdiPlugin]
+INFO - All injection points are validated successfully.
+INFO - OpenWebBeans Container has started, it took 11 ms.
+INFO - Deployed 
Application(path=/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest)
+INFO - Setting the server's publish address to be http://127.0.0.1:4204/test
+INFO - REST Service: http://127.0.0.1:4204/test/greeting/.*  -> Pojo 
org.superbiz.rest.GreetingService
+FINE - ******************* REQUEST ******************
+POST http://localhost:4204/test/greeting/
+Host=localhost:4204
+Content-Length=97
+User-Agent=Apache CXF 2.7.0
+Connection=keep-alive
+Accept=application/xml
+Content-Type=application/xml
+Pragma=no-cache
+Cache-Control=no-cache
+
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><request><value>Hi 
REST!</value></request>
+**********************************************
+
+FINE - HTTP/1.1 200 OK
+Date: Fri, 09 Nov 2012 11:59:00 GMT
+Content-Length: 44
+Set-Cookie: EJBSESSIONID=7cb2246d-5738-4a85-aac5-c0fb5340d36a; Path=/
+Content-Type: application/xml
+Connection: close
+Server: OpenEJB/4.5.1 Linux/3.2.0-23-generic (amd64)
+
+<response><value>hi rest!</value></response>
+INFO - Undeploying app: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+INFO - Stopping network services
+INFO - Stopping server services
+INFO - Cannot find the configuration file [conf/openejb.xml].  Will attempt to 
create one for the beans deployed.
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Creating TransactionManager(id=Default Transaction Manager)
+INFO - Creating SecurityService(id=Default Security Service)
+INFO - Initializing network services
+INFO - Creating ServerService(id=httpejbd)
+INFO - Using 'print=true'
+INFO - Using 'indent.xml=true'
+INFO - Creating ServerService(id=cxf-rs)
+INFO - Initializing network services
+INFO - Starting service httpejbd
+INFO - Started service httpejbd
+INFO - Starting service cxf-rs
+INFO - Started service cxf-rs
+INFO -   ** Bound Services **
+INFO -   NAME                 IP              PORT  
+INFO -   httpejbd             127.0.0.1       4204  
+INFO - -------
+INFO - Ready!
+INFO - Configuring enterprise application: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean 
org.superbiz.rest.GreetingServiceTest: Container(type=MANAGED, id=Default 
Managed Container)
+INFO - Creating Container(id=Default Managed Container)
+INFO - Using directory /tmp for stateful session passivation
+INFO - Enterprise application 
"/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest" loaded.
+INFO - Assembling app: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+INFO - Existing thread singleton service in SystemInstance() null
+INFO - Created new singletonService 
org.apache.openejb.cdi.ThreadSingletonServiceImpl@54128635
+INFO - Succeeded in installing singleton service
+INFO - OpenWebBeans Container is starting...
+INFO - Adding OpenWebBeansPlugin : [CdiPlugin]
+INFO - All injection points are validated successfully.
+INFO - OpenWebBeans Container has started, it took 10 ms.
+INFO - Deployed 
Application(path=/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest)
+INFO - Setting the server's publish address to be http://127.0.0.1:4204/test
+INFO - REST Service: http://127.0.0.1:4204/test/greeting/.*  -> Pojo 
org.superbiz.rest.GreetingService
+FINE - ******************* REQUEST ******************
+GET http://localhost:4204/test/greeting/
+Host=localhost:4204
+User-Agent=Apache CXF 2.7.0
+Connection=keep-alive
+Accept=application/json
+Content-Type=*/*
+Pragma=no-cache
+Cache-Control=no-cache
+
+
+**********************************************
+
+FINE - HTTP/1.1 200 OK
+Date: Fri, 09 Nov 2012 11:59:00 GMT
+Content-Length: 33
+Set-Cookie: EJBSESSIONID=7112a057-fc4c-4f52-a556-1617320d2275; Path=/
+Content-Type: application/json
+Connection: close
+Server: OpenEJB/4.5.1 Linux/3.2.0-23-generic (amd64)
+
+{"response":{"value":"Hi REST!"}}
+INFO - Undeploying app: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+INFO - Stopping network services
+INFO - Stopping server services
+INFO - Cannot find the configuration file [conf/openejb.xml].  Will attempt to 
create one for the beans deployed.
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Creating TransactionManager(id=Default Transaction Manager)
+INFO - Creating SecurityService(id=Default Security Service)
+INFO - Initializing network services
+INFO - Creating ServerService(id=httpejbd)
+INFO - Using 'print=true'
+INFO - Using 'indent.xml=true'
+INFO - Creating ServerService(id=cxf-rs)
+INFO - Initializing network services
+INFO - Starting service httpejbd
+INFO - Started service httpejbd
+INFO - Starting service cxf-rs
+INFO - Started service cxf-rs
+INFO -   ** Bound Services **
+INFO -   NAME                 IP              PORT  
+INFO -   httpejbd             127.0.0.1       4204  
+INFO - -------
+INFO - Ready!
+INFO - Configuring enterprise application: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean 
org.superbiz.rest.GreetingServiceTest: Container(type=MANAGED, id=Default 
Managed Container)
+INFO - Creating Container(id=Default Managed Container)
+INFO - Using directory /tmp for stateful session passivation
+INFO - Enterprise application 
"/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest" loaded.
+INFO - Assembling app: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+INFO - Existing thread singleton service in SystemInstance() null
+INFO - Created new singletonService 
org.apache.openejb.cdi.ThreadSingletonServiceImpl@54128635
+INFO - Succeeded in installing singleton service
+INFO - OpenWebBeans Container is starting...
+INFO - Adding OpenWebBeansPlugin : [CdiPlugin]
+INFO - All injection points are validated successfully.
+INFO - OpenWebBeans Container has started, it took 10 ms.
+INFO - Deployed 
Application(path=/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest)
+INFO - Setting the server's publish address to be http://127.0.0.1:4204/test
+INFO - REST Service: http://127.0.0.1:4204/test/greeting/.*  -> Pojo 
org.superbiz.rest.GreetingService
+FINE - ******************* REQUEST ******************
+POST http://localhost:4204/test/greeting/
+Host=localhost:4204
+Content-Length=97
+User-Agent=Apache CXF 2.7.0
+Connection=keep-alive
+Accept=application/json
+Content-Type=application/xml
+Pragma=no-cache
+Cache-Control=no-cache
+
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><request><value>Hi 
REST!</value></request>
+**********************************************
+
+FINE - HTTP/1.1 200 OK
+Date: Fri, 09 Nov 2012 11:59:01 GMT
+Content-Length: 33
+Set-Cookie: EJBSESSIONID=50cf1d2b-a940-4afb-8993-fff7f9cc6d83; Path=/
+Content-Type: application/json
+Connection: close
+Server: OpenEJB/4.5.1 Linux/3.2.0-23-generic (amd64)
+
+{"response":{"value":"hi rest!"}}
+INFO - Undeploying app: 
/opt/dev/openejb/openejb-trunk/examples/GreetingServiceTest
+INFO - Stopping network services
+INFO - Stopping server services
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/scala-basic.adoc
----------------------------------------------------------------------
diff --git a/src/main/jbake/content/examples/scala-basic.adoc 
b/src/main/jbake/content/examples/scala-basic.adoc
new file mode 100755
index 0000000..e60894c
--- /dev/null
+++ b/src/main/jbake/content/examples/scala-basic.adoc
@@ -0,0 +1,9 @@
+= scala-basic
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example scala-basic can be browsed at 
https://github.com/apache/tomee/tree/master/examples/scala-basic
+
+No README.md yet, be the first to contribute one!

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/schedule-events.adoc
----------------------------------------------------------------------
diff --git a/src/main/jbake/content/examples/schedule-events.adoc 
b/src/main/jbake/content/examples/schedule-events.adoc
new file mode 100755
index 0000000..5d55798
--- /dev/null
+++ b/src/main/jbake/content/examples/schedule-events.adoc
@@ -0,0 +1,185 @@
+= Schedule CDI Events
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example schedule-events can be browsed at 
https://github.com/apache/tomee/tree/master/examples/schedule-events
+
+
+This example uses a nice CDI/EJB combination to schedule CDI Events.  This is 
useful if you want CDI Events that fire regularly or at a specific time or 
calendar date.
+
+Effectively this is a simple wrapper around the 
`BeanManager.fireEvent(Object,Annotations...)` method that adds 
`ScheduleExpression` into the mix.
+
+==  ScheduleExpression and @Timeout
+
+The logic here is simple, we effecitvely expose a method identical to 
`BeanManager.fireEvent(Object, Annotations...)` and wrap it as  
`scheduleEvent(ScheduleExpression, Object, Annotation...)`
+
+To do that we use the EJB `TimerService` (under the covers this is Quartz) and 
create an `@Timeout` method which will be run when the `ScheduleExpression` 
activates.
+
+The `@Timeout` method, simply called `timeout`, takes the event and fires it.
+
+
+[source,java]
+----
+@Singleton
+@Lock(LockType.READ)
+public class Scheduler {
+
+    @Resource
+    private TimerService timerService;
+
+    @Resource
+    private BeanManager beanManager;
+
+    public void scheduleEvent(ScheduleExpression schedule, Object event, 
Annotation... qualifiers) {
+
+        timerService.createCalendarTimer(schedule, new TimerConfig(new 
EventConfig(event, qualifiers), false));
+    }
+
+    @Timeout
+    private void timeout(Timer timer) {
+        final EventConfig config = (EventConfig) timer.getInfo();
+
+        beanManager.fireEvent(config.getEvent(), config.getQualifiers());
+    }
+
+    // Doesn't actually need to be serializable, just has to implement it
+    private final class EventConfig implements Serializable {
+
+        private final Object event;
+        private final Annotation[] qualifiers;
+
+        private EventConfig(Object event, Annotation[] qualifiers) {
+            this.event = event;
+            this.qualifiers = qualifiers;
+        }
+
+        public Object getEvent() {
+            return event;
+        }
+
+        public Annotation[] getQualifiers() {
+            return qualifiers;
+        }
+    }
+}
+----
+
+
+Then to use it, have `Scheduler` injected as an EJB and enjoy.
+
+
+[source,java]
+----
+public class SomeBean {
+
+    @EJB
+    private Scheduler scheduler;
+
+    public void doit() throws Exception {
+
+        // every five minutes
+        final ScheduleExpression schedule = new ScheduleExpression()
+                .hour("*")
+                .minute("*")
+                .second("*/5");
+
+        scheduler.scheduleEvent(schedule, new TestEvent("five"));
+    }
+
+    /**
+     * Event will fire every five minutes
+     */
+    public void observe(@Observes TestEvent event) {
+        // process the event
+    }
+
+}
+----
+
+
+==  Test Case
+
+A working test case for the above would be as follows:
+
+
+[source,java]
+----
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.ejb.AccessTimeout;
+import javax.ejb.EJB;
+import javax.ejb.ScheduleExpression;
+import javax.ejb.embeddable.EJBContainer;
+import javax.enterprise.event.Observes;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class SchedulerTest {
+
+    public static final CountDownLatch events = new CountDownLatch(3);
+
+    @EJB
+    private Scheduler scheduler;
+
+    @Test
+    public void test() throws Exception {
+
+        final ScheduleExpression schedule = new ScheduleExpression()
+                .hour("*")
+                .minute("*")
+                .second("*/5");
+
+        scheduler.scheduleEvent(schedule, new TestEvent("five"));
+
+        Assert.assertTrue(events.await(1, TimeUnit.MINUTES));
+    }
+
+
+    @AccessTimeout(value = 1, unit = TimeUnit.MINUTES)
+    public void observe(@Observes TestEvent event) {
+        if ("five".equals(event.getMessage())) {
+            events.countDown();
+        }
+    }
+
+    public static class TestEvent {
+        private final String message;
+
+        public TestEvent(String message) {
+            this.message = message;
+        }
+
+        public String getMessage() {
+            return message;
+        }
+    }
+
+    @Before
+    public void setup() throws Exception {
+        EJBContainer.createEJBContainer().getContext().bind("inject", this);
+    }
+}
+----
+
+
+
+==  You must know
+
+ - CDI Events are not multi-treaded
+
+If there are 10 observers and each of them take 7 minutes to execute, then the 
total execution time for the one event is 70 minutes.  It would do you 
absolutely no good to schedule that event to fire more frequently than 70 
minutes.
+
+What would happen if you did?  Depends on the `@Singleton` `@Lock` policy
+
+ - `@Lock(WRITE)` is the default.  In this mode the `timeout` method would 
essentially be locked until the previous invocation completes.  Having it fire 
every 5 minutes even though you can only process one every 70 minutes would 
eventually cause all the pooled timer threads to be waiting on your Singleton.
+ - `@Lock(READ)` allows for parallel execution of the `timeout` method.  
Events will fire in parallel for a while.  However since they actually are 
taking 70 minutes each, within an hour or so we'll run out of threads in the 
timer pool just like above.
+
+The elegant solution is to use `@Lock(WRITE)` then specify some short timeout 
like `@AccessTimeout(value = 1, unit = TimeUnit.MINUTES)` on the `timeout` 
method.  When the next 5 minute invocation is triggered, it will wait up until 
1 minute to get access to the Singleton before giving up.  This will keep your 
timer pool from filling up with backed up jobs -- the "overflow" is simply 
discarded.
+

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/schedule-expression.adoc
----------------------------------------------------------------------
diff --git a/src/main/jbake/content/examples/schedule-expression.adoc 
b/src/main/jbake/content/examples/schedule-expression.adoc
new file mode 100755
index 0000000..de97e07
--- /dev/null
+++ b/src/main/jbake/content/examples/schedule-expression.adoc
@@ -0,0 +1,185 @@
+= Schedule Expression
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example schedule-expression can be browsed at 
https://github.com/apache/tomee/tree/master/examples/schedule-expression
+
+
+In this example we exercise the `TimerService`.
+
+
+NOTE: "The TimerService interface provides enterprise bean components with 
access to the container-provided Timer Service. 
+
+The EJB Timer Service allows entity beans, stateless session beans, and 
message-driven beans to be registered for timer 
+callback events at a specified time, after a specified elapsed time, or after 
a specified interval."
+
+For a complete description of the TimerService, please refer to the Java EE 
tutorial dedicated to the 
+link:http://docs.oracle.com/javaee/6/tutorial/doc/bnboy.html[Timer Service].
+
+==  FarmerBrown
+
+At `PostConstruct` we create 5 programmatic timers. First four will most 
likely not be triggered during the test
+execution, however the last one will timeout a couple of times.
+
+Each timer contains an info attribute, which can be inspected at timeout.   
+
+
+[source,java]
+----
+package org.superbiz.corn;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.ScheduleExpression;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.ejb.Timeout;
+import javax.ejb.Timer;
+import javax.ejb.TimerConfig;
+import javax.ejb.TimerService;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * This is where we schedule all of Farmer Brown's corn jobs
+ *
+ * @version $Revision$ $Date$
+ */
+@Singleton
+@Lock(LockType.READ) // allows timers to execute in parallel
+@Startup
+public class FarmerBrown {
+
+    private final AtomicInteger checks = new AtomicInteger();
+
+    @Resource
+    private TimerService timerService;
+
+    @PostConstruct
+    private void construct() {
+        final TimerConfig plantTheCorn = new TimerConfig("plantTheCorn", 
false);
+        timerService.createCalendarTimer(new 
ScheduleExpression().month(5).dayOfMonth("20-Last").minute(0).hour(8), 
plantTheCorn);
+        timerService.createCalendarTimer(new 
ScheduleExpression().month(6).dayOfMonth("1-10").minute(0).hour(8), 
plantTheCorn);
+
+        final TimerConfig harvestTheCorn = new TimerConfig("harvestTheCorn", 
false);
+        timerService.createCalendarTimer(new 
ScheduleExpression().month(9).dayOfMonth("20-Last").minute(0).hour(8), 
harvestTheCorn);
+        timerService.createCalendarTimer(new 
ScheduleExpression().month(10).dayOfMonth("1-10").minute(0).hour(8), 
harvestTheCorn);
+
+        final TimerConfig checkOnTheDaughters = new 
TimerConfig("checkOnTheDaughters", false);
+        timerService.createCalendarTimer(new 
ScheduleExpression().second("*").minute("*").hour("*"), checkOnTheDaughters);
+    }
+
+    @Timeout
+    public void timeout(Timer timer) {
+        if ("plantTheCorn".equals(timer.getInfo())) {
+            plantTheCorn();
+        } else if ("harvestTheCorn".equals(timer.getInfo())) {
+            harvestTheCorn();
+        } else if ("checkOnTheDaughters".equals(timer.getInfo())) {
+            checkOnTheDaughters();
+        }
+    }
+
+    private void plantTheCorn() {
+        // Dig out the planter!!!
+    }
+
+    private void harvestTheCorn() {
+        // Dig out the combine!!!
+    }
+
+    private void checkOnTheDaughters() {
+        checks.incrementAndGet();
+    }
+
+    public int getChecks() {
+        return checks.get();
+    }
+}
+----
+
+
+==  FarmerBrownTest
+
+The test class acquires an instance from the context and waits for 5 seconds 
to give the timers a chance to timeout.
+
+
+[source,java]
+----
+package org.superbiz.corn;
+
+import junit.framework.TestCase;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class FarmerBrownTest extends TestCase {
+
+    public void test() throws Exception {
+
+        final Context context = EJBContainer.createEJBContainer().getContext();
+
+        final FarmerBrown farmerBrown = (FarmerBrown) 
context.lookup("java:global/schedule-expression/FarmerBrown");
+
+        // Give Farmer brown a chance to do some work
+        Thread.sleep(SECONDS.toMillis(5));
+
+        final int checks = farmerBrown.getChecks();
+        assertTrue(checks + "", checks > 4);
+    }
+}
+----
+
+
+=  Running
+
+    
+
+[source]
+----
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.corn.FarmerBrownTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/schedule-expression
+INFO - openejb.base = /Users/dblevins/examples/schedule-expression
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/schedule-expression/target/classes
+INFO - Beginning load: 
/Users/dblevins/examples/schedule-expression/target/classes
+INFO - Configuring enterprise application: 
/Users/dblevins/examples/schedule-expression
+WARN - Method 'lookup' is not available for 'javax.annotation.Resource'. 
Probably using an older Runtime.
+INFO - Configuring Service(id=Default Singleton Container, type=Container, 
provider-id=Default Singleton Container)
+INFO - Auto-creating a container for bean FarmerBrown: 
Container(type=SINGLETON, id=Default Singleton Container)
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean org.superbiz.corn.FarmerBrownTest: 
Container(type=MANAGED, id=Default Managed Container)
+INFO - Enterprise application "/Users/dblevins/examples/schedule-expression" 
loaded.
+INFO - Assembling app: /Users/dblevins/examples/schedule-expression
+INFO - 
Jndi(name="java:global/schedule-expression/FarmerBrown!org.superbiz.corn.FarmerBrown")
+INFO - Jndi(name="java:global/schedule-expression/FarmerBrown")
+INFO - 
Jndi(name="java:global/EjbModule481105279/org.superbiz.corn.FarmerBrownTest!org.superbiz.corn.FarmerBrownTest")
+INFO - 
Jndi(name="java:global/EjbModule481105279/org.superbiz.corn.FarmerBrownTest")
+INFO - Created Ejb(deployment-id=org.superbiz.corn.FarmerBrownTest, 
ejb-name=org.superbiz.corn.FarmerBrownTest, container=Default Managed Container)
+INFO - Created Ejb(deployment-id=FarmerBrown, ejb-name=FarmerBrown, 
container=Default Singleton Container)
+INFO - Started Ejb(deployment-id=org.superbiz.corn.FarmerBrownTest, 
ejb-name=org.superbiz.corn.FarmerBrownTest, container=Default Managed Container)
+INFO - Started Ejb(deployment-id=FarmerBrown, ejb-name=FarmerBrown, 
container=Default Singleton Container)
+INFO - Deployed Application(path=/Users/dblevins/examples/schedule-expression)
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.141 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+----
+
+    

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/schedule-methods-meta.adoc
----------------------------------------------------------------------
diff --git a/src/main/jbake/content/examples/schedule-methods-meta.adoc 
b/src/main/jbake/content/examples/schedule-methods-meta.adoc
new file mode 100755
index 0000000..3705c23
--- /dev/null
+++ b/src/main/jbake/content/examples/schedule-methods-meta.adoc
@@ -0,0 +1,384 @@
+= Schedule Methods Meta
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example schedule-methods-meta can be browsed at 
https://github.com/apache/tomee/tree/master/examples/schedule-methods-meta
+
+
+*Help us document this example! Click the blue pencil icon in the upper right 
to edit this page.*
+
+==  BiAnnually
+
+
+[source,java]
+----
+package org.superbiz.corn.meta.api;
+
+import javax.ejb.Schedule;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface BiAnnually {
+    public static interface $ {
+
+        @BiAnnually
+        @Schedule(second = "0", minute = "0", hour = "0", dayOfMonth = "1", 
month = "1,6")
+        public void method();
+    }
+}
+----
+
+
+==  BiMonthly
+
+
+[source,java]
+----
+package org.superbiz.corn.meta.api;
+
+import javax.ejb.Schedule;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface BiMonthly {
+    public static interface $ {
+
+        @BiMonthly
+        @Schedule(second = "0", minute = "0", hour = "0", dayOfMonth = "1,15")
+        public void method();
+    }
+}
+----
+
+
+==  Daily
+
+
+[source,java]
+----
+package org.superbiz.corn.meta.api;
+
+import javax.ejb.Schedule;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface Daily {
+    public static interface $ {
+
+        @Daily
+        @Schedule(second = "0", minute = "0", hour = "0", dayOfMonth = "*")
+        public void method();
+    }
+}
+----
+
+
+==  HarvestTime
+
+
+[source,java]
+----
+package org.superbiz.corn.meta.api;
+
+import javax.ejb.Schedule;
+import javax.ejb.Schedules;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface HarvestTime {
+    public static interface $ {
+
+        @HarvestTime
+        @Schedules({
+                @Schedule(month = "9", dayOfMonth = "20-Last", minute = "0", 
hour = "8"),
+                @Schedule(month = "10", dayOfMonth = "1-10", minute = "0", 
hour = "8")
+        })
+        public void method();
+    }
+}
+----
+
+
+==  Hourly
+
+
+[source,java]
+----
+package org.superbiz.corn.meta.api;
+
+import javax.ejb.Schedule;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface Hourly {
+    public static interface $ {
+
+        @Hourly
+        @Schedule(second = "0", minute = "0", hour = "*")
+        public void method();
+    }
+}
+----
+
+
+==  Metatype
+
+
+[source,java]
+----
+package org.superbiz.corn.meta.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.ANNOTATION_TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Metatype {
+}
+----
+
+
+==  Organic
+
+
+[source,java]
+----
+package org.superbiz.corn.meta.api;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Singleton;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+
+@Singleton
+@Lock(LockType.READ)
+public @interface Organic {
+}
+----
+
+
+==  PlantingTime
+
+
+[source,java]
+----
+package org.superbiz.corn.meta.api;
+
+import javax.ejb.Schedule;
+import javax.ejb.Schedules;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface PlantingTime {
+    public static interface $ {
+
+        @PlantingTime
+        @Schedules({
+                @Schedule(month = "5", dayOfMonth = "20-Last", minute = "0", 
hour = "8"),
+                @Schedule(month = "6", dayOfMonth = "1-10", minute = "0", hour 
= "8")
+        })
+        public void method();
+    }
+}
+----
+
+
+==  Secondly
+
+
+[source,java]
+----
+package org.superbiz.corn.meta.api;
+
+import javax.ejb.Schedule;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface Secondly {
+    public static interface $ {
+
+        @Secondly
+        @Schedule(second = "*", minute = "*", hour = "*")
+        public void method();
+    }
+}
+----
+
+
+==  FarmerBrown
+
+
+[source,java]
+----
+package org.superbiz.corn.meta;
+
+import org.superbiz.corn.meta.api.HarvestTime;
+import org.superbiz.corn.meta.api.Organic;
+import org.superbiz.corn.meta.api.PlantingTime;
+import org.superbiz.corn.meta.api.Secondly;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * This is where we schedule all of Farmer Brown's corn jobs
+ *
+ * @version $Revision$ $Date$
+ */
+@Organic
+public class FarmerBrown {
+
+    private final AtomicInteger checks = new AtomicInteger();
+
+    @PlantingTime
+    private void plantTheCorn() {
+        // Dig out the planter!!!
+    }
+
+    @HarvestTime
+    private void harvestTheCorn() {
+        // Dig out the combine!!!
+    }
+
+    @Secondly
+    private void checkOnTheDaughters() {
+        checks.incrementAndGet();
+    }
+
+    public int getChecks() {
+        return checks.get();
+    }
+}
+----
+
+
+==  FarmerBrownTest
+
+
+[source,java]
+----
+package org.superbiz.corn.meta;
+
+import junit.framework.TestCase;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class FarmerBrownTest extends TestCase {
+
+    public void test() throws Exception {
+
+        final Context context = EJBContainer.createEJBContainer().getContext();
+
+        final FarmerBrown farmerBrown = (FarmerBrown) 
context.lookup("java:global/schedule-methods-meta/FarmerBrown");
+
+        // Give Farmer brown a chance to do some work
+        Thread.sleep(SECONDS.toMillis(5));
+
+        assertTrue(farmerBrown.getChecks() > 4);
+    }
+}
+----
+
+
+=  Running
+
+    
+
+[source]
+----
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.corn.meta.FarmerBrownTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/schedule-methods-meta
+INFO - openejb.base = /Users/dblevins/examples/schedule-methods-meta
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/schedule-methods-meta/target/classes
+INFO - Beginning load: 
/Users/dblevins/examples/schedule-methods-meta/target/classes
+INFO - Configuring enterprise application: 
/Users/dblevins/examples/schedule-methods-meta
+INFO - Configuring Service(id=Default Singleton Container, type=Container, 
provider-id=Default Singleton Container)
+INFO - Auto-creating a container for bean FarmerBrown: 
Container(type=SINGLETON, id=Default Singleton Container)
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean 
org.superbiz.corn.meta.FarmerBrownTest: Container(type=MANAGED, id=Default 
Managed Container)
+INFO - Enterprise application "/Users/dblevins/examples/schedule-methods-meta" 
loaded.
+INFO - Assembling app: /Users/dblevins/examples/schedule-methods-meta
+INFO - 
Jndi(name="java:global/schedule-methods-meta/FarmerBrown!org.superbiz.corn.meta.FarmerBrown")
+INFO - Jndi(name="java:global/schedule-methods-meta/FarmerBrown")
+INFO - 
Jndi(name="java:global/EjbModule1809441479/org.superbiz.corn.meta.FarmerBrownTest!org.superbiz.corn.meta.FarmerBrownTest")
+INFO - 
Jndi(name="java:global/EjbModule1809441479/org.superbiz.corn.meta.FarmerBrownTest")
+INFO - Created Ejb(deployment-id=org.superbiz.corn.meta.FarmerBrownTest, 
ejb-name=org.superbiz.corn.meta.FarmerBrownTest, container=Default Managed 
Container)
+INFO - Created Ejb(deployment-id=FarmerBrown, ejb-name=FarmerBrown, 
container=Default Singleton Container)
+INFO - Started Ejb(deployment-id=org.superbiz.corn.meta.FarmerBrownTest, 
ejb-name=org.superbiz.corn.meta.FarmerBrownTest, container=Default Managed 
Container)
+INFO - Started Ejb(deployment-id=FarmerBrown, ejb-name=FarmerBrown, 
container=Default Singleton Container)
+INFO - Deployed 
Application(path=/Users/dblevins/examples/schedule-methods-meta)
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.166 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+----
+
+    

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/schedule-methods.adoc
----------------------------------------------------------------------
diff --git a/src/main/jbake/content/examples/schedule-methods.adoc 
b/src/main/jbake/content/examples/schedule-methods.adoc
new file mode 100755
index 0000000..1c01f3e
--- /dev/null
+++ b/src/main/jbake/content/examples/schedule-methods.adoc
@@ -0,0 +1,141 @@
+= Schedule Methods
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example schedule-methods can be browsed at 
https://github.com/apache/tomee/tree/master/examples/schedule-methods
+
+
+*Help us document this example! Click the blue pencil icon in the upper right 
to edit this page.*
+
+==  FarmerBrown
+
+
+[source,java]
+----
+package org.superbiz.corn;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Schedule;
+import javax.ejb.Schedules;
+import javax.ejb.Singleton;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * This is where we schedule all of Farmer Brown's corn jobs
+ *
+ * @version $Revision$ $Date$
+ */
+@Singleton
+@Lock(LockType.READ) // allows timers to execute in parallel
+public class FarmerBrown {
+
+    private final AtomicInteger checks = new AtomicInteger();
+
+    @Schedules({
+            @Schedule(month = "5", dayOfMonth = "20-Last", minute = "0", hour 
= "8"),
+            @Schedule(month = "6", dayOfMonth = "1-10", minute = "0", hour = 
"8")
+    })
+    private void plantTheCorn() {
+        // Dig out the planter!!!
+    }
+
+    @Schedules({
+            @Schedule(month = "9", dayOfMonth = "20-Last", minute = "0", hour 
= "8"),
+            @Schedule(month = "10", dayOfMonth = "1-10", minute = "0", hour = 
"8")
+    })
+    private void harvestTheCorn() {
+        // Dig out the combine!!!
+    }
+
+    @Schedule(second = "*", minute = "*", hour = "*")
+    private void checkOnTheDaughters() {
+        checks.incrementAndGet();
+    }
+
+    public int getChecks() {
+        return checks.get();
+    }
+}
+----
+
+
+==  FarmerBrownTest
+
+
+[source,java]
+----
+package org.superbiz.corn;
+
+import junit.framework.TestCase;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class FarmerBrownTest extends TestCase {
+
+    public void test() throws Exception {
+
+        final Context context = EJBContainer.createEJBContainer().getContext();
+
+        final FarmerBrown farmerBrown = (FarmerBrown) 
context.lookup("java:global/schedule-methods/FarmerBrown");
+
+        // Give Farmer brown a chance to do some work
+        Thread.sleep(SECONDS.toMillis(5));
+
+        assertTrue(farmerBrown.getChecks() > 4);
+    }
+}
+----
+
+
+=  Running
+
+    
+
+[source]
+----
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.corn.FarmerBrownTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/schedule-methods
+INFO - openejb.base = /Users/dblevins/examples/schedule-methods
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/schedule-methods/target/classes
+INFO - Beginning load: /Users/dblevins/examples/schedule-methods/target/classes
+INFO - Configuring enterprise application: 
/Users/dblevins/examples/schedule-methods
+INFO - Configuring Service(id=Default Singleton Container, type=Container, 
provider-id=Default Singleton Container)
+INFO - Auto-creating a container for bean FarmerBrown: 
Container(type=SINGLETON, id=Default Singleton Container)
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean org.superbiz.corn.FarmerBrownTest: 
Container(type=MANAGED, id=Default Managed Container)
+INFO - Enterprise application "/Users/dblevins/examples/schedule-methods" 
loaded.
+INFO - Assembling app: /Users/dblevins/examples/schedule-methods
+INFO - 
Jndi(name="java:global/schedule-methods/FarmerBrown!org.superbiz.corn.FarmerBrown")
+INFO - Jndi(name="java:global/schedule-methods/FarmerBrown")
+INFO - 
Jndi(name="java:global/EjbModule660493198/org.superbiz.corn.FarmerBrownTest!org.superbiz.corn.FarmerBrownTest")
+INFO - 
Jndi(name="java:global/EjbModule660493198/org.superbiz.corn.FarmerBrownTest")
+INFO - Created Ejb(deployment-id=org.superbiz.corn.FarmerBrownTest, 
ejb-name=org.superbiz.corn.FarmerBrownTest, container=Default Managed Container)
+INFO - Created Ejb(deployment-id=FarmerBrown, ejb-name=FarmerBrown, 
container=Default Singleton Container)
+INFO - Started Ejb(deployment-id=org.superbiz.corn.FarmerBrownTest, 
ejb-name=org.superbiz.corn.FarmerBrownTest, container=Default Managed Container)
+INFO - Started Ejb(deployment-id=FarmerBrown, ejb-name=FarmerBrown, 
container=Default Singleton Container)
+INFO - Deployed Application(path=/Users/dblevins/examples/schedule-methods)
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.121 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+----
+
+    

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/server-events.adoc
----------------------------------------------------------------------
diff --git a/src/main/jbake/content/examples/server-events.adoc 
b/src/main/jbake/content/examples/server-events.adoc
new file mode 100755
index 0000000..94664cd
--- /dev/null
+++ b/src/main/jbake/content/examples/server-events.adoc
@@ -0,0 +1,9 @@
+= server-events
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example server-events can be browsed at 
https://github.com/apache/tomee/tree/master/examples/server-events
+
+No README.md yet, be the first to contribute one!

Reply via email to