Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Gradle version of hello.html sample #37

Merged
merged 6 commits into from

2 participants

@msgilligan

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.)

@msgilligan

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.

@joewalnes
Owner

LGTM

@joewalnes joewalnes merged commit ca929c7 into from
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.
View
1  .gitignore
@@ -4,3 +4,4 @@ target/
*.iws
*.iml
.idea
+.gradle
View
21 sitemesh-examples-gradle-hello/README.md
@@ -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.
+
+
View
3  sitemesh-examples-gradle-hello/WEB-INF/sitemesh3.xml
@@ -0,0 +1,3 @@
+<sitemesh>
+ <mapping path="/*" decorator="/decorator.html"/>
+</sitemesh>
View
21 sitemesh-examples-gradle-hello/WEB-INF/web.xml
@@ -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>
View
24 sitemesh-examples-gradle-hello/build.gradle
@@ -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()
+}
View
26 sitemesh-examples-gradle-hello/decorator.html
@@ -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>
View
9 sitemesh-examples-gradle-hello/hello.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>
Something went wrong with that request. Please try again.