Package juju.reattore.io

Examples of juju.reattore.io.ByteSource


    /** @see Interceptor */
    public boolean process(HttpRequest req, HttpResponse resp) {
        String path = req.getPath();

        ByteSource ret;

        File serve = new File(baseDir, path);

        if (serve.isDirectory()) {
            /* Redirect if the request is incomplete. */
 
View Full Code Here


          can't be found.
    */
    public ByteSource get(String req, File resolved)
        throws IOException {

        ByteSource ret;

        if ((ret = tryGet(req)) != null) {
            return ret;
        }
        else {
View Full Code Here

    }

    private String getBody()
        throws IOException {

        ByteSource body = resp.getBody();
        byte[] ab = new byte[body.remaining()];

        assertEquals(body.remaining(), body.get(ab, 0, ab.length));

        return new String(ab);
    }
View Full Code Here

        throws IOException {

        String req = "tests/test/juju/reattore/server/intercept/impl/testfilecache.txt";
        File f = new File(req);

        ByteSource bs = cache.get(req, f);
        String body = getBody(bs);

        assertEquals("This is testfilecache.txt", body);
        bs.dispose();
    }
View Full Code Here

        throws IOException {

        String req = "tests/test/juju/reattore/server/intercept/impl/testfilecache.txt";
        File f = new File(req);

        ByteSource bs = cache.get(req, f);
        String body = getBody(bs);

        assertEquals("This is testfilecache.txt", body);
        bs.dispose();

        bs = cache.get(req, f);
        assertEquals(body, getBody(bs));

        bs.dispose();
    }
View Full Code Here

        File f = new File(req);

        boolean threw = false;

        try {
            ByteSource bs = cache.get(req, f);
            bs.dispose();
        }
        catch (IOException ex) {
            threw = true;
        }
View Full Code Here

TOP

Related Classes of juju.reattore.io.ByteSource

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.