forked from TechEmpower/FrameworkBenchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:TechEmpower/FrameworkBenchmarks
- Loading branch information
Showing
6 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
grizzly-bm/src/main/java/org/glassfish/grizzly/bm/PlainText2HttpHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.glassfish.grizzly.bm; | ||
|
||
import org.glassfish.grizzly.http.server.HttpHandler; | ||
import org.glassfish.grizzly.http.server.Request; | ||
import org.glassfish.grizzly.http.server.RequestExecutorProvider; | ||
import org.glassfish.grizzly.http.server.Response; | ||
import org.glassfish.grizzly.http.util.ContentType; | ||
import org.glassfish.grizzly.http.util.Header; | ||
import org.glassfish.grizzly.utils.Charsets; | ||
|
||
/** | ||
* Binary version of plain text usecase | ||
* | ||
* @see PlainTextHttpHandler | ||
*/ | ||
public class PlainText2HttpHandler extends HttpHandler { | ||
private static final ContentType CONTENT_TYPE = | ||
ContentType.newContentType("text/plain", "utf-8").prepare(); | ||
private static final byte[] HELLO_WORLD_BYTES = "Hello, World!".getBytes(Charsets.UTF8_CHARSET); | ||
|
||
@Override | ||
public void service(final Request request, final Response response) | ||
throws Exception { | ||
response.setContentType(CONTENT_TYPE); | ||
response.setHeader(Header.Server, Server.SERVER_VERSION); | ||
response.getOutputStream().write(HELLO_WORLD_BYTES); | ||
} | ||
|
||
@Override | ||
public RequestExecutorProvider getRequestExecutorProvider() { | ||
return Server.EXECUTOR_PROVIDER; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters