appCtx.registerMockBean("groovyPageLocator", pageLocator);
appCtx.registerMockBean("groovyPageLayoutFinder", layoutFinder);
DefaultCodecLookup codecLookup=new DefaultCodecLookup();
codecLookup.setGrailsApplication(grailsApplication);
codecLookup.afterPropertiesSet();
appCtx.registerMockBean("codecLookup", codecLookup);
appCtx.getServletContext().setAttribute(GrailsApplicationAttributes.APPLICATION_CONTEXT, appCtx);
appCtx.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appCtx);
grailsApplication.setMainContext(appCtx);
return GrailsWebMockUtil.bindMockWebRequest(appCtx, new MockHttpServletRequest(appCtx.getServletContext()) {