Re: Cactus 1.7.2 setting the wrong locale?

"Matt Raible" <[email protected]>
Newsgroups gmane.comp.jakarta.cactus.user
Message-ID <[email protected]>
The problem was that the following only loads the context files
specified by ContextLoaderListener.

       ApplicationContext ctx =
           WebApplicationContextUtils
               .getRequiredWebApplicationContext(
                   session.getServletContext());

In early versions of Spring (1.1.x series), the above line would have
the beans loaded by Spring's DispatcherServlet as well.  This seems to
have changed since 1.2.x, and therefore, I had to mock out any beans I
expected to be in this context. Here's what my new setUp() method
looks like:

    protected void setUp() throws Exception {
        super.setUp();
        ApplicationContext ctx =
            WebApplicationContextUtils
                .getRequiredWebApplicationContext(
                    session.getServletContext());
        UserManager userManager =
            (UserManager) ctx.getBean("userManager");
        list.setUserManager(userManager);
        form.setUserManager(userManager);

        // needed to prevent NPE with getMessageSourceAccessor()
        StaticApplicationContext staticCtx = new StaticApplicationContext();
        Map properties = new HashMap();
        properties.put("basename", "messages");
        staticCtx.registerSingleton("messageSource",
                              ResourceBundleMessageSource.class,
                              new MutablePropertyValues(properties));
        staticCtx.refresh();
        form.setApplicationContext(staticCtx);
    }

Matt

On 8/16/06, Kazuhito SUGURI <[email protected]> wrote:
> Hi Matt,
>
> In article <[email protected]>,
> Tue, 15 Aug 2006 22:13:59 -0600,
> "Matt Raible" <[email protected]> wrote:
> mraible> I managed to solve this problem - thanks for your help.
>
> What was the cause?
> Your feedback would be informative for other Spring users
> in this community.
>
> Best Regards,
> ----
> Kazuhito SUGURI
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.