Package net.sourceforge.stripes.action

Examples of net.sourceforge.stripes.action.FileBean


        if (request.isMultipart()) {
            Enumeration<String> fileParameterNames = request.getFileParameterNames();

            while (fileParameterNames.hasMoreElements()) {
                String fileParameterName = fileParameterNames.nextElement();
                FileBean fileBean = request.getFileParameterValue(fileParameterName);
                log.trace("Attempting to bind file parameter with name [", fileParameterName,
                        "] and value: ", fileBean);

                if (fileBean != null) {
                    try {
View Full Code Here


    protected void checkSingleRequiredField(String name, String strippedName, String[] values,
            StripesRequestWrapper req, ValidationErrors errors) {

        // Firstly if the post is a multipart request, check to see if a file was
        // sent under that parameter name
        FileBean file = null;
        if (req.isMultipart() && (file = req.getFileParameterValue(name)) != null) {
            if (file.getSize() <= 0) {
                errors.add(name, new ScopedLocalizableError("validation.required",
                        "valueNotPresent"));
            }
        }
        // And if not, see if any regular parameters were sent
View Full Code Here

                filename = filename.substring(index + 1);

            // Use an anonymous inner subclass of FileBean that overrides all the
            // methods that rely on having a File present, to use the FileItem
            // created by commons upload instead.
            return new FileBean(null, item.getContentType(), filename, this.charset) {
                @Override public long getSize() { return item.getSize(); }

                @Override public InputStream getInputStream() throws IOException {
                    return item.getInputStream();
                }
View Full Code Here

        if (request.isMultipart()) {
            Enumeration<String> fileParameterNames = request.getFileParameterNames();

            while (fileParameterNames.hasMoreElements()) {
                String fileParameterName = fileParameterNames.nextElement();
                FileBean fileBean = request.getFileParameterValue(fileParameterName);
                log.trace("Attempting to bind file parameter with name [", fileParameterName,
                        "] and value: ", fileBean);

                if (fileBean != null) {
                    try {
View Full Code Here

    protected void checkSingleRequiredField(String name, String strippedName, String[] values,
            StripesRequestWrapper req, ValidationErrors errors) {

        // Firstly if the post is a multipart request, check to see if a file was
        // sent under that parameter name
        FileBean file = null;
        if (req.isMultipart() && (file = req.getFileParameterValue(name)) != null) {
            if (file.getSize() <= 0) {
                errors.add(name, new ScopedLocalizableError("validation.required",
                        "valueNotPresent"));
            }
        }
        // And if not, see if any regular parameters were sent
View Full Code Here

     * @return a FileBean object wrapping the uploaded file
     */
    public FileBean getFileParameterValue(String name) {
        File file = this.multipart.getFile(name);
        if (file != null) {
            return new FileBean(file,
                                this.multipart.getContentType(name),
                                this.multipart.getOriginalFileName(name),
                                this.charset);
        }
        else {
View Full Code Here

        if (request.isMultipart()) {
            Enumeration<String> fileParameterNames = request.getFileParameterNames();

            while (fileParameterNames.hasMoreElements()) {
                String fileParameterName = fileParameterNames.nextElement();
                FileBean fileBean = request.getFileParameterValue(fileParameterName);
                log.trace("Attempting to bind file parameter with name [", fileParameterName,
                        "] and value: ", fileBean);

                if (fileBean != null) {
                    try {
View Full Code Here

    protected void checkSingleRequiredField(String name, String strippedName, String[] values,
            StripesRequestWrapper req, ValidationErrors errors) {

        // Firstly if the post is a multipart request, check to see if a file was
        // sent under that parameter name
        FileBean file = null;
        if (req.isMultipart() && (file = req.getFileParameterValue(name)) != null) {
            if (file.getSize() <= 0) {
                errors.add(name, new ScopedLocalizableError("validation.required",
                        "valueNotPresent"));
            }
        }
        // And if not, see if any regular parameters were sent
View Full Code Here

     * @return a FileBean object wrapping the uploaded file
     */
    public FileBean getFileParameterValue(String name) {
        File file = this.multipart.getFile(name);
        if (file != null) {
            return new FileBean(file,
                                this.multipart.getContentType(name),
                                this.multipart.getOriginalFileName(name),
                                this.charset);
        }
        else {
View Full Code Here

TOP

Related Classes of net.sourceforge.stripes.action.FileBean

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.