[seam-dev] How to store data in contexts

Pete Muir pmuir at redhat.com
Tue May 19 12:53:38 EDT 2009


On 15 May 2009, at 17:26, Dan Allen wrote:

> On Tue, May 12, 2009 at 5:26 AM, Nicklas Karlsson  
> <nickarls at gmail.com> wrote:
> Seam could have a "hacks" module that would add the binding type and
> producer method ;-)
>
> Maybe 10 beers in you can convince me, but I don't see using the  
> HTTP contexts as hacks. To me, they have been around for 10+ years  
> and software uses them. That is a reality. You walk into any  
> technical manager's office and try to tell them you can't use  
> contexts anymore and they will gladly show you the door and hire  
> some programmer willing to use them. There is software in an ivory  
> tower and there is real life. We are stupid not to offer some way to  
> access these contexts. Can we advocate not to .... sure, fine, but I  
> still think it is stupid to pretend they don't exist.

Dan, stop using crazy FUD ;-)

1) JCDI provides a good way to use contextual data, through beans. The  
API is neat, unified and declarative
2) JCDI provides a way to manage the lifecycle of your data in the  
contexts directly should you prefer through Contextual. This isn't  
recommended
3) JCDI doesn't stop you accessing the contexts directly by accessing  
the request, session etc. One of the modules Seam should supply is  
manager objects for the HttpSession, ServletContext and HttpRequest.

Anyway, Matt's suggestion of exposing the attribute maps from these as  
a Map is reasonably neat, and I guess we could do that - some  
abstraction is definitely not a good idea though.

Maybe make something in sandbox to start with, and see how popular it  
is?

>
>
> -Dan
>
>
>
> On Tue, May 12, 2009 at 11:10 AM, Matt Drees <matt.drees at gmail.com>  
> wrote:
> >
> >
> > On Fri, May 8, 2009 at 2:29 PM, Dan Allen <dan.j.allen at gmail.com>  
> wrote:
> >>
> >>
> >> The second use case would be to pick off flags that libraries set  
> into
> >> scopes. So the values are already there, you just need to read  
> them.
> >
> > Several of our apps use a third-party filter [1] to authenticate  
> the user,
> > which stores credentials in the http session.  I'd appreciate  
> being able to
> > write:
> >
> > class UsernameProvider
> > {
> >
> >   @HttpSession Map<String, Object> session;
> >
> >   @Produces @Username String retrieveCasReceipt()
> >   {
> >      return (String) session.get(CASFilter.CAS_FILTER_USER);
> >   }
> >
> > }
> >
> >
> > So, +1 for Dan's suggestion.  If support for such attribute maps  
> aren't in
> > Seam, I'm sure I'm not the only one who will be putting them in my  
> Util
> > project.
> >
> > -Matt
> >
> > [1]  http://www.jasig.org/cas/client-integration/java-client
> >
> >
> >
> >>
> >>
> >> -Dan
> >>
> >> --
> >> Dan Allen
> >> Senior Software Engineer, Red Hat | Author of Seam in Action
> >>
> >> http://mojavelinux.com
> >> http://mojavelinux.com/seaminaction
> >> http://in.relation.to/Bloggers/Dan
> >>
> >> NOTE: While I make a strong effort to keep up with my email on a  
> daily
> >> basis, personal or other work matters can sometimes keep me away
> >> from my email. If you contact me, but don't hear back for more  
> than a
> >> week,
> >> it is very likely that I am excessively backlogged or the message  
> was
> >> caught in the spam filters.  Please don't hesitate to resend a  
> message if
> >> you feel that it did not reach my attention.
> >>
> >> _______________________________________________
> >> seam-dev mailing list
> >> seam-dev at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/seam-dev
> >>
> >
> >
> > _______________________________________________
> > seam-dev mailing list
> > seam-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/seam-dev
> >
> >
>
>
>
> --
> ---
> Nik
>
>
>
> -- 
> Dan Allen
> Senior Software Engineer, Red Hat | Author of Seam in Action
>
> http://mojavelinux.com
> http://mojavelinux.com/seaminaction
> http://in.relation.to/Bloggers/Dan
>
> NOTE: While I make a strong effort to keep up with my email on a daily
> basis, personal or other work matters can sometimes keep me away
> from my email. If you contact me, but don't hear back for more than  
> a week,
> it is very likely that I am excessively backlogged or the message was
> caught in the spam filters.  Please don't hesitate to resend a  
> message if
> you feel that it did not reach my attention.
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev

--
Pete Muir
http://www.seamframework.org
http://in.relation.to/Bloggers/Pete




More information about the seam-dev mailing list