hook up the mw client app with the jsp

This commit is contained in:
Zlatin Balevsky
2019-11-30 08:28:22 +00:00
parent f9f1017e5b
commit 8c33a5e62f
4 changed files with 35 additions and 3 deletions

View File

@ -29,6 +29,7 @@ task precompileJsp {
def generated = new File("$buildDir/tmp_jsp")
generated.mkdirs()
ant.jasper(package: 'com.muwire.webui',
classPath : sourceSets.main.runtimeClasspath.asPath,
uriroot: webAppDir,
outputDir: "$buildDir/tmp_jsp",
compilerSourceVM: "1.8",
@ -37,8 +38,8 @@ task precompileJsp {
def output = new File("$buildDir/compiledJsps")
output.mkdirs()
ant.javac(srcDir: 'build/tmp_jsp',
destDir:file("$buildDir/compiledJsps"),
classpath: configurations.compile.asPath)
classPath : sourceSets.main.runtimeClasspath.asPath,
destDir:file("$buildDir/compiledJsps"))
}
}
@ -54,6 +55,7 @@ task generateWebXML {
}
}
precompileJsp.dependsOn compileJava
generateWebXML.dependsOn precompileJsp
war.dependsOn generateWebXML

View File

@ -0,0 +1,21 @@
package com.muwire.webui;
import java.io.Serializable;
import net.i2p.I2PAppContext;
import net.i2p.router.RouterContext;
public class MuWireBean implements Serializable {
private final Object mwClient;
public MuWireBean() {
mwClient = ((RouterContext)I2PAppContext.getGlobalContext()).clientAppManager().getRegisteredApp("MuWire");
System.out.println("mwClient is "+mwClient);
}
public Object getMwClient() {
return mwClient;
}
}

View File

@ -44,6 +44,7 @@ public class MuWireClient implements RouterApp {
this.home = home;
this.mwProps = new File(home, "MuWire.properties");
this.state = ClientAppState.INITIALIZED;
mgr.register(this);
}
@Override

View File

@ -1,11 +1,19 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>MuWire</title>
</head>
<body>
<p>Nothing here yet</p>
<jsp:useBean id="mwBean" class="com.muwire.webui.MuWireBean"/>
<c:set var="mwClient" scope="application" value="${mwBean.getMwClient()}"/>
<c:if test = "${mwClient.needsMWInit()}">
<p>MW needs initializing</p>
</c:if>
<c:if test = "${!mwClient.needsMWInit()}">
<p>MW doesn't need initing</p>
</c:if>
</body>
</html>