Vaadin "transaction" equals "http request".
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* Vaadin "transaction" equals "http request". This method fires for all servlets
* in the session.
*/
private void attachHttpRequestListener() {
getContext().addTransactionListener(new TransactionListener() {
private static final long serialVersionUID = -2365336986843262181L;
public void transactionStart(Application application,
Object transactionData) {
((LocalizedSystemMessages)getSystemMessages()).setThreadLocale(getLocale());
current.set(CompetitionApplication.this); // make the application available via ThreadLocal
HttpServletRequest request = (HttpServletRequest)transactionData;
request.getSession(true).setMaxInactiveInterval(3600);
}
public void transactionEnd(Application application,
Object transactionData) {
// Transaction listener gets fired for all (Http) sessions
// of Vaadin applications, checking to be this one.
if (application == CompetitionApplication.this) {
closeHibernateSession();
}
}
});
}
* Vaadin "transaction" equals "http request". This method fires for all servlets
* in the session.
*/
private void attachHttpRequestListener() {
getContext().addTransactionListener(new TransactionListener() {
private static final long serialVersionUID = -2365336986843262181L;
public void transactionStart(Application application,
Object transactionData) {
((LocalizedSystemMessages)getSystemMessages()).setThreadLocale(getLocale());
current.set(CompetitionApplication.this); // make the application available via ThreadLocal
HttpServletRequest request = (HttpServletRequest)transactionData;
request.getSession(true).setMaxInactiveInterval(3600);
}
public void transactionEnd(Application application,
Object transactionData) {
// Transaction listener gets fired for all (Http) sessions
// of Vaadin applications, checking to be this one.
if (application == CompetitionApplication.this) {
closeHibernateSession();
}
}
});
}
沒有留言:
張貼留言