Java Code Examples for com.blade.mvc.http.Response#redirect()
The following examples show how to use
com.blade.mvc.http.Response#redirect() .
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: BaseWebHook.java From tale with MIT License | 6 votes |
private boolean isRedirect(Request request, Response response) { Users user = TaleUtils.getLoginUser(); String uri = request.uri(); if (null == user) { Integer uid = TaleUtils.getCookieUid(request); if (null != uid) { user = new Users().find(uid); request.session().attribute(TaleConst.LOGIN_SESSION_KEY, user); } } if (uri.startsWith(TaleConst.ADMIN_URI) && !uri.startsWith(TaleConst.LOGIN_URI)) { if (null == user) { response.redirect(TaleConst.LOGIN_URI); return false; } request.attribute(TaleConst.PLUGINS_MENU_NAME, TaleConst.PLUGIN_MENUS); } return true; }
Example 2
Source File: AuthController.java From tale with MIT License | 5 votes |
@Route(value = "login", method = HttpMethod.GET) public String login(Response response) { if (null != this.user()) { response.redirect("/admin/index"); return null; } return "admin/login"; }
Example 3
Source File: BaseWebHook.java From tale with MIT License | 5 votes |
@Override public boolean before(Signature signature) { Request request = signature.request(); Response response = signature.response(); String uri = request.uri(); String ip = request.address(); // 禁止该ip访问 if (TaleConst.BLOCK_IPS.contains(ip)) { response.text("You have been banned, brother"); return false; } log.info("UserAgent: {}", request.userAgent()); log.info("用户访问地址: {}, 来路地址: {}", uri, ip); if (uri.startsWith(TaleConst.STATIC_URI)) { return true; } if (!TaleConst.INSTALLED && !uri.startsWith(TaleConst.INSTALL_URI)) { response.redirect(TaleConst.INSTALL_URI); return false; } if (TaleConst.INSTALLED) { return isRedirect(request, response); } return true; }
Example 4
Source File: TaleUtils.java From tale with MIT License | 2 votes |
/** * 退出登录状态 * * @param session * @param response */ public static void logout(Session session, Response response) { session.removeAttribute(TaleConst.LOGIN_SESSION_KEY); response.removeCookie(TaleConst.USER_IN_COOKIE); response.redirect(Commons.site_url()); }