|
@@ -8,9 +8,19 @@ import javax.ws.rs.core.MediaType;
|
|
|
@Path("/plaintext")
|
|
|
@Produces(MediaType.TEXT_PLAIN)
|
|
|
public class TextResource {
|
|
|
+ private static final String MESSAGE = "Hello, World!";
|
|
|
+ private static final byte[] buffer;
|
|
|
|
|
|
- @GET
|
|
|
- public String sayHello() {
|
|
|
- return "Hello, World!";
|
|
|
- }
|
|
|
+ static {
|
|
|
+ try {
|
|
|
+ buffer = MESSAGE.getBytes("US-ASCII");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GET
|
|
|
+ public byte[] sayHello() {
|
|
|
+ return buffer;
|
|
|
+ }
|
|
|
}
|