List of usage examples for javax.servlet.http HttpServletResponse sendRedirect
public void sendRedirect(String location) throws IOException;
From source file:it.smartcommunitylab.carpooling.controllers.UserAuthController.java
@RequestMapping("/userlogin") public void login(HttpServletResponse response) throws IOException { String url = service.generateAuthorizationURIForCodeFlow(env.getProperty("ext.redirect"), null, null, null); response.sendRedirect(url); }
From source file:org.myjerry.evenstar.web.author.DeletePostController.java
public ModelAndView confirmedDeletePost(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView mav = null;//from w ww .jav a 2s.com String blogID = request.getParameter("blogID"); String postID = request.getParameter("postID"); boolean result = this.blogPostService.deletePost(new Long(postID), new Long(blogID)); if (result) { response.sendRedirect("/author/editPosts.html?blogID=" + blogID); } else { mav = new ModelAndView(); mav.addObject("errorString", "Unable to delete the post"); mav.setViewName(".author.deletePost"); } // delete the post // if successful redirect to editPosts.html return mav; }
From source file:com.github.adam6806.mediarequest.StoreRequest.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(false); if (session != null) { } else {/*from w ww . ja va 2s. com*/ try { response.setContentType("text/html"); PrintWriter pw = response.getWriter(); response.sendRedirect("http://pirateofdw.gotdns.com/Login"); pw.close(); } catch (IOException ex) { Logger.getLogger(StoreRequest.class.getName()).log(Level.SEVERE, null, ex); } } try { connection = datasource.getConnection(); if (request.getParameter("request").equalsIgnoreCase("data-request")) { response.getWriter().write(getResultJSON(connection)); } else { String name = request.getParameter("medianame"); DSLContext create = DSL.using(connection, SQLDialect.POSTGRES); InsertSetMoreStep<RequestRecord> set = create.insertInto(REQUEST).set(REQUEST.DESCRIPTION, name) .set(REQUEST.MEDIAID, name).set(REQUEST.POSTERIMAGEURL, name).set(REQUEST.REQUESTDATE, name) .set(REQUEST.EMAIL, name).set(REQUEST.ISMOVIE, true); set.execute(); response.getWriter().write(getResultJSON(connection)); emailService.sendMail("asmith0935@gmail.com", name, name); } response.setStatus(200); } catch (SQLException | IOException ex) { Logger.getLogger(StoreRequest.class.getName()).log(Level.SEVERE, null, ex); response.setStatus(500); } }
From source file:pivotal.au.se.gemfirexdweb.controller.AddLoaderController.java
@RequestMapping(value = "/addloader", method = RequestMethod.GET) public String createLoader(Model model, HttpServletResponse response, HttpServletRequest request, HttpSession session) throws Exception { if (session.getAttribute("user_key") == null) { logger.debug("user_key is null new Login required"); response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } else {// w w w .j a v a 2s .co m Connection conn = AdminUtil.getConnection((String) session.getAttribute("user_key")); if (conn == null) { response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } else { if (conn.isClosed()) { response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } } } logger.debug("Received request to add new Table Loader"); AddLoader loaderAttribute = new AddLoader(); if (request.getParameter("tableName") != null) { loaderAttribute.setTableName(request.getParameter("tableName")); } if (request.getParameter("schemaName") != null) { loaderAttribute.setSchemaName(request.getParameter("schemaName")); } model.addAttribute("loaderAttribute", loaderAttribute); // This will resolve to /WEB-INF/jsp/addloader.jsp return "addloader"; }
From source file:pivotal.au.se.gemfirexdweb.controller.ReportsController.java
@RequestMapping(value = "/displayqueryreports", method = RequestMethod.GET) public String showQueryReports(Model model, HttpServletResponse response, HttpServletRequest request, HttpSession session) throws Exception { if (session.getAttribute("user_key") == null) { logger.debug("user_key is null new Login required"); response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } else {//from www. j a v a 2s. c om Connection conn = AdminUtil.getConnection((String) session.getAttribute("user_key")); if (conn == null) { response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } else { if (conn.isClosed()) { response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } } } logger.debug("Received request to show all query reports"); QueryBeanReader reader = QueryBeanReader.getInstance(); List<String> qlBeanNames = Arrays.asList(reader.getQueryListBeans()); List queries = new ArrayList(); List headerNames = new ArrayList(); int i = 0; for (String beanName : qlBeanNames) { i++; QueryList ql = reader.getQueryListBean(beanName); headerNames.add(ql.getDescription()); queries.add(ql.getQueryList()); } model.addAttribute("queries", queries); model.addAttribute("headerNames", headerNames); // This will resolve to /WEB-INF/jsp/reports.jsp return "reports"; }
From source file:com.starr.smartbuilds.controller.RegController.java
@RequestMapping(method = { RequestMethod.POST }) public String regUser(@ModelAttribute("user") User user, Model model, HttpServletRequest req, HttpServletResponse resp) throws IOException, ParseException { HttpSession session = req.getSession(); User userr = (User) session.getAttribute("user"); if (userr == null) { model.addAttribute("authMsg", "<a href='./auth'>Log in</a>"); model.addAttribute("exitReg", "<a href='./reg'>Register</a>"); } else {/* w w w. jav a2 s . c om*/ resp.sendRedirect("./"); } String regMsg = regService.registerUser(user); model.addAttribute("user", new User()); model.addAttribute("result", regMsg); return "register"; }
From source file:pivotal.au.se.gemfirexdweb.controller.AddWriterController.java
@RequestMapping(value = "/addwriter", method = RequestMethod.GET) public String createWriter(Model model, HttpServletResponse response, HttpServletRequest request, HttpSession session) throws Exception { if (session.getAttribute("user_key") == null) { logger.debug("user_key is null new Login required"); response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } else {/*from w w w . ja va2s . c o m*/ Connection conn = AdminUtil.getConnection((String) session.getAttribute("user_key")); if (conn == null) { response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } else { if (conn.isClosed()) { response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } } } logger.debug("Received request to add new Table Writer"); AddWriter writerAttribute = new AddWriter(); if (request.getParameter("tableName") != null) { writerAttribute.setTableName(request.getParameter("tableName")); } if (request.getParameter("schemaName") != null) { writerAttribute.setSchemaName(request.getParameter("schemaName")); } model.addAttribute("writerAttribute", writerAttribute); // This will resolve to /WEB-INF/jsp/addwriter.jsp return "addwriter"; }
From source file:org.myjerry.evenstar.web.admin.DefaultBlogController.java
public ModelAndView setDefaultBlog(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView mav = null;//from w w w .j a v a 2 s .c o m String blogID = request.getParameter("blogID"); Long id = null; if (StringUtils.isNotEmpty(blogID)) { id = new Long(blogID); } boolean result = this.blogService.setDefaultBlogID(id); if (result) { response.sendRedirect("/admin.html"); } else { mav = view(request, response); mav.addObject("errorString", "Unable to set default blog."); } return mav; }
From source file:pivotal.au.se.gemfirexdweb.controller.CreateDiskStoreController.java
@RequestMapping(value = "/creatediskstore", method = RequestMethod.GET) public String createDiskStore(Model model, HttpServletResponse response, HttpServletRequest request, HttpSession session) throws Exception { if (session.getAttribute("user_key") == null) { logger.debug("user_key is null new Login required"); response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } else {// www. j a va2 s . c o m Connection conn = AdminUtil.getConnection((String) session.getAttribute("user_key")); if (conn == null) { response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } else { if (conn.isClosed()) { response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login"); return null; } } } logger.debug("Received request to create a new Disk Store"); model.addAttribute("diskStoreAttribute", new NewDiskStore()); // This will resolve to /WEB-INF/jsp/create-hdfsstore.jsp return "create-diskstore"; }
From source file:io.muic.ooc.webapp.servlet.UserAddServlet.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { boolean authorized = securityService.isAuthorized(request); if (authorized) { // do MVC in here RequestDispatcher rd = request.getRequestDispatcher("WEB-INF/adduser.jsp"); rd.include(request, response);/*from w ww.j a v a2 s.co m*/ } else { response.sendRedirect("/"); } }