You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Jirka (JIRA)" <ji...@apache.org> on 2008/06/17 15:55:46 UTC

[jira] Created: (WICKET-1704) ResourceStreamRequestTarget.configure set wrong ContentLength for non-ascii characters

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.


[jira] Reopened: (WICKET-1704) ResourceStreamRequestTarget.configure set wrong ContentLength for non-ascii characters

Posted by "Jirka (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jirka reopened WICKET-1704:
---------------------------


The same bug in class org.apache.wicket.util.resource.StringBufferResourceStream. Maybe others, that extends org.apache.wicket.util.resource.AbstractStringResourceStream or generally implements IStringResourceStream.

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.4, 1.4-M3
>
>
> 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.


[jira] Updated: (WICKET-1704) ResourceStreamRequestTarget.configure set wrong ContentLength for non-ascii characters

Posted by "Martijn Dashorst (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martijn Dashorst updated WICKET-1704:
-------------------------------------

    Fix Version/s:     (was: 1.3.4)
                       (was: 1.4-M3)
                   1.4-M4

Moved to next milestone release.

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.4-M4
>
>
> 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.


[jira] Resolved: (WICKET-1704) ResourceStreamRequestTarget.configure set wrong ContentLength for non-ascii characters

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-1704.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4-M3
                   1.3.4

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.4, 1.4-M3
>
>
> 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.


[jira] Assigned: (WICKET-1704) ResourceStreamRequestTarget.configure set wrong ContentLength for non-ascii characters

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-1704:
-------------------------------------

    Assignee: Igor Vaynberg

> 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
>            Assignee: Igor Vaynberg
>
> 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.


[jira] Resolved: (WICKET-1704) ResourceStreamRequestTarget.configure set wrong ContentLength for non-ascii characters

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-1704.
-----------------------------------

    Resolution: Fixed

thanks, you couldve just provided a patch from the get go :)

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.4, 1.4-M3
>
>
> 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.


[jira] Reopened: (WICKET-1704) ResourceStreamRequestTarget.configure set wrong ContentLength for non-ascii characters

Posted by "Jirka (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jirka reopened WICKET-1704:
---------------------------


Thanks for fast fix. But it isnt correct, because array of bytes depends on charset.
Better is

               if (getCharset() != null) {
                    try {
                        return getString().getBytes(getCharset().name()).length;
                    } catch (UnsupportedEncodingException e) {
                        throw someException...
                    }
                } else {
                    return getString().getBytes().length;
                }

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.4, 1.4-M3
>
>
> 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.


[jira] Resolved: (WICKET-1704) ResourceStreamRequestTarget.configure set wrong ContentLength for non-ascii characters

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-1704.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.5

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.5, 1.4-M4
>
>
> 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.