Код: Выделить всё
implementation("com.google.code.gson:gson:2.11.0")
Код: Выделить всё
@Named
@Path("/")
public class UsersJSONController {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/get-all-users")
public Response getAllUsersJSON() {
LOGGER.info(">>>>> UsersJSONController getAllUsersJSON .....");
String json = usersJSONEJB.getAllUsersJSON();
LOGGER.info(">>>>> 1.6 UsersJSONEJB getAllUsersJSON = {}", json);
return Response.ok(json, MediaType.APPLICATION_JSON).build();
}
}
Код: Выделить всё
curl -v http://127.0.0.1:8080/get-all-users/
* Trying 127.0.0.1:8080...
* Connected to 127.0.0.1 (127.0.0.1) port 8080
> GET /get-all-users/ HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 404 Not Found
< Connection: keep-alive
< Content-Length: 74
< Content-Type: text/html
< Date: Sun, 04 Aug 2024 17:07:07 GMT
<
* Connection #0 to host 127.0.0.1 left intact
Error404 - Not Found
- macOS Sonoma 14.6
- gson 2.11.0< /li>
curl 8.9.1 - WildFly Distribution — 33.0.0.Final
- Jakarta EE 10.0.0 & 11.0.0-M4
- JDK 22.0.2
- Kotlin 2.0.0
- Mojarra 4.1.0
Подробнее здесь: https://stackoverflow.com/questions/788 ... t-response