You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Phillip Rhodes <sp...@rhoderunner.com> on 2006/01/20 21:34:48 UTC

Inject object from httpsession into visit?

I have an object in the httpsession that I would like to inject into my
application's Visit object.

I am integrating a java authorization engine (called authsum) into a new
tapestry app.  The "authsum" framework that I wrote, puts a "User" object
into the httpsession object

I need to have this "User" object inside my visit object in order to make
authorization calls.

I hope to be releasing authsum in the coming weeks, but doing the hard
work now of actually using this framework in a real app.


authsum is a sso and authorization framework that provides a hibernate
database model, managed by a tapestry administration interface alongside a
suite of web services to provide SSO and authorization services for java
based applications



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


RE: Inject object from httpsession into visit?

Posted by Steve Shucker <ss...@vmsinfo.com>.
I'm doing exactly the same thing, but for various reasons the user is
required to land on the home page, so I just implemented this in the
pageBeginRender of the home page:

public void pageBeginRender(PageEvent event) {
    VisitImpl visit = (VisitImpl) getVisit();
    if (visit.getSession() == null) {
        HttpServletRequest request =
            event.getRequestCycle().getRequestContext().getRequest();
        visit.setSession(
            (SSOSession) request.getSession().getAttribute("session"));
}

If you can land anywhere, this isn't for you, but the point is that anywhere
you've got a PageEvent, RequestCycle or RequestCycle you can do this.  This
is from tapestry3, but for tapestry4 I'd see what happens if you define your
User object as an ASO in your hivemodule.xml like

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

With any luck, tapestry will just grab whatever your SSO framework sticks
there.

-Steve

-----Original Message-----
From: Phillip Rhodes [mailto:spamsucks@rhoderunner.com] 
Sent: Friday, January 20, 2006 1:35 PM
To: tapestry-user@jakarta.apache.org
Subject: Inject object from httpsession into visit?

I have an object in the httpsession that I would like to inject into my
application's Visit object.

I am integrating a java authorization engine (called authsum) into a new
tapestry app.  The "authsum" framework that I wrote, puts a "User" object
into the httpsession object

I need to have this "User" object inside my visit object in order to make
authorization calls.

I hope to be releasing authsum in the coming weeks, but doing the hard
work now of actually using this framework in a real app.


authsum is a sso and authorization framework that provides a hibernate
database model, managed by a tapestry administration interface alongside a
suite of web services to provide SSO and authorization services for java
based applications



---------------------------------------------------------------------
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