Commit 1104af1d by Patryk Czarnik

RTime - pierwsza wersja

parent fb602487
...@@ -8,7 +8,7 @@ public class RHello { ...@@ -8,7 +8,7 @@ public class RHello {
@GET @GET
public String hello() { public String hello() {
return "Hello REST"; return "Hello <b>REST</b>";
} }
} }
package rest;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
@Path("/dt")
public class RTime {
// działa pod adresem: /dt
@GET
public String getDateTime() {
return LocalDateTime.now().toString();
}
// działa pod adresem: /dt/date
@GET
@Path("/date")
public String getDate() {
return LocalDate.now().toString();
}
@GET
@Path("/time")
public String getTime() {
return LocalTime.now().toString();
}
@GET
@Path("/time/second")
public int getSecond() {
return LocalTime.now().getSecond();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment