You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Hugo Palma <hp...@digitalis.pt> on 2005/06/01 11:34:52 UTC

Re: Inject visit and global to base page class

Maybe i'm not understanding this correctly but it seems to me that the 
behaviour i've described is quite essential to most applications. As an 
example, most applications have a base page class that implements the 
pageValidate method for performing authorization checks. These usually 
involve database access, so as usual the code that does the validation 
should be in a hivemind service.

If i understood correctly, for this approach to work now i would have to 
inject the service in every single page of my application, right ? If 
so, i think this is a very poor way of doing things.

I thought about accessing the hivemind registry directly from the base 
page class so that i could use them directly just for this base page but 
the access to the ServletContext has been deprecated.


Is there any other way around this ?



Thanks

Hugo

Howard Lewis Ship wrote:

>No, those are still hard-wired.
>
>On 5/25/05, Hugo Palma <hp...@digitalis.pt> wrote:
>  
>
>>In 4.0 we are supposed to inject the visit and global objects as
>>page/component properties where needed. But what if i need them in every
>>page ?
>>I need the visit object in every page because i use it to check if the
>>user is logged on. I do this in a base class that all page classes
>>extend. I don't want to have to write "inject" element in every single
>>page i create. Is there anyway i can do this ?
>>
>>
>>Cheers
>>
>>Hugo
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>
>  
>

Re: Inject visit and global to base page class

Posted by butterdave <dp...@exchangesolutions.net>.
How do I inject a service into the global object (like visit)?

--
View this message in context: http://www.nabble.com/Inject-visit-and-global-to-base-page-class-t28307.html#a3522296
Sent from the Tapestry - User forum at Nabble.com.


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


Re: Inject visit and global to base page class

Posted by Andreas Andreou <an...@di.uoa.gr>.
Regarding the  required cast,
I always add 2 methods in MyBasePage class
getMyVisit()
getMyGlobal()
which return those objects casted into my specific classes

>
> I guess the suggestion is placing your hibernate service inside the 
> global object, so instead of having a getHibernateService injected 
> property, you can just do:
>
> ((Global)getGlobal()).getHibernateService()
>
> in your validating base class, and have the hibernate service injected 
> once into the global object using HiveMind.
>
> Its not as pretty as it could be, especially as there will be a cast 
> required.
>
> Richard.
>
>
> ---------------------------------------------------------------------
> 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


Stale Link Exception problem using table [auf Viren geprueft]

Posted by Jonathan O'Connor <Jo...@xcom.de>.
Hi,
I'm getting a stale link exception, when I click on an ImageSubmit in a
contrib:Table (within a Form). It appears that the components for the table
are not getting generated when the form is rewinding. Is this a known
problem? Is there a simple fix? The sad thing is that this used to work no
problem!
I'll probably change these ImageSubmits to DirectLink or something else?
Ciao,
Jonathan O'Connor
XCOM Dublin


IBM Workplace 2.5 Launch Events:
XCOM AG und IBM laden zum weltweiten Launch von IBM Workplace Collaboration
Services 2.5 nach Duesseldorf, Frankfurt und Berlin:
http://lotus.xcom.de/events

XCOM Express Programm:
Der schnelle Einstieg in neueste Technologien zum kleinen Preis - Portale,
e-Mail Security und Mobility: http://lotus.xcom.de/express


*** XCOM AG Legal Disclaimer ***

Diese E-Mail einschliesslich ihrer Anhaenge ist vertraulich und ist allein
für den Gebrauch durch den vorgesehenen Empfaenger bestimmt. Dritten ist
das Lesen, Verteilen oder Weiterleiten dieser E-Mail untersagt. Wir bitten,
eine fehlgeleitete E-Mail unverzueglich vollstaendig zu loeschen und uns
eine Nachricht zukommen zu lassen.

This email may contain material that is confidential and for the sole use
of the intended recipient. Any review, distribution by others or forwarding
without express permission is strictly prohibited. If you are not the
intended recipient, please contact the sender and delete all copies.

Re: Inject visit and global to base page class

Posted by Richard Kirby <rb...@capdm.com>.
Hugo Palma wrote:

> Howard Lewis Ship wrote:
>
>> getVisit() and getGlobal() work exactly the same in 4.0 as in 3.0.
>>
>>  
>>
> I'm sorry but i didn't understand. What does that have to do with this 
> issue ?

I guess the suggestion is placing your hibernate service inside the 
global object, so instead of having a getHibernateService injected 
property, you can just do:

((Global)getGlobal()).getHibernateService()

in your validating base class, and have the hibernate service injected 
once into the global object using HiveMind.

Its not as pretty as it could be, especially as there will be a cast 
required.

Richard.


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


Re: Inject visit and global to base page class

Posted by Hugo Palma <hp...@digitalis.pt>.
Howard Lewis Ship wrote:

>getVisit() and getGlobal() work exactly the same in 4.0 as in 3.0.
>
>  
>
I'm sorry but i didn't understand. What does that have to do with this 
issue ?

>The scenario you describe is a great reasont to move towards annotations.
>  
>
I understand that, but since annotations will problably only come in 
Magritte(5.0) what do you think it's the best approach for this now ?


Thanks

Hugo

>On 6/1/05, Hugo Palma <hp...@digitalis.pt> wrote:
>  
>
>>Maybe i'm not understanding this correctly but it seems to me that the
>>behaviour i've described is quite essential to most applications. As an
>>example, most applications have a base page class that implements the
>>pageValidate method for performing authorization checks. These usually
>>involve database access, so as usual the code that does the validation
>>should be in a hivemind service.
>>
>>If i understood correctly, for this approach to work now i would have to
>>inject the service in every single page of my application, right ? If
>>so, i think this is a very poor way of doing things.
>>
>>I thought about accessing the hivemind registry directly from the base
>>page class so that i could use them directly just for this base page but
>>the access to the ServletContext has been deprecated.
>>
>>
>>Is there any other way around this ?
>>
>>
>>
>>Thanks
>>
>>Hugo
>>
>>Howard Lewis Ship wrote:
>>
>>    
>>
>>>No, those are still hard-wired.
>>>
>>>On 5/25/05, Hugo Palma <hp...@digitalis.pt> wrote:
>>>
>>>
>>>      
>>>
>>>>In 4.0 we are supposed to inject the visit and global objects as
>>>>page/component properties where needed. But what if i need them in every
>>>>page ?
>>>>I need the visit object in every page because i use it to check if the
>>>>user is logged on. I do this in a base class that all page classes
>>>>extend. I don't want to have to write "inject" element in every single
>>>>page i create. Is there anyway i can do this ?
>>>>
>>>>
>>>>Cheers
>>>>
>>>>Hugo
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>
>>>
>>>      
>>>
>>    
>>
>
>
>  
>

Re: Inject visit and global to base page class

Posted by Howard Lewis Ship <hl...@gmail.com>.
getVisit() and getGlobal() work exactly the same in 4.0 as in 3.0.

The scenario you describe is a great reasont to move towards annotations.

On 6/1/05, Hugo Palma <hp...@digitalis.pt> wrote:
> Maybe i'm not understanding this correctly but it seems to me that the
> behaviour i've described is quite essential to most applications. As an
> example, most applications have a base page class that implements the
> pageValidate method for performing authorization checks. These usually
> involve database access, so as usual the code that does the validation
> should be in a hivemind service.
> 
> If i understood correctly, for this approach to work now i would have to
> inject the service in every single page of my application, right ? If
> so, i think this is a very poor way of doing things.
> 
> I thought about accessing the hivemind registry directly from the base
> page class so that i could use them directly just for this base page but
> the access to the ServletContext has been deprecated.
> 
> 
> Is there any other way around this ?
> 
> 
> 
> Thanks
> 
> Hugo
> 
> Howard Lewis Ship wrote:
> 
> >No, those are still hard-wired.
> >
> >On 5/25/05, Hugo Palma <hp...@digitalis.pt> wrote:
> >
> >
> >>In 4.0 we are supposed to inject the visit and global objects as
> >>page/component properties where needed. But what if i need them in every
> >>page ?
> >>I need the visit object in every page because i use it to check if the
> >>user is logged on. I do this in a base class that all page classes
> >>extend. I don't want to have to write "inject" element in every single
> >>page i create. Is there anyway i can do this ?
> >>
> >>
> >>Cheers
> >>
> >>Hugo
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

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

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