Package org.apache.tapestry.util

Examples of org.apache.tapestry.util.ContentType


            // 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


        String contentType,
        OutputStream stream)
    {
        this(safe, entities, contentType);

        ContentType contentTypeObject = new ContentType(contentType);
        String encoding = contentTypeObject.getParameter("charset");

        setOutputStream(stream, encoding);
    }
View Full Code Here

     * @param encoding The value of the charset parameter of the content type if it is not already present.
     * @return The content type containing a charset parameter, e.g. text/html;charset=utf-8
     */
    private String generateFullContentType(String contentType, String encoding)
    {
        ContentType contentTypeObject = new ContentType(contentType);
        if (contentTypeObject.getParameter("charset") == null)
            contentTypeObject.setParameter("charset", encoding);
        return contentTypeObject.unparse();
    }
View Full Code Here

        int h = Integer.parseInt(hS);
        int w = Integer.parseInt(wS);


        try {
            OutputStream output = response.getOutputStream(new ContentType("image/jpeg"));


            BufferedImage rc = renderRoundedCorner(bg, fg, w, h, crnr);

            ImageIO.write(rc, "jpeg", output);
View Full Code Here

        // do not squeeze on output either
        Object[] args = cycle.getListenerParameters();
        String strArgs = generateOutputString(args);
        if (strArgs != null)
        {
            OutputStream output = _response.getOutputStream(new ContentType("text/xml"));
            output.write(strArgs.getBytes("utf-8"));
        }
    }
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

    {
        WebSession session = _request.getSession(true);
        String markup = (String) session
                .getAttribute(PortletConstants.PORTLET_EXCEPTION_MARKUP_ATTRIBUTE);

        PrintWriter writer = _response.getPrintWriter(new ContentType(
                "text/html"));

        PortletURL url = _globals.getRenderResponse().createActionURL();

        writer
View Full Code Here

        PortletWebResponse pwr = new PortletWebResponse(response);

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

    {
        WebSession session = _request.getSession(true);
        String markup = (String) session
                .getAttribute(PortletConstants.PORTLET_EXCEPTION_MARKUP_ATTRIBUTE);

        PrintWriter writer = _response.getPrintWriter(new ContentType("text/html"));

        PortletURL url = _globals.getRenderResponse().createActionURL();

        writer.println("<span class=\"portlet-msg-error\">An exception has occured.</span>");
        writer.println("<br/>");
View Full Code Here

    /**
     * @return "text/vnd.wap.wml"
     */
    public ContentType getResponseContentType()
    {
        return new ContentType("text/vnd.wap.wml");
    }
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.