Examples of HttpSession


Examples of javax.servlet.http.HttpSession

      //�ж��Ƿ�վ���ĺ���
      return is_friend_of(site.getOwner().getId(),
          (loginUser != null) ? loginUser.getId() : -1);
    case SiteBean.ACCESS_MODE_SECRET_CODE:
      //�ж��Ƿ��Ѿ���������
      HttpSession ssn = request.getSession(false);
      if(ssn!=null){
        String pwd = (String)ssn.getAttribute("ACCESS_CODE_OF_SITE#"+site.getId());
        return pwd!=null && StringUtils.equals(site.getAccessCode(), pwd);
      }
    }
    return false;
  }
View Full Code Here

Examples of javax.servlet.http.HttpSession

   */
  public static SessionUserObject getLoginUser(HttpServletRequest request,
      HttpServletResponse response, boolean verify_host) {
    // ���session�м�¼��ֱ�Ӵ�session�ж�ȡ������
    Cookie uuidCookie = null;
    HttpSession ssn = request.getSession(false);
    if (ssn != null) {
      SessionUserObject user = (SessionUserObject) ssn
          .getAttribute(SESSION_USER_KEY);
      if (user != null){       
        uuidCookie = getUuidCookie(request);
        //������sessionֵ���ڣ���cookieֵҲ���ڲ���Ч
        //(��Ҫ��Լ�Ⱥ�����£��û���s1ע���ˣ�������������s2ʱ������ʾ��¼״̬)
        if(uuidCookie!=null)
          return user;
        ssn.invalidate();
        return null;
      }
    }
    String uuid = null;
    if(uuidCookie == null)
View Full Code Here

Examples of javax.servlet.http.HttpSession

   *
   * @param req
   * @param ubean
   */
  public static void updateLoginUser(HttpServletRequest req, UserBean ubean) {
    HttpSession ssn = req.getSession(true);
    if (ssn != null && ubean != null) {
      ssn.setAttribute(SESSION_USER_KEY, SessionUserObject
          .copyFrom(ubean));
    }
  }
View Full Code Here

Examples of javax.servlet.http.HttpSession

   * @see com.liusoft.dlog4j.action.UserAction#doLogin(ActionMapping,
   *      ActionForm, HttpServletRequest, HttpServletResponse)
   */
  public static SessionUserObject loginUser(HttpServletRequest req,
      HttpServletResponse res, UserBean ubean, int keepDays) {
    HttpSession ssn = req.getSession(false);
    if (ssn != null) {
      SessionUserObject rub = (SessionUserObject) ssn
          .getAttribute(SESSION_USER_KEY);
      if (rub != null && rub.getId()==ubean.getId()) {
        return rub;
      }
    }
   
    // �����û����������һ�η���ʱ���Լ����ʵ�ַ,ͬʱ��������״̬
    ubean.setLastAddr(req.getRemoteAddr());
    ubean.setLastTime(new Timestamp(System.currentTimeMillis()));
    ubean.setKeepDays(keepDays);
    ubean.setOnlineStatus(1);
    DLOGUserManager.update(ubean);

    // д��¼��Ϣ��cookie,��ʹ��session�����û�����
    UUID uuid = new UUID();
    uuid.uid = ubean.getId();
    uuid.pwdCode = ubean.getPassword().hashCode();
    uuid.host = req.getRemoteAddr();

    String value = uuid.toString();
    RequestUtils.setCookie(req, res, COOKIE_UUID_KEY, value,
        (keepDays > 0) ? keepDays * 86400 : -1);
    RequestUtils.setCookie(req, res, COOKIE_LASTLOGIN_KEY, ubean.getLastTime()
        .toString(), -1);
   
    // �û����ϱ�����Session��
    if (ssn == null)
      ssn = req.getSession(true);
    if (ssn != null && ubean != null) {
      ssn.setAttribute(SESSION_USER_KEY, SessionUserObject
          .copyFrom(ubean));
    }
    return ubean;
  }
View Full Code Here

Examples of javax.servlet.http.HttpSession

    // ���Cookie
    RequestUtils.setCookie(req, res, COOKIE_UUID_KEY, "", 0);
    RequestUtils.setCookie(req, res, COOKIE_LASTLOGIN_KEY, "", 0);

    // ���session
    HttpSession ssn = req.getSession(false);
    if (ssn != null) {
      ssn.invalidate();
    }
  }
View Full Code Here

Examples of javax.servlet.http.HttpSession

   *
   * @param req
   * @return
   */
  protected String getVerifyCode(HttpServletRequest req) {
    HttpSession ssn = req.getSession(false);
    if (ssn != null)
      return (String) ssn.getAttribute(Globals.RANDOM_LOGIN_KEY);
    return null;
  }
View Full Code Here

Examples of javax.servlet.http.HttpSession

{
  private static Logger logger = Logger.getLogger(LiteratureListDeleteHandler.class);
  public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException, CommunicationException, NamingException
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    HttpSession session = request.getSession(true);
    int individualId = ((UserObject)session.getAttribute("userobject")).getIndividualID();
    ArrayList deleteLog = new ArrayList();
   
    String rowId[] = request.getParameterValues("rowId");
    MarketingFacadeHome marketingFacadeHome = (MarketingFacadeHome)CVUtility.getHomeObject("com.centraview.marketing.marketingfacade.MarketingFacadeHome","MarketingFacade");
    try
    {
      MarketingFacade remote = (MarketingFacade)marketingFacadeHome.create();
      remote.setDataSource(dataSource);
      for (int i=0; i<rowId.length; i++)
      {
        if(rowId[i] != null && !rowId[i].equals(""))
        {         
          int elementId = Integer.parseInt(rowId[i]);
          try
          {
            remote.deleteLiterature(elementId, individualId);
          } catch(AuthorizationFailedException ae) {
            String errorMessage = ae.getExceptionDescription();
            deleteLog.add(errorMessage);
          }
        }
      }
    } catch(CreateException e) {
      logger.error("[execute] Exception thrown.", e);
      throw new CommunicationException(e.getMessage());
    }
    if (!deleteLog.isEmpty())
    {
      ActionErrors allErrors = new ActionErrors();
      allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "You do not have permission to delete one or more of the records you selected."));
      session.setAttribute("listErrorMessage", allErrors);
    }
    return new ActionForward(request.getParameter("currentPage"), true);
  }
View Full Code Here

Examples of javax.servlet.http.HttpSession

    AccountFacadeHome accountFacadeHome = (AccountFacadeHome)CVUtility.getHomeObject("com.centraview.account.accountfacade.AccountFacadeHome","AccountFacade");
    try
    {
      InvoiceForm invoiceForm = (InvoiceForm)form;

      HttpSession session = request.getSession(true);
      UserObject  userobjectd = (UserObject)session.getAttribute( "userobject" );
      int individualID = userobjectd.getIndividualID();
      session.setAttribute("highlightmodule", "account");

      request.setAttribute(AccountConstantKeys.TYPEOFSUBMODULE, AccountConstantKeys.INVOICE);
      request.setAttribute("body",AccountConstantKeys.ADD );

      int invoiceID = 0;
View Full Code Here

Examples of javax.servlet.http.HttpSession

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    try
    {
      HttpSession session = request.getSession(true);
      int individualId = ((UserObject)session.getAttribute("userobject")).getIndividualID();
      MarketingFacadeHome cfh = (MarketingFacadeHome)CVUtility.getHomeObject("com.centraview.marketing.marketingfacade.MarketingFacadeHome", "MarketingFacade");
      MarketingFacade remote = (MarketingFacade)cfh.create();
      remote.setDataSource(dataSource);
      int promotionid = Integer.parseInt(request.getParameter("promotionid").toString());
      HashMap mapPromotion = new HashMap();
View Full Code Here

Examples of javax.servlet.http.HttpSession

      Collection colschedule = new ArrayList();
      Collection colsend = new ArrayList();

      String typeofModule = "";

      HttpSession session = request.getSession(true);
      com.centraview.common.UserObject userobjectd = (com.centraview.common.UserObject)session.getAttribute("userobject"); //get the user object
      int individualId = userobjectd.getIndividualID();

      ListGenerator lg = ListGenerator.getListGenerator(dataSource);

      String moduleName = "";
View Full Code Here
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.