Package ariba.ui.aribaweb.util

Examples of ariba.ui.aribaweb.util.AWFileData


        // Clean up the information stashed in the httpSession if necessary.
        if (hasBinding(BindingNames.maxLength)) {
            session().httpSession().removeAttribute(fileUploadName);
        }

        AWFileData fileData = requestContext.request().fileDataForKey(fileUploadName);
        if (fileData == null && inPlaybackMode()) {
            fileData = fileDataFromInputUrl();
        }

        if (fileData != null && (fileData.bytesRead() > 0 || booleanValueForBinding("newMode"))) {
            String filename = fileData.filename();
            setValueForBinding(filename, BindingNames.filename);
            setValueForBinding(fileData.mimeType(), BindingNames.mimeType);
            setValueForBinding(fileData.fileIncomplete(), BindingNames.fileSizeExceeded);

            // Only one binding for file data is honored. Precedence order: file, input stream, byte array.
            if (parent().hasBinding(BindingNames.file)) {
                File file = fileData.file();
                if ((file == null) && (fileData.data() != null)) {
                    throw new AWGenericException("File binding not supported for in memory file uploads");
                }
                setValueForBinding(file, BindingNames.file);
            }
            else {
                if (parent().hasBinding(BindingNames.inputStream)) {
                    InputStream inputStream = fileData.inputStream();
                    setValueForBinding(inputStream, BindingNames.inputStream);
                }
                else if (parent().hasBinding(BindingNames.bytes)) {
                    byte[] byteArray = fileData.data();
                    setValueForBinding(byteArray, BindingNames.bytes);
                }
            }
        }
        // This is here to balance the glid stack since we do not call super.
View Full Code Here


            String uploadDirPath = AWMimeReader.fileUploadDirectory();
            if (uploadDirPath != null) {
                File uploadDirectory = new File(uploadDirPath);
                File uploadFile = File.createTempFile("awupload", ".tmp", uploadDirectory);
                AWUtil.writeToFile(bytes, uploadFile);
                return new AWFileData(fileName, uploadFile, contentType, false, bytes.length, false);
            }
            return new AWFileData(fileName, bytes);
        } catch (IOException e) {
            throw new AWGenericException(Fmt.S("Exception in processing playback simulated file upload on URL: %s", urlString), e);
        }
    }
View Full Code Here

                    String msg = localizedJavaString(ComponentName, 1, "Uploaded %s KB of %s KB...",
                                        AWConcreteServerApplication.sharedInstance().resourceManager(locale));

                    ProgressMonitor.instance().prepare(msg, contentLength()/1024);

                    AWFileData fileData =
                        mimeReader.nextChunk(fileName, headerContentType, maxLength, encrypted);

                    if (fileData != null) {
                        newHashtable.put(name, fileData);
                    }
View Full Code Here

TOP

Related Classes of ariba.ui.aribaweb.util.AWFileData

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.