I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 2ca0ae75 authored by zzz's avatar zzz
Browse files

* i2psnark build:

      - Move FetchAndAdd to static inner class
      - Remove duplicate classes from i2psnark.war (120KB);
        fixes sporadic FetchAndAdd IllegalAccessError
      - Fix standalone build to include i2psnark.jar since classes
        aren't in the .war anymore
      - Have standalone jetty use I2PAppContext temp directory
      - Replace launch-i2psnark.jar with launch-i2psnark script,
        since RunStandalone is in i2p.jar
      - Clean up jetty-i2psnark.xml, turn off jetty logging
      - Remove standalone build from the pkg target in the main build.xml
parent 3ee09df6
No related branches found
No related tags found
No related merge requests found
......@@ -37,16 +37,17 @@
</javac>
</target>
<target name="jar" depends="builddep, compile">
<jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/*Servlet.class">
<jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/I2PSnarkServlet*.class">
<manifest>
<attribute name="Main-Class" value="org.klomp.snark.Snark" />
<attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
</manifest>
</jar>
</target>
<!-- only include the servlet, everything else is in the jar -->
<target name="war" depends="jar">
<war destfile="../i2psnark.war" webxml="../web.xml">
<classes dir="./build/obj" includes="**/*" />
<classes dir="./build/obj" includes="**/I2PSnarkServlet*.class" />
</war>
</target>
......@@ -56,31 +57,13 @@
</zip>
</target>
<target name="standalone_prep" depends="war">
<javac debug="true" deprecation="on" source="1.5" target="1.5"
destdir="./build" srcdir="src/" includes="org/klomp/snark/web/RunStandalone.java" >
<compilerarg line="${javac.compilerargs}" />
<classpath>
<pathelement location="../../jetty/jettylib/commons-logging.jar" />
<pathelement location="../../jetty/jettylib/commons-el.jar" />
<pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
<pathelement location="../../../core/java/build/i2p.jar" />
</classpath>
</javac>
<jar destfile="./build/launch-i2psnark.jar" basedir="./build/" includes="org/klomp/snark/web/RunStandalone.class">
<manifest>
<attribute name="Main-Class" value="org.klomp.snark.web.RunStandalone" />
<attribute name="Class-Path" value="lib/i2p.jar lib/mstreaming.jar lib/streaming.jar lib/commons-el.jar lib/commons-logging.jar lib/jasper-compiler.jar lib/jasper-runtime.jar lib/javax.servlet.jar lib/org.mortbay.jetty.jar" />
</manifest>
</jar>
<delete dir="./dist" />
<mkdir dir="./dist" />
<copy file="./build/launch-i2psnark.jar" tofile="./dist/launch-i2psnark.jar" />
<copy file="../launch-i2psnark" todir="./dist/" />
<mkdir dir="./dist/webapps" />
<copy file="../i2psnark.war" tofile="./dist/webapps/i2psnark.war" />
<mkdir dir="./dist/lib" />
<copy file="./build/i2psnark.jar" tofile="./dist/lib/i2psnark.jar" />
<copy file="../../../core/java/build/i2p.jar" tofile="./dist/lib/i2p.jar" />
<copy file="../../jetty/jettylib/commons-el.jar" tofile="./dist/lib/commons-el.jar" />
<copy file="../../jetty/jettylib/commons-logging.jar" tofile="./dist/lib/commons-logging.jar" />
......@@ -92,7 +75,6 @@
<copy file="../../streaming/java/build/streaming.jar" tofile="./dist/lib/streaming.jar" />
<copy file="../jetty-i2psnark.xml" tofile="./dist/jetty-i2psnark.xml" />
<copy file="../readme-standalone.txt" tofile="./dist/readme.txt" />
<mkdir dir="./dist/work" />
<mkdir dir="./dist/logs" />
<zip destfile="i2psnark-standalone.zip">
......
......@@ -876,10 +876,9 @@ public class I2PSnarkServlet extends HttpServlet {
private static final String TABLE_FOOTER = "</table>\n";
private static final String FOOTER = "</body></html>";
}
class FetchAndAdd implements Runnable {
/** inner class, don't bother reindenting */
private static class FetchAndAdd implements Runnable {
private SnarkManager _manager;
private String _url;
public FetchAndAdd(SnarkManager mgr, String url) {
......@@ -931,3 +930,5 @@ class FetchAndAdd implements Runnable {
}
}
}
}
......@@ -2,6 +2,7 @@ package org.klomp.snark.web;
import java.io.File;
import net.i2p.I2PAppContext;
import net.i2p.util.FileUtil;
import org.mortbay.jetty.Server;
......@@ -22,7 +23,7 @@ public class RunStandalone {
}
public void start() {
File workDir = new File("work");
File workDir = new File(I2PAppContext.getGlobalContext().getTempDir(), "jetty-work");
boolean workDirRemoved = FileUtil.rmdir(workDir, false);
if (!workDirRemoved)
System.err.println("ERROR: Unable to remove Jetty temporary work directory");
......@@ -32,6 +33,8 @@ public class RunStandalone {
try {
_server = new Server("jetty-i2psnark.xml");
// just blow up NPE if we don't have a context
(_server.getContexts()[0]).setTempDirectory(workDir);
_server.start();
} catch (Exception e) {
e.printStackTrace();
......
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.2//EN" "http://jetty.mortbay.org/configure_1_2.dtd">
<!-- =============================================================== -->
<!-- This is the configuration for a standalone i2psnark and -->
<!-- jetty instance connecting to a router in another jvm. -->
<!-- Run it with the launch-i2psnark script. -->
<!-- i2psnark will be accessed at http://127.0.0.1:8002/ -->
<!-- =============================================================== -->
<!-- =============================================================== -->
<!-- Configure the Jetty Server -->
......@@ -12,7 +18,7 @@
<!-- =============================================================== -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Add and configure a HTTP listener to port 8080 -->
<!-- Add and configure a HTTP listener to port 8002 -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Call name="addListener">
<Arg>
......@@ -23,7 +29,7 @@
<Set name="port">8002</Set>
</New>
</Arg>
<Set name="MinThreads">3</Set>
<Set name="MinThreads">1</Set>
<Set name="MaxThreads">10</Set>
<Set name="MaxIdleTimeMs">30000</Set>
<Set name="LowResourcePersistTimeMs">1000</Set>
......@@ -34,45 +40,6 @@
</Arg>
</Call>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Add a HTTPS SSL listener on port 8443 -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- UNCOMMENT TO ACTIVATE
<Call name="addListener">
<Arg>
<New class="org.mortbay.http.SunJsseListener">
<Set name="Port">8443</Set>
<Set name="PoolName">main</Set>
<Set name="Keystore"><SystemProperty name="jetty.home" default="."/>/etc/demokeystore</Set>
<Set name="Password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
<Set name="NonPersistentUserAgent">MSIE 5</Set>
</New>
</Arg>
</Call>
-->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Add a AJP13 listener on port 8009 -->
<!-- This protocol can be used with mod_jk in apache, IIS etc. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!--
<Call name="addListener">
<Arg>
<New class="org.mortbay.http.ajp.AJP13Listener">
<Set name="PoolName">ajp</Set>
<Set name="Port">8009</Set>
<Set name="MinThreads">3</Set>
<Set name="MaxThreads">20</Set>
<Set name="MaxIdleTimeMs">0</Set>
<Set name="confidentialPort">443</Set>
</New>
</Arg>
</Call>
-->
<!-- =============================================================== -->
<!-- Configure the Contexts -->
<!-- =============================================================== -->
......@@ -91,20 +58,6 @@
<Arg>webapps/i2psnark.war</Arg>
</Call>
<!-- =============================================================== -->
<!-- Configure the Request Log -->
<!-- =============================================================== -->
<Set name="RequestLog">
<New class="org.mortbay.http.NCSARequestLog">
<Arg>./logs/yyyy_mm_dd.i2psnark-request.log</Arg>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
<Set name="buffered">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
<!-- =============================================================== -->
<!-- Configure the Other Server Options -->
<!-- =============================================================== -->
......
#!/bin/sh
#
# This launches i2psnark and jetty in a separate jvm.
# The file jetty-i2psnark.xml must be present in the current directory.
# i2psnark will be accessed at http://127.0.0.1:8002/
#
I2P="."
java -cp "$I2P/lib/i2psnark.jar:$I2P/lib/i2p.jar:$I2P/lib/mstreaming.jar:$I2P/lib/streaming.jar:$I2P/lib/commons-el.jar:$I2P/lib/commons-logging.jar:$I2P/lib/jasper-compiler.jar:$I2P/lib/jasper-runtime.jar:$I2P/lib/javax.servlet.jar:$I2P/lib/org.mortbay.jetty.jar" org.klomp.snark.web.RunStandalone "$@"
To run I2PSnark from the command line, run "java -jar lib/i2psnark.jar", but
to run it with the web UI, run "java -jar launch-i2psnark.jar". I2PSnark is
to run it with the web UI, run "launch-i2psnark". I2PSnark is
GPL'ed software, based on Snark (http://www.klomp.org/) to run on top of I2P
(http://www.i2p.net/) within a webserver (such as the bundled Jetty from
(http://www.i2p2.de/) within a webserver (such as the bundled Jetty from
http://jetty.mortbay.org/). For more information about I2PSnark, get in touch
with the folks at http://forum.i2p.net/
\ No newline at end of file
with the folks at http://forum.i2p2.de/
......@@ -39,7 +39,10 @@
</target>
<target name="build" depends="build2">
<!-- so we don't build standalone for the updater -->
<!-- This builds apps/i2psnark/java/i2psnark-standalone.zip,
- which we don't distribute anywhere...
<ant dir="apps/i2psnark/java/" target="standalone" />
-->
</target>
<target name="build2" depends="builddep, jar, buildWEB" />
<target name="buildSmall" depends="builddepSmall, jarSmall, buildWEB" />
......@@ -240,7 +243,7 @@
<copy file="build/susidns.war" todir="pkg-temp/webapps/" />
<!-- <copy file="build/syndie.war" todir="pkg-temp/webapps/" /> -->
<copy file="build/i2psnark.war" todir="pkg-temp/webapps/" />
<copy file="apps/i2psnark/java/build/launch-i2psnark.jar" todir="pkg-temp/" />
<copy file="apps/i2psnark/launch-i2psnark" todir="pkg-temp/" />
<copy file="apps/i2psnark/jetty-i2psnark.xml" todir="pkg-temp/" />
<copy file="apps/i2psnark/i2psnark.config" todir="pkg-temp/" />
<copy file="installer/resources/blocklist.txt" todir="pkg-temp/" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment