Dec 6th, 2012, 07:46 AM
forwading requestDispatcher sing MockHttpServletRequest and MockHttpAServletResponse
We're making us of the MockHttpServletRequest and MockHttpAServletResponse, BUT not in executing test cases (yes it's strange). Our web application is to be integrated with a message based service invocation layer and therefore we're not going to have hold to request/response objects.
As any web app, we have filters, listeners etc... So what we're trying to do is creating new MockHttpServletRequest and MockHttpAServletResponse objects, populating with the necessary headers, parameters etc... and doing a forward to a url (/foo/bar which relative to our root) which is mapped to our controller. The forward is done using the RequestDispatcher (have tried getting it from the MockHttpAServletRequest as well as from the container provided ServletContext), however nothing happens. The forward logic in inside a TimerTask which gets invoked every x minutes.
What i'm expecting (from the forward) is the application to be hit as any normal HTTP request and execute the filters, controllers etc...
Has anyone tried something similar to this.
Tags for this Thread