ResourceStreamRequestTarget.configure set wrong ContentLength for non-ascii 
characters
--------------------------------------------------------------------------------------

                 Key: WICKET-1704
                 URL: https://issues.apache.org/jira/browse/WICKET-1704
             Project: Wicket
          Issue Type: Bug
          Components: wicket
            Reporter: Jirka


CharSequence export = DataBase.getInstance().exportDiscounts();
ResourceStreamRequestTarget target = new ResourceStreamRequestTarget(new 
StringResourceStream(export, "text/plain"));
target.setFileName("discounts.csv");
RequestCycle.get().setRequestTarget(target);

If export contains non-ascii characters. e.g. ěščřžýáíé, is wrong set up the 
ContentLength of the response. ContentLength is set up with number of 
characters, but must be set up with number of bytes. Response on output is not 
all.

Be sure that byte[].length != "čřžýá".length()



ResourceStreamRequestTarget.java method configure:

// WICKET-473 Allow IResourceStream.length() to return -1
                long len = resourceStream.length();
                if (len >= 0)
                {
                        // and the content length
                        response.setContentLength(len);
                }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to