Package javax.servlet.http

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


   * @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

    // ���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

   *
   * @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

{
  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

    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

  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

      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

    try
    {

      DynaActionForm dynaForm = (DynaActionForm)form;

      HttpSession session = request.getSession(true);

      String typeOfSave = "save";
      int individualID = 0;
      UserObject userObject = (UserObject)session.getAttribute("userobject");

    UserPrefererences userPrefererences = userObject.getUserPref();

      // no need to check for null on userobjectd here, because if it is null
      // we should fail now! instead of making an EJB call with bogus info.    
      individualID = userObject.getIndividualID();

      if (request.getParameter("buttonpress") != null)
      {
        typeOfSave = request.getParameter("buttonpress");
        String minutes = (String) (dynaForm.get("minutes"));
        String seconds = (String) (dynaForm.get("seconds"));
        Vector vec = new Vector();
        PreferenceVO pvo1 = new PreferenceVO();
        PreferenceVO pvo2 = new PreferenceVO();
        PreferenceVO pvo3 = new PreferenceVO();
        pvo1.setModuleId(4);
        pvo1.setPreferenceName("calendarrefreshmin");
        pvo1.setPreferenceValue(minutes);
        pvo2.setModuleId(4);
        pvo2.setPreferenceName("calendarrefreshsec");
        pvo2.setPreferenceValue(seconds);
        pvo3.setModuleId(4);
        pvo3.setPreferenceName("caldefaultview");
        pvo3.setPreferenceValue((String) (dynaForm.get("radio")));

        if(minutes != null && !minutes.equals("") && !minutes.equals("null")
              && seconds != null && !seconds.equals("") && !seconds.equals("null"))
        {
            userPrefererences.setCalendarRefreshMin(minutes);
          userPrefererences.setCalendarRefreshSec(seconds);
          userObject.setUserPref(userPrefererences);
          session.setAttribute("userobject",userObject);
        }
       
        if(dynaForm.get("radio") != null)
        {
          userPrefererences.setCalendarDefaultView((String) dynaForm.get("radio"));
          userObject.setUserPref(userPrefererences);
          session.setAttribute("userobject",userObject);
        }
       
        vec.addElement(pvo1);
        vec.addElement(pvo2);
        vec.addElement(pvo3);
        PreferenceHome prefHome = (PreferenceHome)CVUtility.getHomeObject("com.centraview.preference.PreferenceHome", "Preference");
        Preference prefRemote = prefHome.create();
        prefRemote.setDataSource(dataSource);
        prefRemote.updateUserPreference(individualID, vec);
        FORWARD_final = FORWARD_save;
        request.setAttribute("TYPEOFOPERATION", "EDIT");
        session.setAttribute("userobject", userObject);

      }

      request.setAttribute(AdminConstantKeys.PREFERENCEPAGE, "CALENDAR");
      FORWARD_final = FORWARD_save;
View Full Code Here

      PurchaseOrderForm purchaseForm = (PurchaseOrderForm)form;
      purchaseForm.convertItemLines();

      ItemLines itemLines = null;

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

      request.setAttribute(AccountConstantKeys.TYPEOFSUBMODULE, AccountConstantKeys.PURCHASEORDER);

      request.setAttribute("body",AccountConstantKeys.EDIT);
View Full Code Here

TOP

Related Classes of javax.servlet.http.HttpSession

Copyright © 2018 www.massapicom. 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.