Skip to content

Commit

Permalink
[Gepardec/mega#735] Add test post ping (revert later)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ollitod committed Sep 23, 2024
1 parent f3b4f34 commit 12f8fce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/gepardec/mega/rest/api/MailResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.eclipse.microprofile.openapi.annotations.Operation;
Expand Down Expand Up @@ -36,6 +38,7 @@ public interface MailResource {
@GET
@Path("/send-reminder")
Response sendReminder();
// service-60018822787@gcp-sa-pubsub.iam.gserviceaccount.com

/**
* The sole purpose of this endpoint is to trigger the retrieval of emails from the ZEP inbox manually.
Expand Down Expand Up @@ -63,4 +66,8 @@ public interface MailResource {
@Path("/ping")
@GET
LocalDateTime ping();

@Path("/ping")
@POST
LocalDateTime postPing(@Context HttpHeaders headers);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jakarta.annotation.security.RolesAllowed;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.Response;
import org.slf4j.Logger;

Expand Down Expand Up @@ -65,4 +66,12 @@ public Response gmailMessageReceivedWebhook(String payload) {
public LocalDateTime ping() {
return LocalDateTime.now();
}

@Override
public LocalDateTime postPing(HttpHeaders httpHeaders) {
logger.info("Received POST request");
logger.info("Headers: {}", httpHeaders.getRequestHeaders());

return LocalDateTime.now();
}
}

0 comments on commit 12f8fce

Please sign in to comment.