星期日, 7月 24, 2011
星期日, 7月 10, 2011
星期四, 7月 07, 2011
A Vaadin resource for the blobstore
1 | public class BlobstoreResource implements ApplicationResource { |
Vaadin refresh parameter handler
@Override
public void handleParameters(Map<String, String[]> parameters) {
if(parameters.containsKey("refresh")) {
// refresh the layout ...
}
}
1 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) |
Get Http Request Object
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();
}
}
});
}
訂閱:
文章 (Atom)