Java Code Examples for play.mvc.Results#internalServerError()
The following examples show how to use
play.mvc.Results#internalServerError() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NSWikiController.java From NationStatesPlusPlus with MIT License | 5 votes |
public Result verifyNationLogin() throws IOException, SQLException { Utils.handleDefaultPostHeaders(request(), response()); Result ret = Utils.validateRequest(request(), response(), getAPI(), getDatabase(), false); if (ret != null) { return ret; } String nation = Utils.getPostValue(request(), "nation"); String password = Utils.getPostValue(request(), "password"); if (password == null || password.isEmpty() || password.length() < 8) { Logger.warn("NSWiki User [" + nation + "] attempted an invalid password: [" + password + "]"); return Results.badRequest("Invalid password"); } Logger.info("Attempting NSWiki login for " + nation); final String title; Connection conn = null; PreparedStatement select = null; ResultSet set = null; try { conn = getConnection(); select = conn.prepareStatement("SELECT title FROM assembly.nation WHERE name = ?"); select.setString(1, Utils.sanitizeName(nation)); set = select.executeQuery(); set.next(); title = set.getString(1); if (doesNSWikiUserExist(title)) { Logger.info("NSWiki Updating password for " + title); if (changePassword(conn, title, password)) { return Results.ok(); } return Results.internalServerError("Unable to change password for " + title); } } finally { DbUtils.closeQuietly(conn); DbUtils.closeQuietly(select); DbUtils.closeQuietly(set); } return createNSWikiUser(title, password); }
Example 2
Source File: NSWikiController.java From NationStatesPlusPlus with MIT License | 5 votes |
private Result createNSWikiUser(String nation, String password) throws IOException { MediaWikiBot wikibot = new MediaWikiBot("http://nswiki.org/"); wikibot.login(nswikiAdmin, nswikiPass); String result = wikibot.performAction(new CreateUser(nation, password)); if (result.toLowerCase().contains("success")) { return Results.ok(); } else { Logger.warn("Unable to create NSWiki user: " + result); return Results.internalServerError(); } }
Example 3
Source File: SunriseDefaultHttpErrorHandler.java From commercetools-sunrise-java with Apache License 2.0 | 4 votes |
private CompletionStage<Result> renderDevErrorPage(final UsefulException exception) { final SphereCredentialsUsefulException error = new SphereCredentialsUsefulException(exception); final Result result = Results.internalServerError(devError.render(playEditor, error)); return completedFuture(result); }