[ http://issues.apache.org/jira/browse/COCOON-1351?page=all ]

Ralph Goers updated COCOON-1351:
--------------------------------

    Bugzilla Id:   (was: 32289)
      Component: * Cocoon Core
                     (was: Blocks: (Undefined))
    Description: 
The fragment id generated by the FragmentExtractorTransformer is not unique for 
each fragment extracted.

The fragment id is generated by the following code:
this.requestURI = ObjectModelHelper.getRequest(objectModel).getSitemapURI();
String id = Long.toHexString((hashCode()^HashUtil.hash(requestURI)) + 
fragmentID);

where fragmentId is an integer that starts at 0 and is incremented by one for 
each fragment extracted in the current response.

I have an application where a jpeg image is embedded in xml as base64 data.  I 
use FragmentExtractorTransformer to extract the base64 data and replace it with 
a url based on the fragment id.   Another pipeline handles the image request 
from the browser by connecting a fragmentExtractorGenerator with a base64 
serializer.  The problem is that the same image (usually the first one 
requested) is returned for all requests.

The problem occurs because the request for the page containing the image 
displays a different image depending on the request parameters passed.  As 
fragmentExtractorTransformer only uses the SitemapURI as the basis of the hash 
key, it produces the same hash key for every image.  This causes different 
images to be stored under the same id.  Its anyone's guess which image is 
returned by the following request for the image.

The solution is that the fragment id hash should include the request parameters 
as well as the uri to generate unique ids.

  was:
The fragment id generated by the FragmentExtractorTransformer is not unique for 
each fragment extracted.

The fragment id is generated by the following code:
this.requestURI = ObjectModelHelper.getRequest(objectModel).getSitemapURI();
String id = Long.toHexString((hashCode()^HashUtil.hash(requestURI)) + 
fragmentID);

where fragmentId is an integer that starts at 0 and is incremented by one for 
each fragment extracted in the current response.

I have an application where a jpeg image is embedded in xml as base64 data.  I 
use FragmentExtractorTransformer to extract the base64 data and replace it with 
a url based on the fragment id.   Another pipeline handles the image request 
from the browser by connecting a fragmentExtractorGenerator with a base64 
serializer.  The problem is that the same image (usually the first one 
requested) is returned for all requests.

The problem occurs because the request for the page containing the image 
displays a different image depending on the request parameters passed.  As 
fragmentExtractorTransformer only uses the SitemapURI as the basis of the hash 
key, it produces the same hash key for every image.  This causes different 
images to be stored under the same id.  Its anyone's guess which image is 
returned by the following request for the image.

The solution is that the fragment id hash should include the request parameters 
as well as the uri to generate unique ids.


> Batik FragmentExtractorTransformer fragment id clash
> ----------------------------------------------------
>
>          Key: COCOON-1351
>          URL: http://issues.apache.org/jira/browse/COCOON-1351
>      Project: Cocoon
>         Type: Bug
>   Components: * Cocoon Core
>     Versions: 2.1.5
>  Environment: Operating System: Windows XP
> Platform: PC
>     Reporter: Dean Cording
>     Assignee: Cocoon Developers Team

>
> The fragment id generated by the FragmentExtractorTransformer is not unique 
> for 
> each fragment extracted.
> The fragment id is generated by the following code:
> this.requestURI = ObjectModelHelper.getRequest(objectModel).getSitemapURI();
> String id = Long.toHexString((hashCode()^HashUtil.hash(requestURI)) + 
> fragmentID);
> where fragmentId is an integer that starts at 0 and is incremented by one for 
> each fragment extracted in the current response.
> I have an application where a jpeg image is embedded in xml as base64 data.  
> I 
> use FragmentExtractorTransformer to extract the base64 data and replace it 
> with 
> a url based on the fragment id.   Another pipeline handles the image request 
> from the browser by connecting a fragmentExtractorGenerator with a base64 
> serializer.  The problem is that the same image (usually the first one 
> requested) is returned for all requests.
> The problem occurs because the request for the page containing the image 
> displays a different image depending on the request parameters passed.  As 
> fragmentExtractorTransformer only uses the SitemapURI as the basis of the 
> hash 
> key, it produces the same hash key for every image.  This causes different 
> images to be stored under the same id.  Its anyone's guess which image is 
> returned by the following request for the image.
> The solution is that the fragment id hash should include the request 
> parameters 
> as well as the uri to generate unique ids.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to