package com.util;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
public class SmartUpload
{
protected byte m_binArray[];
protected HttpServletRequest m_request;
protected HttpServletResponse m_response;
protected ServletContext m_application;
private int m_totalBytes;
private int m_currentIndex;
private int m_startData;
private int m_endData;
private String m_boundary;
private long m_totalMaxFileSize;
private long m_maxFileSize;
private Vector m_deniedFilesList;
private Vector m_allowedFilesList;
private boolean m_denyPhysicalPath;
//private boolean m_forcePhysicalPath;
private String m_contentDisposition;
public static final int SAVE_AUTO = 0;
public static final int SAVE_VIRTUAL = 1;
public static final int SAVE_PHYSICAL = 2;
private SmartFiles m_files;
private SmartRequest m_formRequest;
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 SmartFiles();
m_formRequest = new SmartRequest();
}
/**
* @deprecated Method init is deprecated
*/
public final void init(ServletConfig servletconfig) throws ServletException
{
m_application = servletconfig.getServletContext();
}
/**
* @deprecated Method service is deprecated
*/
public void service(HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse) throws ServletException,IOException
{
m_request = httpservletrequest;
m_response = httpservletresponse;
}
public final void initialize(ServletConfig servletconfig,HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse) throws ServletException
{
m_application = servletconfig.getServletContext();
m_request = httpservletrequest;
m_response = httpservletresponse;
}
public final void initialize(PageContext pagecontext) throws ServletException
{
m_application = pagecontext.getServletContext();
m_request = (HttpServletRequest)pagecontext.getRequest();
m_response = (HttpServletResponse)pagecontext.getResponse();
}
/**
* @deprecated Method initialize is deprecated
*/
public final void initialize(ServletContext servletcontext,HttpSession httpsession,HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse,JspWriter jspwriter) throws ServletException
{
m_application = servletcontext;
m_request = httpservletrequest;
m_response = httpservletresponse;
}
public void upload() throws ServletException,IOException,SmartUploadException
{
int i = 0;
//boolean flag = false;
boolean flag1 = false;
//boolean flag2 = false;
long l = 0L;
//String s = "";//new String();
//String s2 = "";//new String();
String s4 = ""; //new String();
String s5 = ""; //new String();
String s6 = ""; //new String();
String s7 = ""; //new String();
String s8 = ""; //new String();
String s9 = ""; //new String();
String s10 = ""; //new String();
m_totalBytes = m_request.getContentLength();
m_binArray = new byte[m_totalBytes];
int j;
for(;i < m_totalBytes;i += j)
{
try
{
m_request.getInputStream();
j = m_request.getInputStream().read(m_binArray,i,m_totalBytes - i);
}
catch(Exception exception)
{
throw new SmartUploadException("Unable to upload.");
}
}
for(;!flag1 && m_currentIndex < m_totalBytes;m_currentIndex++)
{
if(m_binArray[m_currentIndex] == 13)
{
flag1 = true;
}
else
{
m_boundary = m_boundary + (char)m_binArray[m_currentIndex];
}
}
if(m_currentIndex == 1)
{
return;
}
for(m_currentIndex++;m_currentIndex < m_totalBytes;m_currentIndex = m_currentIndex + 2)
{
long now=new java.util.Date().getTime();
String s1 = getDataHeader();
m_currentIndex = m_currentIndex + 2;
boolean flag3 = s1.indexOf("filename") > 0;
String s3 = getDataFieldValue(s1,"name");
if(flag3)
{
s6 = getDataFieldValue(s1,"filename");
s4 = now+getFileName(s6);
s5 = getFileExt(s4);
s7 = getContentType(s1);
s8 = getContentDisp(s1);
s9 = getTypeMIME(s7);
s10 = getSubTypeMIME(s7);
}
getDataSection();
if(flag3 && s4.length() > 0)
{
if(m_deniedFilesList.contains(s5))
{
throw new SecurityException("The extension of the file is denied to be uploaded (1015).");
}
if(!m_allowedFilesList.isEmpty() && !m_allowedFilesList.contains(s5))
{
throw new SecurityException("The extension of the file is not allowed to be uploaded (1010).");
}
if(m_maxFileSize > 0L && (long)((m_endData - m_startData) + 1) > m_maxFileSize)
{
throw new SecurityException("Size exceeded for this file : " + s4 + " (1105).");
}
l += (m_endData - m_startData) + 1;
if(m_totalMaxFileSize > 0L && l > m_totalMaxFileSize)
{
throw new SecurityException("Total File Size exceeded (1110).");
}
}
if(flag3)
{
SmartFile file = new SmartFile();
file.setParent(this);
file.setFieldName(s3);
file.setFileName(s4);
file.setFileExt(s5);
file.setFilePathName(s6);
file.setIsMissing(s6.length() == 0);
file.setContentType(s7);
file.setContentDisp(s8);
file.setTypeMIME(s9);
file.setSubTypeMIME(s10);
if(s7.indexOf("application/x-macbinary") > 0)
{
m_startData = m_startData + 128;
}
file.setSize((m_endData - m_startData) + 1);
file.setStartData(m_startData);
file.setEndData(m_endData);
m_files.addFile(file);
}
else
{
String s11 = new String(m_binArray,m_startData,(m_endData - m_startData) + 1);
m_formRequest.putParameter(s3,s11);
}
if((char)m_binArray[m_currentIndex + 1] == '-')
{
break;
}
}
}
p
没有合适的资源?快使用搜索试试~ 我知道了~
JSP旅游网站系统myeclipse开发SQLServer数据库mvc结构java编程
共686个文件
gif:197个
js:181个
jsp:78个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 56 浏览量
2021-09-15
20:56:01
上传
评论 1
收藏 4.26MB RAR 举报
温馨提示
一、源码特点 JSP旅游网站系统 是一套完善的WEB设计系统,对理解JSP java编程开发语言有帮助,系统具有完整的源代码和数据库,系统主要采用B/S模式开发。 二、功能介绍 1、采用JSP开发工具; 2、合理设定用户,控制用户使用权限。让系统可以分辨出非用户和用户,普通用户和超级用户(即管理员)。 3、管理人员可以随时根据实际情况修改数据库中的数据资料,使信息的更新及时、准确; 4、旅游的信息可以由管理人员添加和删除,普通用户只可以查看。 5、景点信息里某些新线路的开发,或旧线路的修改和删除由管理人员按实际要求处理。 6、用户的个人资料可以方便地增加、删除和修改。 7、提供的特价路线信息让用户可以一目了然,清楚了解最新讯息。 三、注意事项 1、用户名 admin 密码 024admin 数据库配置文件DBO.java 2、开发环境为TOMCAT7.0,Myeclipse8.5开发,数据库为SQLServer2008,使用java语言开发。 3、数据库文件名是jsplywz.mdf ,系统名称jsplywz
资源推荐
资源详情
资源评论
收起资源包目录
JSP旅游网站系统myeclipse开发SQLServer数据库mvc结构java编程 (686个子文件)
class_upload.asp 6KB
class_upload.asp 6KB
commands.asp 5KB
upload.asp 3KB
connector.asp 3KB
io.asp 2KB
basexml.asp 2KB
config.asp 2KB
config.asp 2KB
util.asp 1KB
io.asp 836B
connector.aspx 1KB
upload.aspx 1KB
connector.cfm 11KB
spellchecker.cfm 6KB
upload.cfm 6KB
config.cfm 3KB
config.cfm 3KB
connector.cgi 4KB
SmartUpload.class 17KB
TraveBean.class 16KB
MemberBean.class 14KB
AfficheBean.class 13KB
NewsBean.class 13KB
MemberManageBean.class 13KB
GuestBookBean.class 10KB
MemberServlet.class 9KB
FriendLinkBean.class 8KB
NewsServlet.class 8KB
AdminBean.class 8KB
AdminServlet.class 7KB
SystemBean.class 7KB
SmartFile.class 6KB
TraveServlet.class 6KB
CommonServlet.class 5KB
GuestBookServlet.class 5KB
FriendLinkServlet.class 5KB
AfficheServlet.class 5KB
MemberManageServlet.class 4KB
LoginServlet.class 4KB
DBO.class 3KB
Common.class 2KB
SmartRequest.class 2KB
SmartFiles.class 2KB
Log.class 1KB
MD5.class 1KB
Filter.class 975B
CheckCode.class 922B
Constant.class 674B
SmartUploadException.class 364B
.classpath 801B
css.css 10KB
fck_editor.css 8KB
fck_editor.css 8KB
fck_editor.css 8KB
Admin_Style.css 6KB
Admin_Style.css 6KB
style.css 4KB
style.css 4KB
fck_internal.css 2KB
fck_dialog.css 2KB
fck_dialog.css 2KB
fck_dialog.css 2KB
fck_editorarea.css 2KB
browser.css 2KB
fck_dialog_common.css 2KB
fck_showtableborders_gecko.css 1KB
spellerStyle.css 888B
default.css 463B
Thumbs.db 68KB
Thumbs.db 16KB
Thumbs.db 10KB
Thumbs.db 8KB
MainBg.gif 25KB
MainBg.gif 25KB
banner.gif 19KB
fck_strip.gif 9KB
girl.gif 7KB
boy.gif 6KB
logo.gif 6KB
fck_strip.gif 4KB
fck_strip.gif 4KB
5.gif 4KB
4.gif 3KB
8.gif 3KB
11.gif 2KB
Key.gif 2KB
logo_fckeditor.gif 2KB
6.gif 2KB
10.gif 2KB
7.gif 2KB
zhuce.gif 2KB
Title.gif 2KB
1.gif 2KB
qq_22.gif 2KB
qq_22.gif 2KB
Title.gif 2KB
htm.gif 1KB
html.gif 1KB
logo.gif 1KB
共 686 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
- yeyeyin2022-05-17用户下载后在一定时间内未进行评价,系统默认好评。
翰文编程
- 粉丝: 9845
- 资源: 2028
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功