Re: Cache problems with jxmapviewer2 in NetBeans Platform

geertjan wielenga <[email protected]> Sun, 4 Jun 2017 12:53:54 +0200
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Organization Oracle Corporation
Message-ID <[email protected]>

On 15-5-2017 13:06, Patrik Karlsson wrote:
> Hi,
>
> I'm building a platform application using jxmapviewer2 
> https://github.com/msteiger/jxmapviewer2 and can't get the caching to 
> work. The map renders just fine but the tiles are not cached.
>
> Caching works in the example
> https://github.com/msteiger/jxmapviewer2/blob/master/examples/src/sample3_interaction/Sample3.java
>
> and I have sucessfully added caching to MapKit in Sample6
> https://github.com/msteiger/jxmapviewer2/blob/master/examples/src/sample6_mapkit/Sample6.java

There is no cache in the above sample.

Gj


>
> However, it fails when I try to do it in NB 8.2 platform using Windows 
> 7 and Java 8u131.
> The cache directory gets created but is always empty.
>
> Could this be related to the platform and the usage of 
> java.net.ResponseCache?
>
>
> I have created the following repo 
> https://github.com/trixon/netbeans-jxmapviewer2.git
> The map related code is in https://github.com/trixon/netbeans-
> jxmapviewer2/blob/master/maptest/src/main/java/se/trixon/jxmapviewer2/maptest/MapKitTopComponent.java
>
>     private void init() {
>         setLayout(new java.awt.GridLayout());
>         final JXMapKit jXMapKit = new JXMapKit();
>         TileFactoryInfo info = new OSMTileFactoryInfo();
>         DefaultTileFactory tileFactory = new DefaultTileFactory(info);
>
>         // Setup local file cache
>         File cacheDir = new File(System.getProperty("user.home") + 
> File.separator + ".jxmapviewer2");
> LocalResponseCache.installResponseCache(info.getBaseURL(), cacheDir, 
> false);
>
>         jXMapKit.setTileFactory(tileFactory);
>
>         jXMapKit.setZoom(16);
>         add(jXMapKit);
>     }
>
> /Patrik