Package org.apache.tapestry5

Examples of org.apache.tapestry5.ContentType


                                         boolean compactJSON)
    {
        this.response = response;
        this.compactJSON = compactJSON;

        contentType = new ContentType(InternalConstants.JSON_MIME_TYPE).withCharset(outputEncoding);
    }
View Full Code Here


        this.request = request;
        this.response = response;
        this.partialMarkupRenderer = partialMarkupRenderer;
        this.compactJSON = compactJSON;

        contentType = new ContentType(InternalConstants.JSON_MIME_TYPE).withCharset(outputEncoding);
    }
View Full Code Here

        String contentTypeString = metaDataLocator.findMeta(MetaDataConstants.RESPONSE_CONTENT_TYPE, pageResources,
                String.class);

        // Draconian but necessary: overwrite the content type they selected with the application-wide output charset.

        return new ContentType(contentTypeString).withCharset(outputCharset);
    }
View Full Code Here

    @Override
    public StreamableResource getStreamableResource(Resource baseResource, StreamableResourceProcessing processing, ResourceDependencies dependencies) throws IOException
    {
        StreamableResource resource = delegate.getStreamableResource(baseResource, processing, dependencies);

        ContentType contentType = resource.getContentType();

        if (contentType.getBaseType().equals("text")
                && ! contentType.hasParameters()
                && processing != StreamableResourceProcessing.FOR_AGGREGATION)
        {
            return resource.withContentType(contentType.withCharset("utf-8"));
        }

        return resource;
    }
View Full Code Here

        BytestreamCache bytestreamCache = readStream(transformed);

        transformed.close();

        ContentType contentType = rt == null
                ? new ContentType(contentTypeAnalyzer.getContentType(baseResource))
                : rt.getTransformedContentType();

        boolean compressable = compressionAnalyzer.isCompressable(contentType.getMimeType());

        long lastModified = resourceChangeTracker.trackResource(baseResource);

        return new StreamableResourceImpl(baseResource.toString(), contentType, compressable ? CompressionStatus.COMPRESSABLE
                : CompressionStatus.NOT_COMPRESSABLE, lastModified, bytestreamCache, checksumGenerator, null);
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

    {
        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 = -1l;
        boolean debugEnabled = logger.isDebugEnabled();
        if (debugEnabled)
        {
            startNanos = System.nanoTime();
View Full Code Here

     *            text to be streamed in the response
     * @see org.apache.tapestry5.SymbolConstants#CHARSET
     */
    public TextStreamResponse(String contentType, String charset, String text)
    {
        this(new ContentType(contentType).withCharset(charset), text);
    }
View Full Code Here

public class ContentTypeTest extends TestBase
{
    @Test
    public void simple_equals()
    {
        ContentType master = new ContentType("text/html");

        assertFalse(master.equals(null));
        assertFalse(master.equals(this));
        assertTrue(master.equals(master));
        assertTrue(master.equals(new ContentType("text/html")));
        assertFalse(master.equals(new ContentType("foo/bar")));
        assertFalse(master.equals(new ContentType("text/plain")));
    }
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.