Mantis Bugtracker

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004153 [Resin] minor always 08-02-10 11:40 08-02-10 13:35
Reporter ferg View Status public  
Assigned To alex
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.10 Product Version
  Product Build
Summary 0004153: servlet 3.0 @MultipartConfig
Description (rep by Wesley Wu)

I found a frustrating problem when porting my framework to accommodate the Servlet 3.0 file upload spec in Resin 4.0.8/4.0.9.

There did has a (private Object _value) in com.caucho.server.http.HttpServletRequestImpl.PartImpl, however,
if it's not a file upload but a common text form field, I could nowhere to retreive the text value
of the part throught current implementation.

I don't want to write the text value to a file and read it into a string. It's just stupid.

I know it's probably a spec issue without an

Object getValue();


String getTextValue();

, but it does has a workaround.

I think the getInputStream() should not return null when the Part is a normal form field.
It may return a StringReader or something to let me get the string value throught the InputStream.

maybe like this (from [^]

  * Returns the text value of the given part.
private String getValue(Part part) throws IOException {
    String value = new BufferedReader(new InputStreamReader(part.getInputStream(), encoding)).readLine();
    return (value != null) ? value : ""; // Must be empty String according HTTP spec.

Now I have to use


to retrieve the text form field value. But I know it must be wrong, because we may have multiple fields have the same name.

Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
08-02-10 13:35


String values are now accessible with either getParameter or getInputStream. PartImpl.getValue() made public to provide an optimized access.

import com.caucho.server.http.*;

public class MyServlet extends HttpServlet {
  public void service(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    try {
      PrintWriter out = resp.getWriter();
      Collection<Part> parts = req.getParts();
      for (Part part: parts) {
        HttpServletRequestImpl.PartImpl partImpl
          = (HttpServletRequestImpl.PartImpl)part;
        out.println("name: " + part.getName());
        out.println("partImpl-value: " + partImpl.getValue());
        InputStream in = part.getInputStream();
        byte[] buffer = new byte[64];
        int len =;
        out.println("toString(part.getInputStream()): " + new String(buffer, 0, len));
    } catch (Exception e) {
      resp.getWriter().println("exception: " + e);

- Issue History
Date Modified Username Field Change
08-02-10 11:40 ferg New Issue
08-02-10 13:33 alex Status new => assigned
08-02-10 13:33 alex Assigned To  => alex
08-02-10 13:35 alex Status assigned => closed
08-02-10 13:35 alex Note Added: 0004691
08-02-10 13:35 alex Resolution open => fixed
08-02-10 13:35 alex Fixed in Version  => 4.0.10

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker