Revision: 4000
Author: [email protected]
Date: Tue Mar 2 16:07:39 2010
Log: Zero argument ancillary servlet ctor for playground integration
http://codereview.appspot.com/224102
[email protected]
http://code.google.com/p/google-caja/source/detail?r=4000
Modified:
/trunk/src/com/google/caja/ancillary/servlet/Main.java
/trunk/web.xml
=======================================
--- /trunk/src/com/google/caja/ancillary/servlet/Main.java Mon Jan 18
15:50:44 2010
+++ /trunk/src/com/google/caja/ancillary/servlet/Main.java Tue Mar 2
16:07:39 2010
@@ -28,7 +28,20 @@
*
* @author [email protected]
*/
-public class Main {
+public final class Main extends CajaWebToolsServlet {
+
+ private static String makeCacheId() {
+ return Integer.toString(new SecureRandom().nextInt(1 << 30), 36);
+ }
+
+ private static URI makeUserAgentDbUri() {
+ return URI.create(System.getProperty(
+ "caja.webservice.useragentDb",
+ UserAgentDb.BROWSERSCOPE_WEB_SERVICE.toString()));
+ }
+
+ /** Zero argument ctor for Jetty. */
+ public Main() { super(makeCacheId(), makeUserAgentDbUri()); }
/** Starts a server on port 8080. */
public static void main(String[] args) throws Exception {
@@ -40,11 +53,7 @@
throw new Exception("What are these command line parameters for?");
}
Server server = new Server(port);
- String cacheId = Integer.toString(new SecureRandom().nextInt(1 << 30),
36);
- URI uadb = URI.create(System.getProperty(
- "caja.webservice.useragentDb",
- UserAgentDb.BROWSERSCOPE_WEB_SERVICE.toString()));
- final CajaWebToolsServlet servlet = new CajaWebToolsServlet(cacheId,
uadb);
+ final Main servlet = new Main();
server.setHandler(new AbstractHandler() {
public void handle(
String tgt, HttpServletRequest req, HttpServletResponse resp,
=======================================
--- /trunk/web.xml Mon Feb 22 17:04:43 2010
+++ /trunk/web.xml Tue Mar 2 16:07:39 2010
@@ -19,7 +19,7 @@
</servlet>
<servlet>
<servlet-name>ToolsServlet</servlet-name>
-
<servlet-class>com.google.caja.ancillary.servlet.CajaWebToolsServlet</servlet-class>
+ <servlet-class>com.google.caja.ancillary.servlet.Main</servlet-class>
</servlet>
<servlet-mapping>