@POST
@Path("/{apiRequestId}/resend")
public Response resendEmailMessage(@Context ServletContext context, @PathParam("apiRequestId") String apiRequestId) throws Exception {
ApiRequest apiRequest = config.getApiRequestStore().getByApiRequestId(apiRequestId);
EmailPush push = (EmailPush)apiRequest.getPush();
if (useAwsEmail()) {
new AwsEmailDelegate(config.getObjectMapper(), config.getApiRequestStore(), account, apiClient, apiRequest, push).resend();
} else {
new SmtpEmailDelegate(config.getObjectMapper(), config.getApiRequestStore(), account, apiClient, apiRequest, push).resend();
}
// Do not use the old References - they need to be reloaded.
apiRequest = config.getApiRequestStore().getByApiRequestId(apiRequestId);
push = (EmailPush)apiRequest.getPush();
EmailModel model = new EmailModel(account, apiClient, apiRequest, push);
String path = String.format("%s/manage/api-client/%s/emails/%s", context.getContextPath(), apiClient.getClientName(), apiRequest.getApiRequestId());
return Response.seeOther(new URI(path)).build();
}