Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-2082

Result annotation for StreamResult uses value tag instead of inputName parameter for the name of the stream property

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.8, 2.0.9
    • 2.1.2
    • Plugin - CodeBehind
    • None
    • MS Windows, IBM RAD 7 Test Environment, WAS 6.1, Java 5

    Description

      The documentation for StreamResult at http://struts.apache.org/2.x/docs/stream-result.html and the released code differ on how the name of the result stream is determined by the framework. The documentation says that this name is defined by he 'inputName' parameter, while the released code uses the 'value' tag of the result annotation.

      In the following code, getXxx() is called to return the stream instead of getYyy() as the documentation would indicate.

      @Result (name="success", type=StreamResult.class, value="xxx", params=

      {"inputName", "yyy", "contentType", "application/x-download", "contentDisposition", "attachment; filename=test.txt"}

      )
      public class Download2Action extends ActionSupport
      {
      //param inputName says this should be called
      public InputStream getYyy() throws Exception

      { return new FileInputStream("C:/temp/support.txt"); }

      // value tag actually determines that this is called instead
      public InputStream getXxx() throws Exception

      { return new FileInputStream("C:/temp/support.txt"); }

      public String execute() throws Exception

      { return SUCCESS; }

      }

      Attachments

        Activity

          People

            mrdon Donald J. Brown
            kdahlhaus Kevin Dahlhausen
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: