Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion wicket/benchmark_config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"setup_file": "setup",
"json_url": "/wicket/json",
"db_url": "/wicket/db",
"plaintext_url": "/wicket/plaintext",
"query_url": "/wicket/db?queries=",
"port": 8080,
"approach": "Realistic",
Expand All @@ -22,4 +23,4 @@
"versus": "servlet"
}
}]
}
}
2 changes: 2 additions & 0 deletions wicket/source_code
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
./wicket/src/main/java/hellowicket/BasePage.html
./wicket/src/main/java/hellowicket/HomePage.html
./wicket/src/main/java/hellowicket/World.java
./wicket/src/main/java/hellowicket/plaintext/HelloTextReference.java
./wicket/src/main/java/hellowicket/plaintext/HelloTextResource.java
./wicket/src/main/webapp/
./wicket/src/main/webapp/logo.png
./wicket/src/main/webapp/style.css
Expand Down
2 changes: 2 additions & 0 deletions wicket/src/main/java/hellowicket/WicketApplication.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package hellowicket;

import hellowicket.plaintext.HelloTextReference;
import org.apache.wicket.protocol.http.WebApplication;

/**
Expand Down Expand Up @@ -31,6 +32,7 @@ public void init()
// mount the resources under test
mountResource("/json", new HelloJsonReference());
mountResource("/db", new HelloDbReference());
mountResource("/plaintext", new HelloTextReference());

// disable response caching to be more close to other
// test applications' behavior
Expand Down
22 changes: 22 additions & 0 deletions wicket/src/main/java/hellowicket/plaintext/HelloTextReference.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package hellowicket.plaintext;

import org.apache.wicket.request.resource.IResource;
import org.apache.wicket.request.resource.ResourceReference;

public class HelloTextReference extends ResourceReference
{
private static final long serialVersionUID = 1L;

private final HelloTextResource resource = new HelloTextResource();

public HelloTextReference()
{
super(HelloTextReference.class, "plaintext");
}

@Override
public IResource getResource()
{
return resource;
}
}
31 changes: 31 additions & 0 deletions wicket/src/main/java/hellowicket/plaintext/HelloTextResource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package hellowicket.plaintext;

import java.nio.charset.Charset;

import org.apache.wicket.request.resource.AbstractResource;

/**
* A resource that implements the requirements for
* <a href="http://www.techempower.com/benchmarks/#section=code">Test type 6: Plaintext</a>
*/
public class HelloTextResource extends AbstractResource
{
private static final long serialVersionUID = 1L;

private static final String CONTENT_TYPE = "text/plain";
private static final byte[] DATA = "Hello, World!".getBytes(Charset.forName("UTF-8"));

protected ResourceResponse newResourceResponse(Attributes attributes)
{
ResourceResponse response = new ResourceResponse();
response.setContentType(CONTENT_TYPE);
response.setContentLength(DATA.length);
response.setWriteCallback(new WriteCallback() {
public void writeData(Attributes attributes)
{
attributes.getResponse().write(DATA);
}
});
return response;
}
}