[ 
https://issues.apache.org/jira/browse/SHINDIG-641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637313#action_12637313
 ] 

Adam Winer commented on SHINDIG-641:
------------------------------------

As Evan requested, the "what to do after you sync" doc:

Config code changes from pointing at a subclass of HandlerProvider
    bind(HandlerProvider.class).to(SampleContainerHandlerProvider.class);
... to a Provider for HandlerDispatcher:
    bind(HandlerDispatcher.class).toProvider(HandlerDispatcherProvider.class);

The provider changes from a subclass of HandlerProvider:

public class SampleContainerHandlerProvider extends HandlerProvider {
  public SampleContainerHandlerProvider() {
    super(true);
    addHandler("samplecontainer", SampleContainerHandler.class);
  }
}


... to a Provider<HandlerDispatcher> implementation:

  static class HandlerDispatcherProvider implements Provider<HandlerDispatcher> 
{
    private final HandlerDispatcher dispatcher;

    @Inject
    public HandlerDispatcherProvider(StandardHandlerDispatcher dispatcher,
        Provider<SampleContainerHandler> sampleHandler) {
      dispatcher.addHandler("samplecontainer", sampleHandler);
      this.dispatcher = dispatcher;
    }

    public HandlerDispatcher get() {
      return dispatcher;
    }
  }

Instead of subclassing HandlerProvider, you just inject 
StandardHandlerDispatcher.  And instead of adding a Class object, you add a 
Provider that Guice has created on your behalf.

> Simplify DataRequestHandler dispatching
> ---------------------------------------
>
>                 Key: SHINDIG-641
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-641
>             Project: Shindig
>          Issue Type: Improvement
>          Components: RESTful API (Java)
>            Reporter: Adam Winer
>            Priority: Minor
>         Attachments: shindig-641-2.patch, shindig-641.patch
>
>
> SHINDIG-638 cleaned up DataRequestHandler creation, but still left us with a 
> HandleProvider API that you need to subclass to manipulate, and that also 
> codifies a service-name-to-handler Map as the dispatching mechanism.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to