Access to the HTTP Session in a Type Converter?

View: New views
3 Messages — Rating Filter:   Alert me  

Access to the HTTP Session in a Type Converter?

by Matt White-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!

I think I know the answer to this, but I want to ask in case I'm
missing something obvious.

Is there a way to get access to the HTTP Session while in the
convert() method of a TypeConverter?

I'm 99% sure the answer to this is no (since TypeConverter<T> is an
interface), but it seems like every time I think something isn't
possible in Stripes, there's actually a very simple and easy way to do
it. :)

- Matt

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Access to the HTTP Session in a Type Converter?

by Jan Moravec :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Matt,

Not sure if there is an easy way to do what you want using Stripes API, but
you can use a something similar to:

http://article.gmane.org/gmane.comp.java.stripes.user/4834

Then you just need to implement a servlet filter that sets the thread locals
and cleans them up when the processing of the current request finishes.

Jan


> -----Puvodni zprava-----
> Od: Matt White [mailto:mwhite@...]
> Odeslano: 1. November 2009 19:50
> Komu: Stripes Users List
> Predmet: [Stripes-users] Access to the HTTP Session in a Type
> Converter?
>
>
> Hello!
>
> I think I know the answer to this, but I want to ask in case
> I'm missing something obvious.
>
> Is there a way to get access to the HTTP Session while in the
> convert() method of a TypeConverter?
>
> I'm 99% sure the answer to this is no (since TypeConverter<T>
> is an interface), but it seems like every time I think
> something isn't possible in Stripes, there's actually a very
> simple and easy way to do it. :)
>
> - Matt
>
> --------------------------------------------------------------
> ----------------
> Come build with us! The BlackBerry(R) Developer Conference in
> SF, CA is the only developer event you need to attend this
> year. Jumpstart your developing skills, take BlackBerry
> mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009.
> Register now! http://p.sf.net/sfu/devconference 
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@...
> https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Access to the HTTP Session in a Type Converter?

by Ben Gunter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'd recommend using an Interceptor with a ThreadLocal instead of a Filter, but to each his own. FYI, this will be possible in Stripes 1.6 by calling ExecutionContext.currentContext().getActionBeanContext().

-Ben

On Mon, Nov 2, 2009 at 4:41 AM, Jan Moravec <hmor@...> wrote:
Hi Matt,

Not sure if there is an easy way to do what you want using Stripes API, but
you can use a something similar to:

http://article.gmane.org/gmane.comp.java.stripes.user/4834

Then you just need to implement a servlet filter that sets the thread locals
and cleans them up when the processing of the current request finishes.

Jan


> -----Puvodni zprava-----
> Od: Matt White [mailto:mwhite@...]
> Odeslano: 1. November 2009 19:50
> Komu: Stripes Users List
> Predmet: [Stripes-users] Access to the HTTP Session in a Type
> Converter?
>
>
> Hello!
>
> I think I know the answer to this, but I want to ask in case
> I'm missing something obvious.
>
> Is there a way to get access to the HTTP Session while in the
> convert() method of a TypeConverter?
>
> I'm 99% sure the answer to this is no (since TypeConverter<T>
> is an interface), but it seems like every time I think
> something isn't possible in Stripes, there's actually a very
> simple and easy way to do it. :)
>
> - Matt
>
> --------------------------------------------------------------
> ----------------
> Come build with us! The BlackBerry(R) Developer Conference in
> SF, CA is the only developer event you need to attend this
> year. Jumpstart your developing skills, take BlackBerry
> mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009.
> Register now! http://p.sf.net/sfu/devconference
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@...
> https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users