Hi.
Because I could not find proper server-side sample for ExtGWT File Upload,
I have made upload with FormPanel for client side and "extends HttpServlet" for Server-side , not "extends RemoteServiceServlet ".
Problem is that I could not get any response such as Callback or HttpResponse of upload results
1. How can I get or handle the response after upload complete?
2. Is there no sample file uplod for server-side with "RemoteServiceServlet"? if it is, please let me know~
Client
PHP Code:
final FormPanel panel = new FormPanel();
panel.setHeading("File Upload Example");
panel.setFrame(true);
panel.setAction("/upload");
panel.setEncoding(Encoding.MULTIPART);
panel.setMethod(Method.POST);
..
..
btn.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
if (!panel.isValid()) {
return;
}
// normally would submit the form but for example no server set up to
// handle the post
panel.submit();
MessageBox.info("Action", "You file was uploaded", null);
}
});
Server
PHP Code:
public class AGISFileDispatcher extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
try{
resp.setContentType("text/html");
parsing(req);
MyDispatcher a = new MyDispatcher();
a.saveFile(req, resp);
}catch(AgisException ex)
{
ex.printStackTrace();
}
}
Thanks!