Search code examples
javajspservletsjakarta-mailapache-commons-fileupload

How to parse multipart/mixed content from JSP to servlets


I'm sending multipart/mixed content message from JSP to servlets but when I used

ServletFileUpload.isMultipartContent(request);

method to check if the request is Multipart or not, I'm getting the output as "false". This is how content type header of my message is looking like:

multipart/mixed; 
    boundary="----=_Part_26_2184190.1271924416255"

Could anyone please tell me how can I parse the request using Apache fileupload API? How the above method can return me an output as "true"


Solution

  • The conditions are:

    • the request method must be post
    • the content-type must start with multipart/

    Check these two via request.getMethod() and request.getContentType()