You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Giampaolo Tomassoni <g....@libero.it> on 2006/03/15 09:06:56 UTC

[Q] 4.0: How to override RequestLocaleManager default implementation?

Dears,

I need to relay on a session object instead of a client cookie to handle the user locale.

How am I supposed to override the RequestLocaleManager default implementation? Also, since I would need to access session objects from the new implementation of RequestLocaleManager, I would first need to now if this is possible at all.

Regards,

-----------------------------------
Giampaolo Tomassoni - IT Consultant
Piazza VIII Aprile 1948, 4
I-53044 Chiusi (SI) - Italy
Ph: +39-0578-21100


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


R: [Q] 4.0: How to override RequestLocaleManager default implementation?

Posted by Giampaolo Tomassoni <g....@libero.it>.
Thanks a lot, Paul. Gonna try it.

Cheers,

	giampaolo

> To override the default implementation of a hivemind service, use the
> <implementation> element in your hivemodule.xml.
> e.g.
> 
>     <implementation service-id="tapestry.request.RequestLocaleManager">
>         <invoke-factory model="pooled">
>             <construct class="your-implementation-class-name-here">
>                 <!-- To access session objects (i.e. application state
> objects), or the WebSession itself, you can inject them here -->
>                 <!-- Details here:
> http://jakarta.apache.org/hivemind/hivemind/BuilderFactory.html -->
>             </construct>
>         </invoke-factory>
>     </implementation>
> 
> Paul
> 
> Giampaolo Tomassoni wrote:
> > Dears,
> >
> > I need to relay on a session object instead of a client cookie 
> to handle the user locale.
> >
> > How am I supposed to override the RequestLocaleManager default 
> implementation? Also, since I would need to access session 
> objects from the new implementation of RequestLocaleManager, I 
> would first need to now if this is possible at all.
> >
> > Regards,
> >
> > -----------------------------------
> > Giampaolo Tomassoni - IT Consultant
> > Piazza VIII Aprile 1948, 4
> > I-53044 Chiusi (SI) - Italy
> > Ph: +39-0578-21100
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >   
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


R: [Q] 4.0: How to override RequestLocaleManager default implementation?

Posted by Giampaolo Tomassoni <Gi...@Tomassoni.biz>.
Ahh, when things go the way they should!

Thanks everybody,

-----------------------------------
Giampaolo Tomassoni - IT Consultant
Piazza VIII Aprile 1948, 4
I-53044 Chiusi (SI) - Italy
Ph: +39-0578-21100
 
> 
> > You look up your ASOs using the ApplicationStateManager service.
> 
> Ah, that's this the way? You mean there isn't a simpler one, like 
> a "something:somewere" value in a <set-object> or the like... 
> 
> Ok, I'll try it now. Stay connected... :)
> 
> Thanks,
> 
> -----------------------------------
> Giampaolo Tomassoni - IT Consultant
> Piazza VIII Aprile 1948, 4
> I-53044 Chiusi (SI) - Italy
> Ph: +39-0578-21100
> 
> 
> > 
> > Oh, well, Paul.
> > 
> > Your help did produce many things interesting to me: now I have 
> some more
> > classes in my tree, among which a nice RequestLocaleManagerImpl. Also, I
> > brought the <implementation> hint into my hivemodule.xml.
> > 
> > But... How I'm expected to inject a specific Tapestry ASO to my
> > implementation of the RequestLocaleManager?
> > 
> > I really tried hard a lot, getting even more confused. ASOs are 
> a Tapestry
> > enhancement to Hivemind and it seems to me that Tapestry also defines a
> > schema and a configuration point for them: the BuilderFactory 
> details you
> > suggested are a bit too wide in scope.
> > 
> > How should I access them?
> > 
> > My hivemodule.xml actually carries something like the following:
> > 
> > 
> > 	<contribution configuration-id="tapestry.state.ApplicationObjects">
> > 		<state-object name="locale" scope="session">
> > 			<create-instance class="LocaleASO"/>
> > 		</state-object>  
> > 	</contribution>
> > 
> > 	...
> > 
> > 	<implementation service-id="tapestry.request.RequestLocaleManager">
> > 		<invoke-factory model="pooled">
> > 			<construct class="RequestLocaleManagerImpl">
> > 				<set-service property="request"
> > 				 service-id="tapestry.globals.WebRequest"
> > 				>The WebRequest object</set-service>
> > 
> > 				<set-service property="threadLocale"
> > 				 service-id="hivemind.ThreadLocale"
> > 				>The ThreadLocale object</set-service>
> > 
> > 				<set-service property="threadLanguages"
> > 				 service-id="ThreadLanguages"
> > 				>The ThreadLanguages object</set-service>
> > 
> > 				<set-service property="hibernateSession"
> > 				 service-id="confesercenti.hibernateSession"
> > 				>Our reference to the Hibernate Session
> > object</set-service>
> > 
> > 				<set-object property="applicationObjects"
> > 	
> > value="configuration:tapestry.state.ApplicationObjects"
> > 				/>
> > 			</construct>
> > 		</invoke-factory>
> > 	</implementation>
> > 
> > Don't mind the threadLanguages and hibernateSession objects: they are
> > services of my own. The problem is the applicationObject one: how I am
> > expected to get an instance of the ASOs (or even to inspect if 
> it had been
> > already stored into the session)? Do I have any simpler method to 
> > inject my
> > own "locale" ASO into the object, of course respecting the session
> > boundaries?
> > 
> > I've got the feeling that Hivemind is not that well documented 
> > and that the
> > Tapestry-contributed hivemind modules aren't at all...
> > 
> > Thanks again,
> > 
> > -----------------------------------
> > Giampaolo Tomassoni - IT Consultant
> > Piazza VIII Aprile 1948, 4
> > I-53044 Chiusi (SI) - Italy
> > Ph: +39-0578-21100
> > 
> > > To override the default implementation of a hivemind service, use the
> > > <implementation> element in your hivemodule.xml.
> > > e.g.
> > > 
> > >     <implementation 
> service-id="tapestry.request.RequestLocaleManager">
> > >         <invoke-factory model="pooled">
> > >             <construct class="your-implementation-class-name-here">
> > >                 <!-- To access session objects (i.e. application state
> > > objects), or the WebSession itself, you can inject them here -->
> > >                 <!-- Details here:
> > > http://jakarta.apache.org/hivemind/hivemind/BuilderFactory.html -->
> > >             </construct>
> > >         </invoke-factory>
> > >     </implementation>
> > > 
> > > Paul
> > > 
> > > Giampaolo Tomassoni wrote:
> > > > Dears,
> > > >
> > > > I need to relay on a session object instead of a client cookie 
> > > to handle the user locale.
> > > >
> > > > How am I supposed to override the RequestLocaleManager default 
> > > implementation? Also, since I would need to access session 
> > > objects from the new implementation of RequestLocaleManager, I 
> > > would first need to now if this is possible at all.
> > > >
> > > > Regards,
> > > >
> > > > -----------------------------------
> > > > Giampaolo Tomassoni - IT Consultant
> > > > Piazza VIII Aprile 1948, 4
> > > > I-53044 Chiusi (SI) - Italy
> > > > Ph: +39-0578-21100
> > > >
> > > >
> > > > 
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> > > >
> > > >   
> > > 
> > > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


R: [Q] 4.0: How to override RequestLocaleManager default implementation?

Posted by Giampaolo Tomassoni <g....@libero.it>.
> You look up your ASOs using the ApplicationStateManager service.

Ah, that's this the way? You mean there isn't a simpler one, like a "something:somewere" value in a <set-object> or the like... 

Ok, I'll try it now. Stay connected... :)

Thanks,

-----------------------------------
Giampaolo Tomassoni - IT Consultant
Piazza VIII Aprile 1948, 4
I-53044 Chiusi (SI) - Italy
Ph: +39-0578-21100


> 
> Oh, well, Paul.
> 
> Your help did produce many things interesting to me: now I have some more
> classes in my tree, among which a nice RequestLocaleManagerImpl. Also, I
> brought the <implementation> hint into my hivemodule.xml.
> 
> But... How I'm expected to inject a specific Tapestry ASO to my
> implementation of the RequestLocaleManager?
> 
> I really tried hard a lot, getting even more confused. ASOs are a Tapestry
> enhancement to Hivemind and it seems to me that Tapestry also defines a
> schema and a configuration point for them: the BuilderFactory details you
> suggested are a bit too wide in scope.
> 
> How should I access them?
> 
> My hivemodule.xml actually carries something like the following:
> 
> 
> 	<contribution configuration-id="tapestry.state.ApplicationObjects">
> 		<state-object name="locale" scope="session">
> 			<create-instance class="LocaleASO"/>
> 		</state-object>  
> 	</contribution>
> 
> 	...
> 
> 	<implementation service-id="tapestry.request.RequestLocaleManager">
> 		<invoke-factory model="pooled">
> 			<construct class="RequestLocaleManagerImpl">
> 				<set-service property="request"
> 				 service-id="tapestry.globals.WebRequest"
> 				>The WebRequest object</set-service>
> 
> 				<set-service property="threadLocale"
> 				 service-id="hivemind.ThreadLocale"
> 				>The ThreadLocale object</set-service>
> 
> 				<set-service property="threadLanguages"
> 				 service-id="ThreadLanguages"
> 				>The ThreadLanguages object</set-service>
> 
> 				<set-service property="hibernateSession"
> 				 service-id="confesercenti.hibernateSession"
> 				>Our reference to the Hibernate Session
> object</set-service>
> 
> 				<set-object property="applicationObjects"
> 	
> value="configuration:tapestry.state.ApplicationObjects"
> 				/>
> 			</construct>
> 		</invoke-factory>
> 	</implementation>
> 
> Don't mind the threadLanguages and hibernateSession objects: they are
> services of my own. The problem is the applicationObject one: how I am
> expected to get an instance of the ASOs (or even to inspect if it had been
> already stored into the session)? Do I have any simpler method to 
> inject my
> own "locale" ASO into the object, of course respecting the session
> boundaries?
> 
> I've got the feeling that Hivemind is not that well documented 
> and that the
> Tapestry-contributed hivemind modules aren't at all...
> 
> Thanks again,
> 
> -----------------------------------
> Giampaolo Tomassoni - IT Consultant
> Piazza VIII Aprile 1948, 4
> I-53044 Chiusi (SI) - Italy
> Ph: +39-0578-21100
> 
> > To override the default implementation of a hivemind service, use the
> > <implementation> element in your hivemodule.xml.
> > e.g.
> > 
> >     <implementation service-id="tapestry.request.RequestLocaleManager">
> >         <invoke-factory model="pooled">
> >             <construct class="your-implementation-class-name-here">
> >                 <!-- To access session objects (i.e. application state
> > objects), or the WebSession itself, you can inject them here -->
> >                 <!-- Details here:
> > http://jakarta.apache.org/hivemind/hivemind/BuilderFactory.html -->
> >             </construct>
> >         </invoke-factory>
> >     </implementation>
> > 
> > Paul
> > 
> > Giampaolo Tomassoni wrote:
> > > Dears,
> > >
> > > I need to relay on a session object instead of a client cookie 
> > to handle the user locale.
> > >
> > > How am I supposed to override the RequestLocaleManager default 
> > implementation? Also, since I would need to access session 
> > objects from the new implementation of RequestLocaleManager, I 
> > would first need to now if this is possible at all.
> > >
> > > Regards,
> > >
> > > -----------------------------------
> > > Giampaolo Tomassoni - IT Consultant
> > > Piazza VIII Aprile 1948, 4
> > > I-53044 Chiusi (SI) - Italy
> > > Ph: +39-0578-21100
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> > >   
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: [Q] 4.0: How to override RequestLocaleManager default implementation?

Posted by James Carman <ja...@carmanconsulting.com>.
You look up your ASOs using the ApplicationStateManager service.

-----Original Message-----
From: Giampaolo Tomassoni [mailto:g.tomassoni@libero.it] 
Sent: Wednesday, March 22, 2006 9:16 AM
To: Tapestry users
Subject: R: [Q] 4.0: How to override RequestLocaleManager default
implementation?

Oh, well, Paul.

Your help did produce many things interesting to me: now I have some more
classes in my tree, among which a nice RequestLocaleManagerImpl. Also, I
brought the <implementation> hint into my hivemodule.xml.

But... How I'm expected to inject a specific Tapestry ASO to my
implementation of the RequestLocaleManager?

I really tried hard a lot, getting even more confused. ASOs are a Tapestry
enhancement to Hivemind and it seems to me that Tapestry also defines a
schema and a configuration point for them: the BuilderFactory details you
suggested are a bit too wide in scope.

How should I access them?

My hivemodule.xml actually carries something like the following:


	<contribution configuration-id="tapestry.state.ApplicationObjects">
		<state-object name="locale" scope="session">
			<create-instance class="LocaleASO"/>
		</state-object>  
	</contribution>

	...

	<implementation service-id="tapestry.request.RequestLocaleManager">
		<invoke-factory model="pooled">
			<construct class="RequestLocaleManagerImpl">
				<set-service property="request"
				 service-id="tapestry.globals.WebRequest"
				>The WebRequest object</set-service>

				<set-service property="threadLocale"
				 service-id="hivemind.ThreadLocale"
				>The ThreadLocale object</set-service>

				<set-service property="threadLanguages"
				 service-id="ThreadLanguages"
				>The ThreadLanguages object</set-service>

				<set-service property="hibernateSession"
				 service-id="confesercenti.hibernateSession"
				>Our reference to the Hibernate Session
object</set-service>

				<set-object property="applicationObjects"
	
value="configuration:tapestry.state.ApplicationObjects"
				/>
			</construct>
		</invoke-factory>
	</implementation>

Don't mind the threadLanguages and hibernateSession objects: they are
services of my own. The problem is the applicationObject one: how I am
expected to get an instance of the ASOs (or even to inspect if it had been
already stored into the session)? Do I have any simpler method to inject my
own "locale" ASO into the object, of course respecting the session
boundaries?

I've got the feeling that Hivemind is not that well documented and that the
Tapestry-contributed hivemind modules aren't at all...

Thanks again,

-----------------------------------
Giampaolo Tomassoni - IT Consultant
Piazza VIII Aprile 1948, 4
I-53044 Chiusi (SI) - Italy
Ph: +39-0578-21100

> To override the default implementation of a hivemind service, use the
> <implementation> element in your hivemodule.xml.
> e.g.
> 
>     <implementation service-id="tapestry.request.RequestLocaleManager">
>         <invoke-factory model="pooled">
>             <construct class="your-implementation-class-name-here">
>                 <!-- To access session objects (i.e. application state
> objects), or the WebSession itself, you can inject them here -->
>                 <!-- Details here:
> http://jakarta.apache.org/hivemind/hivemind/BuilderFactory.html -->
>             </construct>
>         </invoke-factory>
>     </implementation>
> 
> Paul
> 
> Giampaolo Tomassoni wrote:
> > Dears,
> >
> > I need to relay on a session object instead of a client cookie 
> to handle the user locale.
> >
> > How am I supposed to override the RequestLocaleManager default 
> implementation? Also, since I would need to access session 
> objects from the new implementation of RequestLocaleManager, I 
> would first need to now if this is possible at all.
> >
> > Regards,
> >
> > -----------------------------------
> > Giampaolo Tomassoni - IT Consultant
> > Piazza VIII Aprile 1948, 4
> > I-53044 Chiusi (SI) - Italy
> > Ph: +39-0578-21100
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >   
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


R: [Q] 4.0: How to override RequestLocaleManager default implementation?

Posted by Giampaolo Tomassoni <g....@libero.it>.
Oh, well, Paul.

Your help did produce many things interesting to me: now I have some more classes in my tree, among which a nice RequestLocaleManagerImpl. Also, I brought the <implementation> hint into my hivemodule.xml.

But... How I'm expected to inject a specific Tapestry ASO to my implementation of the RequestLocaleManager?

I really tried hard a lot, getting even more confused. ASOs are a Tapestry enhancement to Hivemind and it seems to me that Tapestry also defines a schema and a configuration point for them: the BuilderFactory details you suggested are a bit too wide in scope.

How should I access them?

My hivemodule.xml actually carries something like the following:


	<contribution configuration-id="tapestry.state.ApplicationObjects">
		<state-object name="locale" scope="session">
			<create-instance class="LocaleASO"/>
		</state-object>  
	</contribution>

	...

	<implementation service-id="tapestry.request.RequestLocaleManager">
		<invoke-factory model="pooled">
			<construct class="RequestLocaleManagerImpl">
				<set-service property="request"
				 service-id="tapestry.globals.WebRequest"
				>The WebRequest object</set-service>

				<set-service property="threadLocale"
				 service-id="hivemind.ThreadLocale"
				>The ThreadLocale object</set-service>

				<set-service property="threadLanguages"
				 service-id="ThreadLanguages"
				>The ThreadLanguages object</set-service>

				<set-service property="hibernateSession"
				 service-id="confesercenti.hibernateSession"
				>Our reference to the Hibernate Session object</set-service>

				<set-object property="applicationObjects"
				 value="configuration:tapestry.state.ApplicationObjects"
				/>
			</construct>
		</invoke-factory>
	</implementation>

Don't mind the threadLanguages and hibernateSession objects: they are services of my own. The problem is the applicationObject one: how I am expected to get an instance of the ASOs (or even to inspect if it had been already stored into the session)? Do I have any simpler method to inject my own "locale" ASO into the object, of course respecting the session boundaries?

I've got the feeling that Hivemind is not that well documented and that the Tapestry-contributed hivemind modules aren't at all...

Thanks again,

-----------------------------------
Giampaolo Tomassoni - IT Consultant
Piazza VIII Aprile 1948, 4
I-53044 Chiusi (SI) - Italy
Ph: +39-0578-21100

> To override the default implementation of a hivemind service, use the
> <implementation> element in your hivemodule.xml.
> e.g.
> 
>     <implementation service-id="tapestry.request.RequestLocaleManager">
>         <invoke-factory model="pooled">
>             <construct class="your-implementation-class-name-here">
>                 <!-- To access session objects (i.e. application state
> objects), or the WebSession itself, you can inject them here -->
>                 <!-- Details here:
> http://jakarta.apache.org/hivemind/hivemind/BuilderFactory.html -->
>             </construct>
>         </invoke-factory>
>     </implementation>
> 
> Paul
> 
> Giampaolo Tomassoni wrote:
> > Dears,
> >
> > I need to relay on a session object instead of a client cookie 
> to handle the user locale.
> >
> > How am I supposed to override the RequestLocaleManager default 
> implementation? Also, since I would need to access session 
> objects from the new implementation of RequestLocaleManager, I 
> would first need to now if this is possible at all.
> >
> > Regards,
> >
> > -----------------------------------
> > Giampaolo Tomassoni - IT Consultant
> > Piazza VIII Aprile 1948, 4
> > I-53044 Chiusi (SI) - Italy
> > Ph: +39-0578-21100
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >   
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: [Q] 4.0: How to override RequestLocaleManager default implementation?

Posted by Paul Ferraro <pm...@columbia.edu>.
To override the default implementation of a hivemind service, use the
<implementation> element in your hivemodule.xml.
e.g.

    <implementation service-id="tapestry.request.RequestLocaleManager">
        <invoke-factory model="pooled">
            <construct class="your-implementation-class-name-here">
                <!-- To access session objects (i.e. application state
objects), or the WebSession itself, you can inject them here -->
                <!-- Details here:
http://jakarta.apache.org/hivemind/hivemind/BuilderFactory.html -->
            </construct>
        </invoke-factory>
    </implementation>

Paul

Giampaolo Tomassoni wrote:
> Dears,
>
> I need to relay on a session object instead of a client cookie to handle the user locale.
>
> How am I supposed to override the RequestLocaleManager default implementation? Also, since I would need to access session objects from the new implementation of RequestLocaleManager, I would first need to now if this is possible at all.
>
> Regards,
>
> -----------------------------------
> Giampaolo Tomassoni - IT Consultant
> Piazza VIII Aprile 1948, 4
> I-53044 Chiusi (SI) - Italy
> Ph: +39-0578-21100
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>