Results 1 to 3 of 3

Thread: Spring 1.1.2 - MockServletContext.getResourcePaths broken

  1. #1
    Join Date
    Aug 2004
    Location
    Denver
    Posts
    249

    Default Spring 1.1.2 - MockServletContext.getResourcePaths broken

    I have the following in a TestCase's setUp() method. It works fine in 1.1.1:

    Code:
    // initialize Spring
    MockServletContext sc = new MockServletContext("");
    sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
                        "/WEB-INF/applicationContext*.xml");
    ServletContextListener contextListener = new ContextLoaderListener();
    ServletContextEvent event = new ServletContextEvent(sc);
    contextListener.contextInitialized(event);
    However, in 1.1.2 it results in the following error:

    Code:
        [junit] java.lang.UnsupportedOperationException: getResourcePaths
        [junit]     at org.springframework.mock.web.MockServletContext.getResourcePaths(MockServletContext.java:128)
        [junit]     at org.springframework.web.context.support.ServletContextResourcePatternResolver.doRetrieveMatchingServletContextResources(ServletContextResourcePatternResolver.java:100)
        [junit]     at org.springframework.web.context.support.ServletContextResourcePatternResolver.doFindPathMatchingFileResources(ServletContextResourcePatternResolver.java:79)
        [junit]     at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingFileResources(PathMatchingResourcePatternResolver.java:192)
        [junit]     at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:145)
        [junit]     at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:142)

  2. #2
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    Thanks for spotting this, Matt!

    This is caused by a refinement in pattern matching within web applications, namely matching via the ServletContext itself rather than via resolution as files (which works in unexpanded WARs too).

    Unfortunately, MockServletContext has not provided an implementation of "getResourcePaths" yet. I've just added such an implementation; will commit it promptly.

    Please give a current snapshot a try!

    Juergen

  3. #3
    Join Date
    Aug 2004
    Location
    Denver
    Posts
    249

    Default

    Works great - thanks Juergen.

    Matt

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  3. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  4. Replies: 4
    Last Post: Dec 8th, 2004, 02:07 PM
  5. Spring Framework 1.1.2 Released
    By Colin Sampaleanu in forum Announcements
    Replies: 0
    Last Post: Nov 14th, 2004, 06:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •