Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6618203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:47:58+00:00 2026-05-25T20:47:58+00:00

I searched for a solution to use Guice Dependency injection together with RequestFactory .

  • 0

I searched for a solution to use Guice Dependency injection together with RequestFactory.
I stumbled upon this: https://github.com/etiennep

It wasn’t working for me so I changed the InjectedServiceLayerDecorator.java implementation to this:

https://github.com/opncow/injected-requestfactory/blob/master/src/main/java/com/trycatchsoft/gwt/requestfactory/InjectedServiceLayerDecorator.java

Now my questions are:

Can something be done better regarding the caching mechanism of RequestFactory (Is it still working?)?
What is getTop() and getNext() (in ServiceLayerDecorator) for?
And is it correct / safe to use getTop() in this place?

Sorry thought too complicated!
It was as easy as:

Class<?> serviceClazz = resolveServiceClass(requestContext);
        return injector.getInstance(serviceClazz);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:47:59+00:00Added an answer on May 25, 2026 at 8:47 pm

    What is getTop() and getNext() (in ServiceLayerDecorator) for?

    ServiceLayer uses a chain of responsibility pattern: in cases your decorator has nothing specific to do, it should delegate to the next decorator in the chain (returned by getNext) by calling the same method with the same arguments. If your decorator changes the arguments, or needs to call another method, it should call it on getTop so the call is routed through all decorators, and not just the ones after itself in the chain.

    Your use of getTop is thus correct and safe (have a look at the LocatorServiceLayer from GWT, that’s exactly what it does).

    But your code (and Etienne’s one!) can actually be made simpler and better: simply override createServiceLocator to get an instance from your injector (same as createLocator).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having searched everywhere for a solution to this problem, and attempting to use a
I've searched everywhere for this, but I can't seem to find a solution. Perhaps
HI.I searched this question inform and I found solution to change column property Unique
I've searched for two days trying to find a solution to this. My problem
I searched for this a lot, but I couldn't find a solution for this
I've searched all over for a solution to this (including SO), however still haven't
Searched the whole web for this with no solution... I want to take a
I have searched and searched for a solution to this problem, but it seems
I've searched online and this website alike for a simple and adaptable solution but
I searched for this, but couldn't find a solution. I understand that one could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.