diff --git a/README b/README index e69de29..844c00e 100644 --- a/README +++ b/README @@ -0,0 +1,4 @@ +To run: +mvn jetty:run + +http://localhost:8080/vendor/hello.json or .xml diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..d7863d1 --- /dev/null +++ b/pom.xml @@ -0,0 +1,309 @@ + + + + 4.0.0 + + com.activedatatech + vendor + 0.0.1-SNAPSHOT + war + + My Web App + Web Application Using Scalate, Scala and JAXRS/Jersey + + + 2.0.9 + + + + + 8080 + ${env.SCALATE_EDITOR} + ${basedir}/target/_scalate + com.activedatatech.vendor.resources + development + + + 1.5-ea05 + 7.2.1.v20101111 + 0.9.26 + 2.8.0 + 1.3.2 + 2.5 + + + 7.2.1.v20101111 + 2.15.0 + 2.6 + 2.1.1 + + + + + javax.servlet + servlet-api + ${servlet-api-version} + provided + + + org.fusesource.scalate + scalate-core + ${scalate-version} + + + com.sun.jersey + jersey-server + ${jersey-version} + + + ch.qos.logback + logback-classic + ${logback-version} + runtime + true + + + + + org.fusesource.scalate + scalate-test + ${scalate-version} + test + + + + + + + repo1.maven + Maven Central Repo + http://repo1.maven.org/maven2/ + + + fusesource.m2 + FuseSource Community Release Repository + http://repo.fusesource.com/nexus/content/repositories/public + + false + + + true + + + + fusesource.m2-snapshot + FuseSource Community Snapshot Repository + http://repo.fusesource.com/nexus/content/repositories/snapshots + + true + + + false + + + + + java.net.m2 + java.net Maven 2 Repo + http://download.java.net/maven/2 + + + openqa-releases + OpenQA Releases + http://archiva.openqa.org/repository/releases + + true + + + false + + + + + glassfish-repo-archive + Nexus repository collection for Glassfish + http://maven.glassfish.org/content/groups/glassfish + + never + + + + + scala + Scala Tools + http://scala-tools.org/repo-releases + + true + + + false + + + + snapshots.scala-tools.org + Scala-Tools Maven2 Snapshot Repository + http://scala-tools.org/repo-snapshots + + true + + fail + + + true + + fail + + + + apache.snapshots + Apache Development Snapshot Repository + https://repository.apache.org/content/repositories/snapshots + + false + + + true + + + + + + + + org.scala-tools + maven-scala-plugin + ${scala-plugin-version} + + + + compile + testCompile + + + + + + -Xmx1024m + + + + -deprecation + + ${scala-version} + + + + + maven-surefire-plugin + ${surefire-plugin-version} + + once + + false + false + + **/*Test.* + + + **/SomeTestThatDoesntWorkYetTest.* + + + + + + maven-war-plugin + ${war-plugin-version} + + true + + + + + org.mortbay.jetty + jetty-maven-plugin + ${jetty-plugin-version} + + + + / + + + + + + com.sun.management.jmxremote + + + + scalate.editor + ${scalateEditor} + + + scalate.workdir + ${scalate.workdir} + + + scalate.package.resources + ${scalate.package.resources} + + + scalate.mode + development + + + 0 + + + + + + + + + precompile + + + + org.fusesource.scalate + maven-scalate-plugin + ${scalate-version} + + + + precompile + + + + + + + + + + diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..92cc364 --- /dev/null +++ b/project/build.properties @@ -0,0 +1,28 @@ +# +# Copyright (C) 2009-2010 the original author or authors. +# See the notice.md file distributed with this work for additional +# information regarding copyright ownership. +# +# 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. +# + +project.organization=myGroupId +project.name=myArtifactId +project.version=1.0-SNAPSHOT + +sbt.version=0.7.3 +scala.version=2.8.0 +def.scala.version=2.7.7 +#def.scala.version=2.8.0 +build.scala.versions=2.8.0 +project.initialize=false diff --git a/project/build/Project.scala b/project/build/Project.scala new file mode 100644 index 0000000..b69c2eb --- /dev/null +++ b/project/build/Project.scala @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2009-2010 the original author or authors. + * See the notice.md file distributed with this work for additional + * information regarding copyright ownership. + * + * 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. + */ + +import sbt._ + +class ScalateProject(info: ProjectInfo) extends DefaultWebProject(info) { + + val mavenLocal = "Local Maven Repository" at "file://" + Path.userHome + "/.m2/repository" + + override def testOptions = { + super.testOptions ++ + Seq(TestArgument("-Dbasedir=" + ".".absolutePath)) + } +} diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..6e23ec1 --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,54 @@ + + + + + + + target/application.log + true + + + %-4relative [%thread] %-5level %logger{40} - %msg%n + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/scala/resources.scala b/src/main/scala/resources.scala new file mode 100644 index 0000000..99b31d6 --- /dev/null +++ b/src/main/scala/resources.scala @@ -0,0 +1,21 @@ +package net.activedatatech.vendor.rest + +import javax.ws.rs._ +import javax.ws.rs.ext._ + +@Provider +@Path("/vendor") +class VendorService { + + @GET + @Path("/hello.json") + @Produces(Array("application/json")) + def getMediaType = "hello" + + @GET + @Path("/hello.xml") + @Produces(Array("text/json")) + def getHTML = "hello" +} + + diff --git a/src/main/webapp/.gitignore b/src/main/webapp/.gitignore new file mode 100644 index 0000000..019d72c --- /dev/null +++ b/src/main/webapp/.gitignore @@ -0,0 +1,3 @@ +css +favicon.ico +images diff --git a/src/main/webapp/WEB-INF/.gitignore b/src/main/webapp/WEB-INF/.gitignore new file mode 100644 index 0000000..08bda70 --- /dev/null +++ b/src/main/webapp/WEB-INF/.gitignore @@ -0,0 +1 @@ +scalate diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..6d952fe --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,82 @@ + + + + + + Scala REST + + + Scala REST Api + + + + + Jersey Filter + com.sun.jersey.spi.container.servlet.ServletContainer + + com.sun.jersey.config.feature.Trace + true + + + com.sun.jersey.config.feature.Redirect + true + + + com.sun.jersey.config.feature.ImplicitViewables + true + + + com.sun.jersey.config.property.packages + org.fusesource.scalate.console;com.activedatatech.vendor + + + com.sun.jersey.config.feature.FilterForwardOn404 + true + + + + + Jersey Filter + /* + + + + + TemplateEngineFilter + org.fusesource.scalate.servlet.TemplateEngineFilter + + + TemplateEngineFilter + /* + + + + index.scaml + + + + 500 + /WEB-INF/scalate/errors/500.scaml + + diff --git a/src/main/webapp/index.scaml b/src/main/webapp/index.scaml new file mode 100644 index 0000000..2813de5 --- /dev/null +++ b/src/main/webapp/index.scaml @@ -0,0 +1,26 @@ +-# +-# Copyright (C) 2009-2010 the original author or authors. +-# See the notice.md file distributed with this work for additional +-# information regarding copyright ownership. +-# +-# 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. +-# + +%img(src="/images/scalate/project-logo.png") + +%p + Welcome to the My Scalate Application + +%p + Please use the Scalate console on the right to create new resources and views + diff --git a/src/test/scala/com/activedatatech/vendor/AppTest.scala b/src/test/scala/com/activedatatech/vendor/AppTest.scala new file mode 100644 index 0000000..17c066c --- /dev/null +++ b/src/test/scala/com/activedatatech/vendor/AppTest.scala @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2009-2010 the original author or authors. + * See the notice.md file distributed with this work for additional + * information regarding copyright ownership. + * + * 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. + */ + +package com.activedatatech.vendor + +import org.fusesource.scalate.test.{WebDriverMixin, WebServerMixin} +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner +import org.scalatest.FunSuite + +/** + * Unit test for My Ap + */ +@RunWith(classOf[JUnitRunner]) +class AppTest extends FunSuite with WebServerMixin with WebDriverMixin { + + test("home page") { + webDriver.get(rootUrl) + pageContains("Scalate") + } + + // + // TODO here is a sample test case for a page + // + // testPageContains("foo.scaml", "this is some content I expect") +}