[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [S2] Can't setBufferSize on StreamResult from action configuration (Struts2 2.1.6) Dale Newfield Fri Jun 26 09:01:04 2009

Francisco José Aquino García wrote:
      <result type="stream">
        <param name="contentType">${mimeType}</param>
        <param name="contentLength">${length}</param>
        <param name="contentDisposition">inline; filename="${fileName}"</param>
        <param name="inputName">inputStream</param>
        <param name="bufferSize">${buffSize}</param>
        <param name="allowCaching">false</param>

The result doesn't evaluate bufferSize.  You can't put in OGNL there.

I've been peeking a little into
org.apache.struts2.dispatcher.StreamResult, and it indeed has a
property bufferSize of type int, but looks like OGNL keeps on
hammering a non-existent String one.

"${buffSize}" is a String.

By the way, I also can't get the point of contentLengh being String.

Did you notice where that string is explicitly parsed to extract a real value?

  198               // Set the content length
  199               if (contentLength != null) {
200 String _contentLength = conditionalParse(contentLength, invocation);
  201                   int _contentLengthAsInt = -1;
  202                   try {
203 _contentLengthAsInt = Integer.parseInt(_contentLength);
  204                       if (_contentLengthAsInt >= 0) {
205 oResponse.setContentLength(_contentLengthAsInt);
  206                       }
  207                   }
  208                   catch(NumberFormatException e) {
209 log.warn("failed to recongnize "+_contentLength+" as a number, contentLength header will not be set", e);
  210                   }
  211               }


To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]