亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fileuploadbase.java

?? 解觖java技術中后臺無法上傳數給的情況
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Copyright 2001-2005 The Apache Software Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.myvietnam.mvncore.web.fileupload;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;

import net.myvietnam.mvncore.web.fileupload.servlet.ServletRequestContext;

/**
 * <p>High level API for processing file uploads.</p>
 *
 * <p>This class handles multiple files per single HTML widget, sent using
 * <code>multipart/mixed</code> encoding type, as specified by
 * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>.  Use {@link
 * #parseRequest(HttpServletRequest)} to acquire a list of {@link
 * org.apache.commons.fileupload.FileItem}s associated with a given HTML
 * widget.</p>
 *
 * <p>How the data for individual parts is stored is determined by the factory
 * used to create them; a given part may be in memory, on disk, or somewhere
 * else.</p>
 *
 * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
 * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
 * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
 * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
 * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
 * @author Sean C. Sullivan
 *
 * @version $Id: FileUploadBase.java,v 1.3 2006/04/14 18:26:31 minhnn Exp $
 */
public abstract class FileUploadBase {

    // ---------------------------------------------------------- Class methods


    /**
     * <p>Utility method that determines whether the request contains multipart
     * content.</p>
     *
     * <p><strong>NOTE:</strong>This method will be moved to the
     * <code>ServletFileUpload</code> class after the FileUpload 1.1 release.
     * Unfortunately, since this method is static, it is not possible to
     * provide its replacement until this method is removed.</p>
     *
     * @param ctx The request context to be evaluated. Must be non-null.
     *
     * @return <code>true</code> if the request is multipart;
     *         <code>false</code> otherwise.
     */
    public static final boolean isMultipartContent(RequestContext ctx) {
        String contentType = ctx.getContentType();
        if (contentType == null) {
            return false;
        }
        if (contentType.toLowerCase().startsWith(MULTIPART)) {
            return true;
        }
        return false;
    }


    /**
     * Utility method that determines whether the request contains multipart
     * content.
     *
     * @param req The servlet request to be evaluated. Must be non-null.
     *
     * @return <code>true</code> if the request is multipart;
     *         <code>false</code> otherwise.
     *
     * @deprecated Use the method on <code>ServletFileUpload</code> instead.
     */
    public static final boolean isMultipartContent(HttpServletRequest req) {
        if (!"post".equals(req.getMethod().toLowerCase())) {
            return false;
        }
        String contentType = req.getContentType();
        if (contentType == null) {
            return false;
        }
        if (contentType.toLowerCase().startsWith(MULTIPART)) {
            return true;
        }
        return false;
    }


    // ----------------------------------------------------- Manifest constants


    /**
     * HTTP content type header name.
     */
    public static final String CONTENT_TYPE = "Content-type";


    /**
     * HTTP content disposition header name.
     */
    public static final String CONTENT_DISPOSITION = "Content-disposition";


    /**
     * Content-disposition value for form data.
     */
    public static final String FORM_DATA = "form-data";


    /**
     * Content-disposition value for file attachment.
     */
    public static final String ATTACHMENT = "attachment";


    /**
     * Part of HTTP content type header.
     */
    public static final String MULTIPART = "multipart/";


    /**
     * HTTP content type header for multipart forms.
     */
    public static final String MULTIPART_FORM_DATA = "multipart/form-data";


    /**
     * HTTP content type header for multiple uploads.
     */
    public static final String MULTIPART_MIXED = "multipart/mixed";


    /**
     * The maximum length of a single header line that will be parsed
     * (1024 bytes).
     */
    public static final int MAX_HEADER_SIZE = 1024;


    // ----------------------------------------------------------- Data members


    /**
     * The maximum size permitted for an uploaded file. A value of -1 indicates
     * no maximum.
     */
    private long sizeMax = -1;


    /**
     * The content encoding to use when reading part headers.
     */
    private String headerEncoding;


    // ----------------------------------------------------- Property accessors


    /**
     * Returns the factory class used when creating file items.
     *
     * @return The factory class for new file items.
     */
    public abstract FileItemFactory getFileItemFactory();


    /**
     * Sets the factory class to use when creating file items.
     *
     * @param factory The factory class for new file items.
     */
    public abstract void setFileItemFactory(FileItemFactory factory);


    /**
     * Returns the maximum allowed upload size.
     *
     * @return The maximum allowed size, in bytes.
     *
     * @see #setSizeMax(long)
     *
     */
    public long getSizeMax() {
        return sizeMax;
    }


    /**
     * Sets the maximum allowed upload size. If negative, there is no maximum.
     *
     * @param sizeMax The maximum allowed size, in bytes, or -1 for no maximum.
     *
     * @see #getSizeMax()
     *
     */
    public void setSizeMax(long sizeMax) {
        this.sizeMax = sizeMax;
    }


    /**
     * Retrieves the character encoding used when reading the headers of an
     * individual part. When not specified, or <code>null</code>, the request
     * encoding is used. If that is also not specified, or <code>null</code>,
     * the platform default encoding is used.
     *
     * @return The encoding used to read part headers.
     */
    public String getHeaderEncoding() {
        return headerEncoding;
    }


    /**
     * Specifies the character encoding to be used when reading the headers of
     * individual part. When not specified, or <code>null</code>, the request
     * encoding is used. If that is also not specified, or <code>null</code>,
     * the platform default encoding is used.
     *
     * @param encoding The encoding used to read part headers.
     */
    public void setHeaderEncoding(String encoding) {
        headerEncoding = encoding;
    }


    // --------------------------------------------------------- Public methods


    /**
     * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
     * compliant <code>multipart/form-data</code> stream.
     *
     * @param req The servlet request to be parsed.
     *
     * @return A list of <code>FileItem</code> instances parsed from the
     *         request, in the order that they were transmitted.
     *
     * @throws FileUploadException if there are problems reading/parsing
     *                             the request or storing files.
     *
     * @deprecated Use the method in <code>ServletFileUpload</code> instead.
     */
    public List /* FileItem */ parseRequest(HttpServletRequest req)
            throws FileUploadException {
        return parseRequest(new ServletRequestContext(req));
    }

    /**
     * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
     * compliant <code>multipart/form-data</code> stream.
     *
     * @param ctx The context for the request to be parsed.
     *
     * @return A list of <code>FileItem</code> instances parsed from the
     *         request, in the order that they were transmitted.
     *
     * @throws FileUploadException if there are problems reading/parsing
     *                             the request or storing files.
     */
    public List /* FileItem */ parseRequest(RequestContext ctx)
            throws FileUploadException {
        if (ctx == null) {
            throw new NullPointerException("ctx parameter");
        }

        ArrayList items = new ArrayList();
        String contentType = ctx.getContentType();

        if ((null == contentType)
            || (!contentType.toLowerCase().startsWith(MULTIPART))) {
            throw new InvalidContentTypeException(
                "the request doesn't contain a "
                + MULTIPART_FORM_DATA
                + " or "
                + MULTIPART_MIXED
                + " stream, content type header is "
                + contentType);
        }
        int requestSize = ctx.getContentLength();

        if (requestSize == -1) {
            throw new UnknownSizeException(
                "the request was rejected because its size is unknown");
        }

        if (sizeMax >= 0 && requestSize > sizeMax) {
            throw new SizeLimitExceededException(
                "the request was rejected because its size (" + requestSize
                + ") exceeds the configured maximum (" + sizeMax + ")",
                requestSize, sizeMax);
        }

        String charEncoding = headerEncoding;
        if (charEncoding == null) {
            charEncoding = ctx.getCharacterEncoding();
        }

        try {
            byte[] boundary = getBoundary(contentType);
            if (boundary == null) {
                throw new FileUploadException(
                        "the request was rejected because "
                        + "no multipart boundary was found");
            }

            InputStream input = ctx.getInputStream();

            MultipartStream multi = new MultipartStream(input, boundary);
            multi.setHeaderEncoding(charEncoding);

            boolean nextPart = multi.skipPreamble();
            while (nextPart) {
                Map headers = parseHeaders(multi.readHeaders());
                String fieldName = getFieldName(headers);
                if (fieldName != null) {
                    String subContentType = getHeader(headers, CONTENT_TYPE);
                    if (subContentType != null && subContentType
                        .toLowerCase().startsWith(MULTIPART_MIXED)) {
                        // Multiple files.
                        byte[] subBoundary = getBoundary(subContentType);
                        multi.setBoundary(subBoundary);
                        boolean nextSubPart = multi.skipPreamble();
                        while (nextSubPart) {
                            headers = parseHeaders(multi.readHeaders());
                            if (getFileName(headers) != null) {
                                FileItem item =
                                        createItem(headers, false);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
裸体一区二区三区| 国产一区二区女| 国产一区二区免费在线| 欧美性做爰猛烈叫床潮| 国产欧美综合色| 老司机午夜精品| 欧美伊人久久大香线蕉综合69| 久久久国产一区二区三区四区小说 | 国产 欧美在线| 91精品国产综合久久久蜜臀粉嫩| 国产精品电影一区二区三区| 美日韩一区二区三区| 欧美综合亚洲图片综合区| 国产欧美一区二区精品婷婷| 精品中文字幕一区二区| 91麻豆精品国产91久久久| 一区二区三区日本| 色综合久久久久久久| 中文成人综合网| 国产a级毛片一区| 国产网站一区二区| 国产ts人妖一区二区| 亚洲精品一线二线三线| 久久精品国产精品亚洲红杏| 欧美一区二区三区在线观看视频 | 久久国产免费看| 日韩欧美123| 极品少妇xxxx精品少妇| 日韩欧美在线不卡| 日本成人中文字幕在线视频| 91精品久久久久久久久99蜜臂| 一区二区三区四区在线播放| 欧美图区在线视频| 日韩国产欧美三级| 欧美一区二区免费| 经典一区二区三区| 国产亚洲欧美激情| 成人黄色小视频| 一区二区三区在线视频观看| 欧美性淫爽ww久久久久无| 亚洲国产精品久久艾草纯爱| 精品视频资源站| 麻豆成人免费电影| 精品国产成人系列| 不卡的电影网站| 亚洲国产另类av| 日韩免费看网站| 粉嫩欧美一区二区三区高清影视| 中文字幕亚洲成人| 欧美日韩在线三级| 久久99日本精品| 国产区在线观看成人精品| av激情亚洲男人天堂| 亚洲国产成人av网| 精品国产一区二区在线观看| 粉嫩av一区二区三区粉嫩| 亚洲精品久久7777| 日韩女优视频免费观看| 成人午夜精品在线| 亚洲丶国产丶欧美一区二区三区| 精品国产一区二区三区不卡| 成人a区在线观看| 天堂一区二区在线| 国产人妖乱国产精品人妖| 欧美私模裸体表演在线观看| 激情六月婷婷综合| 一级精品视频在线观看宜春院 | 中文字幕亚洲一区二区av在线| 欧洲一区在线电影| 麻豆久久一区二区| 亚洲欧美激情在线| 精品国产一区a| 欧美性生交片4| 国内精品不卡在线| 亚洲综合男人的天堂| 国产亚洲成aⅴ人片在线观看| 欧美性高清videossexo| 国产成人综合网| 视频一区视频二区在线观看| 亚洲国产高清在线观看视频| 5月丁香婷婷综合| 97精品视频在线观看自产线路二| 九九视频精品免费| 日一区二区三区| 亚洲视频在线观看三级| 久久久久久久久久久99999| 在线成人免费观看| 在线视频综合导航| av不卡免费电影| 国产成人夜色高潮福利影视| 日本午夜精品一区二区三区电影| 亚洲天堂免费看| 国产欧美日韩在线视频| 久久―日本道色综合久久| 91精品欧美综合在线观看最新 | 成人av电影在线| 久久国产欧美日韩精品| 日韩中文字幕区一区有砖一区| 一区二区三区四区视频精品免费| 中文一区二区完整视频在线观看| 精品处破学生在线二十三| 欧美日韩午夜影院| 欧美日韩免费在线视频| 在线视频中文字幕一区二区| 色综合欧美在线视频区| 99久久精品免费看| eeuss影院一区二区三区| 成人午夜短视频| 国产精品一级黄| 国产乱码精品一区二区三区五月婷| 日本麻豆一区二区三区视频| 日本不卡一二三区黄网| 首页亚洲欧美制服丝腿| 日本中文字幕一区二区有限公司| 视频一区在线视频| 日本不卡123| 国产在线乱码一区二区三区| 极品少妇一区二区| 成人在线视频一区| 成人精品免费网站| 成人av第一页| 欧洲激情一区二区| 欧美一区二区三区喷汁尤物| 日韩欧美一级二级三级| 2021久久国产精品不只是精品| 精品国产乱码久久久久久1区2区| 久久久久久久久久久久久女国产乱| 日本一区二区三区四区| 成人免费一区二区三区在线观看 | 欧美午夜不卡在线观看免费| 欧美日韩国产美| 精品卡一卡二卡三卡四在线| 国产性做久久久久久| 亚洲品质自拍视频网站| 天涯成人国产亚洲精品一区av| 久久精品国产亚洲一区二区三区| 国产曰批免费观看久久久| eeuss鲁片一区二区三区| 欧美日韩午夜在线视频| 精品成a人在线观看| 国产精品白丝在线| 亚洲成人激情自拍| 狠狠色综合色综合网络| 91色视频在线| 欧美一区二区三区在线电影 | 精品久久久影院| 国产精品乱码一区二三区小蝌蚪| 亚洲欧美二区三区| 日韩极品在线观看| 成人午夜在线播放| 7777精品久久久大香线蕉| 久久久夜色精品亚洲| 亚洲精品国产高清久久伦理二区| 免费日韩伦理电影| 99久久99久久久精品齐齐| 欧美一级午夜免费电影| **欧美大码日韩| 久久99精品久久久久| 欧美视频精品在线| 国产欧美日韩激情| 久久精品噜噜噜成人88aⅴ| 91在线视频观看| 精品国产乱码久久久久久免费| 一区二区三区免费网站| 国产一区二区免费看| 在线不卡一区二区| 一区二区三区欧美亚洲| 国产成人激情av| 日韩欧美卡一卡二| 亚洲高清视频中文字幕| 成人激情av网| 久久这里只精品最新地址| 亚洲高清不卡在线| 99精品视频免费在线观看| 26uuu另类欧美亚洲曰本| 五月天欧美精品| 色综合久久中文综合久久牛| 中文一区在线播放| 国产精品一级二级三级| 精品国产一区二区三区四区四| 亚洲第四色夜色| 欧美视频在线一区| 亚洲综合图片区| 色老综合老女人久久久| 国产精品久99| 成人av在线网站| 国产精品日日摸夜夜摸av| 成人免费高清在线| 国产欧美日韩精品a在线观看| 国产乱码精品一区二区三| 精品国一区二区三区| 久久国产精品无码网站| 日韩一区二区免费高清| 日韩中文字幕区一区有砖一区| 欧美区视频在线观看| 午夜视频一区在线观看| 欧美精品乱码久久久久久| 亚洲高清在线精品| 欧美一区二区视频在线观看2020| 日韩精品亚洲一区|