users@jersey.java.net

Re: [Jersey] Passing objects in Jersey Service.

From: RajKal <rajkal23_at_yahoo.com>
Date: Fri, 18 Dec 2009 07:01:09 -0800 (PST)

Thanks Paul for the response. I was under the assumption that Jersey supports Dependency Injection.

Now,I am thinking of this approach ,method takes xml string as input, parse the xml build the Employee and User objects and boolean variable.Then call my regular method. Is this a good approach? Is there any other approach you can suggest me off?

Raj
--- On Thu, 12/17/09, Paul Sandoz <Paul.Sandoz_at_Sun.COM> wrote:

> From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
> Subject: Re: [Jersey] Passing objects in Jersey Service.
> To: users_at_jersey.dev.java.net
> Date: Thursday, December 17, 2009, 11:11 AM
> Hi Raj,
>
> I suspect you are getting a 404 because your application
> fails to deploy, which is because Jersey will throw an
> exception on deployment because it cannot bind the
> parameters on the getResult method?
>
> How do you propose to bind the type Employee, User and
> boolean to values? The latter is especially problematic, it
> will additional contextual information.
>
> Note that Jersey does not provide a fully featured
> Dependency Injection (DI) framework and instead relies on
> integration with other DI frameworks, like Guice.
>
> Having said that Jersey does have some DI support, and you
> could use that if you do not want to use say Guice, as i
> said it all depends on how you want to bind the parameters.
> And from that i can provide more details.
>
> Paul.
>
> On Dec 16, 2009, at 10:48 PM, RajKal wrote:
>
> > Writing a web app that can be used as an application
> as well as service to return a employee detail object.
> Method takes 2 objects as input and one boolean variable. I
> want below method to be used in the app and the same method
> to serve as restful service.
> >
> > Is this correct approach or do I need to do anything
> else? Also I need to know how I can test with the browser or
> any client? When I am trying to access it to with the below
> url it gives me 404 -not found error.
> >
> > http://localhost:7001/jersey/detail/result
> >
> >  @GET
> >  @Path("/result")
> >  @Produces( { "text/xml"})
> >  public EmployeeDetail getResult(@Context
> Employee employee, @Context User user, @Context boolean
> isSSNRequired) throws Exception {
> >
> >  return employeeDetail;
> >  }
> >
> >
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>