[wip] praktikum4
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
package org.example.webservice;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
@ApplicationPath("/")
|
||||||
|
public class ApplicationConfig extends Application {
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.Produces;
|
||||||
|
import jakarta.ws.rs.core.MediaType;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
@Path("/time")
|
||||||
|
public class TimeService {
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.TEXT_PLAIN)
|
||||||
|
public String getTime() {
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss");
|
||||||
|
return "Aktuelle Serverzeit: " + now.format(formatter);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user