mirror of https://github.com/zlatinb/muwire
include a servlet as well as pre-compiled jsps
parent
cd0b860210
commit
efef0f3734
|
@ -30,7 +30,7 @@ task precompileJsp {
|
||||||
outputDir: "$buildDir/tmp_jsp",
|
outputDir: "$buildDir/tmp_jsp",
|
||||||
compilerSourceVM: "1.8",
|
compilerSourceVM: "1.8",
|
||||||
compilerTargetVM: "1.8",
|
compilerTargetVM: "1.8",
|
||||||
webXml: "$buildDir/tmp_jsp/web.xml") // maybe change this to a fragment?
|
webXmlFragment: "$buildDir/tmp_jsp/web.xml.jasper")
|
||||||
def output = new File("$buildDir/compiledJsps")
|
def output = new File("$buildDir/compiledJsps")
|
||||||
output.mkdirs()
|
output.mkdirs()
|
||||||
ant.javac(srcDir: 'build/tmp_jsp',
|
ant.javac(srcDir: 'build/tmp_jsp',
|
||||||
|
@ -40,7 +40,19 @@ task precompileJsp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
war.dependsOn precompileJsp
|
task generateWebXML {
|
||||||
|
doLast {
|
||||||
|
def template = new File("$projectDir/templates/web.xml.template")
|
||||||
|
def templateText = template.text
|
||||||
|
def jasper = new File("$buildDir/tmp_jsp/web.xml.jasper")
|
||||||
|
templateText = templateText.replaceAll("__JASPER__", jasper.text)
|
||||||
|
def webXml = new File("$buildDir/tmp_jsp/web.xml")
|
||||||
|
webXml.text = templateText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
generateWebXML.dependsOn precompileJsp
|
||||||
|
war.dependsOn generateWebXML
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
warArtifact war
|
warArtifact war
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.muwire.webui;
|
||||||
|
|
||||||
|
import javax.servlet.ServletConfig;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
|
||||||
|
public class MuWireServlet extends HttpServlet {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ServletConfig config) throws ServletException {
|
||||||
|
super.init(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
|
||||||
|
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
|
||||||
|
version="3.1"
|
||||||
|
metadata-complete="false">
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>com.muwire.webui.MuWireServlet</servlet-name>
|
||||||
|
<servlet-class>com.muwire.webui.MuWireServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>com.muwire.webui.MuWireServlet</servlet-name>
|
||||||
|
<url-pattern>/</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
|
||||||
|
__JASPER__
|
||||||
|
|
||||||
|
</web-app>
|
Loading…
Reference in New Issue