Browse Source

Merge branch 'master' of https://github.com/javalite/FrameworkBenchmarks

Conflicts:
	activeweb/src/main/webapp/WEB-INF/views/fortunes/index.ftl
	activeweb/src/main/webapp/WEB-INF/views/fortunes/index.html
	activeweb/src/main/webapp/WEB-INF/views/home/index.ftl
	activeweb/src/main/webapp/WEB-INF/views/home/index.html
	activeweb/src/main/webapp/WEB-INF/views/layouts/default_layout.ftl
	activeweb/src/main/webapp/WEB-INF/views/layouts/default_layout.html
	activeweb/src/main/webapp/WEB-INF/views/system/404.ftl
	activeweb/src/main/webapp/WEB-INF/views/system/404.html
	activeweb/src/main/webapp/WEB-INF/views/system/error.ftl
	activeweb/src/main/webapp/WEB-INF/views/system/error.html
	frameworks/Java/activeweb/src/main/java/app/config/FreeMarkerConfig.java
	frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/fortunes/index.ftl
	frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/home/index.ftl
	frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/default_layout.ftl
	frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/footer.ftl
	frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/header.ftl
	frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/queries/index.ftl
	frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/404.ftl
	frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/error.ftl
ericbn 10 years ago
parent
commit
559fbdc71b

+ 50 - 5
frameworks/Java/activeweb/pom.xml

@@ -9,7 +9,7 @@
     <name>ActiveWeb Benchmark App</name>
 
     <properties>
-        <activeweb.version>1.9</activeweb.version>
+        <activeweb.version>1.11-SNAPSHOT</activeweb.version>
     </properties>
 
     <build>
@@ -51,12 +51,20 @@
                             <maxIdleTime>1000</maxIdleTime>
                         </connector>
                     </connectors>
+
+                    <!--<systemProperties>-->
+                        <!--<systemProperty>-->
+                            <!--<name>active_reload</name>-->
+                            <!--<value>true</value>-->
+                        <!--</systemProperty>-->
+                    <!--</systemProperties>-->
+
                 </configuration>
             </plugin>
             <plugin>
                 <groupId>org.javalite</groupId>
                 <artifactId>activejdbc-instrumentation</artifactId>
-                <version>1.4.9</version>
+                <version>1.4.10-SNAPSHOT</version>
                 <executions>
                     <execution>
                         <phase>process-classes</phase>
@@ -99,17 +107,54 @@
             <version>1.7.5</version>
         </dependency>
 
+        <!--<dependency>-->
+            <!--<groupId>com.sun</groupId>-->
+            <!--<artifactId>tools</artifactId>-->
+            <!--<version>1.7.0</version>-->
+            <!--<scope>system</scope>-->
+            <!--<systemPath>${java.home}/../lib/tools.jar</systemPath>-->
+        <!--</dependency>-->
+
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-core</artifactId>
             <version>2.3.1</version>
+            <scope>test</scope>
         </dependency>
 
         <dependency>
-          <groupId>com.fasterxml.jackson.core</groupId>
-          <artifactId>jackson-databind</artifactId>
-          <version>2.3.1</version>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>2.3.1</version>
+            <scope>test</scope>
         </dependency>
 
+
     </dependencies>
+
+    <repositories>
+        <repository>
+            <id>snapshots1</id>
+            <name>Sonatype Snapshots</name>
+            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>always</updatePolicy>
+                <checksumPolicy>warn</checksumPolicy>
+            </snapshots>
+        </repository>
+    </repositories>
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots2</id>
+            <name>Sonatype Snapshots</name>
+            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>always</updatePolicy>
+                <checksumPolicy>warn</checksumPolicy>
+            </snapshots>
+        </pluginRepository>
+    </pluginRepositories>
+
 </project>

+ 2 - 1
frameworks/Java/activeweb/src/main/java/app/config/AppBootstrap.java

@@ -18,8 +18,8 @@ package app.config;
 import org.javalite.activeweb.AppContext;
 import org.javalite.activeweb.Bootstrap;
 
-import com.google.inject.Guice;
 import org.javalite.activeweb.Configuration;
+import org.javalite.templator.TemplatorConfig;
 
 /**
  * @author Igor Polevoy
@@ -27,5 +27,6 @@ import org.javalite.activeweb.Configuration;
 public class AppBootstrap extends Bootstrap {
     public void init(AppContext context) {
         Configuration.setUseDefaultLayoutForErrors(true);
+        TemplatorConfig.instance().cacheTemplates(true);
     }
 }

+ 0 - 30
frameworks/Java/activeweb/src/main/java/app/config/FreeMarkerConfig.java

@@ -1,30 +0,0 @@
-/*
-Copyright 2009-2010 Igor Polevoy 
-
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
-
-http://www.apache.org/licenses/LICENSE-2.0 
-
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
-*/
-
-package app.config;
-
-import org.javalite.activeweb.freemarker.AbstractFreeMarkerConfig;
-
-/**
- * @author Igor Polevoy
- */
-public class FreeMarkerConfig extends org.javalite.activeweb.freemarker.AbstractFreeMarkerConfig {
-    @Override
-    public void init() {
-        //this is to override a strange FreeMarker default processing of numbers 
-        getConfiguration().setNumberFormat("0.##");
-    }
-}

+ 3 - 6
frameworks/Java/activeweb/src/main/java/app/controllers/JsonController.java

@@ -20,7 +20,6 @@ limitations under the License.
 
 package app.controllers;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
 import org.javalite.activeweb.AppController;
 
 import java.io.IOException;
@@ -28,11 +27,9 @@ import java.util.Date;
 
 public class JsonController extends AppController {
     public void index() throws IOException {
-        String json = new ObjectMapper().writeValueAsString(new Message("Hello, World!"));
-        respond(json)
-                .contentType("application/json")
-                .header("Content-Length", String.valueOf(json.length()))
-                .header("Date", new Date().toString());
+        view("message", new Message("Hello, World!"));
+        header("Date", new Date().toString());
+        render().noLayout().contentType("application/json");
     }
 
     public static final class Message {

+ 1 - 0
frameworks/Java/activeweb/src/main/resources/activeweb.properties

@@ -0,0 +1 @@
+templateManager=org.javalite.activeweb.templator.TemplatorManager

+ 2 - 2
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/fortunes/index.ftl → frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/fortunes/index.html

@@ -8,10 +8,10 @@
         <th>message</th>
     </tr>
 
-<#list fortunes as fortune>
+<#list fortunes as fortune >
     <tr>
         <td>${fortune.id}</td>
-        <td>${fortune.message?html}</td>
+        <td>${fortune.message}</td>
     </tr>
 </#list>
 

+ 0 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/home/index.ftl → frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/home/index.html


+ 1 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/json/index.html

@@ -0,0 +1 @@
+{"message": "${message.message}"}

+ 10 - 5
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/default_layout.ftl → frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/default_layout.html

@@ -1,21 +1,26 @@
-<#setting url_escaping_charset='ISO-8859-1'>
-
 <html>
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <LINK href="${context_path}/css/main.css" rel="stylesheet" type="text/css"/>
     <script src="${context_path}/js/jquery-1.4.2.min.js" type="text/javascript"></script>
     <script src="${context_path}/js/aw.js" type="text/javascript"></script>
-    <title>ActiveWeb - <@yield to="title"/></title>
+    <title>ActiveWeb</title>
 </head>
 <body>
 
 <div class="main">
-<#include "header.ftl" >
+    <div class="header">
+        <h1><a href="${context_path}">ActiveWeb Benchmark Application</a></h1>
+    </div>
+
+
     <div class="content">
     ${page_content}
     </div>
-<#include "footer.ftl" >
+    <div class='footer'>
+        <p>2010 - 2015 Active Web.</p>
+    </div>
+
 </div>
 
 </body>

+ 0 - 3
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/footer.ftl

@@ -1,3 +0,0 @@
-<div class='footer'>
-    <p>2010 - 2013 Active Web. No Rights Reserved.</p>
-</div>

+ 0 - 4
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/header.ftl

@@ -1,4 +0,0 @@
-<div class="header">
-    <h1><a href="${context_path}">ActiveWeb Benchmark Application</a></h1>
-</div>
-

+ 0 - 7
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/queries/index.ftl

@@ -1,7 +0,0 @@
-<@compress single_line=true>
-[<#list worlds as w>
-{"id":${w.id},"randomNumber":${w.randomNumber}}
-<#if w_has_next>,</#if>
-</#list>
-]
-</@compress>

+ 5 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/queries/index.html

@@ -0,0 +1,5 @@
+[<#list worlds as w >
+    {"id":${w.id},"randomNumber":${w.randomNumber}}
+    <#if w_has_next >,</#if>
+</#list>]
+

+ 0 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/404.ftl → frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/404.html


+ 0 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/error.ftl → frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/error.html


+ 1 - 4
frameworks/Java/activeweb/src/test/java/app/controllers/JsonControllerSpec.java

@@ -30,10 +30,7 @@ public class JsonControllerSpec extends ControllerSpec {
 
     @Test
     public void shouldRenderMessage() {
-
-        System.out.println("ACTIVE_ENV value ============>>>>" + Configuration.getEnv());
-        //execute controller
-        request().get("index");
+        request().integrateViews().get("index");
 
         //process result
         Map result = JsonHelper.toMap(responseContent());