View Full Version : MockServletContext needs a resourceLoader
Jan 4th, 2006, 03:08 PM
I'm trying to write a test case for a tag.
The tag uses:
which is null from MockServletContext.
The api doc says to configure it with a resourceloader.
Anyone know how?
I've been trying to create a DefaultResourceLoader, which wants a servletContext, which wants a ResourceLoader.
I'm soooo confused.
Jan 4th, 2006, 05:59 PM
getRealPath returns null if you don't give it a path even on some real servers. Have you tried pageContext.getServletContext().getRealPath("/")?
Jan 6th, 2006, 10:34 AM
Actually, I've been trying something specific:
The tag I want to test is supposed to open a file found relative to the home dir of the web app. I just can't figure out how to define the home dir of the web app to the mock classes in a way that getRealPath will actually work.
Feb 15th, 2006, 01:23 PM
Have you tried, when instantiating your MockServletContext, passing in the home directory of the webapp?
ServletContext sc = new MockServletContext("/path/to/web_home");
Jun 28th, 2007, 02:58 PM
just for further reference as i came across this thread:
it must be IMHO:
ServletContext sc =
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.