use of com.formkiq.stacks.api.ApiEmptyResponse in project formkiq-core by formkiq.
the class DocumentIdUrlRequestHandler method get.
@Override
public ApiRequestHandlerResponse get(final LambdaLogger logger, final ApiGatewayRequestEvent event, final ApiAuthorizer authorizer, final AwsServiceCache awsservice) throws Exception {
String documentId = event.getPathParameters().get("documentId");
String versionId = getParameter(event, "versionId");
String siteId = authorizer.getSiteId();
DocumentItem item = awsservice.documentService().findDocument(siteId, documentId);
if (item == null) {
throw new NotFoundException("Document " + documentId + " not found.");
}
URL url = getS3Url(logger, authorizer, awsservice, event, item, documentId, versionId);
return url != null ? new ApiRequestHandlerResponse(SC_OK, new ApiUrlResponse(url.toString(), documentId)) : new ApiRequestHandlerResponse(SC_NOT_FOUND, new ApiEmptyResponse());
}
Aggregations