com.feilong.controller.TestController.java Source code

Java tutorial

Introduction

Here is the source code for com.feilong.controller.TestController.java

Source

/**
 * Copyright (c) 2008-2014 FeiLong, Inc. All Rights Reserved.
 * <p>
 *    This software is the confidential and proprietary information of FeiLong Network Technology, Inc. ("Confidential Information").  <br>
 *    You shall not disclose such Confidential Information and shall use it 
 *  only in accordance with the terms of the license agreement you entered into with FeiLong.
 * </p>
 * <p>
 *    FeiLong MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, 
 *    INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 *    PURPOSE, OR NON-INFRINGEMENT. <br> 
 *    FeiLong SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
 *    THIS SOFTWARE OR ITS DERIVATIVES.
 * </p>
 */
package com.feilong.controller;

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

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.view.UrlBasedViewResolver;

/**
 * @author <a href="mailto:venusdrogon@163.com"></a>
 * @version 1.0 2012-3-18 ?11:32:05
 */
@Controller
@SuppressWarnings("all")
public class TestController {

    @SuppressWarnings("unused")
    private static final Logger log = LoggerFactory.getLogger(TestController.class);

    @RequestMapping("/helloworld")
    public String hello() {
        return "feilong.helloworld";
    }

    @RequestMapping("/helloworld1")
    public String test1(HttpServletRequest request, HttpSession session, HttpServletResponse response) {

        session.setAttribute("name", "?");
        request.setAttribute("name", "");
        session.getServletContext().setAttribute("name", "?");

        return UrlBasedViewResolver.REDIRECT_URL_PREFIX + "/index";
    }

}