Package org.apache.tapestry.util

Examples of org.apache.tapestry.util.ContentType


        RenderWebResponse rwr = new RenderWebResponse(response);

        try
        {
            rwr.getOutputStream(new ContentType("foo/bar"));
            unreachable();
        }
        catch (UnsupportedOperationException ex)
        {
            // Expected.
View Full Code Here


        return cycle;
    }

    public void testSuccess() throws Exception
    {
        ContentType ct = new ContentType("text/html");
        PrintWriter pw = newPrintWriter();
        WebResponse response = newWebResponse(ct, pw);
        IMarkupWriter nested = newNestedWriter();

        MockControl control = newControl(IMarkupWriter.class);
View Full Code Here

    {
        cycle.activate(pageName);

        IPage page = cycle.getPage();

        ContentType contentType = page.getResponseContentType();

        PrintWriter printWriter = _response.getPrintWriter(contentType);

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

            // provide it, try and guess it by the extension.

            if (contentType == null || contentType.length() == 0)
                contentType = getMimeType(resourcePath);

            OutputStream output = _response.getOutputStream(new ContentType(contentType));

            input = new BufferedInputStream(resourceConnection.getInputStream());

            byte[] buffer = new byte[BUFFER_SIZE];
View Full Code Here

        return _outputStream;
    }

    public PrintWriter getWriter() throws IOException
    {
        ContentType ct = new ContentType(_contentType);

        String encoding = ct.getParameter("charset");

        return new PrintWriter(new BufferedWriter(new OutputStreamWriter(getOutputStream(),
                encoding)));
    }
View Full Code Here

        {
            IChartProvider provider = (IChartProvider) component;

            Chart chart = provider.getChart();

            OutputStream output = _response.getOutputStream(new ContentType("image/jpeg"));

            // I've seen a few bits of wierdness (including a JVM crash) inside this code.
            // Hopefully, its a multi-threading problem that can be resolved
            // by synchronizing.
View Full Code Here

    {
        cycle.activate(pageName);

        IPage page = cycle.getPage();

        ContentType contentType = page.getResponseContentType();

        PrintWriter printWriter = _response.getPrintWriter(contentType);

        IMarkupWriter writer = _markupWriterSource.newMarkupWriter(printWriter, contentType);
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.newJSONWriter(printWriter, contentType);
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

     * @return "text/html"
     */

    public ContentType getResponseContentType()
    {
        return new ContentType("text/html");
    }
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.