File tree Expand file tree Collapse file tree 5 files changed +59
-1
lines changed
src/main/java/hellowicket Expand file tree Collapse file tree 5 files changed +59
-1
lines changed Original file line number Diff line number Diff line change 55 "setup_file": "setup",
66 "json_url": "/wicket/json",
77 "db_url": "/wicket/db",
8+ "plaintext_url": "/wicket/plaintext",
89 "query_url": "/wicket/db?queries=",
910 "port": 8080,
1011 "approach": "Realistic",
2223 "versus": "servlet"
2324 }
2425 }]
25- }
26+ }
Original file line number Diff line number Diff line change 1111./wicket/src/main/java/hellowicket/BasePage.html
1212./wicket/src/main/java/hellowicket/HomePage.html
1313./wicket/src/main/java/hellowicket/World.java
14+ ./wicket/src/main/java/hellowicket/plaintext/HelloTextReference.java
15+ ./wicket/src/main/java/hellowicket/plaintext/HelloTextResource.java
1416./wicket/src/main/webapp/
1517./wicket/src/main/webapp/logo.png
1618./wicket/src/main/webapp/style.css
Original file line number Diff line number Diff line change 11package hellowicket ;
22
3+ import hellowicket .plaintext .HelloTextReference ;
34import org .apache .wicket .protocol .http .WebApplication ;
45
56/**
@@ -31,6 +32,7 @@ public void init()
3132 // mount the resources under test
3233 mountResource ("/json" , new HelloJsonReference ());
3334 mountResource ("/db" , new HelloDbReference ());
35+ mountResource ("/plaintext" , new HelloTextReference ());
3436
3537 // disable response caching to be more close to other
3638 // test applications' behavior
Original file line number Diff line number Diff line change 1+ package hellowicket .plaintext ;
2+
3+ import org .apache .wicket .request .resource .IResource ;
4+ import org .apache .wicket .request .resource .ResourceReference ;
5+
6+ public class HelloTextReference extends ResourceReference
7+ {
8+ private static final long serialVersionUID = 1L ;
9+
10+ private final HelloTextResource resource = new HelloTextResource ();
11+
12+ public HelloTextReference ()
13+ {
14+ super (HelloTextReference .class , "plaintext" );
15+ }
16+
17+ @ Override
18+ public IResource getResource ()
19+ {
20+ return resource ;
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ package hellowicket .plaintext ;
2+
3+ import java .nio .charset .Charset ;
4+
5+ import org .apache .wicket .request .resource .AbstractResource ;
6+
7+ /**
8+ * A resource that implements the requirements for
9+ * <a href="http://www.techempower.com/benchmarks/#section=code">Test type 6: Plaintext</a>
10+ */
11+ public class HelloTextResource extends AbstractResource
12+ {
13+ private static final long serialVersionUID = 1L ;
14+
15+ private static final String CONTENT_TYPE = "text/plain" ;
16+ private static final byte [] DATA = "Hello, World!" .getBytes (Charset .forName ("UTF-8" ));
17+
18+ protected ResourceResponse newResourceResponse (Attributes attributes )
19+ {
20+ ResourceResponse response = new ResourceResponse ();
21+ response .setContentType (CONTENT_TYPE );
22+ response .setContentLength (DATA .length );
23+ response .setWriteCallback (new WriteCallback () {
24+ public void writeData (Attributes attributes )
25+ {
26+ attributes .getResponse ().write (DATA );
27+ }
28+ });
29+ return response ;
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments