Wicket
  1. Wicket
  2. WICKET-4370

HttpSession getSession() in MockHttpServletRequest is not compliant with the j2ee servlet spec

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.4
    • Fix Version/s: 1.5.5, 6.0.0-beta1
    • Component/s: wicket
    • Labels:
      None

      Description

      The implementation of
      httpRequest.getSession();
      for MockHttpServletRequest seems not correct since it can return null when
      the servler api specs
      (http://docs.oracle.com/javaee/1.4/api/) says:

      public HttpSession getSession()
      Returns the current session associated with this request, or if the request
      does not have a session, creates one.

      So as far as I understand
      httpRequest.getSession(); and httpRequest.getSession(true); are equivalent

      The MockHttpServletRequest implementation is

      public HttpSession getSession()
      {
      if (session instanceof MockHttpSession &&
      ((MockHttpSession)session).isTemporary())

      { return null; }

      return session;
      }

      I think it should be
      public HttpSession getSession()

      { return getSession(true); }

        Activity

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Giovanni Cuccu
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development