2
0
Fork 0
mirror of https://github.com/ethauvin/rife2-hello.git synced 2025-04-26 07:47:13 -07:00

Updated for better alignment across hello templates

This commit is contained in:
Geert Bevin 2023-03-20 11:06:06 -04:00
parent e0e07a3d27
commit 8751306d0f
5 changed files with 12 additions and 12 deletions

View file

@ -13,8 +13,8 @@ version = 1.0
group = "com.example" group = "com.example"
rife2 { rife2 {
version.set("1.4.0") version.set("1.5.1")
uberMainClass.set("hello.AppUber") uberMainClass.set("hello.AppSiteUber")
useAgent.set(true) useAgent.set(true)
precompiledTemplateTypes.add(HTML) precompiledTemplateTypes.add(HTML)
} }
@ -36,12 +36,12 @@ repositories {
} }
dependencies { dependencies {
testImplementation("org.jsoup:jsoup:1.15.3") testImplementation("org.jsoup:jsoup:1.15.4")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.1") testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
} }
application { application {
mainClass.set("hello.App") mainClass.set("hello.AppSite")
} }
tasks { tasks {

View file

@ -2,7 +2,7 @@ package hello;
import rife.engine.*; import rife.engine.*;
public class App extends Site { public class AppSite extends Site {
public void setup() { public void setup() {
var hello = get("/hello", c -> c.print(c.template("hello"))); var hello = get("/hello", c -> c.print(c.template("hello")));
get("/", c -> c.redirect(hello)); get("/", c -> c.redirect(hello));
@ -11,6 +11,6 @@ public class App extends Site {
public static void main(String[] args) { public static void main(String[] args) {
new Server() new Server()
.staticResourceBase("src/main/webapp") .staticResourceBase("src/main/webapp")
.start(new App()); .start(new AppSite());
} }
} }

View file

@ -2,10 +2,10 @@ package hello;
import rife.engine.Server; import rife.engine.Server;
public class AppUber extends App { public class AppSiteUber extends AppSite {
public static void main(String[] args) { public static void main(String[] args) {
new Server() new Server()
.staticUberJarResourceBase("webapp") .staticUberJarResourceBase("webapp")
.start(new AppUber()); .start(new AppSiteUber());
} }
} }

View file

@ -11,13 +11,13 @@ import static org.junit.jupiter.api.Assertions.*;
public class AppTest { public class AppTest {
@Test @Test
void verifyRoot() { void verifyRoot() {
var m = new MockConversation(new App()); var m = new MockConversation(new AppSite());
assertEquals(m.doRequest("/").getStatus(), 302); assertEquals(m.doRequest("/").getStatus(), 302);
} }
@Test @Test
void verifyHello() { void verifyHello() {
var m = new MockConversation(new App()); var m = new MockConversation(new AppSite());
assertEquals("Hello", m.doRequest("/hello") assertEquals("Hello", m.doRequest("/hello")
.getTemplate().getValue("title")); .getTemplate().getValue("title"));
} }

View file

@ -7,7 +7,7 @@
<filter-class>rife.servlet.RifeFilter</filter-class> <filter-class>rife.servlet.RifeFilter</filter-class>
<init-param> <init-param>
<param-name>rifeSiteClass</param-name> <param-name>rifeSiteClass</param-name>
<param-value>hello.App</param-value> <param-value>hello.AppSite</param-value>
</init-param> </init-param>
</filter> </filter>