Package org.apache.tapestry5

Examples of org.apache.tapestry5.ContentType


        {
            // This is a complex area as we are trying to keep public and private services properly
            // separated, and trying to keep stateless and stateful (i.e., perthread scope) services
            // separated. So we inform the stateful queue service what it needs to do here ...

            ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);
           
            String pageName = (String) request.getAttribute(InternalConstants.PAGE_NAME_ATTRIBUTE_NAME);

            MarkupWriter writer = factory.newPartialMarkupWriter(pageName);

            // ... and here, the pipeline eventually reaches the PRQ to let it render the root render command.

            partialMarkupRenderer.renderMarkup(writer, reply);

            PrintWriter pw = response.getPrintWriter(contentType.toString());

            reply.print(pw, compactJSON);

            pw.close();
        } finally
View Full Code Here


    {
        assert page != null;

        requestGlobals.storeActivePageName(page.getName());

        ContentType contentType = pageContentTypeAnalyzer.findContentType(page);
       
        MarkupWriter writer = markupWriterFactory.newMarkupWriter(page);

        markupRenderer.renderPageMarkup(page, writer);

        PrintWriter pw = response.getPrintWriter(contentType.toString());

        long startNanos = System.nanoTime();

        writer.toMarkup(pw);
View Full Code Here

    public MarkupWriter newMarkupWriter(Page page)
    {
        boolean isHTML5 = hasHTML5Doctype(page);
       
        ContentType contentType = pageContentTypeAnalyzer.findContentType(page);
       
        return constructMarkupWriter(contentType, false, isHTML5);
    }
View Full Code Here

    public MarkupWriter newPartialMarkupWriter(Page page)
    {
        boolean isHTML5 = hasHTML5Doctype(page);
       
        ContentType contentType = pageContentTypeAnalyzer.findContentType(page);
       
        return constructMarkupWriter(contentType, true, isHTML5);
    }
View Full Code Here

            {
                // This is a complex area as we are trying to keep public and private services properly
                // separated, and trying to keep stateless and stateful (i.e., perthread scope) services
                // separated. So we inform the stateful queue service what it needs to do here ...

                ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);

                String pageName = (String) request.getAttribute(InternalConstants.PAGE_NAME_ATTRIBUTE_NAME);

                MarkupWriter writer = factory.newPartialMarkupWriter(pageName);

                // ... and here, the pipeline eventually reaches the PRQ to let it render the root render command.

                partialMarkupRenderer.renderMarkup(writer, reply);

                PrintWriter pw = response.getPrintWriter(contentType.toString());

                reply.print(pw, compactJSON);

                pw.close();
View Full Code Here

        if (pageActivator.activatePage(activePage.getRootElement().getComponentResources(), parameters
                .getPageActivationContext(), interceptor))
            return;

        ContentType contentType = pageContentTypeAnalyzer.findContentType(activePage);

        request.setAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME, contentType);

        Page containerPage = cache.get(parameters.getContainingPageName());
View Full Code Here

            }
        };

        resources.triggerEvent(EventConstants.PROVIDE_COMPLETIONS, new Object[] { input }, callback);

        ContentType contentType = responseRenderer.findContentType(this);

        MarkupWriter writer = factory.newPartialMarkupWriter(contentType);

        generateResponseMarkup(writer, matchesHolder.get());

        return new TextStreamResponse(contentType.toString(), writer.toString());
    }
View Full Code Here

    {
        // This is a complex area as we are trying to keep public and private services properly
        // seperated, and trying to keep stateless and stateful (i.e., perthread scope) services
        // seperated. So we inform the stateful queue service what it needs to do here ...

        ContentType pageContentType = (ContentType) request.getAttribute(
                InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME);
        String charset = pageContentType.getParameter(InternalConstants.CHARSET_CONTENT_TYPE_PARAMETER);

        ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE);
        contentType.setParameter(InternalConstants.CHARSET_CONTENT_TYPE_PARAMETER, charset);

        MarkupWriter writer = factory.newMarkupWriter(pageContentType);

        JSONObject reply = new JSONObject();

        // ... and here, the pipeline eventually reaches the PRQ to let it render the root render command.

        partialMarkupRenderer.renderMarkup(writer, reply);

        PrintWriter pw = response.getPrintWriter(contentType.toString());

        pw.print(reply);

        pw.flush();
    }
View Full Code Here

        Page page = cache.get(pageName);
        ComponentResources pageResources = page.getRootElement().getComponentResources();

        String contentTypeString = locator.findMeta(MetaDataConstants.RESPONSE_CONTENT_TYPE, pageResources,
                                                    String.class);
        ContentType contentType = new ContentType(contentTypeString);

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

        if (encoding == null)
            encoding = locator.findMeta(MetaDataConstants.RESPONSE_ENCODING, pageResources, String.class);

        request.setEncoding(encoding);
View Full Code Here

            }
        };

        resources.triggerEvent("providecompletions", new Object[] { input }, callback);

        ContentType contentType = responseRenderer.findContentType(this);

        MarkupWriter writer = factory.newMarkupWriter(contentType);

        generateResponseMarkup(writer, matchesHolder.get());

        return new TextStreamResponse(contentType.getMimeType(), writer.toString());
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.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.