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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? commonsmultipartrequesthandler.java

?? 這是STRUTS1.2。6的開(kāi)發(fā)包。。這是我從芝APACHE網(wǎng)站下下來(lái)
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
        if (sizeString.endsWith("K")) {
            multiplier = 1024;
        } else if (sizeString.endsWith("M")) {
            multiplier = 1024 * 1024;
        } else if (sizeString.endsWith("G")) {
            multiplier = 1024 * 1024 * 1024;
        }
        if (multiplier != 1) {
            sizeString = sizeString.substring(0, sizeString.length() - 1);
        }
        
        long size = 0;
        try {
            size = Long.parseLong(sizeString);
        } catch (NumberFormatException nfe) {
            log.warn("Invalid format for file size ('" + sizeString +
                    "'). Using default.");
            size = defaultSize;
            multiplier = 1;
        }
                
        return (size * multiplier);
    }


    /**
     * Returns the path to the temporary directory to be used for uploaded
     * files which are written to disk. The directory used is determined from
     * the first of the following to be non-empty.
     * <ol>
     * <li>A temp dir explicitly defined either using the <code>tempDir</code>
     *     servlet init param, or the <code>tempDir</code> attribute of the
     *     &lt;controller&gt; element in the Struts config file.</li>
     * <li>The container-specified temp dir, obtained from the
     *     <code>javax.servlet.context.tempdir</code> servlet context
     *     attribute.</li>
     * <li>The temp dir specified by the <code>java.io.tmpdir</code> system
     *     property.</li>
     * (/ol>
     *
     * @param mc The module config instance for which the path should be
     *           determined.
     *
     * @return The path to the directory to be used to store uploaded files.
     */
    protected String getRepositoryPath(ModuleConfig mc) {

        // First, look for an explicitly defined temp dir.
        String tempDir = mc.getControllerConfig().getTempDir();

        // If none, look for a container specified temp dir.
        if (tempDir == null || tempDir.length() == 0) {
            if (servlet != null) {
                ServletContext context = servlet.getServletContext();
                File tempDirFile = (File) context.getAttribute(
                        "javax.servlet.context.tempdir");
                tempDir = tempDirFile.getAbsolutePath();
            }

            // If none, pick up the system temp dir.
            if (tempDir == null || tempDir.length() == 0) {
                tempDir = System.getProperty("java.io.tmpdir");
            }
        }

        if (log.isTraceEnabled()) {
            log.trace("File upload temp dir: " + tempDir);
        }

        return tempDir;
    }


    /**
     * Adds a regular text parameter to the set of text parameters for this
     * request and also to the list of all parameters. Handles the case of
     * multiple values for the same parameter by using an array for the
     * parameter value.
     *
     * @param request The request in which the parameter was specified.
     * @param item    The file item for the parameter to add.
     */
    protected void addTextParameter(HttpServletRequest request, FileItem item) {
        String name = item.getFieldName();
        String value = null;
        boolean haveValue = false;
        String encoding = request.getCharacterEncoding();

        if (encoding != null) {
            try {
                value = item.getString(encoding);
                haveValue = true;
            } catch (Exception e) {
                // Handled below, since haveValue is false.
            }
        }
        if (!haveValue) {
            try {
                 value = item.getString("ISO-8859-1");
            } catch (java.io.UnsupportedEncodingException uee) {
                 value = item.getString();
            }
            haveValue = true;
        }

        if (request instanceof MultipartRequestWrapper) {
            MultipartRequestWrapper wrapper = (MultipartRequestWrapper) request;
            wrapper.setParameter(name, value);
        }

        String[] oldArray = (String[]) elementsText.get(name);
        String[] newArray;

        if (oldArray != null) {
            newArray = new String[oldArray.length + 1];
            System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
            newArray[oldArray.length] = value;
        } else {
            newArray = new String[] { value };
        }

        elementsText.put(name, newArray);
        elementsAll.put(name, newArray);
    }


    /**
     * Adds a file parameter to the set of file parameters for this request
     * and also to the list of all parameters.
     *
     * @param item    The file item for the parameter to add.
     */
    protected void addFileParameter(FileItem item) {
        FormFile formFile = new CommonsFormFile(item);

        elementsFile.put(item.getFieldName(), formFile);
        elementsAll.put(item.getFieldName(), formFile);
    }


    // ---------------------------------------------------------- Inner Classes


    /**
     * This class implements the Struts <code>FormFile</code> interface by
     * wrapping the Commons FileUpload <code>FileItem</code> interface. This
     * implementation is <i>read-only</i>; any attempt to modify an instance
     * of this class will result in an <code>UnsupportedOperationException</code>.
     */
    static class CommonsFormFile implements FormFile, Serializable {

        /**
         * The <code>FileItem</code> instance wrapped by this object.
         */
        FileItem fileItem;


        /**
         * Constructs an instance of this class which wraps the supplied
         * file item.
         *
         * @param fileItem The Commons file item to be wrapped.
         */
        public CommonsFormFile(FileItem fileItem) {
            this.fileItem = fileItem;
        }


        /**
         * Returns the content type for this file.
         *
         * @return A String representing content type.
         */
        public String getContentType() {
            return fileItem.getContentType();
        }


        /**
         * Sets the content type for this file.
         * <p>
         * NOTE: This method is not supported in this implementation.
         *
         * @param contentType A string representing the content type.
         */
        public void setContentType(String contentType) {
            throw new UnsupportedOperationException(
                    "The setContentType() method is not supported.");
        }


        /**
         * Returns the size, in bytes, of this file.
         *
         * @return The size of the file, in bytes.
         */
        public int getFileSize() {
            return (int)fileItem.getSize();
        }


        /**
         * Sets the size, in bytes, for this file.
         * <p>
         * NOTE: This method is not supported in this implementation.
         *
         * @param filesize The size of the file, in bytes.
         */
        public void setFileSize(int filesize) {
            throw new UnsupportedOperationException(
                    "The setFileSize() method is not supported.");
        }


        /**
         * Returns the (client-side) file name for this file.
         *
         * @return The client-size file name.
         */
        public String getFileName() {
            return getBaseFileName(fileItem.getName());
        }


        /**
         * Sets the (client-side) file name for this file.
         * <p>
         * NOTE: This method is not supported in this implementation.
         *
         * @param fileName The client-side name for the file.
         */
        public void setFileName(String fileName) {
            throw new UnsupportedOperationException(
                    "The setFileName() method is not supported.");
        }


        /**
         * Returns the data for this file as a byte array. Note that this may
         * result in excessive memory usage for large uploads. The use of the
         * {@link #getInputStream() getInputStream} method is encouraged
         * as an alternative.
         *
         * @return An array of bytes representing the data contained in this
         *         form file.
         *
         * @exception FileNotFoundException If some sort of file representation
         *                                  cannot be found for the FormFile
         * @exception IOException If there is some sort of IOException
         */
        public byte[] getFileData() throws FileNotFoundException, IOException {
            return fileItem.get();
        }


        /**
         * Get an InputStream that represents this file.  This is the preferred
         * method of getting file data.
         * @exception FileNotFoundException If some sort of file representation
         *                                  cannot be found for the FormFile
         * @exception IOException If there is some sort of IOException
         */
        public InputStream getInputStream() throws FileNotFoundException, IOException {
            return fileItem.getInputStream();
        }


        /**
         * Destroy all content for this form file.
         * Implementations should remove any temporary
         * files or any temporary file data stored somewhere
         */
        public void destroy() {
            fileItem.delete();
        }


        /**
         * Returns the base file name from the supplied file path. On the surface,
         * this would appear to be a trivial task. Apparently, however, some Linux
         * JDKs do not implement <code>File.getName()</code> correctly for Windows
         * paths, so we attempt to take care of that here.
         *
         * @param filePath The full path to the file.
         *
         * @return The base file name, from the end of the path.
         */
        protected String getBaseFileName(String filePath) {

            // First, ask the JDK for the base file name.
            String fileName = new File(filePath).getName();

            // Now check for a Windows file name parsed incorrectly.
            int colonIndex = fileName.indexOf(":");
            if (colonIndex == -1) {
                // Check for a Windows SMB file path.
                colonIndex = fileName.indexOf("\\\\");
            }
            int backslashIndex = fileName.lastIndexOf("\\");

            if (colonIndex > -1 && backslashIndex > -1) {
                // Consider this filename to be a full Windows path, and parse it
                // accordingly to retrieve just the base file name.
                fileName = fileName.substring(backslashIndex + 1);
            }

            return fileName;
        }

        /**
         * Returns the (client-side) file name for this file.
         *
         * @return The client-size file name.
         */
        public String toString() {
            return getFileName();
        }
    }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产乱码精品一区二区三区忘忧草| 日韩欧美三级在线| 不卡一区二区在线| 国产经典欧美精品| 国产精品影视在线观看| 国产综合久久久久影院| 国产一区二区三区在线观看免费视频 | 国产精品女人毛片| 国产欧美一区二区在线| 国产三级一区二区| 国产精品视频线看| 亚洲三级久久久| 亚洲六月丁香色婷婷综合久久 | 成人开心网精品视频| 99这里都是精品| 欧美影视一区在线| 91精品午夜视频| 久久久综合视频| 1024成人网| 亚洲成精国产精品女| 日本不卡高清视频| 国产麻豆成人传媒免费观看| 99久久综合精品| 日本道在线观看一区二区| 在线不卡免费欧美| 2021久久国产精品不只是精品| 国产日产精品1区| 亚洲乱码精品一二三四区日韩在线| 午夜精品影院在线观看| 激情五月激情综合网| 91小视频免费观看| 69久久99精品久久久久婷婷| 日韩精品一区二区三区中文不卡| 国产精品素人一区二区| 亚洲一卡二卡三卡四卡| 日本不卡123| 国产99久久久国产精品潘金| 91麻豆精品秘密| 91精品国产色综合久久不卡蜜臀| 精品国产免费视频| 亚洲欧洲无码一区二区三区| 日韩av电影天堂| 国产成人三级在线观看| 欧美偷拍一区二区| 久久久久一区二区三区四区| 亚洲精品日日夜夜| 国内精品久久久久影院薰衣草| 色综合久久中文综合久久97| 日韩欧美国产电影| 亚洲色图在线播放| 久久99国产精品久久| 97se亚洲国产综合自在线观| 91精品国产高清一区二区三区| 欧美国产97人人爽人人喊| 亚洲成年人影院| 成人高清视频免费观看| 555夜色666亚洲国产免| 国产精品福利一区二区三区| 美女视频黄免费的久久| 91网站最新网址| 久久午夜国产精品| 亚洲国产精品尤物yw在线观看| 国产成人av一区二区| 91精品国产日韩91久久久久久| 国产精品亲子乱子伦xxxx裸| 日本欧美韩国一区三区| 91精品福利视频| 国产欧美一区二区精品婷婷| 婷婷久久综合九色国产成人| 成人av网址在线观看| 日韩三级免费观看| 午夜激情综合网| 色老头久久综合| 国产精品大尺度| 国产精品一区二区黑丝| 欧美一级艳片视频免费观看| 亚洲午夜精品在线| 99久久免费视频.com| 久久老女人爱爱| 精品一区二区三区av| 91精品免费在线观看| 亚洲国产精品自拍| 在线观看国产日韩| 亚洲精品视频在线| 97久久精品人人澡人人爽| 国产欧美精品区一区二区三区| 免费成人av在线| 欧美精品乱人伦久久久久久| 亚洲综合成人网| 在线视频综合导航| 亚洲婷婷在线视频| 97久久超碰国产精品| 国产精品久久久久久久久果冻传媒 | 一区二区三区av电影| jizzjizzjizz欧美| 国产精品免费人成网站| 国产成人8x视频一区二区| 久久综合999| 精品一区二区三区免费播放| 日韩精品资源二区在线| 美女尤物国产一区| 日韩精品一区二区在线| 久久精品二区亚洲w码| 日韩欧美专区在线| 久久精品噜噜噜成人88aⅴ| 日韩小视频在线观看专区| 麻豆一区二区在线| 久久久久久久网| 国产永久精品大片wwwapp| 久久久久久久久一| 国产成人av一区| 1区2区3区欧美| 色综合 综合色| 亚洲v精品v日韩v欧美v专区| 日韩一区二区麻豆国产| 国内久久婷婷综合| 国产欧美日韩不卡| 91视频观看免费| 亚洲一区二区三区视频在线播放 | 欧美三级三级三级| 日韩av网站免费在线| 日韩精品一区二区三区三区免费| 国产一区在线不卡| 1024亚洲合集| 欧美日韩一区二区三区在线| 男男视频亚洲欧美| 国产人伦精品一区二区| 99精品久久免费看蜜臀剧情介绍| 亚洲精品日韩综合观看成人91| 欧美日韩免费视频| 极品瑜伽女神91| 国产精品私人影院| 色综合久久综合网欧美综合网| 日韩综合在线视频| 久久精品视频一区二区三区| 91无套直看片红桃| 日日噜噜夜夜狠狠视频欧美人| 精品人在线二区三区| av男人天堂一区| 日韩精品五月天| 日本一区二区三区免费乱视频| 91成人在线观看喷潮| 久久国产精品99久久久久久老狼 | 一区二区三区高清| 精品国产免费一区二区三区香蕉| 99久久精品一区| 免费观看久久久4p| ...中文天堂在线一区| 制服丝袜亚洲网站| jvid福利写真一区二区三区| 日韩电影在线免费| 亚洲欧美在线视频观看| 精品国产乱码久久久久久蜜臀| 色综合久久久网| 精品一区二区免费在线观看| 亚洲精品久久久蜜桃| 久久亚洲一区二区三区明星换脸 | 日韩美女久久久| 日韩精品自拍偷拍| 欧美亚洲精品一区| 国产精品一区二区在线观看不卡 | 93久久精品日日躁夜夜躁欧美| 美女性感视频久久| 亚洲精品乱码久久久久久久久| 欧美成人三级电影在线| 欧美这里有精品| 成人视屏免费看| 寂寞少妇一区二区三区| 亚洲一区免费观看| 久久久久久久久99精品| 欧美高清www午色夜在线视频| 成人看片黄a免费看在线| 国产综合一区二区| 奇米888四色在线精品| 亚洲伦在线观看| 国产欧美综合在线观看第十页| 777奇米成人网| 欧美性色aⅴ视频一区日韩精品| 99久久精品国产网站| 国产精品亚洲专一区二区三区 | 亚洲美腿欧美偷拍| 久久精品一区二区三区av| 欧美军同video69gay| bt7086福利一区国产| 国产精品99久久久久久久女警 | 69p69国产精品| 欧美少妇一区二区| 91网站黄www| k8久久久一区二区三区| 粉嫩蜜臀av国产精品网站| 国产在线播放一区二区三区| 另类专区欧美蜜桃臀第一页| 日韩电影在线看| 天堂精品中文字幕在线| 夜夜嗨av一区二区三区网页 | 成人精品国产一区二区4080| 麻豆传媒一区二区三区| 爽好多水快深点欧美视频| 亚洲电影第三页| 亚洲国产成人av好男人在线观看|