Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Repurposed plain text status checks for the APIs into simple json check. #6962

Merged
merged 3 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,12 @@ public Response viewSwaggerO2c() {
* @return Plain text message indicating health of service
*/
@GET
@Produces(value = { MediaType.TEXT_PLAIN })
@Produces(value = { MediaType.APPLICATION_JSON })
@Path(STATUS_PATH)
public Response viewStatusText() {
return serviceDelegator.viewStatusText();
public Response viewStatusSimple() {
httpRequest.setAttribute("skipAccessLog", true);
httpRequest.setAttribute("isMonitoring", true);
return serviceDelegator.viewStatusSimple();
}

@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface MemberV3ApiServiceDelegator<DISTINCTION, EDUCATION, EMPLOYMENT,

static final String LATEST_V3_VERSION = "3.0";

Response viewStatusText();
Response viewStatusSimple();

Response viewStatus();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,9 @@ public void setFilterVersionOfIdentifiers(Boolean filterVersionOfIdentifiers) {
}

@Override
public Response viewStatusText() {
return Response.ok(STATUS_OK_MESSAGE).build();
public Response viewStatusSimple() {
Map<String, Boolean> statusMap = statusManager.createStatusMapSimple();
return Response.ok(statusMap).build();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<sec:http pattern="/v3**/o2c.html" security="none"/>

<!-- Status check -->
<sec:http pattern="/v*/status" security="none"/>
<sec:http pattern="/v*/apiStatus" security="none"/>

<!-- Authenticate the client before reaching the token endpoint -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ public interface StatusManager {
String TOMCAT_UP = "tomcatUp";

Map<String, Boolean> createStatusMap();

Map<String, Boolean> createStatusMapSimple();

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public Map<String, Boolean> createStatusMap() {
return result;
}

@Override
public Map<String, Boolean> createStatusMapSimple() {
Map<String, Boolean> result = new LinkedHashMap<>();
result.put(TOMCAT_UP, true);
return result;
}

private boolean isConnectionOk(MiscDao miscDao) {
try {
Date dbDate = miscDao.retrieveDatabaseDatetime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,12 @@ public Response viewSwagger() {


@GET
@Produces(value = { MediaType.TEXT_PLAIN })
@Produces(value = { MediaType.APPLICATION_JSON })
@Path(STATUS_PATH)
public Response viewStatusText() {
return serviceDelegator.viewStatusText();
public Response viewStatusSimple() {
httpRequest.setAttribute("skipAccessLog", true);
httpRequest.setAttribute("isMonitoring", true);
return serviceDelegator.viewStatusSimple();
}

@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface PublicV3ApiServiceDelegator<DISTINCTION, EDUCATION, EMPLOYMENT,

static final String LATEST_V3_VERSION = "3.0";

Response viewStatusText();
Response viewStatusSimple();

Response viewStatus();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ public void setFilterVersionOfIdentifiers(Boolean filterVersionOfIdentifiers) {
}

@Override
public Response viewStatusText() {
return Response.ok(STATUS_OK_MESSAGE).build();
public Response viewStatusSimple() {
Map<String, Boolean> statusMap = statusManager.createStatusMapSimple();
return Response.ok(statusMap).build();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public void setPublicV3ApiServiceDelegator(
}

@Override
public Response viewStatusText() {
return publicV3ApiServiceDelegator.viewStatusText();
public Response viewStatusSimple() {
return publicV3ApiServiceDelegator.viewStatusSimple();
}

@Override
Expand Down
Loading