com.wx.spring.controller.UserController.java Source code

Java tutorial

Introduction

Here is the source code for com.wx.spring.controller.UserController.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.wx.spring.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.wx.spring.interceptor.OAuthRequired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/** 
 * ??OAuth2 
 * @author Sunlight 
 * 
 */
@Controller
public class UserController {
    /** 
     * ?@OAuthRequired 
     * @param model 
     * @return 
     */
    @RequestMapping(value = { "/userInfo.do" })
    @OAuthRequired
    public String load(HttpServletRequest request, Model model) {
        System.out.println("Load a User!");
        HttpSession session = request.getSession();
        model.addAttribute("Userid", session.getAttribute("Userid"));
        return "user";
    }
}