Package org.restlet.data

Examples of org.restlet.data.Status


     *            The status to set (code and reason phrase).
     * @param description
     *            The longer status description.
     */
    public void setStatus(Status status, String description) {
        setStatus(new Status(status, description));
    }
View Full Code Here


     *            The status to set.
     * @param throwable
     *            The related error or exception.
     */
    public void setStatus(Status status, Throwable throwable) {
        setStatus(new Status(status, throwable));
    }
View Full Code Here

     *            The related error or exception.
     * @param message
     *            The status message.
     */
    public void setStatus(Status status, Throwable throwable, String message) {
        setStatus(new Status(status, throwable, message));
    }
View Full Code Here

    /**
     * Tests for status classes.
     */
    public void testStatusClasses() {
        final Status s1 = new Status(287);
        assertTrue(s1.isSuccess());

        final Status s2 = Status.CLIENT_ERROR_BAD_REQUEST;
        assertTrue(s2.isClientError());
        assertTrue(s2.isError());
    }
View Full Code Here

    /**
     * Unequality tests.
     */
    public void testUnEquals() throws Exception {
        final Status s1 = new Status(200);
        final Status s2 = Status.SUCCESS_CREATED;

        assertFalse(s1.equals(s2));
        assertFalse(s1.getCode() == s2.getCode());
        assertFalse(s1.equals(null));
        assertFalse(s2.equals(null));
    }
View Full Code Here

     * @param code
     *            The code.
     * @return The associated status.
     */
    public static Status valueOf(int code) {
        Status result = null;

        switch (code) {
        case 100:
            result = INFO_TRYING;
            break;
View Full Code Here

*/
public class StatusTestCase extends RestletTestCase {

    public void testCustomDescription() {
        final String customDescription = "My custom description";
        final Status s = new Status(Status.CLIENT_ERROR_NOT_FOUND,
                customDescription);
        assertEquals(customDescription, s.getDescription());
    }
View Full Code Here

    /**
     * Equality tests.
     */
    public void testEquals() throws Exception {
        final Status s1 = new Status(201);
        final Status s2 = Status.SUCCESS_CREATED;

        assertTrue(s1.equals(s2));
        assertTrue(s1.getCode() == s2.getCode());
        assertEquals(s1, s2);

        assertTrue(s1.equals(s1));
        assertEquals(s1, s1);
    }
View Full Code Here

     *
     * @param code
     *            The specification code of the encapsulated status.
     */
    public ResourceException(int code) {
        this(new Status(code));
    }
View Full Code Here

     * @param uri
     *            The URI of the specification describing the method.
     */
    public ResourceException(int code, String name, String description,
            String uri) {
        this(new Status(code, name, description, uri));
    }
View Full Code Here

TOP

Related Classes of org.restlet.data.Status

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.