-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: event listener, struts and i18n
PostPosted: Tue Feb 21, 2006 2:31 pm 
Newbie

Joined: Tue Nov 15, 2005 2:14 am
Posts: 7
I develop an Struts application using hibernate.
I use Struts processor to open a session for each client request.
I use hibernate event mechanism to be notified when an object is inserted.

I need to send an email to some people when an event occurs.
This email contains i18n message according to the Locale presents in his HTTPSession.

My problem is that when I receive a notification, the notification event does not known what a HTTPSession is (of course ;-) ).

So can I put the Locale in the Hibernate Session or Transaction (or everything else) to allow me to do something like that :


Code:
Locale userLocale = session.getCustomParameter("locale");


And use the struts processord to do something like :
Code:
session.setCustomParameter(locale);


Top
 Profile  
 
 Post subject: trick
PostPosted: Tue Feb 28, 2006 7:30 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Something like this will do the trick:
http://sandbox.sourcelabs.com/kosta/hb- ... ation.html

Of course you do not need to use custom session factories and such, just use ThreadLocal variables approach...

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.