users@jersey.java.net

Re: [Jersey] Jersey and Spring

From: Matt Brozowski <brozow_at_opennms.org>
Date: Tue, 8 Jul 2008 17:35:20 -0400

Great!! Any chance of pushing a snapshot up to maven sometime soon?

Thanks!
Matt

On Tue, Jul 8, 2008 at 5:33 PM, Martin Grotzke <martin.grotzke_at_freiheit.com>
wrote:

> Hi Matt,
>
> good catch!
>
> It seems as if the service method was just overridden for debugging
> issues. This is fixed now in the trunk: I simply removed the overridden
> service method in the SpringServlet, a test has been added to show/track
> this issue.
>
> Thanx for reporting this,
> cheers,
> Martin
>
>
> On Tue, 2008-07-08 at 11:08 -0400, Matt Brozowski wrote:
> >
> >
> > On Mon, Jul 7, 2008 at 4:15 PM, Martin Grotzke
> > <martin.grotzke_at_freiheit.com> wrote:
> >
> > > The one bug I did find in the SpringServlet is related to
> > excpetion
> > > handling. It fails to pass RuntimeException up the servlet
> > container
> > > as the spec specifies it should.
> >
> > Do you know if this is specific to the SpringServlet or if
> > it's related
> > to the general ServletContainer?
> >
> > It is specific to the SpringServlet. It catches all RuntimeExceptions
> > and Logs them without rethrowing them.
> >
> > Probably only a one line fix. Add a throw e; to the service method of
> > SpringServlet
> >
> >
> >
> > > I have included a Hack that resolves this but it would be
> > nice to get
> > > the real. Therefore if an exception occurs that has no
> > mapping only a
> > > blank web page is shown with no content. Rather than
> > allowing the
> > > container to use its default mechanism.
> > >
> > > Any simple way to report bugs on this?
> >
> > Just copy the code of a very simple example for reproducing
> > the bug into
> > this email, e.g. a resource class, spring configuration stuff
> > and a
> > spring bean.
> > Another way would be to enter a jira issue.
> >
> > Ok.. Glad to do it. I'll open a defect in jira
> >
> >
> >
> >
> > Cheers,
> > Martin
> >
> >
> > >
> > > Matt Brozowski
> > >
> > >
> > >
> > >
> > > On Mon, Jul 7, 2008 at 10:10 AM, Martin Grotzke
> > > <martin.grotzke_at_freiheit.com> wrote:
> > > On Mon, 2008-07-07 at 12:11 +0200, Lars Tackmann
> > wrote:
> > > > On Mon, Jul 7, 2008 at 10:24 AM, Martin Grotzke
> > > > <martin.grotzke_at_freiheit.com> wrote:
> > > > > Hi Lars,
> > > > >
> > > > > I would say that your UsersResource is not set
> > up
> > > correctly: I'd say
> > > > > that it is not create by spring and therefore
> > the
> > > UserManager should not
> > > > > be injected. That you receive status 200 all the
> > time
> > > sounds really
> > > > > weird to me!
> > > > >
> > > > > But let's first check if your UsersResource is
> > set up as
> > > expected.
> > > > > Can you please check, if the UserManager is
> > already
> > > injected? If not,
> > > > > you should add @Component to your UsersResource,
> > so that
> > > spring is aware
> > > > > of this class.
> > > >
> > > > HI and thanks for the feedback.
> > > >
> > > > Some real bad code from my part, made the code
> > swollow a
> > > null pointer
> > > > exception (why this results in 200 is still a
> > mystery
> > > though).
> > >
> > > Can you create some really, really simple resource
> > that shows
> > > this issue
> > > and send this again, or perhaps directly submit an
> > issue for
> > > this?
> > >
> > > > it turned out that I had to annotate the resource
> > with;
> > > >
> > > > --
> > > > @PerRequest
> > > > @Component
> > > > @Scope( "prototype" )
> > > > --
> > > >
> > > > I can understand the component part, but having to
> > use
> > > springs @Scope
> > > > annotation is overkill (at least when one also
> > uses Jersey's
> > > lifecycle
> > > > annotations).
> > >
> > > Why do you want to have a prototype there? AFAICS
> > you should
> > > be able to
> > > use a singleton resource, which is the default scope
> > of both
> > > jersey and
> > > spring.
> > >
> > > >
> > > > Anyway thanks for the help. I suspect I will have
> > a complete
> > > mavenised
> > > > Spring/Jersey sample ready in a couple of days
> > (integrated
> > > with Spring
> > > > security 2) - I will gladly post it here, so
> > others can
> > > benefit from
> > > > it (perhaps it can go into jersey's example
> > folder).
> > >
> > > Sound good, this would be great! :)
> > >
> > > Cheers,
> > > Martin
> > >
> > >
> >
> >
>
>