package com.lemon.lifecenter.common;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class LifeCenterSessionController {
  public static void setSession( HttpServletRequest request, String key, String value ) {
    HttpSession session = request.getSession( true );
    session.setAttribute( key, value );
  }
  
  public static String getSession( HttpServletRequest request, String key ) {
    HttpSession session = request.getSession( false );
    String data = session.getAttribute( key ) == null ? "" : session.getAttribute( key ).toString();
    
    return data;
  }
  
  public static void sessionInvalidate( HttpServletRequest request ) {
    request.getSession().invalidate();
  }
}