Package slash.navigation.rest

Examples of slash.navigation.rest.Head


                "http://download.freizeitkarte-osm.de/android/1404/freizeitkarte_berlin.map.zip",   // Content-Type: application/zip
                "http://download.mapsforge.org/maps/asia/azerbaijan.map",
                "http://ftp5.gwdg.de/pub/misc/openstreetmap/openandromaps/maps/Germany/berlin.zip"  // Content-Type: application/zip
        };
        for (String url : URLS) {
            Head head200 = new Head(url);
            head200.executeAsString();
            assertTrue(head200.isOk());
            assertTrue(head200.getAcceptByteRanges());
            assertNotNull(head200.getETag());
            assertNotNull(head200.getLastModified());
            assertNotNull(head200.getContentLength());
            System.out.println(url + ":\nHEAD 200: " + head200.getHeaders());

            Head head304IfModifiedSince = new Head(url);
            head304IfModifiedSince.setIfModifiedSince(head200.getLastModified());
            head304IfModifiedSince.executeAsString();
            assertTrue(head304IfModifiedSince.isNotModified());
            assertFalse(head304IfModifiedSince.getAcceptByteRanges());
            assertNotNull(head304IfModifiedSince.getETag());
            assertNull(head304IfModifiedSince.getLastModified());
            assertNull(head304IfModifiedSince.getContentLength());
            System.out.println(head304IfModifiedSince.getHeaders());

            Head head304Etag = new Head(url);
            head304Etag.setIfNoneMatch(head200.getETag());
            head304Etag.executeAsString();
            assertTrue(head304Etag.isNotModified());
            assertFalse(head304Etag.getAcceptByteRanges());
            assertNotNull(head304Etag.getETag());
            assertNull(head304Etag.getLastModified());
            assertNull(head304Etag.getContentLength());
            System.out.println(head304Etag.getHeaders());

            Get get200 = new Get(url);
            get200.executeAsString();
            assertTrue(get200.isOk());
            assertTrue(get200.getAcceptByteRanges());
View Full Code Here


        } catch (InterruptedException e) {
            // intentionally do nothing
        }
        System.out.println(getClass().getSimpleName() + ": Extracting content length and last modified from " + baseUrl + uri + " (" + index + ")");
        try {
            Head head = new Head(baseUrl + uri);
            head.executeAsString();
            if (head.isSuccessful()) {
                return new ContentLengthAndLastModified(head.getContentLength(), head.getLastModified());
            }
        } catch (IOException e) {
            System.err.println(getClass().getSimpleName() + ": " + e.getMessage());
        }
        return null;
View Full Code Here

TOP

Related Classes of slash.navigation.rest.Head

Copyright © 2018 www.massapicom. 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.