Package com.simpletwitter.web.controllers

Source Code of com.simpletwitter.web.controllers.Logout

package com.simpletwitter.web.controllers;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.simpletwitter.models.TwitterUser;

@Controller
@RequestMapping(value = "/twitterlogout.html")
public class Logout {
  @RequestMapping(method = RequestMethod.GET)
  public ModelAndView logout(HttpServletRequest request) {
    HttpSession session = request.getSession();
    session.invalidate();
    ModelAndView mv = new ModelAndView();
    TwitterUser tuser = new TwitterUser();
    mv.addObject("TwitterUser", tuser);
    mv.setViewName("loginorregister");
    return mv;
  }
}
TOP

Related Classes of com.simpletwitter.web.controllers.Logout

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.