Package org.richfaces.component

Examples of org.richfaces.component.AbstractOutputFile


    @Override
    public void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
        if (!(component instanceof AbstractOutputFile)) {
            return;
        }
        AbstractOutputFile outputFile = (AbstractOutputFile) component;
        String contents = null;
        Object value = outputFile.getValue();
        if (value instanceof File) {
            contents = getContents((File) value);
        } else if (value instanceof InputStream) {
            contents = getContents((InputStream) value);
        } else if (value != null) {
            String resourcePath = value.toString();
            URL resource = context.getExternalContext().getResource(resourcePath);
            if (resource == null) {
                throw new FileNotFoundException(resourcePath);
            }
            contents = getContents(resource.openStream());
        }
        if (contents != null) {
            if (outputFile.isEscape()) {
                writer.writeText(contents, null);
            } else {
                writer.write(contents);
            }
        }
View Full Code Here

TOP

Related Classes of org.richfaces.component.AbstractOutputFile

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.