balbuenac / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
1 stars 0 forks source link

HEAD does not use UserAgentCallback anymore for images #50

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
*** This issue was imported from http://java.net/jira/browse/XHTMLRENDERER-310

It was reported by bago on 12.01.2010 22:40:55 +0100 and last updated in the 
previous bug tracker on 12.01.2010 22:40:55 +0100

Found in
Operating System: All
Platform: All

The priority for this issue at migration was Major.

Original description: 
AFAIK UserAgentCallback is the service that was used in R8 to retrieve any 
resource. 

I wrote an application against R8 implementing a new UserAgentCallback using a 
persistent disk cache for any resource (no cache expiration, nothing more than 
persistence) and it seems HEAD stopped using it for Images, delegating instead 
to the hardcoded StreamResource (that uses URL).

Expecially, SwingReplacedElementFactory.replaceImage directly use the 
ImageResourceLoader.

I'm happy to fix this but I'd like to understand how you think it should work: 
should the useragent be responsible for resizing ? 

Maybe it is better to move back the network retrieval and basic Image 
generation 
to the UAC and the let the ImageResourceLoader to simply use UAC for the first 
retrieval and instead to simply do the resizing/caching stuff.

Original issue reported on code.google.com by pdoubl...@gmail.com on 16 Feb 2011 at 9:47

GoogleCodeExporter commented 9 years ago
+1 It doesn't really make sense to have the UserAgentCallback as interface if 
it isn't used for a core thing like image rendering.

I worked around it by implementing a custom java.net.URL protocol, as 
StreamResource and co all use URL to get the streams. But this might not always 
work, if you want to provide e.g. caching for an existing protocol like http, 
where overriding the protocol could interfere with other usages of java.net.URL.

Original comment by alexande...@googlemail.com on 23 Oct 2012 at 9:32