users@jersey.java.net

Re: [Jersey] Re: Spring jersey request scope issue

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 28 May 2010 07:52:33 +0200

On May 27, 2010, at 9:37 PM, golfingal72 wrote:

>
> Okay, I realized your example was from 1.2, so i upgraded and am now
> invoking
> the call as follows:
> this is just from modification of the jersey spring-annotations
> sample ... i
> tried adding it in the code with compile failures... I took it out
> of the
> code and updated the web.xml file still the same scope failure...
>
> import org.springframework.web.context.ContextLoaderListener;
> import org.springframework.web.context.request.RequestContextListener;
>
> public SpringAnnotationsWebAppTest() throws Exception {
> super(new
> WebAppDescriptor
> .Builder
> ("com.sun.jersey.samples.springannotations.resources.jerseymanaged")
> .contextPath("spring")
> .contextParam("contextConfigLocation",
> "classpath:applicationContext.xml")
> .servletClass(SpringServlet.class)
> .contextListenerClass(ContextLoaderListener.class)
> .contextListenerClass(RequestContextListener.class)
> .build());
> }


Change

   .contextListenerClass(RequestContextListener.class)

to:

   .requestListenerClass(RequestContextListener.class)

See:

https://jersey.dev.java.net/nonav/apidocs/latest/jersey-test-framework/jersey-test-framework-core/com/sun/jersey/test/framework/WebAppDescriptor.Builder.html
#requestListenerClass%28java.lang.Class%29

Paul.

>
> compile failure:
> [INFO] Compilation failure
> /nfsmounts/devexp2/devcox/jersey/spring-annotations/src/test/java/
> com/sun/jersey/samples/springannotations/
> SpringAnnotationsWebAppTest.java:[66,16]
> contextListenerClass(java.lang.Class<? extends
> javax.servlet.ServletContextListener>) in
> com.sun.jersey.test.framework.WebAppDescriptor.Builder cannot be
> applied to
> (java.lang.Class<org.springframework.web.context.request.RequestContextListener
> >)
>
>
>
> /nfsmounts/devexp2/devcox/jersey/spring-annotations/src/test/java/
> com/sun/jersey/samples/springannotations/
> SpringAnnotationsWebAppTest.java:[66,16]
> contextListenerClass(java.lang.Class<? extends
> javax.servlet.ServletContextListener>) in
> com.sun.jersey.test.framework.WebAppDescriptor.Builder cannot be
> applied to
> (java.lang.Class<org.springframework.web.context.request.RequestContextListener
> >)
>
> any ideas where i've gone wrong?
> thanks,
> Lisa
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Re-Spring-jersey-request-scope-issue-tp5073495p5110238.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>