Package javax.servlet.http

Examples of javax.servlet.http.HttpSession


    c.readAnnotations(action.getClass());
    Map<String, InjectionWrapper> inputs = c.getInjectionMap();

    HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
    HttpSession session = EasyMock.createMock(HttpSession.class);

    expect(request.getSession(false)).andReturn(null);
    expect(request.getSession()).andReturn(session);
    session.setAttribute(eq("autoCreateSession"), anyObject());

    replay(request);
    replay(session);

    InjectionWrapper inputWrapper = inputs.get("autoCreateSession");
View Full Code Here


    c.readAnnotations(action.getClass());
    Map<String, InjectionWrapper> inputs = c.getInjectionMap();

    HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
    HttpSession session = EasyMock.createMock(HttpSession.class);

    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute("requiredSessionAttribute")).andReturn(null);

    replay(request);
    replay(session);

    InjectionWrapper inputWrapper = inputs.get("requiredSessionAttribute");
View Full Code Here

    c.readAnnotations(action.getClass());
    Map<String, InjectionWrapper> inputs = c.getInjectionMap();

    HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
    HttpSession session = EasyMock.createMock(HttpSession.class);

    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute("requiredAutoCreateSessionAttribute")).andReturn(null);

    replay(request);
    replay(session);

    InjectionWrapper inputWrapper = inputs.get("requiredAutoCreateSessionAttribute");
View Full Code Here

  public void testPreValidate()
  {

    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    HttpSession session = createStrictMock(HttpSession.class);

    replay(mapping);
    replay(request);
    replay(session);
View Full Code Here

  @Test
  public void testPostValidateFailed()
  {

    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    HttpSession session = createStrictMock(HttpSession.class);

    final ActionErrors actionErrors = new ActionErrors();
    EasyMock.expect(request.getAttribute(Globals.ERROR_KEY)).andReturn(actionErrors);
    EasyMock.expect(request.getSession()).andReturn(session);
    session.setAttribute(Globals.ERROR_KEY, actionErrors);
   
    replay(request);
    replay(session);

    FormValidationHandlerImpl delegate = new FormValidationHandlerImpl();
View Full Code Here

    NavigableLookupDispatchAction actionBean = createMock(NavigableLookupDispatchAction.class);

    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);

    action.setServlet(servlet);

    actionBean.preBind();
    form.bindInwards(actionBean);
    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("Insert Stuff Here");
    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.findMessageResourcesConfigs()).andReturn(new MessageResourcesConfig[]
    {
      new MessageResourcesConfig()
    });
View Full Code Here

    NavigableLookupDispatchAction actionBean = createMock(NavigableLookupDispatchAction.class);

    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);

    action.setServlet(servlet);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("Insert Stuff Here");
    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.findMessageResourcesConfigs()).andReturn(new MessageResourcesConfig[]
    {
      new MessageResourcesConfig()
    });
View Full Code Here

  @WebMethod
  @WebResult(name = "stringOut", partName = "stringOut")
  public String test1StringInStringOut(
      @WebParam(name = "string", partName = "string") String string) {
    HttpServletRequest request = (HttpServletRequest)Fiber.current().getPacket().get(MessageContext.SERVLET_REQUEST);
    HttpSession session = request.getSession(true);
    if(session != null){
      Object sessionAttr = session.getAttribute("sessionAttr");
      session.setAttribute("sessionAttr", string);
      if(sessionAttr != null){
        return sessionAttr.toString();
      }
    }
    return string;
View Full Code Here

      //�ж��Ƿ�վ���ĺ���
      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

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

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.