[jetrix-cvs] SF.net SVN: jetrix:[814] jetrix/trunk
Brought to you by:
smanux
From: <sm...@us...> - 2010-01-10 20:47:49
|
Revision: 814 http://jetrix.svn.sourceforge.net/jetrix/?rev=814&view=rev Author: smanux Date: 2010-01-10 20:47:42 +0000 (Sun, 10 Jan 2010) Log Message: ----------- Replaced Jetty with Winstone for the web administration console Modified Paths: -------------- jetrix/trunk/build.xml jetrix/trunk/pom.xml jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/PrecompiledPagesFilter.java jetrix/trunk/src/admin/WEB-INF/web.xml jetrix/trunk/src/admin/channel.jsp jetrix/trunk/src/admin/server.jsp jetrix/trunk/src/java/net/jetrix/listeners/HttpListener.java Added Paths: ----------- jetrix/trunk/lib/jsp-api-2.1.jar jetrix/trunk/lib/jsp-api-light.jar jetrix/trunk/lib/winstone-lite-0.9.10.jar Removed Paths: ------------- jetrix/trunk/lib/jetty.jar jetrix/trunk/lib/servlet-light.jar jetrix/trunk/lib/servlet.jar Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2009-09-13 22:00:05 UTC (rev 813) +++ jetrix/trunk/build.xml 2010-01-10 20:47:42 UTC (rev 814) @@ -151,8 +151,8 @@ <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-lang-2.0-light"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-pool-1.4"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-dbcp-1.2.2"/></antcall> - <antcall target="pack.lib" inheritAll="true"><param name="library" value="jetty"/></antcall> - <antcall target="pack.lib" inheritAll="true"><param name="library" value="servlet-light"/></antcall> + <antcall target="pack.lib" inheritAll="true"><param name="library" value="winstone-lite-0.9.10"/></antcall> + <antcall target="pack.lib" inheritAll="true"><param name="library" value="jsp-api-light"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="jasper-runtime"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="jcrontab-1.4.1-light"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="mailapi-1.4.1"/></antcall> Deleted: jetrix/trunk/lib/jetty.jar =================================================================== (Binary files differ) Added: jetrix/trunk/lib/jsp-api-2.1.jar =================================================================== (Binary files differ) Property changes on: jetrix/trunk/lib/jsp-api-2.1.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: jetrix/trunk/lib/jsp-api-light.jar =================================================================== (Binary files differ) Property changes on: jetrix/trunk/lib/jsp-api-light.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: jetrix/trunk/lib/servlet-light.jar =================================================================== (Binary files differ) Deleted: jetrix/trunk/lib/servlet.jar =================================================================== (Binary files differ) Added: jetrix/trunk/lib/winstone-lite-0.9.10.jar =================================================================== (Binary files differ) Property changes on: jetrix/trunk/lib/winstone-lite-0.9.10.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: jetrix/trunk/pom.xml =================================================================== --- jetrix/trunk/pom.xml 2009-09-13 22:00:05 UTC (rev 813) +++ jetrix/trunk/pom.xml 2010-01-10 20:47:42 UTC (rev 814) @@ -127,12 +127,11 @@ <artifactId>commons-dbcp</artifactId> <version>1.2.2</version> </dependency> - + <dependency> - <groupId>jetty</groupId> - <artifactId>jetty</artifactId> - <version>4.1-rc1</version> - <optional>true</optional> + <groupId>net.sourceforge.winstone</groupId> + <artifactId>winstone</artifactId> + <version>0.9.10</version> </dependency> <dependency> Modified: jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/PrecompiledPagesFilter.java =================================================================== --- jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/PrecompiledPagesFilter.java 2009-09-13 22:00:05 UTC (rev 813) +++ jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/PrecompiledPagesFilter.java 2010-01-10 20:47:42 UTC (rev 814) @@ -31,7 +31,6 @@ */ public class PrecompiledPagesFilter implements Filter { - public void init(FilterConfig filterConfig) throws ServletException { } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException Modified: jetrix/trunk/src/admin/WEB-INF/web.xml =================================================================== --- jetrix/trunk/src/admin/WEB-INF/web.xml 2009-09-13 22:00:05 UTC (rev 813) +++ jetrix/trunk/src/admin/WEB-INF/web.xml 2010-01-10 20:47:42 UTC (rev 814) @@ -2,34 +2,37 @@ <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> - <display-name>Jetrix Administration</display-name> - <description>Web administration console for Jetrix</description> + <display-name>Jetrix Administration</display-name> + <description>Web administration console for Jetrix</description> - <filter> - <filter-name>precomp</filter-name> - <filter-class>net.jetrix.servlets.PrecompiledPagesFilter</filter-class> - </filter> + <filter> + <filter-name>precomp</filter-name> + <filter-class>net.jetrix.servlets.PrecompiledPagesFilter</filter-class> + </filter> - <filter-mapping> - <filter-name>precomp</filter-name> - <url-pattern>*.jsp</url-pattern> - </filter-mapping> + <filter-mapping> + <filter-name>precomp</filter-name> + <url-pattern>*.jsp</url-pattern> + </filter-mapping> - <security-constraint> - <web-resource-collection> - <web-resource-name/> - <url-pattern>/</url-pattern> - <url-pattern>*.html</url-pattern> - <url-pattern>*.jsp</url-pattern> - </web-resource-collection> - <auth-constraint> - <role-name>admin</role-name> - </auth-constraint> - </security-constraint> + <security-constraint> + <web-resource-collection> + <web-resource-name/> + <url-pattern>/*</url-pattern> + </web-resource-collection> + <auth-constraint> + <role-name>admin</role-name> + </auth-constraint> + </security-constraint> - <login-config> - <auth-method>BASIC</auth-method> - <realm-name>Jetrix Admin</realm-name> - </login-config> + <login-config> + <auth-method>BASIC</auth-method> + <realm-name>Jetrix Administration</realm-name> + </login-config> + + <security-role> + <description>Jetrix Administrator</description> + <role-name>admin</role-name> + </security-role> </web-app> Modified: jetrix/trunk/src/admin/channel.jsp =================================================================== --- jetrix/trunk/src/admin/channel.jsp 2009-09-13 22:00:05 UTC (rev 813) +++ jetrix/trunk/src/admin/channel.jsp 2010-01-10 20:47:42 UTC (rev 814) @@ -125,7 +125,7 @@ <div class="tab-page" style="height: 400px"> <h2 class="tab">Settings</h2> - <jsp:include page="/servlet/org.apache.jsp.settings_jsp"/> + <%@ include file="settings.jsp"%> </div> <div class="tab-page" style="height: 400px"> Modified: jetrix/trunk/src/admin/server.jsp =================================================================== --- jetrix/trunk/src/admin/server.jsp 2009-09-13 22:00:05 UTC (rev 813) +++ jetrix/trunk/src/admin/server.jsp 2010-01-10 20:47:42 UTC (rev 814) @@ -57,7 +57,6 @@ <td> <select name="host"> <option value="[ALL]">All Interfaces</option> - <% Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) @@ -166,7 +165,7 @@ <div class="tab-page" style="height: 400px"> <h2 class="tab">Settings</h2> - <jsp:include page="/servlet/org.apache.jsp.settings_jsp"/> + <%@ include file="settings.jsp" %> </div> <div class="tab-page" style="height: 400px"> @@ -288,8 +287,8 @@ </tr> <% } %> <tr> - <td><input type="text" name="pattern" style="thin"></td> - <td><input type="text" name="expires" style="thin"></td> + <td><input type="text" name="pattern" class="thin"></td> + <td><input type="text" name="expires" class="thin"></td> <td width="50" align="center"> <select name="type"> <option value="0">Host</option> Modified: jetrix/trunk/src/java/net/jetrix/listeners/HttpListener.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/listeners/HttpListener.java 2009-09-13 22:00:05 UTC (rev 813) +++ jetrix/trunk/src/java/net/jetrix/listeners/HttpListener.java 2010-01-10 20:47:42 UTC (rev 814) @@ -1,6 +1,6 @@ /** * Jetrix TetriNET Server - * Copyright (C) 2001-2003 Emmanuel Bourg + * Copyright (C) 2010 Emmanuel Bourg * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -19,15 +19,18 @@ package net.jetrix.listeners; -import java.io.*; -import java.util.logging.*; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; -import org.mortbay.http.*; -import org.mortbay.util.*; - -import net.jetrix.*; +import net.jetrix.Listener; +import net.jetrix.Server; import net.jetrix.services.AbstractService; +import winstone.Launcher; + /** * Web administration console. * @@ -36,40 +39,10 @@ */ public class HttpListener extends AbstractService implements Listener { - private org.mortbay.jetty.Server jetty; + private winstone.Launcher server; private Logger log = Logger.getLogger("net.jetrix"); - private boolean initialized; private int port = 31460; - public HttpListener() - { - // configure the log file - System.setProperty("LOG_CLASSES", "org.mortbay.util.OutputStreamLogSink"); - System.setProperty("LOG_FILE", "log/jetty.log"); - System.setProperty("LOG_DATE_FORMAT", "[yyyy-MM-dd HH:mm:ss] "); - } - - private void init() - { - // authentication realm - HashUserRealm realm = new HashUserRealm("Jetrix Admin"); - realm.put("admin", Server.getInstance().getConfig().getAdminPassword()); - realm.addUserToRole("admin", "admin"); - - jetty = new org.mortbay.jetty.Server(); - jetty.addRealm(realm); - - try - { - jetty.addListener(new InetAddrPort(getPort())); - jetty.addWebApplication("/", "./lib/jetrix-admin-@version@.war"); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - public String getName() { return "web admin"; @@ -91,15 +64,29 @@ { try { - if (!initialized) - { - init(); - initialized = true; - } - jetty.start(); + Map<String, String> args = new HashMap<String, String>(); + args.put("warfile", "./lib/jetrix-admin-@version@.war"); + args.put("httpPort", String.valueOf(getPort())); + //args.put("ajp13Port", "-1"); + args.put("argumentsRealm.passwd.admin", Server.getInstance().getConfig().getAdminPassword()); + args.put("argumentsRealm.roles.admin", "admin"); + //args.put("accessLoggerClassName", "winstone.accesslog.SimpleAccessLogger"); + //args.put("simpleAccessLogger.file", "./log/webadmin_access.log"); + //args.put("simpleAccessLogger.format", "resin"); + args.put("logfile", "./log/webadmin.log"); + args.put("useInvoker", "true"); + args.put("invokerPrefix", "/servlet/"); + args.put("debug", "5"); + args.put("commonLibFolder", "./lib/shared"); + //args.put("useServletReloading", "true"); + + Launcher.initLogger(args); + + server = new Launcher(args); + log.info("Web administration console started on port " + getPort()); } - catch (MultiException e) + catch (IOException e) { log.log(Level.SEVERE, "Unable to start the Web administration console on port " + getPort(), e); } @@ -110,15 +97,8 @@ { if (isRunning()) { - try - { - jetty.stop(); - log.info("Web administration console stopped"); - } - catch (InterruptedException e) - { - e.printStackTrace(); - } + server.shutdown(); + log.info("Web administration console stopped"); } } @@ -126,6 +106,6 @@ public boolean isRunning() { - return jetty != null && jetty.isStarted(); + return server != null && server.isRunning(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |