Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Gradle version of hello.html sample #37

Merged
merged 6 commits into from Jul 7, 2012
View
@@ -4,3 +4,4 @@ target/
*.iws
*.iml
.idea
+.gradle
@@ -0,0 +1,21 @@
+SiteMesh 3 Hello World Demo using Gradle
+=======================================
+This is a very simple 'hello world' [SiteMesh 3](http://wiki.sitemesh.org/display/sitemesh3/SiteMesh+3+Overview) web-application. It demonstrates applying a page decorator to the content of a website. It uses the [Gradle build tool](http://www.gradle.org/) to download the SiteMesh jar and run the example using the [Jetty](http://www.eclipse.org/jetty/) WebServer.
+
+It is essentially the [Getting Started](http://wiki.sitemesh.org/display/sitemesh3/Getting+Started+with+SiteMesh+3) tutorial ready-to-run with Gradle.
+
+If you do not have Gradle installed on your sytem, you must [install Gradle](http://www.gradle.org/docs/current/userguide/installation.html) before proceeding.
+
+To run the SiteMesh demo in Jetty:
+
+ gradle jettyRun
+
+All required .jar files will be loaded automatically. You should then see output similar to the following:
+
+ > Building > :jettyRun > Running at http://localhost:8080/
+
+You can then load [http://localhost:8080/hello.html](http://localhost:8080/hello.html) in your browser and see SiteMesh 3 in action.
+
+Note: There is a way to run Gradle builds without requiring a previous Gradle install. If there is interest, that feature could be added to the demo.
+
+
@@ -0,0 +1,3 @@
+<sitemesh>
+ <mapping path="/*" decorator="/decorator.html"/>
+</sitemesh>
@@ -0,0 +1,21 @@
+<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"
+ version="2.5">
+
+ <display-name>SiteMesh Gradle Test</display-name>
+ <description>
+ Small webapp for Sitemesh testing
+ </description>
+
+ <filter>
+ <filter-name>sitemesh</filter-name>
+ <filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>sitemesh</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+</web-app>
@@ -0,0 +1,24 @@
+/*
+ * build.gradle for SiteMesh 3 Hello World Demo
+ *
+ * SiteMesh 3: http://wiki.sitemesh.org/display/sitemesh3/Home
+ * Gradle: http://www.gradle.org/
+ */
+
+apply plugin: 'java'
+apply plugin: 'jetty'
+
+
+// Keep everything simple by making webapp root the project root and the context '' (aka '/')
+jettyRun.contextPath = ''
+jettyRun.webAppSourceDirectory = file("$rootDir")
+
+dependencies {
+ // scope 'groupID:artifactID:version'
+ runtime 'org.sitemesh:sitemesh:3.0-alpha-2'
+}
+
+repositories {
+ // Use Maven Central Repo to search for Dependencies
+ mavenCentral()
+}
@@ -0,0 +1,26 @@
+<html>
+ <head>
+ <title>SiteMesh example: <sitemesh:write property='title'/></title>
+ <style type='text/css'>
+ /* Some CSS */
+ body { font-family: arial, sans-serif; background-color: #ffffcc; }
+ h1, h2, h3, h4 { text-align: center; background-color: #ccffcc;
+ border-top: 1px solid #66ff66; }
+ .mainBody { padding: 10px; border: 1px solid #555555; }
+ .disclaimer { text-align: center; border-top: 1px solid #cccccc;
+ margin-top: 40px; color: #666666; font-size: smaller; }
+ </style>
+ <sitemesh:write property='head'/>
+ </head>
+ <body>
+
+ <h1 class='title'>SiteMesh example site: <sitemesh:write property='title'/></h1>
+
+ <div class='mainBody'>
+ <sitemesh:write property='body'/>
+ </div>
+
+ <div class='disclaimer'>Site disclaimer. This is an example.</div>
+
+ </body>
+</html>
@@ -0,0 +1,9 @@
+<html>
+ <head>
+ <title>Hello World</title>
+ <meta name='description' content='A simple page'>
+ </head>
+ <body>
+ <p>Hello <strong>world</strong>!</p>
+ </body>
+</html>