Making contributions to the Alias service can be somewhat tricky,
there's a chicken-and-the-egg problem.  You're contributing into the
Alias service, but the Alias service is used to disambiguate
injections ... such as the SymbolSource and AssetSource parameters to
the contribution method.  That's the recursion.  You may have to
perform the injection explicitly, via @InjectService.

On 6/18/07, David Avenante <[EMAIL PROTECTED]> wrote:
Humm I'm very confuse with your input. The documentation and the
tapestry  code source don't help me too :(

I use the Alias approche like this :

public static void contributeAlias(Configuration<AliasContribution>
configuration,
                                       final SymbolSource
symbolSource, final AssetSource assetSource)
    {
        configuration.add(AliasContribution.create(PageRenderCommand.class,
new PageRenderCommand() {
            public void cleanup(Environment environment) {
                environment.pop(PageRenderSupport.class);

                Document document = environment.peek(Document.class);
                DocumentScriptBuilder builder =
environment.pop(DocumentScriptBuilder.class);
                builder.updateDocument(document);
            }

            public void setup(Environment environment) {
                DocumentScriptBuilder builder = new
MyDocumentScriptBuilderImpl();
                environment.push(DocumentScriptBuilder.class, builder);
                environment.push(PageRenderSupport.class, new
PageRenderSupportImpl(builder, symbolSource, assetSource));
            }
        }));

    }

But I raise a recursive exception :
java.lang.RuntimeException: Failure starting Jetty instance:
org.mortbay.util.MultiException[java.lang.RuntimeException: Exception
constructing service 'ServletApplicationInitializer': Unable to
instantiate class org.apache.tapestry.services.TapestryModule as a
module builder: Exception constructing service 'Alias': Error invoking
service builder method
org.apache.tapestry.services.TapestryModule.build(Log, String,
AliasManager, Collection) (at TapestryModule.java:254) (for service
'Alias'): Error invoking service contribution method
com.illuminate.services.AppModule.contributeAlias(Configuration,
SymbolSource, AssetSource): Exception constructing service 'Alias':
Construction of service 'Alias' has failed due to recursion: the
service depends on itself in some way. Please check
org.apache.tapestry.services.TapestryModule.build(Log, String,
AliasManager, Collection) (at TapestryModule.java:254) for references
to another service that is itself dependent on service 'Alias'.]

Does i need to overide the PageRenderSupport service or only the
DocumentScriptBuilder and what the right way ?

Thank's


On 6/18/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
> You should be getting an error there, ApplicationDefault's
> configuration is a Map<String,String>.
>
> You override built-in services by contributing to the Alias service
> (or the AliasOverrides service).
>
> On 6/18/07, David Avenante <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I've two questions about the configuration of my ioc container.
> >
> > First i would be able to override the default configuration to use my
> > own DocumentScriptBuilder i've wrote some code in my appModule to try
> > to overide
> > the default config but without succes !!!
> >
> > public static void
> > contributeApplicationDefaults(MappedConfiguration<String, Object>
> > configuration,
> >                                                      final
> > SymbolSource symbolSource,
> >                                                      final AssetSource
> > assetSource) {
> >         configuration.add("tapestry.supported-locales", "en");
> >         configuration.add("PageRenderSupport", new PageRenderCommand()
> >         {
> >             public void cleanup(Environment environment)
> >             {
> >                 environment.pop(PageRenderSupport.class);
> >                 Document document = environment.peek(Document.class);
> >                 DocumentScriptBuilder builder =
> > environment.pop(DocumentScriptBuilder.class);
> >                 builder.updateDocument(document);
> >             }
> >
> >             public void setup(Environment environment)
> >             {
> >                 DocumentScriptBuilder builder = new
> > MyDocumentScriptBuilderImpl();
> >                 environment.push(DocumentScriptBuilder.class, builder);
> >                 environment.push(PageRenderSupport.class, new
> > PageRenderSupportImpl(builder,
> >                         symbolSource, assetSource));
> >             }
> >         });
> >
> >     }
> >
> > I've miss something ?
> >
> > Other question is about my authenticate Filter. I can test the url and
> > find if the user session is valide. But how redirect/forward the user
> > to a specifique page with the same use of tapestry navigation (with
> > class name for exemple) and without use of low level servlet API.
> >
> > Thank's
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to