fixed produces to MediaType.APPLICATION_JSON

This commit is contained in:
Francesco Mangiacrapa 2024-10-18 16:56:04 +02:00
parent 8cea8b9aea
commit 9e3549e410
2 changed files with 37 additions and 39 deletions

View File

@ -43,7 +43,7 @@ public class GeoportalHealth {
@GET
@Path("/mongo")
@Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response databaseCheck(@QueryParam("context") String context) throws JsonProcessingException {
log.debug("databaseCheck called in the context {}", context);
if (context == null) {
@ -62,7 +62,8 @@ public class GeoportalHealth {
}
private String healthCheckSerializer(HealthCheckResponse response) throws JsonProcessingException {
// Serializes HealthCheckResponse in JSON with custom HealthCheckResponseSerializer
// Serializes HealthCheckResponse in JSON with custom
// HealthCheckResponseSerializer
return mapper.writeValueAsString(response);
}

View File

@ -25,9 +25,6 @@ public abstract class GuardedMethod<T> {
preoperations.add(preoperation);
}
private T result = null;
public GuardedMethod<T> execute() throws WebApplicationException {
@ -51,7 +48,8 @@ public abstract class GuardedMethod<T> {
throw new WebApplicationException("Environment is not properly configured", e, Status.EXPECTATION_FAILED);
} catch (InsufficientPrivileges e) {
log.error("Returning exception ", e);
throw new WebApplicationException("User has insufficient privileges for requested action", e,Status.FORBIDDEN);
throw new WebApplicationException("User has insufficient privileges for requested action", e,
Status.FORBIDDEN);
} catch (WebApplicationException e) {
log.error("Throwing Web Application Exception ", e);
throw e;
@ -75,6 +73,5 @@ public abstract class GuardedMethod<T> {
return result;
}
protected abstract T run() throws Exception, WebApplicationException;
}