smartfile.java

来自「对学习 VC有所帮助的几个例子」· Java 代码 · 共 1,378 行 · 第 1/5 页

JAVA
1,378
字号
        }
    }

    public void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
        throws ServletException, IOException
    {
        m_request = httpservletrequest;
        m_response = httpservletresponse;
        Calendar calendar = Calendar.getInstance();
        Calendar calendar1 = Calendar.getInstance();
        calendar1.set(2003, 5, 1);
        if(calendar.after(calendar1))
        {
            ResponseWriteLn("<HTML>");
            ResponseWriteLn("<BODY bgcolor='white'>");
            ResponseWriteLn("<font face=helv,helvetica size=2 color='red'>");
            ResponseWriteLn("This is an evaluation version of jspSmartFile.<br>");
            ResponseWriteLn("If you would like to use jspSmartFile<br>");
            ResponseWriteLn("you must purchase the licensed version.<br><br>");
            ResponseWriteLn("</strong></font>");
            ResponseWriteLn("<font face=helv,helvetica color='blue' size=2>");
            ResponseWriteLn("buy jspSmartFile online at <br>");
            ResponseWriteLn("<a href='http://www.jspSmart.com'>");
            ResponseWriteLn("http://www.jspSmart.com</a>.<br>");
            ResponseWriteLn("</font>");
            ResponseWriteLn("</BODY>");
            ResponseWriteLn("</HTML>");
        }
    }

    private void ResponseWriteLn(String s)
        throws IOException
    {
        if(m_initialize == 1 || m_initialize == 2)
        {
            m_outOld = m_response.getWriter();
            m_outOld.println(s);
        } else
        {
            m_outNew.println(s);
        }
    }

    private void ResponseWrite(String s)
        throws IOException
    {
        if(m_initialize == 1 || m_initialize == 2)
        {
            m_outOld = m_response.getWriter();
            m_outOld.print(s);
        } else
        {
            m_outNew.print(s);
        }
    }

    public void setLanguage(String s, String s1)
    {
        if(s != null && s1 != null)
        {
            currentLocale = new Locale(s, s1);
            labels = ResourceBundle.getBundle("com.jspsmart.file.SmartFileLabels", currentLocale);
            try
            {
                mimes = ResourceBundle.getBundle("com.jspsmart.file.SmartFileMIMETypes", currentLocale);
            }
            catch(Exception exception)
            {
                System.out.println(exception.getMessage());
            }
            try
            {
                images = ResourceBundle.getBundle("com.jspsmart.file.SmartFileImages", currentLocale);
            }
            catch(Exception exception1)
            {
                System.out.println(exception1.getMessage());
            }
            try
            {
                colors = ResourceBundle.getBundle("com.jspsmart.file.SmartFileColors", currentLocale);
            }
            catch(Exception exception2)
            {
                System.out.println(exception2.getMessage());
            }
            try
            {
                icons = ResourceBundle.getBundle("com.jspsmart.file.SmartFileIcons", currentLocale);
            }
            catch(Exception exception3)
            {
                System.out.println(exception3.getMessage());
            }
        }
    }

    public Locale getLanguage()
    {
        return currentLocale;
    }

    public void setIconsPath(String s)
    {
        m_iconsPath = s + "/";
    }

    public String getIconsPath()
    {
        return m_iconsPath;
    }

    public void setImagesPath(String s)
    {
        m_imagesPath = s + "/";
    }

    public String getImagesPath()
    {
        return m_imagesPath;
    }

    public void setDiskSpaceQuota(long l)
    {
        m_quota = l;
    }

    public long getDiskSpaceQuota()
    {
        return m_quota;
    }

    public void setShowProperties(boolean flag)
    {
        m_showProperties = flag;
    }

    public boolean getShowProperties()
    {
        return m_showProperties;
    }

    public void setReadOnly(boolean flag)
    {
        m_readOnly = flag;
    }

    public boolean getReadOnly()
    {
        return m_readOnly;
    }

    public void setForceAuthentication(boolean flag)
    {
        m_authentication = flag;
    }

    public boolean getForceAuthentication()
    {
        return m_authentication;
    }

    public void setDeniedFilesList(String s)
        throws ServletException, IOException
    {
        int i = 1;
        boolean flag = false;
        String s1 = "";
        m_strDeniedFilesList = s;
        if(s != null)
        {
            for(int j = 0; j < s.length(); j++)
            {
                s1 = s1 + s.charAt(j);
                if(s.charAt(j) == ',')
                {
                    s1 = s1.substring(0, s1.length() - 1);
                    m_deniedFilesList.put(new Integer(i), s1);
                    s1 = "";
                    i++;
                }
                if(j + 1 == s.length() && s1 != "")
                {
                    m_deniedFilesList.put(new Integer(i), s1);
                    s1 = "";
                    i++;
                }
            }

            if(s.indexOf(",,") >= 0)
                m_deniedFilesList.put(new Integer(i), "");
        } else
        {
            m_deniedFilesList = null;
        }
    }

    public String getDeniedFilesList()
    {
        return m_deniedFilesList.toString();
    }

    public void setAllowedFilesList(String s)
    {
        int i = 1;
        boolean flag = false;
        String s1 = "";
        m_strAllowedFilesList = s;
        if(s != null)
        {
            for(int j = 0; j < s.length(); j++)
            {
                s1 = s1 + s.charAt(j);
                if(s.charAt(j) == ',')
                {
                    s1 = s1.substring(0, s1.length() - 1);
                    m_allowedFilesList.put(new Integer(i), s1);
                    s1 = "";
                    i++;
                }
                if(j + 1 == s.length() && s1 != "")
                {
                    m_allowedFilesList.put(new Integer(i), s1);
                    s1 = "";
                    i++;
                }
            }

            if(s.indexOf(",,") >= 0)
                m_allowedFilesList.put(new Integer(i), "");
        } else
        {
            m_allowedFilesList = null;
        }
    }

    public String getAllowedFilesList()
    {
        return m_allowedFilesList.toString();
    }

    public void setUnvisibleFilesList(String s)
    {
        m_unvisibleFilesList = s;
    }

    public String getUnvisibleFilesList()
    {
        return m_unvisibleFilesList;
    }

    public void setUnvisibleFoldersList(String s)
    {
        m_unvisibleFoldersList = s;
    }

    public String getUnvisibleFoldersList()
    {
        return m_unvisibleFoldersList;
    }

    public void setDenyPhysicalPath(boolean flag)
    {
        m_denyPhysicalPath = flag;
    }

    public boolean getDenyPhysicalPath()
    {
        return m_denyPhysicalPath;
    }

    public void setContextPath(String s)
    {
        m_contextPath = s;
    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?