浏览代码

First draft of fortunes test in Gemini.

Brian Hauer 12 年之前
父节点
当前提交
5d389e4083

+ 0 - 7
gemini/Docroot/WEB-INF/GeminiHello-Dev.conf

@@ -10,9 +10,6 @@
 # Extend the baseline configuration.
 Extends = GeminiHello-Base.conf
 
-# TODO: Edit these settings according to the particulars of the
-# Development environments.
-
 DeploymentDescription = Development/${Servlet.MachineName}
 
 # Database connectivity for Development.
@@ -23,8 +20,4 @@ db.LoginPass = root
 # Disable outbound e-mail from the Development environment.
 OutboundMailEnabled = no
 
-# You may want to disable the last login update on Development.
-#BasicSecurity.UpdateLastLogin = no
-
-
 

+ 1 - 1
gemini/Docroot/WEB-INF/GeminiHello-Inverness.conf

@@ -9,7 +9,7 @@
 
 # Extend the development configuration, which in turn extends the
 # baseline configuration.
-Extends = GeminiHello-Dev.conf
+Extends = GeminiHello-Prod.conf
 
 # Now set any attributes that are specific to this machine.
 

+ 2 - 16
gemini/Docroot/WEB-INF/GeminiHello-Prod.conf

@@ -10,9 +10,6 @@
 # Extend the baseline configuration.
 Extends = GeminiHello-Base.conf
 
-# TODO: Edit these settings according to the particulars of the
-# Production environment.
-
 DeploymentDescription = Production/${Servlet.MachineName}
 
 # Database connectivity for Production.
@@ -20,19 +17,8 @@ db.ConnectString = localhost:3306/gemini?jdbcCompliantTruncation=false&cachePrep
 db.LoginName = hello
 db.LoginPass = hello
 
-# Mail server definition for the production environment.  TODO: Most
-# likely you shouldn't be using the TechEmpower mail server in 
-# Production, so change this.
-MailServerCount = 1
-MailServer1.ServerAddress = mail.techempower.com
-MailServer1.SmtpPort = 25
-MailServer1.PopPort = 110
-MailServer1.Username = mhixson
-MailServer1.Password = password
-MailServer1.ServerRole = Outbound
-
-# In production, we'll want to have the email exception handler enabled.
-EmailExceptionHandler.Enabled = true
+# For this application, we are not sending any outbound e-mail.
+OutboundMailEnabled = no
 
 # In production, refer to all the static assets via URLs with version strings to
 # allow us to perform aggressive caching.

二进制
gemini/Docroot/WEB-INF/lib/techempower.jar


+ 0 - 10
gemini/Docroot/WEB-INF/web.xml

@@ -50,14 +50,4 @@
   <!-- Use UTF-8 for everything. -->
   <character-encoding>UTF-8</character-encoding>
 
-  <!-- Enable GZIP compression. -->
-  <!--
-  <filter filter-name="gzip" filter-class="com.caucho.filters.GzipFilter">
-    <init>
-      <use-vary>true</use-vary>
-    </init>
-  </filter>
-  <filter-mapping url-pattern='*' filter-name="gzip" />
-  -->
-
 </web-app>

+ 2 - 2
gemini/Source/hello/GhForm.java

@@ -58,9 +58,9 @@ public class GhForm
   }
 
   @Override
-  protected <C extends Context> void onValidlySubmitted(C arg0)
+  protected void onValidlySubmitted()
   {
-    // Does nothing.    
+    // Does nothing.
   }
 
 }   // End GhForm.

+ 1 - 1
gemini/Source/hello/GhStore.java

@@ -5,7 +5,6 @@ import hello.home.entity.*;
 import com.techempower.*;
 import com.techempower.cache.*;
 import com.techempower.data.*;
-import com.techempower.gemini.cluster.client.handler.*;
 import com.techempower.log.*;
 
 /**
@@ -48,6 +47,7 @@ public class GhStore
     
     // Use EntityGroup rather than CacheGroup to ensure World entities are not cached.
     register(EntityGroup.of(World.class));
+    register(EntityGroup.of(Fortune.class));
 
     // Register relationships.
     // We have no relationships in this application.

+ 14 - 0
gemini/Source/hello/home/handler/HelloHandler.java

@@ -59,5 +59,19 @@ public class HelloHandler
     
     return json(worlds);
   }
+  
+  /**
+   * Fetch the full list of Fortunes from the database, sort them by the
+   * fortune message text, and then render the results to simple HTML using a 
+   * server-side template.
+   */
+  @PathSegment
+  public boolean fortunes()
+  {
+    final List<Fortune> fortunes = store.list(Fortune.class);
+    Collections.sort(fortunes);
+    //return mustache("fortunes", Collections.singletonMap("fortunes", fortunes));   
+    return mustache("fortunes", fortunes);
+  }
 
 }