I happened to reported a jira for custom rewriters. See here:

 https://issues.apache.org/jira/browse/SHINDIG-1456

Does it help?

On Wednesday, December 22, 2010, NikNik <[email protected]> wrote:
> hi
>
> I want to add 1 custom rewriter.
> It doesn't matter in which part of rewriters chain.
>
> If I'll extend RewriteModule I'll be forced to rewrite DefaultGuiceModule
> (because RewriteModule installing from there). This solution may lead
> me to future synchronization troubles with new versions of shindig.
>
> RewriteModule.provideGadgetRewriters -- is annotation injection:
>
>  �...@provides
>  �...@singleton
>  �...@named("shindig.rewriters.gadget")
>   protected List<GadgetRewriter> provideGadgetRewriters(
>       PipelineDataGadgetRewriter pipelineRewriter,
>       TemplateRewriter templateRewriter,
>       AbsolutePathReferenceRewriter absolutePathRewriter,
>       StyleTagExtractorContentRewriter styleTagExtractorRewriter,
>       StyleAdjacencyContentRewriter styleAdjacencyRewriter,
>       ProxyingContentRewriter proxyingRewriter,
>       CajaContentRewriter cajaRewriter,
>       SanitizingGadgetRewriter sanitizedRewriter,
>       RenderingGadgetRewriter renderingRewriter,
>       OpenSocialI18NGadgetRewriter i18nRewriter) {
>     return ImmutableList.of(pipelineRewriter, templateRewriter,
>         absolutePathRewriter, styleTagExtractorRewriter, 
> styleAdjacencyRewriter, proxyingRewriter,
>         cajaRewriter, sanitizedRewriter, renderingRewriter, i18nRewriter);
>   }
>
> What if I'll create my own module. Which will directly inject 
> List<GadgetRewriter>
>     to override annotation injection.
>
> But I don't know how to inject collections directly. This construction 
> doesn't work:
>
>         this.binder()
>             .bind(List.class)
>             .annotatedWith(Names.named("shindig.rewriters.gadget"))
>             .toInstance(new ArrayList<GadgetRewriter>());
>
> And I don't know where can I get other injected rewriters to create final 
> rewriters List in my module...
>
> Does this make sense ?
>
> thanks
>
> On 12/21/2010 11:06 PM, John Hjelmstad wrote:
>
> IMO depends on how much customization you want to do. If you want to add a
> rewriter to the beginning or end of the rewriter chain you might just be
> able to extend RewriteModule. We @Google have enough customization that we
> basically just created our own RewriteModule and in it supply our own
> bindings in the order we require. We don't get as much code reuse this way
> (ie. we don't use Shindig's RewriteModule) but we get more flexibility.
>
> Cheers,
> John
>
> On Tue, Dec 21, 2010 at 12:59 PM, NikNik<[email protected]>wrote:
>
>
> hi
>
> I have a small question because I'm newbie in Guice.
>
> Where is the best place to inject my additional GadgetRewriter
> implementation ?
> I mean which module I should replace or where add provider/module or ...
> if I don't want to harm whole architecture ?
>
> Should I replace/extend DefaultGuiceModule and RewriteModule?
> Or better way to provide new module for GadgetRewritersProvider injection ?
>
> I just want to keep the shindig clear like it is :)
>
> thanks
>
>
>
>

-- 
Thanks,

--
Kevin Zhang (凯峰)
Gtalk:   [email protected]
Blog:    http://www.zhangkf.com
Twitter: http://twitter.com/zhangkf

Reply via email to