Skip to content

Commit 9a5702a

Browse files
Daniel-Doschkal
authored andcommitted
Tomcat/TomEE guide (mvc-spec#23)
1 parent 2c1cc7a commit 9a5702a

File tree

2 files changed

+164
-1
lines changed

2 files changed

+164
-1
lines changed

src/ozark/docs/install-javaee.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,70 @@ JAX-RS fraction with the dependencies from wildfly section above:
7373

7474
TomEE uses CXF as JAX-RS implementation. Right now there is no Ozark module for that.
7575

76+
To get around this, we'll demonstrate how to use it with the RestEasy module.
77+
78+
The following pom.xml example that shows the dependency configuration:
79+
80+
```xml
81+
<dependency>
82+
<groupId>javax.mvc</groupId>
83+
<artifactId>javax.mvc-api</artifactId>
84+
<version>1.0-SNAPSHOT</version>
85+
</dependency>
86+
<dependency>
87+
<groupId>org.mvc-spec.ozark</groupId>
88+
<artifactId>ozark-resteasy</artifactId>
89+
<version>1.0.0-m03-SNAPSHOT</version>
90+
</dependency>
91+
<dependency>
92+
<groupId>javax</groupId>
93+
<artifactId>javaee-web-api</artifactId>
94+
<version>7.0</version>
95+
<scope>provided</scope>
96+
</dependency>
97+
<dependency>
98+
<groupId>org.jboss.resteasy</groupId>
99+
<artifactId>resteasy-cdi</artifactId>
100+
<version>3.1.4.Final</version>
101+
</dependency>
102+
<dependency>
103+
<groupId>org.jboss.resteasy</groupId>
104+
<artifactId>resteasy-servlet-initializer</artifactId>
105+
<version> 3.1.4.Final</version>
106+
</dependency>
107+
<dependency>
108+
<groupId>org.hibernate</groupId>
109+
<artifactId>hibernate-validator</artifactId>
110+
<version>5.4.1.Final</version>
111+
</dependency>
112+
```
113+
### 3. Add the bean.xml,context.xml and web.xml file
114+
make sure to add an empty beans.xml file in your /resources/META-INF/ folder to your Web project:
115+
116+
```xml
117+
<?xml version="1.0"?>
118+
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
119+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
120+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
121+
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
122+
version="1.1" bean-discovery-mode="all">
123+
</beans>
124+
```
125+
to finish create within /webapp/WEB-INF/ the web.xml file with the following content:
126+
127+
```xml
128+
<?xml version="1.0" encoding="UTF-8"?>
129+
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
130+
xmlns="http://java.sun.com/xml/ns/javaee"
131+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
132+
http://java.sun.com/xml/ns/javaee/web-app_3_1.xsd"
133+
version="3.1">
134+
135+
<context-param>
136+
<!--http://docs.jboss.org/resteasy/docs/3.1.4.Final/userguide/html_single/index.html#d4e143 -->
137+
<param-name>resteasy.injector.factory</param-name>
138+
<param-value>org.jboss.resteasy.cdi.CdiInjectorFactory</param-value>
139+
</context-param>
140+
</web-app>
141+
```
142+

src/ozark/docs/install-servlet.md

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,100 @@ template: page.html
55

66
## Install Guide for Servlet Containers
77

8-
TODO
8+
The Ozark MVC implementation is based on Jersey and recently a RestEasy module has been added to work with Widlfly.
9+
10+
In this guide we will run Ozark on Apache Tomcat using the RestEasy module
11+
12+
The following pom.xml example that shows the dependency configuration:
13+
14+
### Apache Tomcat
15+
16+
```xml
17+
<dependency>
18+
<groupId>javax.mvc</groupId>
19+
<artifactId>javax.mvc-api</artifactId>
20+
<version>1.0-SNAPSHOT</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>org.mvc-spec.ozark</groupId>
24+
<artifactId>ozark-resteasy</artifactId>
25+
<version>1.0.0-m03-SNAPSHOT</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>javax</groupId>
29+
<artifactId>javaee-web-api</artifactId>
30+
<version>7.0</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.jboss.weld.servlet</groupId>
34+
<artifactId>weld-servlet-core</artifactId>
35+
<version>2.4.3.Final</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.jboss.resteasy</groupId>
39+
<artifactId>resteasy-cdi</artifactId>
40+
<version>3.1.4.Final</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.jboss.resteasy</groupId>
44+
<artifactId>resteasy-servlet-initializer</artifactId>
45+
<version> 3.1.4.Final</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.hibernate</groupId>
49+
<artifactId>hibernate-validator</artifactId>
50+
<version>5.4.1.Final</version>
51+
</dependency>
52+
```
53+
### 3. Add the bean.xml,context.xml and web.xml file
54+
make sure to add an empty beans.xml file in your /resources/META-INF folder to your Web project:
55+
56+
```xml
57+
<?xml version="1.0"?>
58+
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
59+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
60+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
61+
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
62+
version="1.1" bean-discovery-mode="all">
63+
</beans>
64+
```
65+
still in the same folder add the context.xml with the following content:
66+
67+
```xml
68+
<?xml version="1.0" encoding="UTF-8"?>
69+
<Context>
70+
<Manager pathname=""/>
71+
<Resource name="BeanManager"
72+
auth="Container"
73+
type="javax.enterprise.inject.spi.BeanManager"
74+
factory="org.jboss.weld.resources.ManagerObjectFactory"/>
75+
</Context>
76+
```
77+
this file is essential for the operation of the CDI in TomCat as described here:[Weld-Doc](http://docs.jboss.org/weld/reference/latest/en-US/html_single/#_tomcat)
78+
79+
to finish create within /webapp/WEB-INF/ the web.xml file with the following content:
80+
81+
```xml
82+
<?xml version="1.0" encoding="UTF-8"?>
83+
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
84+
xmlns="http://java.sun.com/xml/ns/javaee"
85+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
86+
http://java.sun.com/xml/ns/javaee/web-app_3_1.xsd"
87+
version="3.1">
88+
89+
<listener>
90+
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
91+
</listener>
92+
93+
<resource-env-ref>
94+
<resource-env-ref-name>BeanManager</resource-env-ref-name>
95+
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
96+
</resource-env-ref>
97+
98+
<context-param>
99+
<!--http://docs.jboss.org/resteasy/docs/3.1.4.Final/userguide/html_single/index.html#d4e143 -->
100+
<param-name>resteasy.injector.factory</param-name>
101+
<param-value>org.jboss.resteasy.cdi.CdiInjectorFactory</param-value>
102+
</context-param>
103+
</web-app>
104+
```

0 commit comments

Comments
 (0)