-
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.
- Loading branch information
Showing
2 changed files
with
48 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package helloworld; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.Application; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
@Path("/hello") | ||
public class HelloWorld extends Application { | ||
@GET | ||
@Produces(MediaType.TEXT_HTML) | ||
public String getDataHTML() { | ||
return """ | ||
<html> | ||
<head></head> | ||
<body>Hello World (HTML text)!!!</body> | ||
</html> | ||
"""; | ||
} | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String getDataPlain() { | ||
return "Hello World (plain text)"; | ||
} | ||
@GET | ||
@Path("/xml") | ||
@Produces(MediaType.TEXT_XML) | ||
public String getDataXML() { | ||
return "<helloworld.HelloWorld>Hello World (XML text)!!!</helloworld.HelloWorld>"; | ||
} | ||
@GET | ||
@Path("/json") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public String getDataJSON() { | ||
return "{\"val\":\"helloworld.HelloWorld\"}"; | ||
} | ||
|
||
} |
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