This commit is contained in:
MGislv 2024-04-22 09:35:52 +02:00
parent 3992e0dd83
commit 0dbe0652b6
2 changed files with 34 additions and 6 deletions

View File

@ -23,6 +23,11 @@ dependencies {
// This dependency is used by the application.
implementation(libs.guava)
// JSON
implementation("com.google.code.gson:gson:2.10.1")
compileOnly("jakarta.platform:jakarta.jakartaee-core-api:11.0.0-M2")
}
// Apply a specific Java toolchain to ease working on different environments.

View File

@ -1,11 +1,34 @@
/*
* This source file was generated by the Gradle 'init' task
*/
package org.example;
/*
* This source file was generated by the Gradle 'init' task
*/
package org.example;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.UriInfo;
import com.google.gson;
@Path("app")
public class App {
public String getGreeting() {
return "Hello World!";
@Context
private UriInfo context;
/** Creates a new instance of HelloWorld */
public HelloWorld() {
}
/**
* Retrieves representation of an instance of helloWorld.HelloWorld
* @return an instance of java.lang.String
*/
@GET
@Produces("text/html")
public String getHtml() {
return "<html lang=\"en\"><body><h1>Hello, World!!</h1></body></html>";
}
public static void main(String[] args) {