@Override public Result adapt(final int code, final PlayWebContext context) { logger.debug("requires HTTP action: {}", code); if (code == HttpConstants.UNAUTHORIZED) { return unauthorized("authentication required"); } else if (code == HttpConstants.FORBIDDEN) { return forbidden("forbidden"); } else if (code == HttpConstants.TEMP_REDIRECT) { return redirect(context.getLocation()); } else if (code == HttpConstants.BAD_REQUEST) { return badRequest("bad request"); } else if (code == HttpConstants.OK) { final String content = context.getResponseContent(); logger.debug("render: {}", content); return ok(content).as(HttpConstants.HTML_CONTENT_TYPE); } else if (code == HttpConstants.NO_CONTENT) { return noContent(); } final String message = "Unsupported HTTP action: " + code; logger.error(message); throw new TechnicalException(message); } }
@Override public Result adapt(final int code, final PlayWebContext context) { logger.debug("requires HTTP action: {}", code); if (code == HttpConstants.UNAUTHORIZED) { return unauthorized("authentication required"); } else if (code == HttpConstants.FORBIDDEN) { return forbidden("forbidden"); } else if (code == HttpConstants.TEMP_REDIRECT) { return redirect(context.getLocation()); } else if (code == HttpConstants.BAD_REQUEST) { return badRequest("bad request"); } else if (code == HttpConstants.OK) { final String content = context.getResponseContent(); logger.debug("render: {}", content); return ok(content).as(HttpConstants.HTML_CONTENT_TYPE); } else if (code == HttpConstants.NO_CONTENT) { return noContent(); } final String message = "Unsupported HTTP action: " + code; logger.error(message); throw new TechnicalException(message); } }