Package org.andromda.cartridges.jsf.component

Examples of org.andromda.cartridges.jsf.component.BinaryFile


    public void encodeBegin(
        FacesContext context,
        UIComponent component)
        throws IOException
    {
        final BinaryFile fileComponent = (BinaryFile)component;
        if (fileComponent.isRendered())
        {
            final HttpServletResponse response = this.getResponse(context);
            final OutputStream stream = response.getOutputStream();

            // - reset the reponse to clear out any any headers (i.e. so
            //   the user doesn't get "unable to open..." when using IE.)
            response.reset();
            final String fileName = fileComponent.getFileName();
            if (fileComponent.isPrompt() && fileName != null && fileName.trim().length() > 0)
            {
                response.addHeader(
                    "Content-disposition",
                    "attachment; filename=\"" + fileName + '"');
            }

            Object value = fileComponent.getValue();
            final String contentType = fileComponent.getContentType();
            // - for IE we need to set the content type, content length and buffer size and
            //   then the flush the response right away because it seems as if there is any lag time
            //   IE just displays a blank page. With mozilla based clients reports display correctly regardless.
            if (contentType != null && contentType.length() > 0)
            {
View Full Code Here


    public void encodeEnd(
        final FacesContext context,
        final UIComponent component)
        throws IOException
    {
        final BinaryFile fileComponent = (BinaryFile)component;
        if (fileComponent.isRendered())
        {
            final HttpServletResponse response = this.getResponse(context);
            final OutputStream stream = response.getOutputStream();
            stream.flush();
            stream.close();
View Full Code Here

TOP

Related Classes of org.andromda.cartridges.jsf.component.BinaryFile

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.