Skip to content
This repository

Gradle version of hello.html sample #37

Merged
merged 6 commits into from almost 2 years ago

2 participants

Sean Gilligan Joe Walnes
Sean Gilligan

I made a Gradle version of the hello.html sample.

(Since I wasn't able to pull the jar from a Maven repo and the mvn build is not working for me, I just put the alpha-2 version of the jar in a 'lib' directory for now.)

Sean Gilligan

I just updated the build.gradle file to pull the sitemesh3 jar from the Maven Repo and removed the copy of the jar from the 'lib' subdirectory.

I also just noticed I made the pull request without creating a branch first. If you'd like I can recreate it on a branch -- let me know.

Joe Walnes
Owner

LGTM

Joe Walnes joewalnes merged commit ca929c7 into from July 07, 2012
Joe Walnes joewalnes closed this July 07, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
1  .gitignore
@@ -4,3 +4,4 @@ target/
4 4
 *.iws
5 5
 *.iml
6 6
 .idea
  7
+.gradle
21  sitemesh-examples-gradle-hello/README.md
Source Rendered
... ...
@@ -0,0 +1,21 @@
  1
+SiteMesh 3 Hello World Demo using Gradle
  2
+=======================================
  3
+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.
  4
+
  5
+It is essentially the [Getting Started](http://wiki.sitemesh.org/display/sitemesh3/Getting+Started+with+SiteMesh+3) tutorial ready-to-run with Gradle.
  6
+
  7
+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.
  8
+
  9
+To run the SiteMesh demo in Jetty:
  10
+
  11
+    gradle jettyRun
  12
+    
  13
+All required .jar files will be loaded automatically.  You should then see output similar to the following:
  14
+
  15
+    > Building > :jettyRun > Running at http://localhost:8080/
  16
+    
  17
+You can then load [http://localhost:8080/hello.html](http://localhost:8080/hello.html) in your browser and see SiteMesh 3 in action.
  18
+    
  19
+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.
  20
+    
  21
+
3  sitemesh-examples-gradle-hello/WEB-INF/sitemesh3.xml
... ...
@@ -0,0 +1,3 @@
  1
+<sitemesh>
  2
+  <mapping path="/*" decorator="/decorator.html"/>
  3
+</sitemesh>
21  sitemesh-examples-gradle-hello/WEB-INF/web.xml
... ...
@@ -0,0 +1,21 @@
  1
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
  2
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3
+   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  4
+   version="2.5">
  5
+  
  6
+  <display-name>SiteMesh Gradle Test</display-name>
  7
+  <description>
  8
+     Small webapp for Sitemesh testing
  9
+  </description>
  10
+
  11
+  <filter>
  12
+    <filter-name>sitemesh</filter-name>
  13
+    <filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class>
  14
+  </filter>
  15
+
  16
+  <filter-mapping>
  17
+    <filter-name>sitemesh</filter-name>
  18
+    <url-pattern>/*</url-pattern>
  19
+  </filter-mapping>
  20
+
  21
+</web-app>
24  sitemesh-examples-gradle-hello/build.gradle
... ...
@@ -0,0 +1,24 @@
  1
+/*
  2
+ * build.gradle for SiteMesh 3 Hello World Demo
  3
+ *
  4
+ * SiteMesh 3: http://wiki.sitemesh.org/display/sitemesh3/Home
  5
+ * Gradle: http://www.gradle.org/
  6
+ */
  7
+
  8
+apply plugin: 'java'
  9
+apply plugin: 'jetty'
  10
+
  11
+
  12
+// Keep everything simple by making webapp root the project root and the context '' (aka '/')
  13
+jettyRun.contextPath = ''
  14
+jettyRun.webAppSourceDirectory = file("$rootDir")
  15
+
  16
+dependencies {
  17
+    // scope 'groupID:artifactID:version'
  18
+    runtime 'org.sitemesh:sitemesh:3.0-alpha-2'
  19
+}
  20
+
  21
+repositories {
  22
+    // Use Maven Central Repo to search for Dependencies
  23
+    mavenCentral()
  24
+}
26  sitemesh-examples-gradle-hello/decorator.html
... ...
@@ -0,0 +1,26 @@
  1
+<html>
  2
+  <head>
  3
+    <title>SiteMesh example: <sitemesh:write property='title'/></title>
  4
+    <style type='text/css'>
  5
+      /* Some CSS */
  6
+     body { font-family: arial, sans-serif; background-color: #ffffcc; }
  7
+     h1, h2, h3, h4 { text-align: center; background-color: #ccffcc;
  8
+                      border-top: 1px solid #66ff66; }
  9
+     .mainBody { padding: 10px; border: 1px solid #555555; }
  10
+     .disclaimer { text-align: center; border-top: 1px solid #cccccc;
  11
+                   margin-top: 40px; color: #666666; font-size: smaller; }
  12
+    </style>
  13
+    <sitemesh:write property='head'/>
  14
+  </head>
  15
+  <body>
  16
+
  17
+    <h1 class='title'>SiteMesh example site: <sitemesh:write property='title'/></h1>
  18
+
  19
+    <div class='mainBody'>
  20
+      <sitemesh:write property='body'/>
  21
+    </div>
  22
+
  23
+    <div class='disclaimer'>Site disclaimer. This is an example.</div>
  24
+
  25
+  </body>
  26
+</html>
9  sitemesh-examples-gradle-hello/hello.html
... ...
@@ -0,0 +1,9 @@
  1
+<html>
  2
+  <head>
  3
+    <title>Hello World</title>
  4
+    <meta name='description' content='A simple page'>
  5
+  </head>
  6
+  <body>
  7
+    <p>Hello <strong>world</strong>!</p>
  8
+  </body>
  9
+</html>
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.