Package org.apache.amber.oauth2.common

Examples of org.apache.amber.oauth2.common.OAuth$ContentType


    }

    @Test
    public void unparse_with_parameters() throws Exception
    {
        ContentType contentType = new ContentType();

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

        assertEquals(contentType.unparse(), "text/html;charset=utf-8");
    }
View Full Code Here


    }

    @Test
    public void unparse_no_parameters() throws Exception
    {
        ContentType contentType = new ContentType();

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

        assertEquals(contentType.unparse(), "text/html");
    }
View Full Code Here

    }

    @Test
    public void to_string_is_unparse()
    {
        ContentType contentType = new ContentType();

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

        assertEquals(contentType.toString(), contentType.unparse());
    }
View Full Code Here

    {
        assert page != null;

        requestGlobals.storeActivePageName(page.getName());

        ContentType contentType = pageContentTypeAnalyzer.findContentType(page);

        // For the moment, the content type is all that's used determine the model for the markup writer.
        // It's something of a can of worms.

        MarkupWriter writer = markupWriterFactory.newMarkupWriter(contentType);

        markupRenderer.renderPageMarkup(page, writer);

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

        long startNanos = System.nanoTime();

        writer.toMarkup(pw);
View Full Code Here

        // If we end up doing a partial render, the page render queue service needs to know the
        // page that will be rendered (for logging purposes, if nothing else).

        queue.setRenderingPage(activePage);

        ContentType contentType = pageContentTypeAnalyzer.findContentType(activePage);

        request.setAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME, contentType);

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

        this.compactJSON = compactJSON;
    }

    public void processResultValue(JSONArray value) throws IOException
    {
        ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);

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

        value.print(pw, compactJSON);

        pw.close();
    }
View Full Code Here

        this.compactJSON = compactJSON;
    }

    public void processResultValue(JSONObject value) throws IOException
    {
        ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);

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

        value.print(pw, compactJSON);

        pw.close();
    }
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, outputCharset);
    }
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 pageContentType = (ContentType) request.getAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME);

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

        MarkupWriter writer = factory.newPartialMarkupWriter(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());

        reply.print(pw, compactJSON);

        pw.close();
    }
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, charset), text);
    }
View Full Code Here

TOP

Related Classes of org.apache.amber.oauth2.common.OAuth$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.