GWT FileUpload - Servlet options and handling response
I am new to GWT and am trying to implement a file upload
functionality. Found some implementation help over the internet and
used that as reference. But have some questions related to that:
The actual upload or writing the contents of file on server(or disk)
will be done by a servlet. Is it necessary that this servlet (say
MyFileUploadServlet) extends HttpServlet? OR
I can use RemoteServiceServlet or any other servlet or implement any
other interface? If yes, which method do I need to implement/override?
In my servlet, after everything is done, I need to return back the
response back to the client. I think form.addSubmitCompleteHandler()
can be used to achieve that. From servlet, I could return text/html
(or String type object) and then use SubmitCompleteEvent.getResults()
to get the result.
Question is that can I use my custom object instead of String (lets
say MyFileUploadResult), populate the results in it and then pass it
back to client? or can I get back JSON object?
Currently, after getting back the response and using
SubmitCompleteEvent.getResults(), I am getting some HTML tags added to
the actual response such as :
pre> Image upload successfully /pre> .
Is there a way to get rid of that?
Thanks a lot in advance!