I'm trying to simple POST data from my form to my spring controller and I always getting the error message:
the server responded with a status of 400 (Required String parameter 'profileId' is not present)
my Form within my uiBinder:
<g:FormPanel ui:field="formPanel">
<g:HTMLPanel>
<table border="0" width="100%">
<tr>
<td width="20%"><g:HTML HTML="Profile ID:" /></td>
<td width="80%"><g:TextBox name="profileId" ui:field="profileId" width="300px" "/>
<td width="20%"><g:HTML HTML="Logo: " /></td>
<td width="80%"> <g:FileUpload name="logo" ui:field="logoUpload"/> </td>
</tr>
</table><br/>
</g:HTMLPanel>
</g:FormPanel>
the submit within the view:
String actionUrl = com.google.gwt.core.client.GWT.getHostPageBaseURL() + "/create";
formPanel.setAction(actionUrl);
formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
formPanel.setMethod(FormPanel.METHOD_POST);
formPanel.submit();
my spring controller:
@RequestMapping(method = RequestMethod.POST, value = "/create")
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public void create(@RequestParam("profileId") String profileId,
@RequestParam("logo") MultipartFile logo) throws BadRequestException, InternalException, NotFoundException{
log.info("Request to create new user.");
}
The request payload tracked with chrome dev tool:
------WebKitFormBoundaryX7km8vQwaC3LtjqO Content-Disposition: form-data; name="profileId"
test1 ------WebKitFormBoundaryX7km8vQwaC3LtjqO Content-Disposition: form-data; name="logo"; filename="test1.png" Content-Type: image/png
------WebKitFormBoundaryX7km8vQwaC3LtjqO--
Eclipse console output:
[WARN] 400 - POST /create (127.0.0.1) 1495 bytes Request headers
Host: lokalhorst.com:55409
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36
Referer: http://lokalhorst.com:55409/admin.html
Accept-Encoding: gzip,deflate
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: JSESSIONID=63vn7rbgnrqa
Content-Length: 10244
Pragma: no-cache
Cache-Control: no-cache
Origin: lokalhorst.com:55409
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryX7km8vQwaC3LtjqO Response headers
Content-Type: text/html; charset=iso-8859-1
Content-Length: 1495
Thanks for any help.