List of usage examples for javax.servlet.http HttpServletResponse sendRedirect
public void sendRedirect(String location) throws IOException;
From source file:Controller.KaryawanController.java
@RequestMapping(value = "ProsesHapusKaryawan.htm", method = RequestMethod.GET) public void ProsesHapusAdmin(HttpServletResponse response, @RequestParam(value = "id", required = false) int id) throws IOException { KaryawanImplement ai = new KaryawanImplement(); Karyawan a = ai.getByID(id);//from w w w. ja va 2 s. c om ai.delete(a); response.sendRedirect("TampilAllKaryawan.htm"); }
From source file:org.chos.transaction.passport.controller.BusinessPassportController.java
@RequestMapping(value = "/business/register") public String input(HttpServletRequest request, HttpServletResponse response, Model model) throws IOException { Session session = httpContextSessionManager.getSession(request); if (session == null) { response.sendRedirect("../login.shtml?returnUrl=/business/register.shtml"); }/* w ww . j a va 2 s. c om*/ Merchant merchant = userService.getMerchantByUserId(session.getUserId()); if (merchant != null) { response.sendRedirect("/merchant/1234.shtml"); } return "business/register-businesses"; }
From source file:com.redhat.rhn.frontend.servlets.EnvironmentFilter.java
private void redirectToSecure(HttpServletRequest request, HttpServletResponse response) throws IOException { String originalUrl = request.getRequestURL().toString(); String secureUrl = "https://" + originalUrl.substring(7); response.sendRedirect(secureUrl); return;/*from w w w. j a v a2 s . c om*/ }
From source file:dijalmasilva.controllers.ControladorUser.java
@RequestMapping("/logout") public void logout(HttpServletRequest req, HttpServletResponse resp) throws IOException { req.getSession().invalidate();//from ww w . j a va2s . c o m resp.sendRedirect("/home"); }
From source file:com.museum_web.controller.ThemeController.java
@RequestMapping("actions/SaveTheme") public void saveTheme(Theme theme, HttpServletRequest request, HttpServletResponse response) throws Exception { if (theme.getId() == 0) { theme.setId(null);//from w ww .java 2 s . c o m new ThemeService().createTheme(theme); } else { new ThemeService().editTheme(theme); } response.sendRedirect("../theme"); }
From source file:com.wavemaker.tools.security.CloudFoundrySecurityFilter.java
private void redirectToSpinup(HttpServletResponse response) throws IOException { String controllerUrl = CloudFoundryUtils.getControllerUrl(); String spinupUrl = controllerUrl.replace("api.", "WaveMaker."); response.sendRedirect(spinupUrl); }
From source file:alpha.portal.webapp.controller.CardAssignFormController.java
/** * Return to case.//from w ww .j av a 2 s .c o m * * @param response * the response * @param caseId * the case id * @param cardId * the card id * @throws IOException * Signals that an I/O exception has occurred. */ private void returnToCase(final HttpServletResponse response, final String caseId, final String cardId) throws IOException { response.sendRedirect("caseform?caseId=" + caseId + "&activeCardId=" + cardId); }
From source file:com.glaf.base.modules.sys.springmvc.MyMenuController.java
@RequestMapping(params = "method=jump") public void jump(HttpServletRequest request, HttpServletResponse response) { LoginContext loginContext = RequestUtils.getLoginContext(request); if (loginContext == null) { try {/* www .ja v a2 s. com*/ response.sendRedirect(request.getContextPath() + "/index.jsp"); return; } catch (IOException ex) { } } String menuId = request.getParameter("menuId"); if (menuId != null) { menuId = RequestUtils.decodeString(menuId); logger.debug("->menuId:" + menuId); } else { menuId = request.getParameter("id"); } if (menuId != null && StringUtils.isNumeric(menuId)) { TreeModel treeModel = sysApplicationService.getTreeModelByAppId(Long.parseLong(menuId)); if (treeModel != null) { try { String url = treeModel.getUrl(); if (url != null) { if (!(url.toLowerCase().startsWith("http://") || url.toLowerCase().startsWith("https://"))) { if (url.startsWith("/")) { url = request.getContextPath() + url; } else { url = request.getContextPath() + "/" + url; } } if (url.indexOf("?") != -1) { url = url + "&time=" + System.currentTimeMillis(); } else { url = url + "?time=" + System.currentTimeMillis(); } response.sendRedirect(url); } else { return; } } catch (IOException ex) { ex.printStackTrace(); } } } try { request.getRequestDispatcher("/WEB-INF/views/404.jsp").forward(request, response); } catch (Exception e) { } }
From source file:net.solarnetwork.node.setup.web.NodeAssociationFilter.java
private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { final String path = request.getPathInfo(); if (!path.startsWith(NODE_ASSOCIATE_PATH) && identityService.getNodeId() == null) { response.sendRedirect(request.getContextPath() + NODE_ASSOCIATE_PATH); } else {//from w w w. j a v a 2 s . c o m chain.doFilter(request, response); } }
From source file:com.google.sampling.experiential.server.WhitelistFilter.java
@Override public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException { User user = UserServiceFactory.getUserService().getCurrentUser(); String email = user == null ? null : user.getEmail().toLowerCase(); if (!isDevServer((HttpServletRequest) arg0) && (user == null)) { log.info("Error logging in from: " + arg0.getRemoteAddr() + " user: " + (user != null ? email : "not logged in")); HttpServletResponse resp = (HttpServletResponse) arg1; String loginUrl = UserServiceFactory.getUserService() .createLoginURL(((HttpServletRequest) arg0).getRequestURL().toString(), "google.com"); resp.sendRedirect(loginUrl); } else if (!allowed(email)) { ((HttpServletResponse) arg1).sendError(HttpStatus.SC_FORBIDDEN); } else {//from w w w.j a va2 s .c o m log.info("Allowing user: " + email); arg2.doFilter(arg0, arg1); } }