JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-5628

Mule breaks multipart/form-data encoded messages

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 3.1.1
  • Fix Version/s: 3.1.4 (EE only), 3.2.1
  • Component/s: Modules: Jersey
  • Labels:
    • jersey
    • mule
  • Environment:

    Fedora 15
    java-1.6.0-openjdk-1.6.0.0-58.1.10.2.fc15.i686

  • User impact:
    High
  • Configuration:
    Hide
    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
    http://www.mulesoft.org/schema/mule/jersey
    http://www.mulesoft.org/schema/mule/jersey/3.0/mule-jersey.xsd
    http://jersey.apache.org/core http://jersey.apache.org/schemas/core.xsd">
    
    	<flow name="X12ToSummaryHtml">
    		<inbound-endpoint address="http://localhost:8080/jersey" />
    		<jersey:resources>
    			<component class="com.optuminsight.unionstation.service.X12ToSummaryHtml" />
    		</jersey:resources>
    	</flow>
    </mule>
    @POST
        @Path("/getSummaryHtml")
        @Consumes(MediaType.MULTIPART_FORM_DATA)
        @Produces("text/html")
        public final Response getSummaryHtml(@FormDataParam("x12file") final InputStream x12file) throws IOException {
            LOG.info("called getSummaryHtml");
            return Response.ok(IOUtils.toString(x12file)).build();
        }
    Show
    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
    http://www.mulesoft.org/schema/mule/jersey
    http://www.mulesoft.org/schema/mule/jersey/3.0/mule-jersey.xsd
    http://jersey.apache.org/core http://jersey.apache.org/schemas/core.xsd">
    
    	<flow name="X12ToSummaryHtml">
    		<inbound-endpoint address="http://localhost:8080/jersey" />
    		<jersey:resources>
    			<component class="com.optuminsight.unionstation.service.X12ToSummaryHtml" />
    		</jersey:resources>
    	</flow>
    </mule>
    @POST
        @Path("/getSummaryHtml")
        @Consumes(MediaType.MULTIPART_FORM_DATA)
        @Produces("text/html")
        public final Response getSummaryHtml(@FormDataParam("x12file") final InputStream x12file) throws IOException {
            LOG.info("called getSummaryHtml");
            return Response.ok(IOUtils.toString(x12file)).build();
        }
  • Log Output:
    Hide
    About to connect() to localhost port 8080 (#0)
    Trying 127.0.0.1... connected
    Connected to localhost (127.0.0.1) port 8080 (#0)

    POST /jersey/X12ToSummaryHtml/getHtml/ HTTP/1.1
    User-Agent: curl/7.21.3 (i386-redhat-linux-gnu) libcurl/7.21.3 NSS/3.12.10.0 zlib/1.2.5 libidn/1.19 libssh2/1.2.7
    Host: localhost:8080
    Accept: /
    Content-Length: 2706
    Expect: 100-continue
    Content-Type: multipart/form-data; boundary=----------------------------55b24ac88245
    < HTTP/1.1 100 Continue
    < Content-Type: text/plain
    < Content-Length: 0
    < Connection: close
    < HTTP/1.1 400 Bad Request
    < Content-Type: multipart/form-data; boundary=----------------------------55b24ac88245
    < Date: Sat, 25 Jun 2011 01:29:10 MDT
    < Server: Mule Core/3.1.1
    < Expires: Sat, 25 Jun 2011 01:29:10 MDT
    < http.status: 400
    < MULE_ENCODING: UTF-8
    < Transfer-Encoding: chunked
    < Connection: close
    <
    Show
    About to connect() to localhost port 8080 (#0) Trying 127.0.0.1... connected Connected to localhost (127.0.0.1) port 8080 (#0) POST /jersey/X12ToSummaryHtml/getHtml/ HTTP/1.1 User-Agent: curl/7.21.3 (i386-redhat-linux-gnu) libcurl/7.21.3 NSS/3.12.10.0 zlib/1.2.5 libidn/1.19 libssh2/1.2.7 Host: localhost:8080 Accept: / Content-Length: 2706 Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------55b24ac88245 < HTTP/1.1 100 Continue < Content-Type: text/plain < Content-Length: 0 < Connection: close < HTTP/1.1 400 Bad Request < Content-Type: multipart/form-data; boundary=----------------------------55b24ac88245 < Date: Sat, 25 Jun 2011 01:29:10 MDT < Server: Mule Core/3.1.1 < Expires: Sat, 25 Jun 2011 01:29:10 MDT < http.status: 400 < MULE_ENCODING: UTF-8 < Transfer-Encoding: chunked < Connection: close <
  • Similar Issues:
    None

Description

I wrote a Jersey class that was supposed to accept a multipart/form-data encoded POST from a html form. It returned a 400 error. Digging into the actual problem, I found that a MIMEParsingException is being thrown by mimepull (a Jersey dependency). The body of the post is getting corrupted somehow. I've confirmed that the Jersey class is working correctly by deploying it in a Jetty container and testing it there.

Until this gets fixed, I can't create a web service that accepts files

The original report is at http://forums.mulesoft.org/thread.jspa?messageID=16784#16784

Issue Links

is duplicated by

Bug - A problem which impairs or prevents the functions of the product. MULE-5828 POSTing a multipart/form-data message w/o a payload parameter throws IllegalArgumentException

  • Critical - Crashes, loss of data, severe memory leak.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
No work has yet been logged on this issue.

People

  • Assignee:
    Santiago Vacas
    Reporter:
    Ben Mathews
Vote (1)
Watch (0)

Dates

  • Created:
    01/Jul/11 11:53 AM
    Updated:
    12/Dec/11 08:24 AM
    Resolved:
    18/Oct/11 03:32 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.