Package ninja

Examples of ninja.Result.contentType()


    @Test
    public void testRenderPlainStringLeavesExplicitlySetContentTypeUntouched() {
        final String toRender = "this is just a plain string";
        final String contentType = "any/contenttype";
        Result result = Results.ok();
        result.contentType(contentType);
        result.renderRaw(toRender);
        resultHandler.handleResult(result, context);
        assertEquals(contentType, result.getContentType());
    }
View Full Code Here


    @Test
    public void testRenderPictureFromBytes() {
        final byte[] toRender = new byte[] { 1, 2, 3 };
        final String contentType = "image/png";
        Result result = Results.ok();
        result.contentType(contentType);
        result.renderRaw(toRender);
        resultHandler.handleResult(result, context);
        assertEquals(contentType, result.getContentType());
    }
   
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.