Package ninja.utils

Examples of ninja.utils.Message


                                .url(testServerUrl().path("/_non_existing_url"))
                                .addHeader(HttpConstants.HEADER_ACCEPT, HttpConstants.APPLICATION_JSON));

    assertEquals(404, response.httpStatus);
       
    Message message = response.payloadJsonAs(Message.class);
        Assert.assertThat(message.text, CoreMatchers.equalTo(NinjaConstant.I18N_NINJA_SYSTEM_NOT_FOUND_TEXT_DEFAULT));

  }
View Full Code Here


                                .url(testServerUrl().path("/_non_existing_url"))
                                .addHeader(HttpConstants.HEADER_ACCEPT, HttpConstants.APPLICATION_XML));

    assertEquals(404, response.httpStatus);

    Message message = response.payloadXmlAs(Message.class);
        Assert.assertThat(message.text, CoreMatchers.equalTo(NinjaConstant.I18N_NINJA_SYSTEM_NOT_FOUND_TEXT_DEFAULT));

  }
View Full Code Here

        Response response = makeRequest(
                Request.GET().addHeader("ACCEPT", "application/json")
                        .url(testServerUrl().path("throw_exception")));

        Assert.assertThat(response.httpStatus, CoreMatchers.equalTo(400));
        Message message = response.payloadJsonAs(Message.class);
        Assert.assertThat(message.text, CoreMatchers.equalTo("Oops. That's a bad request and all we know."));

    }
View Full Code Here

                        I18N_TIMEOUT_EXCEPTION_MESSAGE_KEY,
                        I18N_TIMEOUT_EXCEPTION_MESSAGE_DEFAULT,
                        context,
                        Optional.<Result>absent());
       
        Message message = new Message(messageI18n);

        Result result = Results
                .internalServerError()
                .render(message)
                .template(NinjaConstant.LOCATION_VIEW_FTL_HTML_INTERNAL_SERVER_ERROR);
View Full Code Here

                        I18N_RESPONSER_REJECTED_EXECUTION_MESSAGE_KEY,
                        I18N_RESPONSER_REJECTED_EXECUTION_MESSAGE_DEFAULT,
                        context,
                        Optional.<Result>absent());
       
        Message message = new Message(messageI18n);

        Result result = Results
                .internalServerError()
                .render(message)
                .template(NinjaConstant.LOCATION_VIEW_FTL_HTML_INTERNAL_SERVER_ERROR);
View Full Code Here

                        I18N_TIMEOUT_EXCEPTION_MESSAGE_KEY,
                        I18N_TIMEOUT_EXCEPTION_MESSAGE_DEFAULT,
                        context,
                        Optional.<Result>absent());
       
        Message message = new Message(messageI18n);

        Result result = Results
                .internalServerError()
                .render(message)
                .template(NinjaConstant.LOCATION_VIEW_FTL_HTML_INTERNAL_SERVER_ERROR);
View Full Code Here

                        NinjaConstant.I18N_NINJA_SYSTEM_INTERNAL_SERVER_ERROR_TEXT_KEY,
                        NinjaConstant.I18N_NINJA_SYSTEM_INTERNAL_SERVER_ERROR_TEXT_DEFAULT,
                        context,
                        Optional.<Result>absent());
       
        Message message = new Message(messageI18n);

        Result result = Results
                .internalServerError()
                .supportedContentTypes(Result.TEXT_HTML, Result.APPLICATON_JSON, Result.APPLICATION_XML)
                .fallbackContentType(Result.TEXT_HTML)
View Full Code Here

                        NinjaConstant.I18N_NINJA_SYSTEM_NOT_FOUND_TEXT_KEY,
                        NinjaConstant.I18N_NINJA_SYSTEM_NOT_FOUND_TEXT_DEFAULT,
                        context,
                        Optional.<Result>absent());
       
        Message message = new Message(messageI18n);
       
        Result result = Results
                        .notFound()
                        .supportedContentTypes(Result.TEXT_HTML, Result.APPLICATON_JSON, Result.APPLICATION_XML)
                        .fallbackContentType(Result.TEXT_HTML)
View Full Code Here

                        NinjaConstant.I18N_NINJA_SYSTEM_BAD_REQUEST_TEXT_KEY,
                        NinjaConstant.I18N_NINJA_SYSTEM_BAD_REQUEST_TEXT_DEFAULT,
                        context,
                        Optional.<Result>absent());
       
        Message message = new Message(messageI18n);
          
        Result result = Results
                        .badRequest()
                        .supportedContentTypes(Result.TEXT_HTML, Result.APPLICATON_JSON, Result.APPLICATION_XML)
                        .fallbackContentType(Result.TEXT_HTML)
View Full Code Here

                        NinjaConstant.I18N_NINJA_SYSTEM_UNAUTHORIZED_REQUEST_TEXT_KEY,
                        NinjaConstant.I18N_NINJA_SYSTEM_UNAUTHORIZED_REQUEST_TEXT_DEFAULT,
                        context,
                        Optional.<Result>absent());

        Message message = new Message(messageI18n);

        // WWW-Authenticate must be included per the spec
        // http://www.ietf.org/rfc/rfc2617.txt 3.2.1 The WWW-Authenticate Response Header
        Result result = Results
                        .unauthorized()
View Full Code Here

TOP

Related Classes of ninja.utils.Message

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.