@Test public void getMail_someoneElsesMail() throws Exception { final HttpResponse response = apiClient.getMail(otherUsersMailId); RestApiTestUtils.validateStatusCode(response, 403); RestApiTestUtils.validateErrors(response, "mailId"); }
public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().render(mailData); } catch (final Exception e) { log.error("Failed to parse MIME message", e); return ApiResults.internalServerError(); } }); }
MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().render(mailData); } catch (final Exception e) { log.error("Failed to parse MIME message", e); return ApiResults.internalServerError(); } }); } }
MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().render(mailData); } catch (final Exception e) { log.error("Failed to parse MIME message", e); return ApiResults.internalServerError(); } }); }  }
MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().render(mailData); } catch (final Exception e) { log.error("Failed to parse MIME message", e); return ApiResults.internalServerError(); } }); }  Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress,
                            @Attribute("userId") @DbId final Long userId, final Context context); Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId,
                          final Context context); Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId,
                                    @PathParam("attachmentName") @NotBlank final String attachmentName,
                                    @Attribute("userId") @DbId final Long userId, final Context context); Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId,
                             final Context context); }
MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().render(mailData); } catch (final Exception e) { log.error("Failed to parse MIME message", e); return ApiResults.internalServerError(); } }); }  Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress,
                            @Attribute("userId") @DbId final Long userId, final Context context); Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId,
                          final Context context); Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId,
                                    @PathParam("attachmentName") @NotBlank final String attachmentName,
                                    @Attribute("userId") @DbId final Long userId, final Context context); Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId,
                             final Context context);  }