You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Janko Muzykant <um...@googlemail.com> on 2007/05/25 14:02:44 UTC
T5 migration from T4
i couldn't find a proper answers to the following questions so i would be
grateful if someone could enlighten me a bit.
* how to get a current page that component is rendered on? I know there is
almost no difference between pages and components in T5. in such a case, how
to get a 'root' component that acts as a Page in T4?
* how to get current HttpSession? I know how to get a Session object but it
is not enough as it doesn't have an 'invalidate' method for example.
* the same thing with HttpServletRequest. There is a Request but it doesn't
allow to get/set attributes.
* how to get a ServletContext object?
I guess these question may look a bit silly but unfortunately they are a
real stoppers in my migration to T5.
umrzyk.
Re: T5 migration from T4
Posted by Howard Lewis Ship <hl...@gmail.com>.
Not using the built-in services, since there's not been a call for it. Yes,
there's a call here, but that's mostly represents missing functionality in
the exposed Request interface, rather than a real need to inject
HttpServletRequest.
On 5/28/07, Paul Stanton <pa...@gunnsoft.com.au> wrote:
>
>
> > You can inject the RequestGlobals service, and obtain HttpServletRequest
> > from it, then the session from the request.
>
> does that mean you can't inject HttpServletRequest ala 4.1?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
Re: T5 migration from T4
Posted by Paul Stanton <pa...@gunnsoft.com.au>.
> You can inject the RequestGlobals service, and obtain HttpServletRequest
> from it, then the session from the request.
does that mean you can't inject HttpServletRequest ala 4.1?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 migration from T4
Posted by Howard Lewis Ship <hl...@gmail.com>.
On 5/25/07, Janko Muzykant <um...@googlemail.com> wrote:
>
> i couldn't find a proper answers to the following questions so i would be
> grateful if someone could enlighten me a bit.
>
> * how to get a current page that component is rendered on? I know there is
> almost no difference between pages and components in T5. in such a case,
> how
> to get a 'root' component that acts as a Page in T4?
Must of this involves access to the ComponentResources for your component.
ComponentResources is a window into the structure Tapestry builds around
your classes.
@Inject
private ComponentResources _resources;
The page component is available as _resources.getPage(). You can cast from
Component down to the actual class.
* how to get current HttpSession? I know how to get a Session object but it
> is not enough as it doesn't have an 'invalidate' method for example.
There's a JIRA issue about adding additional methods to Session.
You can inject the RequestGlobals service, and obtain HttpServletRequest
from it, then the session from the request.
* the same thing with HttpServletRequest. There is a Request but it doesn't
> allow to get/set attributes.
> * how to get a ServletContext object?
You can work through the RequestGlobals.
If you use these a lot, you can use the ShadowBuilder service to create
services that shadow properties of RequestGlobals, much as the Request
service:
public Request buildRequest()
{
return _shadowBuilder.build(_requestGlobals, "request",
Request.class);
}
Once a shadow service exists, you can inject that service directly.
I guess these question may look a bit silly but unfortunately they are a
> real stoppers in my migration to T5.
>
> umrzyk.
>
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com