I want to recursively upload files from a directory and then additionally evaluate the original path. The HTMLInputElement multiple webkitdirectory provides exactly what I need. I also managed to integrate the HTMLInputElement into a javascript component. But I do not know how to access the server side file object.
Can someone help me there? Or is there perhaps an easier way?
VaadinSession.getCurrent().addRequestHandler(
new RequestHandler() {
@Override
public boolean handleRequest(VaadinSession session,
VaadinRequest request,
VaadinResponse response)
throws IOException {
if ("/rhexample".equals(request.getPathInfo())) {
// Generate a plain text document
response.setContentType("text/plain");
response.getWriter().append(
"Here's some dynamically generated content.\n");
response.getWriter().format(Locale.ENGLISH,
"Time: %Tc\n", new Date());
// Use shared session data
response.getWriter().format("Session data: %s\n",
session.getAttribute("mydata"));
return true; // We wrote a response
} else
return false; // No response was written
}
});
Add this request handler from Vaadin component code and you will be able to handle multipart uploads to /rhexample URL.