Package ariba.ui.aribaweb.util

Examples of ariba.ui.aribaweb.util.AWMimeReader


    protected AWStringKeyHashtable parseMultipartEncodedRequest ()
    {
        try {
            AWStringKeyHashtable newHashtable = new AWStringKeyHashtable(1);
            AWMimeReader mimeReader = new AWMimeReader(
                contentStream(), contentLength(), contentType());
            while (true) {
                Parameters parameters = mimeReader.nextHeaders();
                if (parameters == null) {
                    break;
                }
                String disposition = parameters.getParameter(
                    MIME.HeaderContentDisposition);
                if (disposition == null) {
                        // This is the workaround to a bug in the Macintosh version of IE.
                    disposition = parameters.getParameter(
                        AWRequest.HeaderContentDispositionForMacintosh);
                }
                String name = AWMimeReader.mimeArgumentValue(
                    disposition, MIME.ParameterName);
                String fileName = AWMimeReader.mimeArgumentValue(
                    disposition, MIME.ParameterFilename);
                if (fileName != null) {
                    String headerContentType =
                        parameters.getParameter(MIME.HeaderContentType);
                    if (headerContentType == null) {
                        headerContentType = MIME.ContentTypeApplicationOctetStream;
                    }

                    // get locale for this request.  Default to browser preferred locale.
                    Locale locale = preferredLocale();
                    // get max size for this request
                    int maxLength = AWMimeReader.maxBytesPerChunk();
                    boolean encrypted = false;
                    HttpSession httpSession = getSession(false);
                    if (httpSession != null) {
                        Integer length = (Integer)httpSession.getAttribute(name);
                        if (length != null) {
                            maxLength = length.intValue();
                        }
                        Boolean enc = (Boolean)httpSession.getAttribute(BindingNames.encrypt +"."+name);
                        if (enc != null) {
                            encrypted = enc;
                        }
                        locale = (Locale)httpSession.getAttribute(Locale.class.getName());
                    }

                    String sessionId = initSessionId();
                    ProgressMonitor.register(sessionId);

                    // Message for file upload status panel
                    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);
                    }
                }
                else {
                    byte[] nextChunk = mimeReader.nextChunk();
                    int nextChunkLength = nextChunk.length;
                    if (nextChunkLength > 0) {
                        if (nextChunk[nextChunkLength - 1] == '\n') {
                            nextChunkLength--;
                            if (nextChunk[nextChunkLength - 1] == '\r') {
View Full Code Here

TOP

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

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.