@Test public void testQueryMailbox() throws Exception { user.setApiToken("validToken"); user.save(); ninjaTestBrowser.makeRequest(ninjaTestServer.getBaseUrl() + "/create/temporaryMail/" + user.getApiToken() + "/mailboxquery@xcmailr.test/10"); user = User.getById(user.getId()); List<MBox> mailBoxes = user.getBoxes(); assertTrue(mailBoxes.size() == 1); final MBox tempMBox = mailBoxes.get(0); final InputStream is = getClass().getResourceAsStream("/testmails/multiPart.eml"); Assert.assertNotNull("Failed to load 'multiPart.eml'", is); final Mail mail = createMail(tempMBox, "spamme@org.com", "Multipart HTML", HelperUtils.readLimitedAmount(is, 500_000)); final String uri = ninjaTestServer.getBaseUrl() + "/mailbox/mailboxquery@xcmailr.test/validToken"; result = ninjaTestBrowser.makeRequest(uri + "?format=html"); assertTrue(result.contains("<td class=\"subject\">Multipart HTML</td>")); assertFalse(result.contains("=3D")); result = ninjaTestBrowser.makeRequest(uri + "?format=json"); assertTrue(result.contains("\"subject\":\"Multipart HTML\"")); result = ninjaTestBrowser.makeRequest(uri + "?format=header"); assertEquals(HelperUtils.getHeaderText(MimeMessageUtils.createMimeMessage(null, mail.getMessage())).replaceAll("[\r\n]+", ""), result); }
public Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress, Context context) throws Exception { if (apiToken == null || mailAddress == null) return ninja.getBadRequestResult(context, null); log.trace("passed null check"); User user = User.findUserByToken(apiToken); if (user == null) { log.error("Token invalid"); return ninja.getUnauthorizedResult(context); } String sessionKey = context.getSession().getId(); cachingSessionHandler.set(sessionKey, xcmConfiguration.COOKIE_EXPIRETIME, user); cachingSessionHandler.setSessionUser(user, sessionKey, xcmConfiguration.COOKIE_EXPIRETIME); context.getSession().put("username", user.getMail()); final String[] mailAddressParts = HelperUtils.splitMailAddress(mailAddress); final MBox mailbox = HelperUtils.checkEmailAddressValidness(mailAddressParts, xcmConfiguration.DOMAIN_LIST) ? MBox.getByName(mailAddressParts[0], mailAddressParts[1]) : null; if (mailbox == null) { log.info("Mailbox not found: " + mailAddress); return ninja.getNotFoundResult(context); } if (!mailbox.belongsTo(user.getId())) { log.error("Mailbox belongs to another user"); return ninja.getForbiddenResult(context); } List<Mail> emails = Ebean.find(Mail.class).where() .eq("mailbox_id", mailbox.getId()) .order("receiveTime") .findList(); String senderRegex = context.getParameter("from"); String subjectRegex = context.getParameter("subject"); String plainTextRegex = context.getParameter("textContent"); String htmlTextRegex = context.getParameter("htmlContent"); String headerRegex = context.getParameter("mailHeader"); boolean lastMatch = context.getParameter("lastMatch") != null; final Pattern senderPattern; final Pattern subjectPattern; final Pattern plainTextPattern; final Pattern htmlTextPattern; final Pattern headerPattern; try { senderPattern = senderRegex != null ? Pattern.compile(senderRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; subjectPattern = subjectRegex != null ? Pattern.compile(subjectRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; plainTextPattern = plainTextRegex != null ? Pattern.compile(plainTextRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; htmlTextPattern = htmlTextRegex != null ? Pattern.compile(htmlTextRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; headerPattern = headerRegex != null ? Pattern.compile(headerRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; } catch (PatternSyntaxException e) { return ninja.getBadRequestResult(context, null); } final List<MailboxEntry> entries = new LinkedList<>(); for (int i = 0; i < emails.size(); i++) { final Mail email = emails.get(i); final MailboxEntry mailboxEntry = new MailboxEntry(mailAddress, email); final MailboxEntry.Content mailContent = mailboxEntry.mailContent; if ((senderPattern == null || senderPattern.matcher(mailboxEntry.sender).find()) && (subjectPattern == null || subjectPattern.matcher(mailboxEntry.subject).find()) && (plainTextPattern == null || (mailContent != null && plainTextPattern.matcher(mailContent.text).find())) && (htmlTextPattern == null || (mailContent != null && htmlTextPattern.matcher(mailContent.html).find())) && (headerPattern == null || headerPattern.matcher(mailboxEntry.mailHeader).find())) { entries.add(mailboxEntry); } } final String formatParameter = context.getParameter("format", "html").toLowerCase(); if ((entries.size() > 1 && lastMatch) || "header".equals(formatParameter)) { if (entries.size() >= 1) { MailboxEntry lastEntry = entries.get(entries.size() - 1); entries.clear(); entries.add(lastEntry); } } if ("html".equals(formatParameter)) { return Results.html().render("accountEmails", entries).render("mailaddress", mailAddress); } else if ("json".equals(formatParameter)) { return Results.json().render(entries); } else if ("header".equals(formatParameter)) { if (entries.size() == 0 || entries.size() > 1) { return ninja.getBadRequestResult(context, null); } return Results.text().render(entries.get(0).mailHeader); } else { return ninja.getBadRequestResult(context, null); } }
BoxHandler { public Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress, Context context) throws Exception { if (apiToken == null || mailAddress == null) return ninja.getBadRequestResult(context, null); log.trace("passed null check"); User user = User.findUserByToken(apiToken); if (user == null) { log.error("Token invalid"); return ninja.getUnauthorizedResult(context); } String sessionKey = context.getSession().getId(); cachingSessionHandler.set(sessionKey, xcmConfiguration.COOKIE_EXPIRETIME, user); cachingSessionHandler.setSessionUser(user, sessionKey, xcmConfiguration.COOKIE_EXPIRETIME); context.getSession().put("username", user.getMail()); final String[] mailAddressParts = HelperUtils.splitMailAddress(mailAddress); final MBox mailbox = HelperUtils.checkEmailAddressValidness(mailAddressParts, xcmConfiguration.DOMAIN_LIST) ? MBox.getByName(mailAddressParts[0], mailAddressParts[1]) : null; if (mailbox == null) { log.info("Mailbox not found: " + mailAddress); return ninja.getNotFoundResult(context); } if (!mailbox.belongsTo(user.getId())) { log.error("Mailbox belongs to another user"); return ninja.getForbiddenResult(context); } List<Mail> emails = Ebean.find(Mail.class).where() .eq("mailbox_id", mailbox.getId()) .order("receiveTime") .findList(); String senderRegex = context.getParameter("from"); String subjectRegex = context.getParameter("subject"); String plainTextRegex = context.getParameter("textContent"); String htmlTextRegex = context.getParameter("htmlContent"); String headerRegex = context.getParameter("mailHeader"); boolean lastMatch = context.getParameter("lastMatch") != null; final Pattern senderPattern; final Pattern subjectPattern; final Pattern plainTextPattern; final Pattern htmlTextPattern; final Pattern headerPattern; try { senderPattern = senderRegex != null ? Pattern.compile(senderRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; subjectPattern = subjectRegex != null ? Pattern.compile(subjectRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; plainTextPattern = plainTextRegex != null ? Pattern.compile(plainTextRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; htmlTextPattern = htmlTextRegex != null ? Pattern.compile(htmlTextRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; headerPattern = headerRegex != null ? Pattern.compile(headerRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; } catch (PatternSyntaxException e) { return ninja.getBadRequestResult(context, null); } final List<MailboxEntry> entries = new LinkedList<>(); for (int i = 0; i < emails.size(); i++) { final Mail email = emails.get(i); final MailboxEntry mailboxEntry = new MailboxEntry(mailAddress, email); final MailboxEntry.Content mailContent = mailboxEntry.mailContent; if ((senderPattern == null || senderPattern.matcher(mailboxEntry.sender).find()) && (subjectPattern == null || subjectPattern.matcher(mailboxEntry.subject).find()) && (plainTextPattern == null || (mailContent != null && plainTextPattern.matcher(mailContent.text).find())) && (htmlTextPattern == null || (mailContent != null && htmlTextPattern.matcher(mailContent.html).find())) && (headerPattern == null || headerPattern.matcher(mailboxEntry.mailHeader).find())) { entries.add(mailboxEntry); } } final String formatParameter = context.getParameter("format", "html").toLowerCase(); if ((entries.size() > 1 && lastMatch) || "header".equals(formatParameter)) { if (entries.size() >= 1) { MailboxEntry lastEntry = entries.get(entries.size() - 1); entries.clear(); entries.add(lastEntry); } } if ("html".equals(formatParameter)) { return Results.html().render("accountEmails", entries).render("mailaddress", mailAddress); } else if ("json".equals(formatParameter)) { return Results.json().render(entries); } else if ("header".equals(formatParameter)) { if (entries.size() == 0 || entries.size() > 1) { return ninja.getBadRequestResult(context, null); } return Results.text().render(entries.get(0).mailHeader); } else { return ninja.getBadRequestResult(context, null); } } }
BoxHandler { public Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress, Context context) throws Exception { if (apiToken == null || mailAddress == null) return ninja.getBadRequestResult(context, null); log.trace("passed null check"); User user = User.findUserByToken(apiToken); if (user == null) { log.error("Token invalid"); return ninja.getUnauthorizedResult(context); } String sessionKey = context.getSession().getId(); cachingSessionHandler.set(sessionKey, xcmConfiguration.COOKIE_EXPIRETIME, user); cachingSessionHandler.setSessionUser(user, sessionKey, xcmConfiguration.COOKIE_EXPIRETIME); context.getSession().put("username", user.getMail()); final String[] mailAddressParts = HelperUtils.splitMailAddress(mailAddress); final MBox mailbox = HelperUtils.checkEmailAddressValidness(mailAddressParts, xcmConfiguration.DOMAIN_LIST) ? MBox.getByName(mailAddressParts[0], mailAddressParts[1]) : null; if (mailbox == null) { log.info("Mailbox not found: " + mailAddress); return ninja.getNotFoundResult(context); } if (!mailbox.belongsTo(user.getId())) { log.error("Mailbox belongs to another user"); return ninja.getForbiddenResult(context); } List<Mail> emails = Ebean.find(Mail.class).where() .eq("mailbox_id", mailbox.getId()) .order("receiveTime") .findList(); String senderRegex = context.getParameter("from"); String subjectRegex = context.getParameter("subject"); String plainTextRegex = context.getParameter("textContent"); String htmlTextRegex = context.getParameter("htmlContent"); String headerRegex = context.getParameter("mailHeader"); boolean lastMatch = context.getParameter("lastMatch") != null; final Pattern senderPattern; final Pattern subjectPattern; final Pattern plainTextPattern; final Pattern htmlTextPattern; final Pattern headerPattern; try { senderPattern = senderRegex != null ? Pattern.compile(senderRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; subjectPattern = subjectRegex != null ? Pattern.compile(subjectRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; plainTextPattern = plainTextRegex != null ? Pattern.compile(plainTextRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; htmlTextPattern = htmlTextRegex != null ? Pattern.compile(htmlTextRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; headerPattern = headerRegex != null ? Pattern.compile(headerRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; } catch (PatternSyntaxException e) { return ninja.getBadRequestResult(context, null); } final List<MailboxEntry> entries = new LinkedList<>(); for (int i = 0; i < emails.size(); i++) { final Mail email = emails.get(i); final MailboxEntry mailboxEntry = new MailboxEntry(mailAddress, email); final MailboxEntry.Content mailContent = mailboxEntry.mailContent; if ((senderPattern == null || senderPattern.matcher(mailboxEntry.sender).find()) && (subjectPattern == null || subjectPattern.matcher(mailboxEntry.subject).find()) && (plainTextPattern == null || (mailContent != null && plainTextPattern.matcher(mailContent.text).find())) && (htmlTextPattern == null || (mailContent != null && htmlTextPattern.matcher(mailContent.html).find())) && (headerPattern == null || headerPattern.matcher(mailboxEntry.mailHeader).find())) { entries.add(mailboxEntry); } } final String formatParameter = context.getParameter("format", "html").toLowerCase(); if ((entries.size() > 1 && lastMatch) || "header".equals(formatParameter)) { if (entries.size() >= 1) { MailboxEntry lastEntry = entries.get(entries.size() - 1); entries.clear(); entries.add(lastEntry); } } if ("html".equals(formatParameter)) { return Results.html().render("accountEmails", entries).render("mailaddress", mailAddress); } else if ("json".equals(formatParameter)) { return Results.json().render(entries); } else if ("header".equals(formatParameter)) { if (entries.size() == 0 || entries.size() > 1) { return ninja.getBadRequestResult(context, null); } return Results.text().render(entries.get(0).mailHeader); } else { return ninja.getBadRequestResult(context, null); } }  }
BoxHandler { public Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress, Context context) throws Exception { if (apiToken == null || mailAddress == null) return ninja.getBadRequestResult(context, null); log.trace("passed null check"); User user = User.findUserByToken(apiToken); if (user == null) { log.error("Token invalid"); return ninja.getUnauthorizedResult(context); } String sessionKey = context.getSession().getId(); cachingSessionHandler.set(sessionKey, xcmConfiguration.COOKIE_EXPIRETIME, user); cachingSessionHandler.setSessionUser(user, sessionKey, xcmConfiguration.COOKIE_EXPIRETIME); context.getSession().put("username", user.getMail()); final String[] mailAddressParts = HelperUtils.splitMailAddress(mailAddress); final MBox mailbox = HelperUtils.checkEmailAddressValidness(mailAddressParts, xcmConfiguration.DOMAIN_LIST) ? MBox.getByName(mailAddressParts[0], mailAddressParts[1]) : null; if (mailbox == null) { log.info("Mailbox not found: " + mailAddress); return ninja.getNotFoundResult(context); } if (!mailbox.belongsTo(user.getId())) { log.error("Mailbox belongs to another user"); return ninja.getForbiddenResult(context); } List<Mail> emails = Ebean.find(Mail.class).where() .eq("mailbox_id", mailbox.getId()) .order("receiveTime") .findList(); String senderRegex = context.getParameter("from"); String subjectRegex = context.getParameter("subject"); String plainTextRegex = context.getParameter("textContent"); String htmlTextRegex = context.getParameter("htmlContent"); String headerRegex = context.getParameter("mailHeader"); boolean lastMatch = context.getParameter("lastMatch") != null; final Pattern senderPattern; final Pattern subjectPattern; final Pattern plainTextPattern; final Pattern htmlTextPattern; final Pattern headerPattern; try { senderPattern = senderRegex != null ? Pattern.compile(senderRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; subjectPattern = subjectRegex != null ? Pattern.compile(subjectRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; plainTextPattern = plainTextRegex != null ? Pattern.compile(plainTextRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; htmlTextPattern = htmlTextRegex != null ? Pattern.compile(htmlTextRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; headerPattern = headerRegex != null ? Pattern.compile(headerRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; } catch (PatternSyntaxException e) { return ninja.getBadRequestResult(context, null); } final List<MailboxEntry> entries = new LinkedList<>(); for (int i = 0; i < emails.size(); i++) { final Mail email = emails.get(i); final MailboxEntry mailboxEntry = new MailboxEntry(mailAddress, email); final MailboxEntry.Content mailContent = mailboxEntry.mailContent; if ((senderPattern == null || senderPattern.matcher(mailboxEntry.sender).find()) && (subjectPattern == null || subjectPattern.matcher(mailboxEntry.subject).find()) && (plainTextPattern == null || (mailContent != null && plainTextPattern.matcher(mailContent.text).find())) && (htmlTextPattern == null || (mailContent != null && htmlTextPattern.matcher(mailContent.html).find())) && (headerPattern == null || headerPattern.matcher(mailboxEntry.mailHeader).find())) { entries.add(mailboxEntry); } } final String formatParameter = context.getParameter("format", "html").toLowerCase(); if ((entries.size() > 1 && lastMatch) || "header".equals(formatParameter)) { if (entries.size() >= 1) { MailboxEntry lastEntry = entries.get(entries.size() - 1); entries.clear(); entries.add(lastEntry); } } if ("html".equals(formatParameter)) { return Results.html().render("accountEmails", entries).render("mailaddress", mailAddress); } else if ("json".equals(formatParameter)) { return Results.json().render(entries); } else if ("header".equals(formatParameter)) { if (entries.size() == 0 || entries.size() > 1) { return ninja.getBadRequestResult(context, null); } return Results.text().render(entries.get(0).mailHeader); } else { return ninja.getBadRequestResult(context, null); } }  @FilterWith(SecureFilter.class) Result deleteBoxDialog(); @FilterWith(SecureFilter.class) Result editBoxDialog(); @FilterWith(SecureFilter.class) Result newDateDialog(); @FilterWith(SecureFilter.class) Result showAngularBoxOverview(Context context); @FilterWith(JsonSecureFilter.class) Result addBoxJsonData(Context context); @FilterWith(JsonSecureFilter.class) Result addBoxJsonProcess(Context context, @JSR303Validation MBox addBoxDialogData, Validation validation); @FilterWith(JsonSecureFilter.class) Result bulkDeleteBoxes(Object parameter, Context context); @FilterWith(JsonSecureFilter.class) Result bulkDisableBoxes(Object parameter, Context context); @FilterWith(JsonSecureFilter.class) Result bulkEnablePossibleBoxes(Object parameter, Context context); @FilterWith(JsonSecureFilter.class) Result bulkNewDate(Object parameter, Context context); @FilterWith(JsonSecureFilter.class) Result bulkResetBoxes(Object parameter, Context context); @FilterWith(JsonSecureFilter.class) Result deleteBoxByJson(@PathParam("id") Long boxId, Context context); @FilterWith(JsonSecureFilter.class) Result editBoxJson(Context context, @PathParam("id") Long boxId, @JSR303Validation MBox mailboxFormData,
                              Validation validation); @FilterWith(JsonSecureFilter.class) Result expireBoxJson(@PathParam("id") Long boxId, Context context); @FilterWith(JsonSecureFilter.class) Result jsonBox(Context context); @FilterWith(JsonSecureFilter.class) Result jsonDomainList(Context context); @FilterWith(JsonSecureFilter.class) Result resetBoxCounterProcessXhr(@PathParam("id") Long boxId, Context context); @FilterWith(SecureFilter.class) Result showMailsAsTextList(Context context); @FilterWith(SecureFilter.class) Result showActiveMailsAsTextList(Context context); @FilterWith(SecureFilter.class) Result showSelectedMailsAsTextList(@Param("jsonObj") String inputList, Context context); Result createTemporaryMailAddress(@PathParam("token") String apiToken,
                                             @PathParam("mailAddress") String desiredMailAddress,
                                             @PathParam("validTime") String validTime, Context context); Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress,
                               Context context); @FilterWith(SecureFilter.class) Result queryAllMailboxes(Context context, @Param("offset") final Integer offset,
                                    @Param("limit") final Integer limit, @Param("sort") String sort,
                                    @Param("order") String order, @Param("search") String search); @FilterWith(SecureFilter.class) Result downloadMailAttachment(Context context, @PathParam("downloadToken") String downloadToken,
                                         @PathParam("filename") String filename); }
BoxHandler { public Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress, Context context) throws Exception { if (apiToken == null || mailAddress == null) return ninja.getBadRequestResult(context, null); log.trace("passed null check"); User user = User.findUserByToken(apiToken); if (user == null) { log.error("Token invalid"); return ninja.getUnauthorizedResult(context); } String sessionKey = context.getSession().getId(); cachingSessionHandler.set(sessionKey, xcmConfiguration.COOKIE_EXPIRETIME, user); cachingSessionHandler.setSessionUser(user, sessionKey, xcmConfiguration.COOKIE_EXPIRETIME); context.getSession().put("username", user.getMail()); final String[] mailAddressParts = HelperUtils.splitMailAddress(mailAddress); final MBox mailbox = HelperUtils.checkEmailAddressValidness(mailAddressParts, xcmConfiguration.DOMAIN_LIST) ? MBox.getByName(mailAddressParts[0], mailAddressParts[1]) : null; if (mailbox == null) { log.info("Mailbox not found: " + mailAddress); return ninja.getNotFoundResult(context); } if (!mailbox.belongsTo(user.getId())) { log.error("Mailbox belongs to another user"); return ninja.getForbiddenResult(context); } List<Mail> emails = Ebean.find(Mail.class).where() .eq("mailbox_id", mailbox.getId()) .order("receiveTime") .findList(); String senderRegex = context.getParameter("from"); String subjectRegex = context.getParameter("subject"); String plainTextRegex = context.getParameter("textContent"); String htmlTextRegex = context.getParameter("htmlContent"); String headerRegex = context.getParameter("mailHeader"); boolean lastMatch = context.getParameter("lastMatch") != null; final Pattern senderPattern; final Pattern subjectPattern; final Pattern plainTextPattern; final Pattern htmlTextPattern; final Pattern headerPattern; try { senderPattern = senderRegex != null ? Pattern.compile(senderRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; subjectPattern = subjectRegex != null ? Pattern.compile(subjectRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; plainTextPattern = plainTextRegex != null ? Pattern.compile(plainTextRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; htmlTextPattern = htmlTextRegex != null ? Pattern.compile(htmlTextRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; headerPattern = headerRegex != null ? Pattern.compile(headerRegex, Pattern.MULTILINE | Pattern.DOTALL) : null; } catch (PatternSyntaxException e) { return ninja.getBadRequestResult(context, null); } final List<MailboxEntry> entries = new LinkedList<>(); for (int i = 0; i < emails.size(); i++) { final Mail email = emails.get(i); final MailboxEntry mailboxEntry = new MailboxEntry(mailAddress, email); final MailboxEntry.Content mailContent = mailboxEntry.mailContent; if ((senderPattern == null || senderPattern.matcher(mailboxEntry.sender).find()) && (subjectPattern == null || subjectPattern.matcher(mailboxEntry.subject).find()) && (plainTextPattern == null || (mailContent != null && plainTextPattern.matcher(mailContent.text).find())) && (htmlTextPattern == null || (mailContent != null && htmlTextPattern.matcher(mailContent.html).find())) && (headerPattern == null || headerPattern.matcher(mailboxEntry.mailHeader).find())) { entries.add(mailboxEntry); } } final String formatParameter = context.getParameter("format", "html").toLowerCase(); if ((entries.size() > 1 && lastMatch) || "header".equals(formatParameter)) { if (entries.size() >= 1) { MailboxEntry lastEntry = entries.get(entries.size() - 1); entries.clear(); entries.add(lastEntry); } } if ("html".equals(formatParameter)) { return Results.html().render("accountEmails", entries).render("mailaddress", mailAddress); } else if ("json".equals(formatParameter)) { return Results.json().render(entries); } else if ("header".equals(formatParameter)) { if (entries.size() == 0 || entries.size() > 1) { return ninja.getBadRequestResult(context, null); } return Results.text().render(entries.get(0).mailHeader); } else { return ninja.getBadRequestResult(context, null); } }  @FilterWith(SecureFilter.class) Result deleteBoxDialog(); @FilterWith(SecureFilter.class) Result editBoxDialog(); @FilterWith(SecureFilter.class) Result newDateDialog(); @FilterWith(SecureFilter.class) Result showAngularBoxOverview(Context context); @FilterWith(JsonSecureFilter.class) Result addBoxJsonData(Context context); @FilterWith(JsonSecureFilter.class) Result addBoxJsonProcess(Context context, @JSR303Validation MBox addBoxDialogData, Validation validation); @FilterWith(JsonSecureFilter.class) Result bulkDeleteBoxes(Object parameter, Context context); @FilterWith(JsonSecureFilter.class) Result bulkDisableBoxes(Object parameter, Context context); @FilterWith(JsonSecureFilter.class) Result bulkEnablePossibleBoxes(Object parameter, Context context); @FilterWith(JsonSecureFilter.class) Result bulkNewDate(Object parameter, Context context); @FilterWith(JsonSecureFilter.class) Result bulkResetBoxes(Object parameter, Context context); @FilterWith(JsonSecureFilter.class) Result deleteBoxByJson(@PathParam("id") Long boxId, Context context); @FilterWith(JsonSecureFilter.class) Result editBoxJson(Context context, @PathParam("id") Long boxId, @JSR303Validation MBox mailboxFormData,
                              Validation validation); @FilterWith(JsonSecureFilter.class) Result expireBoxJson(@PathParam("id") Long boxId, Context context); @FilterWith(JsonSecureFilter.class) Result jsonBox(Context context); @FilterWith(JsonSecureFilter.class) Result jsonDomainList(Context context); @FilterWith(JsonSecureFilter.class) Result resetBoxCounterProcessXhr(@PathParam("id") Long boxId, Context context); @FilterWith(SecureFilter.class) Result showMailsAsTextList(Context context); @FilterWith(SecureFilter.class) Result showActiveMailsAsTextList(Context context); @FilterWith(SecureFilter.class) Result showSelectedMailsAsTextList(@Param("jsonObj") String inputList, Context context); Result createTemporaryMailAddress(@PathParam("token") String apiToken,
                                             @PathParam("mailAddress") String desiredMailAddress,
                                             @PathParam("validTime") String validTime, Context context); Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress,
                               Context context); @FilterWith(SecureFilter.class) Result queryAllMailboxes(Context context, @Param("offset") final Integer offset,
                                    @Param("limit") final Integer limit, @Param("sort") String sort,
                                    @Param("order") String order, @Param("search") String search); @FilterWith(SecureFilter.class) Result downloadMailAttachment(Context context, @PathParam("downloadToken") String downloadToken,
                                         @PathParam("filename") String filename);  }