Examples of exhaust()


Examples of org.restlet.representation.DigesterRepresentation.exhaust()

        StringRepresentation rep = new StringRepresentation("0123456789");
        try {
            DigesterRepresentation digester = new DigesterRepresentation(rep);
            // Such representation computes the digest while
            // consuming the wrapped representation.
            digester.exhaust();
            // Set the digest with the computed one
            digester.setDigest(digester.computeDigest());
            request.setEntity(digester);

            Response response = client.handle(request);
View Full Code Here

Examples of org.restlet.representation.DigesterRepresentation.exhaust()

            Response response = client.handle(request);

            assertEquals(Status.SUCCESS_OK, response.getStatus());
            digester = new DigesterRepresentation(response.getEntity());
            digester.exhaust();
            assertTrue(digester.checkDigest());

            client.stop();
        } catch (Exception e) {
            fail(e.getMessage());
View Full Code Here

Examples of org.restlet.representation.DigesterRepresentation.exhaust()

                    try {
                        // Such representation computes the digest while
                        // consuming the wrapped representation.
                        DigesterRepresentation digester = new DigesterRepresentation(
                                rep);
                        digester.exhaust();
                        if (digester.checkDigest()) {
                            response.setStatus(Status.SUCCESS_OK);
                            StringRepresentation f = new StringRepresentation(
                                    "9876543210");
                            digester = new DigesterRepresentation(f);
View Full Code Here

Examples of org.restlet.representation.DigesterRepresentation.exhaust()

                            response.setStatus(Status.SUCCESS_OK);
                            StringRepresentation f = new StringRepresentation(
                                    "9876543210");
                            digester = new DigesterRepresentation(f);
                            // Consume first
                            digester.exhaust();
                            // Set the digest
                            digester.setDigest(digester.computeDigest());
                            response.setEntity(digester);
                        } else {
                            response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
View Full Code Here

Examples of org.restlet.representation.Representation.exhaust()

        try {
            Representation entity = resource.get();
            System.out.println("Status: " + resource.getStatus());

            long expectedSize = entity.getSize();
            long receivedSize = entity.exhaust();

            System.out.println("Size expected: " + expectedSize);
            System.out.println("Size consumed: " + receivedSize);

            if ((expectedSize != -1) && (expectedSize != receivedSize)) {
View Full Code Here

Examples of org.restlet.representation.Representation.exhaust()

                                .log(Level.FINE,
                                        "Automatically exhausting the request entity as it is still available after writing the final response.");
                    }

                    // Exhaust it to allow reuse of the connection
                    requestEntity.exhaust();

                    // Give a chance to the representation to release associated
                    // state and resources
                    requestEntity.release();
                } catch (IOException e) {
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.