#76 Fix ServletUnit file upload Content-Type header


The "boundery" part of the Content-Type header, which is mandatory for commons-fileupload, was missing from the httprequest in the servlet.

Attached code fixes servletunit in order to be able to test a file upload servlet that has been implemented with the commons-fileupload library.


  • Wolfgang Fahl

    Wolfgang Fahl - 2007-12-30

    Logged In: YES
    Originator: NO

    please supply the header you'd like to parse and the result you expect so that we can fix to create what is intended.
    A Junit Test for checking parseContentTypeHeader would be great

    * Returns the content type and encoding as a pair of strings.
    * If no character set is specified, the second entry will be null.
    public static String[] parseContentTypeHeader( String header ) {
    String[] result = new String[] { "text/plain", null };
    StringTokenizer st = new StringTokenizer( header, ";=" );
    result[0] = st.nextToken();
    while (st.hasMoreTokens()) {
    String parameter = st.nextToken();
    if (st.hasMoreTokens()) {
    String value = stripQuotes( st.nextToken() );
    if (parameter.trim().equalsIgnoreCase( "charset" )) result[1] = value;
    return result;

  • Wolfgang Fahl

    Wolfgang Fahl - 2007-12-30
    • assigned_to: nobody --> wolfgang_fahl
    • status: open --> pending
  • SourceForge Robot

    • status: pending --> closed
  • SourceForge Robot

    Logged In: YES
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).


Log in to post a comment.