I hope there are still some GWT developers ... I'm new to GWT development and I'm trying to do a form-based file upload system. To do so, I implemented a HTTPServlet and overrode the methode doPost. However, when I submit the form, I do get a response 200 without any content. But if you look at my file below, I'm sending a 500 response ... And thee System.out.println is not being called ...
I went through a lot of already asked questions on the web but couldn't find a solution ...
POST method not called on servlet - GWT project
How exactly servlet Work in GWT?
Here are files I have:
web.xml
<servlet>
<servlet-name>fileupload</servlet-name>
<servlet-class>com.myCompany.FileUpload
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>fileupload</servlet-name>
<url-pattern>/myModule/fileupload</url-pattern>
</servlet-mapping>
FormPresenter.java (I'm using MVP Architecture)
formPanel.setAction(GWT.getModuleBaseURL() + "fileupload");
formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
formPanel.setMethod(FormPanel.METHOD_POST);
FileUpload.java (Servlet File)
@RemoteServiceRelativePath("fileupload")
public class FileUpload extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("FileUpload doPost");
resp.sendError(500);
}
}
Form.ui.xml
<g:FormPanel ui:field="formPanel">
<g:VerticalPanel>
<g:FileUpload ui:field="fileUpload"></g:FileUpload>
</g:VerticalPanel>
</g:FormPanel>
Thanks for your help !
Hyukchan.