Package org.geoserver.platform.resource

Examples of org.geoserver.platform.resource.Resource.lastmodified()


        public ResourcesBuilder resource(String path, InputStream content) {
            Resource r = mock(Resource.class);
            when(r.path()).thenReturn(path);
            when(r.name()).thenReturn(path.substring(path.lastIndexOf('/')+1));
            when(r.getType()).thenReturn(Type.RESOURCE);
            when(r.lastmodified()).thenReturn( System.currentTimeMillis() );
            when(r.in()).thenReturn(content);
            when(r.out()).thenReturn(new ByteArrayOutputStream());
           
            when(resourceStore.get(path)).thenReturn(r);
            paths.add( path );
View Full Code Here


        return new Answer<Resource>() {
            @Override
            public Resource answer(InvocationOnMock invocation) throws Throwable {
                Resource r = mock(Resource.class);
                when(r.getType()).thenReturn(Type.RESOURCE);
                when(r.lastmodified()).thenReturn(new Date().getTime());
                return r;
            }
        };
    }
}
View Full Code Here

        IO.workspace(obj, ws, ns, isDefault);
        if (!obj.has(Metadata.MODIFIED)) {
            // derive from resource
            Resource r = dataDir().config(ws);
            if (r.getType() != Type.UNDEFINED) {
                IO.date(obj.putObject("modified"), new Date(r.lastmodified()));
            }
        }
        return obj;
    }
View Full Code Here

        }
        String mimeType = ICON_FORMATS.get(ext.toLowerCase());

        response.setContentType(mimeType);
        //response.setStatus(HttpServletResponse.SC_OK);
        response.setDateHeader("Last-Modified", resource.lastmodified() );
        //IOUtils.copy(resource.in(), response.getOutputStream());

        try (
            InputStream in = resource.in();
        ) {
View Full Code Here

    JSONObj layer(JSONObj obj, LayerInfo l, HttpServletRequest req) {
        IO.layer(obj, l, req);
        if (!obj.has("modified")) {
            Resource r = dataDir().config(l);
            if (r.getType() != Type.UNDEFINED) {
                IO.date(obj.putObject("modified"), new Date(r.lastmodified()));
            }
        }
        return obj;
    }
View Full Code Here

        IO.metadata(obj, map);
        if (!obj.has("modified")) {
            Resource r = dataDir().config(map);
            if (r.getType() != Type.UNDEFINED) {
                IO.date(obj.putObject("modified"), new Date(r.lastmodified()));
            }
        }

        return obj;
    }
View Full Code Here

                    if( resource == null ){
                        String path = Paths.path("security/role", name, fileConfig.getFileName());
                        resource = get(path);
                    }

                    RoleFileWatcher watcher = new RoleFileWatcher(resource, service, resource.lastmodified());
                    service.registerRoleLoadedListener(watcher);
                    watcher.start();

                    //register the watcher so we can kill it later
                    fileWatchers.add(watcher);
View Full Code Here

    public void theoryExtantHaveDate(String path) throws Exception {
        Resource res = getResource(path);
       
        assumeThat(res, defined());
       
        long result = res.lastmodified();
       
        assertThat(result, notNullValue());
    }
   
    @Theory
View Full Code Here

        Resource sldResource = loader.get(Paths.path("styles", "Bridges.sld"));
        File sampleFile = getSampleFile("Bridges");
       
        long lastTime = sampleFile.lastModified();
        long lastLength = sampleFile.length();
        long previousTime = sldResource.lastmodified();
        sldResource.file().setLastModified(lastTime + 1000);
       
        // force cleaning of samples cache, to get updates on files
        ((LegendSampleImpl)GeoServerExtensions.bean(LegendSample.class)).reloaded();
       
View Full Code Here

        Resource sldResource = loader.get(Paths.path("styles", "Bridges.sld"));
        File sampleFile = getSampleFile("Bridges");
       
        long lastTime = sampleFile.lastModified();
        long lastLength = sampleFile.length();
        long previousTime = sldResource.lastmodified();
        sldResource.file().setLastModified(lastTime + 1000);
       
        catalog.firePostModified(catalog.getStyleByName("Bridges"));
       
        TransformerBase tr = createTransformer();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.