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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? smartupload.jad

?? <JSP應(yīng)用開發(fā)詳解>第十章 在不同頁面或用戶之間共享數(shù)據(jù) 在JSP中操作文件、上傳文件 的代碼
?? JAD
?? 第 1 頁 / 共 2 頁
字號:
// Decompiled by DJ v2.5.5.45 Copyright 2000 Atanas Neshkov  Date: 2003-9-13 17:37:35
// Home Page : http//members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   SmartUpload.java

package com.jspsmart.upload;

import java.io.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;

// Referenced classes of package com.jspsmart.upload:
//            Files, Request, SmartUploadException, File

public class SmartUpload
{

    public SmartUpload()
    {
        m_totalBytes = 0;
        m_currentIndex = 0;
        m_startData = 0;
        m_endData = 0;
        m_boundary = new String();
        m_totalMaxFileSize = 0L;
        m_maxFileSize = 0L;
        m_deniedFilesList = new Vector();
        m_allowedFilesList = new Vector();
        m_denyPhysicalPath = false;
        m_forcePhysicalPath = false;
        m_contentDisposition = new String();
        m_files = new Files();
        m_formRequest = new Request();
    }

    public final void init(ServletConfig config)
        throws ServletException
    {
        m_application = config.getServletContext();
    }

    public void service(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
    {
        m_request = request;
        m_response = response;
    }

    public final void initialize(ServletConfig config, HttpServletRequest request, HttpServletResponse response)
        throws ServletException
    {
        m_application = config.getServletContext();
        m_request = request;
        m_response = response;
    }

    public final void initialize(PageContext pageContext)
        throws ServletException
    {
        m_application = pageContext.getServletContext();
        m_request = (HttpServletRequest)pageContext.getRequest();
        m_response = (HttpServletResponse)pageContext.getResponse();
    }

    public final void initialize(ServletContext application, HttpSession session, HttpServletRequest request, HttpServletResponse response, JspWriter out)
        throws ServletException
    {
        m_application = application;
        m_request = request;
        m_response = response;
    }

    public void upload()
        throws SmartUploadException, IOException, ServletException
    {
        int totalRead = 0;
        int readBytes = 0;
        long totalFileSize = 0L;
        boolean found = false;
        String dataHeader = new String();
        String fieldName = new String();
        String fileName = new String();
        String fileExt = new String();
        String filePathName = new String();
        String contentType = new String();
        String contentDisp = new String();
        String typeMIME = new String();
        String subTypeMIME = new String();
        boolean isFile = false;
        m_totalBytes = m_request.getContentLength();
        m_binArray = new byte[m_totalBytes];
        for(; totalRead < m_totalBytes; totalRead += readBytes)
            try
            {
                m_request.getInputStream();
                readBytes = m_request.getInputStream().read(m_binArray, totalRead, m_totalBytes - totalRead);
            }
            catch(Exception e)
            {
                throw new SmartUploadException("Unable to upload.");
            }

        for(; !found && m_currentIndex < m_totalBytes; m_currentIndex++)
            if(m_binArray[m_currentIndex] == 13)
                found = true;
            else
                m_boundary = m_boundary + (char)m_binArray[m_currentIndex];

        if(m_currentIndex == 1)
            return;
        m_currentIndex++;
        do
        {
            if(m_currentIndex >= m_totalBytes)
                break;
            dataHeader = getDataHeader();
            m_currentIndex = m_currentIndex + 2;
            isFile = dataHeader.indexOf("filename") > 0;
            fieldName = getDataFieldValue(dataHeader, "name");
            if(isFile)
            {
                filePathName = getDataFieldValue(dataHeader, "filename");
                fileName = getFileName(filePathName);
                fileExt = getFileExt(fileName);
                contentType = getContentType(dataHeader);
                contentDisp = getContentDisp(dataHeader);
                typeMIME = getTypeMIME(contentType);
                subTypeMIME = getSubTypeMIME(contentType);
            }
            getDataSection();
            if(isFile && fileName.length() > 0)
            {
                if(m_deniedFilesList.contains(fileExt))
                    throw new SecurityException("The extension of the file is denied to be uploaded (1015).");
                if(!m_allowedFilesList.isEmpty() && !m_allowedFilesList.contains(fileExt))
                    throw new SecurityException("The extension of the file is not allowed to be uploaded (1010).");
                if(m_maxFileSize > (long)0 && (long)((m_endData - m_startData) + 1) > m_maxFileSize)
                    throw new SecurityException(String.valueOf((new StringBuffer("Size exceeded for this file : ")).append(fileName).append(" (1105).")));
                totalFileSize += (m_endData - m_startData) + 1;
                if(m_totalMaxFileSize > (long)0 && totalFileSize > m_totalMaxFileSize)
                    throw new SecurityException("Total File Size exceeded (1110).");
            }
            if(isFile)
            {
                com.jspsmart.upload.File newFile = new com.jspsmart.upload.File();
                newFile.setParent(this);
                newFile.setFieldName(fieldName);
                newFile.setFileName(fileName);
                newFile.setFileExt(fileExt);
                newFile.setFilePathName(filePathName);
                newFile.setIsMissing(filePathName.length() == 0);
                newFile.setContentType(contentType);
                newFile.setContentDisp(contentDisp);
                newFile.setTypeMIME(typeMIME);
                newFile.setSubTypeMIME(subTypeMIME);
                if(contentType.indexOf("application/x-macbinary") > 0)
                    m_startData = m_startData + 128;
                newFile.setSize((m_endData - m_startData) + 1);
                newFile.setStartData(m_startData);
                newFile.setEndData(m_endData);
                m_files.addFile(newFile);
            } else
            {
                String value = new String(m_binArray, m_startData, (m_endData - m_startData) + 1);
                m_formRequest.putParameter(fieldName, value);
            }
            if((char)m_binArray[m_currentIndex + 1] == '-')
                break;
            m_currentIndex = m_currentIndex + 2;
        } while(true);
    }

    public int save(String destPathName)
        throws SmartUploadException, IOException, ServletException
    {
        return save(destPathName, 0);
    }

    public int save(String destPathName, int option)
        throws SmartUploadException, IOException, ServletException
    {
        int count = 0;
        if(destPathName == null)
            destPathName = m_application.getRealPath("/");
        if(destPathName.indexOf("/") != -1)
        {
            if(destPathName.charAt(destPathName.length() - 1) != '/')
                destPathName = String.valueOf(destPathName).concat("/");
        } else
        if(destPathName.charAt(destPathName.length() - 1) != '\\')
            destPathName = String.valueOf(destPathName).concat("\\");
        for(int i = 0; i < m_files.getCount(); i++)
            if(!m_files.getFile(i).isMissing())
            {
                m_files.getFile(i).saveAs(destPathName + m_files.getFile(i).getFileName(), option);
                count++;
            }

        return count;
    }

    public int getSize()
    {
        return m_totalBytes;
    }

    public byte getBinaryData(int index)
    {
        byte retval;
        try
        {
            retval = m_binArray[index];
        }
        catch(Exception e)
        {
            throw new ArrayIndexOutOfBoundsException("Index out of range (1005).");
        }
        return retval;
    }

    public Files getFiles()
    {
        return m_files;
    }

    public Request getRequest()
    {
        return m_formRequest;
    }

    public void downloadFile(String sourceFilePathName)
        throws SmartUploadException, IOException, ServletException
    {
        downloadFile(sourceFilePathName, null, null);
    }

    public void downloadFile(String sourceFilePathName, String contentType)
        throws SmartUploadException, IOException, ServletException
    {
        downloadFile(sourceFilePathName, contentType, null);
    }

    public void downloadFile(String sourceFilePathName, String contentType, String destFileName)
        throws SmartUploadException, IOException, ServletException
    {
        downloadFile(sourceFilePathName, contentType, destFileName, 65000);
    }

    public void downloadFile(String sourceFilePathName, String contentType, String destFileName, int blockSize)
        throws SmartUploadException, IOException, ServletException
    {
        if(sourceFilePathName == null)
            throw new IllegalArgumentException(String.valueOf((new StringBuffer("File '")).append(sourceFilePathName).append("' not found (1040).")));
        if(sourceFilePathName.equals(""))
            throw new IllegalArgumentException(String.valueOf((new StringBuffer("File '")).append(sourceFilePathName).append("' not found (1040).")));
        if(!isVirtual(sourceFilePathName) && m_denyPhysicalPath)
            throw new SecurityException("Physical path is denied (1035).");
        if(isVirtual(sourceFilePathName))
            sourceFilePathName = m_application.getRealPath(sourceFilePathName);
        File file = new File(sourceFilePathName);
        FileInputStream fileIn = new FileInputStream(file);
        long fileLen = file.length();
        int readBytes = 0;
        int totalRead = 0;
        byte b[] = new byte[blockSize];
        if(contentType == null)
            m_response.setContentType("application/x-msdownload");
        else
        if(contentType.length() == 0)
            m_response.setContentType("application/x-msdownload");
        else
            m_response.setContentType(contentType);
        m_response.setContentLength((int)fileLen);
        m_contentDisposition = m_contentDisposition != null ? m_contentDisposition : "attachment;";
        if(destFileName == null)
            m_response.setHeader("Content-Disposition", String.valueOf((new StringBuffer(String.valueOf(m_contentDisposition))).append(" filename=").append(getFileName(sourceFilePathName))));
        else
        if(destFileName.length() == 0)
            m_response.setHeader("Content-Disposition", m_contentDisposition);
        else
            m_response.setHeader("Content-Disposition", String.valueOf((new StringBuffer(String.valueOf(m_contentDisposition))).append(" filename=").append(destFileName)));
        while((long)totalRead < fileLen) 
        {
            readBytes = fileIn.read(b, 0, blockSize);
            totalRead += readBytes;
            m_response.getOutputStream().write(b, 0, readBytes);
        }
        fileIn.close();
    }

    public void downloadField(ResultSet rs, String columnName, String contentType, String destFileName)
        throws SQLException, IOException, ServletException
    {
        if(rs == null)
            throw new IllegalArgumentException("The RecordSet cannot be null (1045).");
        if(columnName == null)
            throw new IllegalArgumentException("The columnName cannot be null (1050).");
        if(columnName.length() == 0)
            throw new IllegalArgumentException("The columnName cannot be empty (1055).");
        byte b[] = rs.getBytes(columnName);
        if(contentType == null)
            m_response.setContentType("application/x-msdownload");
        else
        if(contentType.length() == 0)
            m_response.setContentType("application/x-msdownload");
        else
            m_response.setContentType(contentType);
        m_response.setContentLength(b.length);
        if(destFileName == null)
            m_response.setHeader("Content-Disposition", "attachment;");
        else
        if(destFileName.length() == 0)
            m_response.setHeader("Content-Disposition", "attachment;");
        else
            m_response.setHeader("Content-Disposition", "attachment; filename=".concat(String.valueOf(destFileName)));
        m_response.getOutputStream().write(b, 0, b.length);
    }

    public void fieldToFile(ResultSet rs, String columnName, String destFilePathName)
        throws SQLException, SmartUploadException, IOException, ServletException
    {
        try
        {
            if(m_application.getRealPath(destFilePathName) != null)
                destFilePathName = m_application.getRealPath(destFilePathName);
            InputStream is_data = rs.getBinaryStream(columnName);
            FileOutputStream file = new FileOutputStream(destFilePathName);
            int c;
            while((c = is_data.read()) != -1) 
                file.write(c);
            file.close();
        }
        catch(Exception e)
        {
            throw new SmartUploadException("Unable to save file from the DataBase (1020).");
        }
    }

    private String getDataFieldValue(String dataHeader, String fieldName)
    {
        String token = new String();
        String value = new String();
        int pos = 0;
        int i = 0;
        int start = 0;
        int end = 0;
        token = String.valueOf((new StringBuffer(String.valueOf(fieldName))).append("=").append('"'));
        pos = dataHeader.indexOf(token);
        if(pos > 0)
        {
            i = pos + token.length();
            start = i;
            token = "\"";
            end = dataHeader.indexOf(token, i);
            if(start > 0 && end > 0)
                value = dataHeader.substring(start, end);
        }
        return value;
    }

    private String getFileExt(String fileName)
    {
        String value = new String();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一个色资源| 欧美精品一区二区在线观看| 麻豆成人免费电影| 国产精品久久久久影院亚瑟| 欧美剧在线免费观看网站 | 亚洲三级电影网站| 欧美精品一区二区不卡 | 色av综合在线| 国产成人亚洲综合a∨婷婷| 亚洲成人激情av| 亚洲精选在线视频| 国产欧美视频一区二区| 制服丝袜亚洲精品中文字幕| 色综合久久天天| 成人精品高清在线| 国产在线精品一区二区三区不卡 | 亚洲午夜在线电影| 国产精品伦一区| 久久日韩精品一区二区五区| 欧美日韩免费观看一区三区| 96av麻豆蜜桃一区二区| 国产成人精品免费| 国产麻豆精品theporn| 日本美女一区二区| 丝袜美腿亚洲一区| 亚洲高清免费观看高清完整版在线观看| 日本一区二区三区四区在线视频| 日韩午夜激情电影| 欧美一区二区网站| 欧美日韩的一区二区| 在线观看日韩国产| 97se亚洲国产综合在线| 99久久婷婷国产| av电影在线不卡| 99久久精品免费看国产| 成人av网址在线| 成人性生交大片免费看中文 | 国产精品美女久久久久久久久久久| 日韩欧美专区在线| 日韩欧美专区在线| 精品噜噜噜噜久久久久久久久试看 | 精品日韩一区二区三区免费视频| 欧美亚洲国产bt| 欧美撒尿777hd撒尿| 欧美色图免费看| 欧美久久一区二区| 日韩一区二区三区在线视频| 91精品国产高清一区二区三区蜜臀 | 国产精品国产三级国产aⅴ原创| 中文字幕国产一区二区| 亚洲欧洲成人自拍| 亚洲欧美一区二区视频| 亚洲美女视频在线观看| 亚洲国产日韩av| 日av在线不卡| 国产精品18久久久久久久久久久久| 国产毛片精品一区| av男人天堂一区| 在线观看一区日韩| 69堂国产成人免费视频| 日韩美一区二区三区| 久久亚洲一级片| 自拍偷拍亚洲欧美日韩| 亚洲一区二区三区四区五区黄| 亚洲成人午夜电影| 激情成人午夜视频| www.欧美日韩国产在线| 在线观看网站黄不卡| 欧美一区二区三区小说| 国产亚洲一二三区| 一区二区欧美视频| 久草精品在线观看| 99久久国产综合精品麻豆| 欧美日韩精品电影| 亚洲精品一区二区三区福利 | 亚洲免费在线视频一区 二区| 亚洲国产日韩a在线播放| 久久成人免费日本黄色| 丁香亚洲综合激情啪啪综合| 欧美在线制服丝袜| 2欧美一区二区三区在线观看视频| 国产精品国产三级国产aⅴ中文| 午夜国产不卡在线观看视频| 国产精品一区三区| 欧美视频一区二区三区| 久久久午夜精品理论片中文字幕| 亚洲精品视频观看| 国产一区福利在线| 欧美日韩精品一区二区三区蜜桃| 精品国一区二区三区| 亚洲女女做受ⅹxx高潮| 久久99精品国产91久久来源| 91麻豆蜜桃一区二区三区| 欧美电视剧免费全集观看| 亚洲人成网站影音先锋播放| 久久国产精品无码网站| 在线日韩一区二区| 欧美高清在线一区二区| 日韩成人免费电影| 99视频一区二区| 亚洲国产精品人人做人人爽| 国产乱子轮精品视频| 欧美日韩美女一区二区| 国产精品成人在线观看| 久久超碰97中文字幕| 欧美色图免费看| 亚洲欧美色图小说| 国产精品一二三四| 日韩一区二区精品在线观看| 亚洲精品高清视频在线观看| 国产乱国产乱300精品| 56国语精品自产拍在线观看| 亚洲视频你懂的| 成人网页在线观看| 久久人人97超碰com| 麻豆成人久久精品二区三区红| 欧美日韩一区在线观看| 亚洲天堂2014| 成人免费观看视频| 国产欧美一区二区三区网站 | 久久九九全国免费| 激情六月婷婷久久| 欧美岛国在线观看| 美女视频黄久久| 日韩视频在线观看一区二区| 亚洲福利视频三区| 欧美自拍偷拍一区| 亚洲影视在线观看| 欧洲一区二区三区免费视频| 亚洲三级理论片| 91在线码无精品| 亚洲视频精选在线| 91亚洲精品久久久蜜桃| 国产精品久久久久aaaa| 成人aaaa免费全部观看| 中国色在线观看另类| 国产成人日日夜夜| 国产精品视频一区二区三区不卡| 成人综合激情网| 中文字幕一区二区三区四区| 成人在线视频一区| 国产精品久久久久精k8| 99re成人在线| 亚洲五码中文字幕| 欧美精品在线观看一区二区| 日本视频一区二区| 精品国产乱码久久久久久蜜臀| 激情成人午夜视频| 中文字幕国产一区二区| 91一区二区在线观看| 亚洲五码中文字幕| 日韩欧美国产一二三区| 国产美女一区二区| 中文字幕日韩一区二区| 色av成人天堂桃色av| 99re视频精品| 亚洲一卡二卡三卡四卡五卡| 欧美另类变人与禽xxxxx| 美女脱光内衣内裤视频久久网站 | 亚洲午夜视频在线观看| 欧美精品久久99| 国内一区二区视频| 国产精品每日更新| 在线观看亚洲精品| 麻豆91在线播放| 国产精品美女久久久久aⅴ | 精品少妇一区二区三区| 国产曰批免费观看久久久| 中文字幕一区av| 精品视频资源站| 狠狠狠色丁香婷婷综合久久五月| 亚洲国产精品成人久久综合一区| 一本到一区二区三区| 日韩精品电影一区亚洲| 久久亚洲免费视频| 在线视频你懂得一区| 精品一区二区在线看| 最新成人av在线| 日韩美女天天操| 色综合久久久久| 久久 天天综合| 一区二区三区中文字幕电影 | 欧美一级午夜免费电影| 国产成人aaa| 日韩精品一二三区| 中文字幕欧美激情一区| 欧美精品久久久久久久多人混战 | 国产一区二区三区精品视频| 亚洲自拍偷拍av| 国产性天天综合网| 777久久久精品| 色综合天天性综合| 国模冰冰炮一区二区| 亚洲成人7777| 中文字幕一区二区不卡 | 亚洲一区国产视频| 国产日韩亚洲欧美综合| 日韩午夜在线观看视频| 欧美系列日韩一区| 丁香婷婷综合色啪|