You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Pete <pe...@gmx.org> on 2005/09/04 21:14:36 UTC

access tapestry application objects in hivemind

Hi,

unfortunately I am unable to figure out how to access an application  
object within my-hivemind.xml...

does somebody know how to inject 'myState' into the marked 'MyFilter'  
property 'injectedState' ????

    <contribution configuration-id="tapestry.state.ApplicationObjects">
       <state-object name="myState" scope="session">
          <create-instance class="app.model.state.MyState" />
       </state-object>
    </contribution>

    <service-point id="MyFilter"  
interface="org.apache.tapestry.services.ServletRequestServicerFilter">
       <invoke-factory model="pooled">
             <set-object property="injectedState"  
value="???????????????????????????????????" />
          </construct>
       </invoke-factory>
    </service-point>

    <contribution  
configuration-id="tapestry.request.ServletRequestServicerPipeline">
       <filter name="shopSelect" object="service:MyFilter" />
    </contribution>

Regards
Peter

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


Re: access tapestry application objects in hivemind

Posted by Kent Tong <ke...@cpttm.org.mo>.
Pete <pertl <at> gmx.org> writes:

> does somebody know how to inject 'myState' into the marked 'MyFilter'  
> property 'injectedState' ????

Try:
   <set-service
     property="appStateMgr"  
     value="tapestry.state.ApplicationStateManager"/>

class MyFilter {
  ApplicationStateManager appStateMgr;

  MyState getInjectedState() {
    return (MyState)appStateMgr.get("myState");
  }
}

--
Author of an e-Book for learning Tapestry (http://www.agileskills2.org/EWDT)


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


Re: access tapestry application objects in hivemind

Posted by Adam Greene <ag...@iq-2000.com>.
I think you might have misunderstood the whole question.  You would access 
the state object via "state:myState", but watch out though as putting 
"state:myState" as the value of a Tapestry binding within a page/jwc has a 
different meaning (it returns a boolean indicating if the object has been 
created, useful for discovering if the application is running "stateless").

----- Original Message ----- 
From: "Nick Stuart" <ba...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Sunday, September 04, 2005 10:18 PM
Subject: Re: access tapestry application objects in hivemind


You wouldnt actually set an actual object in your service, but would
use the configuration instead. Use the <set-configuration> tag
instead. Inside your class you will have to read over all the values
in the configuration list to get the object/values you are looking
for.

-Nick

On 9/4/05, Pete <pe...@gmx.org> wrote:
> Hi,
>
> unfortunately I am unable to figure out how to access an application
> object within my-hivemind.xml...
>
> does somebody know how to inject 'myState' into the marked 'MyFilter'
> property 'injectedState' ????
>
>     <contribution configuration-id="tapestry.state.ApplicationObjects">
>        <state-object name="myState" scope="session">
>           <create-instance class="app.model.state.MyState" />
>        </state-object>
>     </contribution>
>
>     <service-point id="MyFilter"
> interface="org.apache.tapestry.services.ServletRequestServicerFilter">
>        <invoke-factory model="pooled">
>              <set-object property="injectedState"
> value="???????????????????????????????????" />
>           </construct>
>        </invoke-factory>
>     </service-point>
>
>     <contribution
> configuration-id="tapestry.request.ServletRequestServicerPipeline">
>        <filter name="shopSelect" object="service:MyFilter" />
>     </contribution>
>
> Regards
> Peter
>
> ---------------------------------------------------------------------
> 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: access tapestry application objects in hivemind

Posted by Nick Stuart <ba...@gmail.com>.
You wouldnt actually set an actual object in your service, but would
use the configuration instead. Use the <set-configuration> tag
instead. Inside your class you will have to read over all the values
in the configuration list to get the object/values you are looking
for.

-Nick

On 9/4/05, Pete <pe...@gmx.org> wrote:
> Hi,
> 
> unfortunately I am unable to figure out how to access an application
> object within my-hivemind.xml...
> 
> does somebody know how to inject 'myState' into the marked 'MyFilter'
> property 'injectedState' ????
> 
>     <contribution configuration-id="tapestry.state.ApplicationObjects">
>        <state-object name="myState" scope="session">
>           <create-instance class="app.model.state.MyState" />
>        </state-object>
>     </contribution>
> 
>     <service-point id="MyFilter"
> interface="org.apache.tapestry.services.ServletRequestServicerFilter">
>        <invoke-factory model="pooled">
>              <set-object property="injectedState"
> value="???????????????????????????????????" />
>           </construct>
>        </invoke-factory>
>     </service-point>
> 
>     <contribution
> configuration-id="tapestry.request.ServletRequestServicerPipeline">
>        <filter name="shopSelect" object="service:MyFilter" />
>     </contribution>
> 
> Regards
> Peter
> 
> ---------------------------------------------------------------------
> 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