Jetty
  1. Jetty
  2. JETTY-1500

form parameters from multipart request not available via request.getParameter

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 8.1.2
    • Fix Version/s: 8.1.3
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Simple form parameters are not available via request.getParameter:

      When using a form like:
      <form enctype="multipart/form-data" method="post">
      <input id="simple" name="simple" type="text"/>
      <input name="translationFile" type="file"/>
      </form>

      The parameter "simple" is not available via request.getParameter, but it is available as a multipart part.

      request.getParameter("simple") > null
      request.getPart("simple") > org.eclipse.jetty.util.MultiPartInputStream$MultiPart@5b46a7bf

      According to the spec, they should be available:

      "For parts with form-data as the Content-Disposition, but without a filename,
      the string value of the part will also be available via the getParameter /
      getParameterValues methods on HttpServletRequest, using the name of the
      part."

      A workaround is to just get the part and retrieve the parameter from it:

      String simple = IOUtils.toString(getPart("simple").getInputStream());

        Activity

        Jan Bartel made changes -
        Field Original Value New Value
        Assignee Jan Bartel [ janb ]
        Hide
        Jan Bartel added a comment -

        Thanks, fixed for 8.1.3
        Jan

        Show
        Jan Bartel added a comment - Thanks, fixed for 8.1.3 Jan
        Jan Bartel made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 8.1.3 [ 18369 ]
        Resolution Fixed [ 1 ]
        Hide
        Gert-Jan van de Streek added a comment -

        Awesome, too quick for me to supply a patch. Thanks!

        Show
        Gert-Jan van de Streek added a comment - Awesome, too quick for me to supply a patch. Thanks!

          People

          • Assignee:
            Jan Bartel
            Reporter:
            Gert-Jan van de Streek
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: