#2 Track RequestDispatcher name


With our servlets, we want to test that the proper path
is used to calls to
ServletRequest.getRequestDispatcher() and
ServletContext.getNamedDispatcher(). I've attached a
small patch that exposes the supplied path/name
argument, for your approval.
I also had to make a small modification to
MockHttpServletResponseTest, because the current
testHeaders() method will fail if run in another timezone.


  • Brian Sanders

    Brian Sanders - 2004-07-09

    Patch for classes in com.mockrunner.mock.web and com.mockrunner.test.web

  • Alwin Ibba

    Alwin Ibba - 2004-07-10
    • assigned_to: nobody --> aibba
  • Alwin Ibba

    Alwin Ibba - 2004-07-10

    Logged In: YES

    Hi Brian,

    Thank you for your patch.

    I applied it with some modifications:

    - I renamed set/getName to set/getPath in MockRequestDispatcher

    - The HttpServletRequest and ServletContext now stores a Map
    of all created path/names with the corresponding
    RequestDispatcher objects. It's possible to check the Map
    for existing path/names. It's also possible (but not
    necessary) to preload RequestDispatcher objects that are
    returned on a specified path/name.

    I think the modified version also fits your testing needs
    and makes things a little more flexible, if one wants to use
    more than one RequestDispatcher in a servlet. Please let me
    know if you have problems with the modifications or if
    something is missing.

    So long,


  • Brian Sanders

    Brian Sanders - 2004-07-12

    Logged In: YES

    Thanks, Alwin. Your revisions fit our needs much better
    than what I submitted. Much appreciated!

  • Alwin Ibba

    Alwin Ibba - 2004-08-21
    • status: open --> closed