星期四, 7月 07, 2011

Vaadin refresh parameter handler

@Override
public void handleParameters(Map<String, String[]> parameters) {
if(parameters.containsKey("refresh")) {
// refresh the layout ...
}
}

1
2
3
4
5
6
7
8
9
10
11
12
13
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
final Map blobs = blobstoreService.getUploadedBlobs(req);
final BlobKey blobKey = blobs.get("myImage");
final String uploadKey = req.getParameter("uploadKey");
 
final Objectify ofy = ObjectifyService.begin();
final User user = ofy.query(User.class).filter("uploadKey", uploadKey).get();
user.setBlobKey(blobKey.getKeyString());
ofy.put(user);
 
resp.sendRedirect("/?refresh");
}

沒有留言: