I have an application where occasionally Spring throws the error:
org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'action' is not present
Naturally you would expect the action
param to be missing, however it is definitely being POSTed by the browser. I've even gone as far as watching the network traffic with Wireshark, and it is there!
Here is an example of the raw post taken from Chromes dev tools - Note the &action=accept
is there:
imageId=1445&customReason=&action=accept&image=iVBORw0K...
The &image
is a base64 encoded image (taken from a canvas element), and the whole POST is approx 4Mb.
This is running inside Tomcat 6.0 with Spring 3.2.8.
The Spring MVC controller that is throwing this is:
public String saveApprove(
HttpServletRequest request,
Model model,
@RequestParam(value="action", required=true) String action,
@RequestParam("imageId") int imageId,
@RequestParam(value="image", required=false) String imageBase64Encoded,
@RequestParam(value="rejectReasons", required=false) String rejectReasons[],
@RequestParam(value="customReason", required=false) String customReason
)
What could be causing this? Most photos are OK, but approx 10% throw this error. It's reproducible for a photo that throws it.
Is this a bug in Spring?