Re: Session in ServiceEncoder's?

2008-01-23 Thread Kaspar Fischer


On 21.01.2008, at 17:24, Kaspar Fischer wrote:


Hi,

Can I inject the current session into a service encoder?


Any idea how I could achieve this?

Many thanks!
Kaspar

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



Re: Session in ServiceEncoder's?

2008-01-23 Thread Kaspar Fischer

This seems to work:

 service-point id=myencoder  
interface=org.apache.tapestry.engine.ServiceEncoder

  invoke-factory
   construct  
class=org.myorg.tapestry.myproject.serviceencoders.DBObjectServiceEncod 
er

set property=pageName value=node /
set-object property=applicationStateManager  
value=service:tapestry.state.ApplicationStateManager /

   /construct
  /invoke-factory
 /service-point

and in the service encoder class:

  ...
  private ApplicationStateManager applicationStateManager;
  ...
  public void setApplicationStateManager(ApplicationStateManager  
applicationStateManager)

  {
this.applicationStateManager = applicationStateManager;
  }
  ...
... = (...) this.applicationStateManager.get(whatever you need);
  ...

Kaspar

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



Session in ServiceEncoder's?

2008-01-21 Thread Kaspar Fischer

Hi,

Can I inject the current session into a service encoder?

Doing it with

 service-point id=myencoder  
interface=org.apache.tapestry.engine.ServiceEncoder

  invoke-factory
   construct  
class=org.myorg.tapestry.myproject.serviceencoders.DBObjectServiceEncod 
er

set property=pageName value=node /
set-object property=loginSession value=app- 
property:loginSession /

   /construct
  /invoke-factory
 /service-point

in hivemodule.xml does not work: the loginSession is only set once  
(to null), when

the service encoder is created.

The need for the session in the service encoder might seem strange,  
but I
need it as I need to decide, depending on the object-id encoded in  
the URL
and the user currently logged in, what page-class to use to display  
the object.


Many thanks,
Kaspar

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