guice integration with persistence and RESTeasy

292 views
Skip to first unread message

transmeta01

unread,
Feb 14, 2011, 9:22:17 AM2/14/11
to classic dev
Hi Cristian,

Questions:

1) private void bindServices() {
bind(UserService.class).to(UserServiceImpl.class);
}

the @ImplementedBy annotation does not work?

2) Did you modifify the pom.xml to use Guice 2.0 or did you keep it
with Guice 3.0-RC2? In the RC2 version warp-persistence is integrated
as guice-persist. We should use that library instead if it`s
compatible, which is should be I think.

Regards

Cristian Olaru

unread,
Feb 14, 2011, 9:31:49 AM2/14/11
to class...@googlegroups.com
On Mon, Feb 14, 2011 at 4:22 PM, transmeta01 <trans...@gmail.com> wrote:
Hi Cristian,

Questions:

1) private void bindServices() {
       bind(UserService.class).to(UserServiceImpl.class);
   }


the @ImplementedBy annotation does not work?

Aha - I didn't look in the  services - I will give it a try to see if it works - if yes - I will remove  this bindServices method.


2) Did you modifify the pom.xml to use Guice 2.0 or did you keep it
with Guice 3.0-RC2? In the RC2 version warp-persistence is integrated
as guice-persist. We should use that library instead if it`s
compatible, which is should be I think.

RestEasy is integrated with guice 2. It doesn't work with Guice 3. That's way I keep guice 2 and warp-persistence.
 

Regards



--
Cristian Olaru
weblog: http://olaru.blogspot.com
mobile: 0743163039

Richard Mutezintare

unread,
Feb 14, 2011, 9:55:15 AM2/14/11
to class...@googlegroups.com
Good! Excellent work. One more detail, all requests to server should go through resteasy
so this:  <param-value>/rest-services</param-value>
should be : <param-value>/*</param-value>

same for the resteasy servlet

One more question, I thought from the guice documentation that the listener (in our case the Boostrap class) was needed by guice to in order for it to start everything. But know I see that RESTeasy is the entry point.  :-)

Turns out the listener approach would be good for our own custom servlet implementation, but there is no need for that since RESTeasy has a it`s own servlet that handles everything. Does this reasoning sound right or I am missing something?

Regards
Richard

Cristian Olaru

unread,
Feb 15, 2011, 1:57:39 AM2/15/11
to class...@googlegroups.com
On Mon, Feb 14, 2011 at 4:55 PM, Richard Mutezintare <trans...@gmail.com> wrote:
Good! Excellent work. One more detail, all requests to server should go through resteasy
so this:  <param-value>/rest-services</param-value>
should be : <param-value>/*</param-value>

same for the resteasy servlet

I made the change. Now the path will be /*
 

One more question, I thought from the guice documentation that the listener (in our case the Boostrap class) was needed by guice to in order for it to start everything. But know I see that RESTeasy is the entry point.  :-)

Turns out the listener approach would be good for our own custom servlet implementation, but there is no need for that since RESTeasy has a it`s own servlet that handles everything. Does this reasoning sound right or I am missing something?

I think:

- org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener is used to rise in runtime the RestEasy Resources and make all the Guice injection to them (to start the Guice context - see that resources are infected with services and so on); even if Guice in not used, you must specify somehow the resurces as RestEasy elements
-  org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher is the front controller servlet (in fact is a servlet from our container) that will intercept the request dispatch them to the right Resource
 

Regards
Richard


On Mon, Feb 14, 2011 at 9:31 AM, Cristian Olaru <col...@gmail.com> wrote:


On Mon, Feb 14, 2011 at 4:22 PM, transmeta01 <trans...@gmail.com> wrote:
Hi Cristian,

Questions:

1) private void bindServices() {
       bind(UserService.class).to(UserServiceImpl.class);
   }


the @ImplementedBy annotation does not work?

Aha - I didn't look in the  services - I will give it a try to see if it works - if yes - I will remove  this bindServices method.


2) Did you modifify the pom.xml to use Guice 2.0 or did you keep it
with Guice 3.0-RC2? In the RC2 version warp-persistence is integrated
as guice-persist. We should use that library instead if it`s
compatible, which is should be I think.

RestEasy is integrated with guice 2. It doesn't work with Guice 3. That's way I keep guice 2 and warp-persistence.
 

Regards



--
Cristian Olaru
weblog: http://olaru.blogspot.com
mobile: 0743163039

Cristian Olaru

unread,
Feb 15, 2011, 1:59:44 AM2/15/11
to class...@googlegroups.com
Hi Richard.

I push some updates. See UserSimplifiedResourceTest for a simplified version of the client (reuse the same interface an shared entities)

Regards...
Reply all
Reply to author
Forward
0 new messages