Package org.apache.tapestry.util

Examples of org.apache.tapestry.util.ContentType


     * @return "text/html"
     */

    public ContentType getResponseContentType()
    {
        return new ContentType("text/html");
    }
View Full Code Here


            return;
        }

        StringWriter sWriter = new StringWriter();
        IMarkupWriter nested = getMarkupWriterSource().newMarkupWriter(new PrintWriter(sWriter),
                                                                       new ContentType(writer.getContentType()));

        nested.begin("style");
        nested.attribute("type", "text/css");

        if (getMedia()!=null)
View Full Code Here

        {
            _localeManager.persistLocale();

            IPage page = cycle.getPage();

            ContentType contentType = page.getResponseContentType();
            String encoding = contentType.getParameter(ENCODING_KEY);

            if (encoding == null)
            {
                encoding = cycle.getEngine().getOutputEncoding();

                contentType.setParameter(ENCODING_KEY, encoding);
            }

            PrintWriter printWriter = _webResponse.getPrintWriter(contentType);

            _writer = _markupWriterSource.newMarkupWriter(printWriter, contentType);
View Full Code Here

        assertTrue("The charset parameter of the ContentType is invalid", charset == null);
    }

    public void testUnparsing1() throws Exception
    {
        ContentType contentType = new ContentType();

        contentType.setBaseType("text");
        contentType.setSubType("html");
        contentType.setParameter("charset", "utf-8");

        assertEquals(
                "ContentType does not generate a valid String representation",
                "text/html;charset=utf-8",
                contentType.unparse());
    }
View Full Code Here

                contentType.unparse());
    }

    public void testUnparsing2() throws Exception
    {
        ContentType contentType = new ContentType();

        contentType.setBaseType("text");
        contentType.setSubType("html");

        assertEquals(
                "ContentType does not generate a valid String representation",
                "text/html",
                contentType.unparse());
    }
View Full Code Here

        replayControls();

        ServletWebResponse swr = new ServletWebResponse(response);

        assertSame(stream, swr.getOutputStream(new ContentType("foo/bar")));

        verifyControls();
    }
View Full Code Here

        ServletWebResponse swr = new ServletWebResponse(response);

        try
        {
            swr.getOutputStream(new ContentType("foo/bar"));
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertEquals(
View Full Code Here

        replayControls();

        ServletWebResponse swr = new ServletWebResponse(response);

        assertSame(writer, swr.getPrintWriter(new ContentType("foo/bar")));

        verifyControls();
    }
View Full Code Here

       
        replayControls();

        ServletWebResponse swr = new ServletWebResponse(response);

        assertSame(writer1, swr.getPrintWriter(new ContentType("foo/bar")));

        verifyControls();

        response.reset();
        response.setContentType("biff/bazz");
       
        trainGetWriter(response, writer2);
       
        replayControls();

        assertSame(writer2, swr.getPrintWriter(new ContentType("biff/bazz")));

        verifyControls();
    }
View Full Code Here

       
        replayControls();

        ServletWebResponse swr = new ServletWebResponse(response, log, true);

        assertSame(writer1, swr.getPrintWriter(new ContentType("foo/bar")));

        verifyControls();

        response.reset();

        trainGetWriter(response, writer2);
       
        replayControls();

        assertSame(writer2, swr.getPrintWriter(new ContentType("foo/bar")));

        verifyControls();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.util.ContentType

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.