You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2011/10/11 17:19:39 UTC
svn commit: r1181835 - in /openejb/trunk/openejb/examples/webapps: ./
rest-example-with-application/ rest-example-with-application/src/
rest-example-with-application/src/main/
rest-example-with-application/src/main/java/
rest-example-with-application/s...
Author: rmannibucau
Date: Tue Oct 11 15:19:38 2011
New Revision: 1181835
URL: http://svn.apache.org/viewvc?rev=1181835&view=rev
Log:
adding an example with an applicationpath (rest)
Added:
openejb/trunk/openejb/examples/webapps/rest-example-with-application/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/pom.xml
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/ApplicationConfig.java
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/SimpleRESTEJB.java
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/SimpleRESTPojo.java
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/tomcat/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/tomcat/conf/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/tomcat/conf/logging.properties
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/WEB-INF/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/WEB-INF/web.xml
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/index.html
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/test/
openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/test/java/
Modified:
openejb/trunk/openejb/examples/webapps/pom.xml
Modified: openejb/trunk/openejb/examples/webapps/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/pom.xml?rev=1181835&r1=1181834&r2=1181835&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/webapps/pom.xml (original)
+++ openejb/trunk/openejb/examples/webapps/pom.xml Tue Oct 11 15:19:38 2011
@@ -34,6 +34,7 @@
<module>struts</module>
<module>moviefun</module>
<module>rest-example</module>
+ <module>rest-example-with-application</module>
<module>resources-declared-in-webapp</module>
</modules>
Added: openejb/trunk/openejb/examples/webapps/rest-example-with-application/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example-with-application/pom.xml?rev=1181835&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example-with-application/pom.xml (added)
+++ openejb/trunk/openejb/examples/webapps/rest-example-with-application/pom.xml Tue Oct 11 15:19:38 2011
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.superbiz</groupId>
+ <artifactId>rest-example-with-application</artifactId>
+ <packaging>war</packaging>
+ <version>1.1-SNAPSHOT</version>
+ <name>OpenEJB :: Web Examples :: REST Example With Application</name>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <openejb.version>4.0.0-beta-2-SNAPSHOT</openejb.version>
+ </properties>
+ <repositories>
+ <repository>
+ <id>apache-m2-snapshot</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://repository.apache.org/snapshots</url>
+ </repository>
+ <repository>
+ <id>tomcat-m2-repo</id>
+ <name>Tomcat Dev Repository</name>
+ <url>http://tomcat.apache.org/dev/dist/m2-repository/</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>apache-m2-snapshot</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://repository.apache.org/snapshots</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <build>
+ <defaultGoal>package</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1.1</version>
+ <configuration>
+ <packagingExcludes>WEB-INF/web.xml</packagingExcludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.googlecode.t7mp</groupId>
+ <artifactId>maven-t7-plugin</artifactId>
+ <version>0.9.7</version>
+ <configuration>
+ <tomcatHttpPort>1234</tomcatHttpPort>
+ <tomcatShutdownPort>13245</tomcatShutdownPort>
+ <tomcatVersion>7.0.21</tomcatVersion>
+ <libs>
+ <jarArtifact>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-logging</artifactId>
+ <version>${openejb.version}</version>
+ </jarArtifact>
+ </libs>
+ <webapps>
+ <webappArtifact>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>tomee-plus-webapp</artifactId>
+ <version>${openejb.version}</version>
+ <contextPath>openejb</contextPath>
+ </webappArtifact>
+ </webapps>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>6.0-3-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/ApplicationConfig.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/ApplicationConfig.java?rev=1181835&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/ApplicationConfig.java (added)
+++ openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/ApplicationConfig.java Tue Oct 11 15:19:38 2011
@@ -0,0 +1,17 @@
+package org.superbiz.rest.application;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author rmannibucau
+ */
+@ApplicationPath("/rest-prefix")
+public class ApplicationConfig extends Application {
+ public Set<Class<?>> getClasses() {
+ return new HashSet<Class<?>>(Arrays.asList(SimpleRESTPojo.class, SimpleRESTEJB.class));
+ }
+}
Added: openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/SimpleRESTEJB.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/SimpleRESTEJB.java?rev=1181835&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/SimpleRESTEJB.java (added)
+++ openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/SimpleRESTEJB.java Tue Oct 11 15:19:38 2011
@@ -0,0 +1,20 @@
+package org.superbiz.rest.application;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Singleton;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import java.util.Date;
+
+/**
+ * @author rmannibucau
+ */
+@Singleton
+@Lock(LockType.READ)
+@Path("/ejb")
+public class SimpleRESTEJB {
+ @GET public String ejb() {
+ return "ejb ok @ " + new Date().toString();
+ }
+}
Added: openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/SimpleRESTPojo.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/SimpleRESTPojo.java?rev=1181835&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/SimpleRESTPojo.java (added)
+++ openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/java/org/superbiz/rest/application/SimpleRESTPojo.java Tue Oct 11 15:19:38 2011
@@ -0,0 +1,15 @@
+package org.superbiz.rest.application;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import java.util.Date;
+
+/**
+ * @author rmannibucau
+ */
+@Path("/pojo")
+public class SimpleRESTPojo {
+ @GET public String pojo() {
+ return "pojo ok @ " + new Date().toString();
+ }
+}
Added: openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/tomcat/conf/logging.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/tomcat/conf/logging.properties?rev=1181835&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/tomcat/conf/logging.properties (added)
+++ openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/tomcat/conf/logging.properties Tue Oct 11 15:19:38 2011
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2010 Joerg Bellmann <jo...@googlemail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# OpenEJB logs
+#
+log4j.rootLogger = INFO, stdout
+log4j.appender.stdout = org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout = org.apache.openejb.logging.SimpleJULLikeLayout
Added: openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/WEB-INF/web.xml?rev=1181835&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/WEB-INF/web.xml (added)
+++ openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/WEB-INF/web.xml Tue Oct 11 15:19:38 2011
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<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>
Added: openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/index.html?rev=1181835&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/index.html (added)
+++ openejb/trunk/openejb/examples/webapps/rest-example-with-application/src/main/webapp/index.html Tue Oct 11 15:19:38 2011
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html lang="en">
+ <head>
+ <title>OpenEJB REST Example</title>
+ </head>
+ <body>
+ <p>
+ Two rest services are deployed:
+ <ul>
+ <li>A simple Pojo one: http://localhost:1234/rest-example-with-application-1.1-SNAPSHOT/rest-prefix/pojo</li>
+ <li>An EJB one: http://localhost:1234/rest-example-with-application-1.1-SNAPSHOT/rest-prefix/ejb</li>
+ </ul>
+ </p>
+ <p>
+ Both are define to be deployed through the ApplicationConfig class.
+ </p>
+ </body>
+</html>