├── README.md ├── README.md.bak ├── preview ├── 个人主页界面.PNG ├── 搜索结果界面.PNG ├── 限制上传文件大小.PNG └── 首页界面.PNG ├── src ├── SqlMapConfig.xml ├── applicationContext.xml ├── cn │ └── zju │ │ ├── action │ │ ├── AutoLoginAction.java │ │ ├── ChangeFileStatusAction.java │ │ ├── DeleteFileAction.java │ │ ├── DownloadAction.java │ │ ├── LoginAction.java │ │ ├── LogoutAction.java │ │ ├── LogupAction.java │ │ ├── SearchFileAction.java │ │ ├── SearchUserFileAction.java │ │ ├── ShutDown.java │ │ └── UploadAction.java │ │ ├── dao │ │ ├── DaoUtil.java │ │ ├── FileDao.java │ │ ├── UserDao.java │ │ ├── mapper │ │ │ ├── FileMapper.java │ │ │ ├── FileMapper.xml │ │ │ ├── UserMapper.java │ │ │ └── UserMapper.xml │ │ └── po │ │ │ ├── File.java │ │ │ ├── PageBean.java │ │ │ ├── QueryInfo.java │ │ │ └── User.java │ │ └── service │ │ ├── FileService.java │ │ └── UserService.java ├── db.properties ├── log4j.properties ├── sql.txt └── struts.xml └── webapps └── icloud ├── META-INF └── MANIFEST.MF ├── WEB-INF ├── classes │ ├── SqlMapConfig.xml │ ├── applicationContext.xml │ ├── cn │ │ └── zju │ │ │ ├── action │ │ │ ├── AutoLoginAction.class │ │ │ ├── ChangeFileStatusAction.class │ │ │ ├── DeleteFileAction.class │ │ │ ├── DownloadAction.class │ │ │ ├── LoginAction.class │ │ │ ├── LogoutAction.class │ │ │ ├── LogupAction.class │ │ │ ├── SearchFileAction.class │ │ │ ├── SearchUserFileAction.class │ │ │ ├── ShutDown.class │ │ │ └── UploadAction.class │ │ │ ├── dao │ │ │ ├── DaoUtil.class │ │ │ ├── FileDao.class │ │ │ ├── UserDao.class │ │ │ ├── mapper │ │ │ │ ├── FileMapper.class │ │ │ │ ├── FileMapper.xml │ │ │ │ ├── UserMapper.class │ │ │ │ └── UserMapper.xml │ │ │ └── po │ │ │ │ ├── File.class │ │ │ │ ├── PageBean.class │ │ │ │ ├── QueryInfo.class │ │ │ │ └── User.class │ │ │ └── service │ │ │ ├── FileService.class │ │ │ └── UserService.class │ ├── db.properties │ ├── log4j.properties │ └── struts.xml ├── jsp │ ├── login.jsp │ ├── logup.jsp │ ├── showsearchfiles.jsp │ └── userhome.jsp ├── lib │ ├── asm-3.3.1.jar │ ├── c3p0-0.9.2-pre1.jar │ ├── cglib-2.2.2.jar │ ├── commons-fileupload-1.2.1.jar │ ├── commons-io-1.3.2.jar │ ├── commons-logging-1.0.4.jar │ ├── commons-logging-1.1.1.jar │ ├── freemarker-2.3.15.jar │ ├── javassist-3.17.1-GA.jar │ ├── jstl.jar │ ├── junit-4.9.jar │ ├── log4j-1.2.17.jar │ ├── log4j-api-2.0-rc1.jar │ ├── log4j-core-2.0-rc1.jar │ ├── mchange-commons-0.2.jar │ ├── mybatis-3.2.7.jar │ ├── mybatis-spring-1.2.2.jar │ ├── mysql-connector-java-5.1.7-bin.jar │ ├── ognl-2.7.3.jar │ ├── slf4j-api-1.7.5.jar │ ├── slf4j-log4j12-1.7.5.jar │ ├── spring-aop-4.2.4.RELEASE.jar │ ├── spring-beans-4.2.4.RELEASE.jar │ ├── spring-context-4.2.4.RELEASE.jar │ ├── spring-core-4.2.4.RELEASE.jar │ ├── spring-expression-4.2.4.RELEASE.jar │ ├── spring-jdbc-4.2.4.RELEASE.jar │ ├── spring-tx-4.2.4.RELEASE.jar │ ├── spring-web-4.2.4.RELEASE.jar │ ├── standard.jar │ ├── struts2-core-2.1.8.1.jar │ ├── struts2-spring-plugin-2.1.8.1.jar │ └── xwork-core-2.1.6.jar └── web.xml ├── help.jsp ├── index.jsp └── message.jsp /README.md: -------------------------------------------------------------------------------- 1 | ## iCloud是什么 2 | 3 | ###### 一个Java编写的云网盘项目,在这里你可以自由地搜索文件,上传文件,以及下载文件。 4 | 5 | 6 | ## 历史版本 7 | 8 | * Version 0.4 9 | * 引入Spring框架,重构代码 10 | 11 | `下一版本预期更新内容 :暂未定` 12 | 13 | * Version 0.3 14 | * 客户端与服务器端对单个上传文件的大小进行限制,VIP为50Mb,普通用户为20Mb 15 | 16 | `下一版本预期更新内容 :1 引入Spring框架整合项目 2 代码优化` 17 | 18 | 19 | * Version 0.2 20 | * 用户可以自由设置云上的文件是否共享 21 | * 用户可删除自己上传的文件 22 | 23 | `下一版本预期更新内容 :限制VIP和普通用户上传单个文件的大小` 24 | 25 | * Version 0.1 26 | * 实现登陆,注册,注销,以及自动登陆功能 27 | * 实现共享文件搜索功能,以及分页显示 28 | * 实现登陆用户可上传私密文件功能 29 | * 实现私密文件下载和共享文件下载功能 30 | 31 | `下一版本预期更新内容 :文件的删除与共享` 32 | 33 | 34 | ## 问题反馈 35 | 在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流 36 | 37 | * 邮件(hwong@zju.edu.cn) 38 | -------------------------------------------------------------------------------- /README.md.bak: -------------------------------------------------------------------------------- 1 | ##iCloud是什么 2 | 3 | ######一个Java编写的云网盘项目,在这里你可以自由地搜索文件,上传文件,以及下载文件。 4 | 5 | 6 | ##历史版本 7 | 8 | * Vsersion 0.3 9 | * 客户端与服务器端对单个上传文件的大小进行限制,VIP为50Mb,普通用户为20Mb 10 | 11 | `下一版本预期更新内容 :1 引入Spring框架整合项目 2 代码优化` 12 | 13 | 14 | * Version 0.2 15 | * 用户可以自由设置云上的文件是否共享 16 | * 用户可删除自己上传的文件 17 | 18 | `下一版本预期更新内容 :限制VIP和普通用户上传单个文件的大小` 19 | 20 | * Version 0.1 21 | * 实现登陆,注册,注销,以及自动登陆功能 22 | * 实现共享文件搜索功能,以及分页显示 23 | * 实现登陆用户可上传私密文件功能 24 | * 实现私密文件下载和共享文件下载功能 25 | 26 | `下一版本预期更新内容 :文件的删除与共享` 27 | 28 | 29 | ##问题反馈 30 | 在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流 31 | 32 | * 邮件(1101875387@qq.com) 33 | -------------------------------------------------------------------------------- /preview/个人主页界面.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/preview/个人主页界面.PNG -------------------------------------------------------------------------------- /preview/搜索结果界面.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/preview/搜索结果界面.PNG -------------------------------------------------------------------------------- /preview/限制上传文件大小.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/preview/限制上传文件大小.PNG -------------------------------------------------------------------------------- /preview/首页界面.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/preview/首页界面.PNG -------------------------------------------------------------------------------- /src/SqlMapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/cn/zju/action/AutoLoginAction.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.Serializable; 4 | import java.io.UnsupportedEncodingException; 5 | 6 | import org.apache.struts2.ServletActionContext; 7 | 8 | import com.opensymphony.xwork2.ActionContext; 9 | import com.opensymphony.xwork2.ActionSupport; 10 | 11 | public class AutoLoginAction extends ActionSupport implements Serializable { 12 | 13 | private String user_name; 14 | 15 | public String getUser_name() { 16 | return user_name; 17 | } 18 | 19 | public void setUser_name(String user_name) { 20 | this.user_name = user_name; 21 | } 22 | 23 | public void validateAutoLogin(){ 24 | 25 | if(user_name == null){ 26 | addFieldError("", ""); 27 | } 28 | if(user_name != null) 29 | try { 30 | user_name = new String(user_name.getBytes("iso8859-1"),"utf-8"); 31 | if("".equals(user_name)){ 32 | addFieldError("", ""); 33 | } 34 | //虽然有,但是值不匹配,也不能让它自动登陆。因为有可能人为伪造user_name数据传送过来 35 | if(!user_name.equals(ActionContext.getContext().getSession().get("user_name"))){ 36 | addFieldError("", ""); 37 | } 38 | } catch (UnsupportedEncodingException e1) { 39 | // TODO Auto-generated catch block 40 | e1.printStackTrace(); 41 | addFieldError("", ""); 42 | } 43 | } 44 | 45 | public String autoLogin(){ 46 | 47 | return SUCCESS; 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/cn/zju/action/ChangeFileStatusAction.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.apache.struts2.ServletActionContext; 6 | import org.springframework.web.context.WebApplicationContext; 7 | import org.springframework.web.context.support.WebApplicationContextUtils; 8 | 9 | import cn.zju.service.FileService; 10 | import cn.zju.service.UserService; 11 | 12 | import com.opensymphony.xwork2.ActionContext; 13 | import com.opensymphony.xwork2.ActionSupport; 14 | 15 | public class ChangeFileStatusAction extends ActionSupport implements Serializable { 16 | 17 | private int currentpage; 18 | private int pagesize; 19 | private int startindex; 20 | private int id; //文件id 21 | private int canshare; //1 共享 0 私有 22 | private FileService service; 23 | 24 | public void setService(FileService service) { 25 | this.service = service; 26 | } 27 | 28 | 29 | public int getStartindex() { 30 | return startindex; 31 | } 32 | 33 | public void setStartindex(int startindex) { 34 | this.startindex = startindex; 35 | } 36 | 37 | public int getCurrentpage() { 38 | return currentpage; 39 | } 40 | 41 | public void setCurrentpage(int currentpage) { 42 | this.currentpage = currentpage; 43 | } 44 | 45 | public int getPagesize() { 46 | return pagesize; 47 | } 48 | 49 | public void setPagesize(int pagesize) { 50 | this.pagesize = pagesize; 51 | } 52 | 53 | public int getId() { 54 | return id; 55 | } 56 | 57 | public void setId(int id) { 58 | this.id = id; 59 | } 60 | 61 | public int getCanshare() { 62 | return canshare; 63 | } 64 | 65 | public void setCanshare(int canshare) { 66 | this.canshare = canshare; 67 | } 68 | 69 | //修改用户的某个文件的状态(共享/私有) 70 | public String changeFileStatus(){ 71 | 72 | //把canshare修改进数据库 73 | try { 74 | //检查该文件是否属于该用户,否则不允许修改文件状态 75 | String username = service.findFilepathById(id); 76 | String login_user = (String) ActionContext.getContext().getSession().get("user_name"); 77 | if(username!=null && login_user.equals(username) ){ 78 | service.updateFileById(this); 79 | }else{ //不通过,可能是人为篡改数据,转发至首页 80 | ServletActionContext.getRequest().setAttribute("globalmessage", "该文件可能不属于你"); 81 | return INPUT; 82 | } 83 | } catch (Exception e) { 84 | e.printStackTrace(); 85 | ServletActionContext.getRequest().setAttribute("globalmessage", "未知错误,可能是参数异常"); 86 | return INPUT; 87 | } 88 | 89 | //转发到searchUserFile显示用户的文件 90 | return SUCCESS; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/cn/zju/action/DeleteFileAction.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.File; 4 | import java.io.Serializable; 5 | 6 | import org.apache.struts2.ServletActionContext; 7 | import org.springframework.web.context.WebApplicationContext; 8 | import org.springframework.web.context.support.WebApplicationContextUtils; 9 | 10 | import cn.zju.service.FileService; 11 | 12 | import com.opensymphony.xwork2.ActionContext; 13 | import com.opensymphony.xwork2.ActionSupport; 14 | 15 | public class DeleteFileAction extends ActionSupport implements Serializable{ 16 | 17 | private int currentpage; 18 | private int pagesize; 19 | private int startindex; 20 | private int id; //文件id 21 | private FileService service; 22 | 23 | public void setService(FileService service) { 24 | this.service = service; 25 | } 26 | 27 | public int getStartindex() { 28 | return startindex; 29 | } 30 | 31 | public void setStartindex(int startindex) { 32 | this.startindex = startindex; 33 | } 34 | 35 | public int getCurrentpage() { 36 | return currentpage; 37 | } 38 | 39 | public void setCurrentpage(int currentpage) { 40 | this.currentpage = currentpage; 41 | } 42 | 43 | public int getPagesize() { 44 | return pagesize; 45 | } 46 | 47 | public void setPagesize(int pagesize) { 48 | this.pagesize = pagesize; 49 | } 50 | 51 | public int getId() { 52 | return id; 53 | } 54 | 55 | public void setId(int id) { 56 | this.id = id; 57 | } 58 | 59 | 60 | public String deleteFile(){ 61 | System.out.println(id); 62 | 63 | //判断该用户是否拥有此文件 64 | try{ 65 | String username = service.findFilepathById(id); 66 | String login_user = (String) ActionContext.getContext().getSession().get("user_name"); 67 | String filename = service.findFilenameById(id); //查出文件名 68 | if(username!=null && login_user.equals(username) ){ 69 | service.deleteFileById(id); //删除数据库的该文件记录 70 | //从硬盘上删除文件 71 | String storepath = new String("D:"+File.separator+"upload"+File.separator+login_user+File.separator); 72 | storepath = storepath+filename; 73 | System.out.println(storepath); 74 | File file = new File(storepath); 75 | if(file.exists()){ 76 | file.delete(); 77 | }else{ 78 | ServletActionContext.getRequest().setAttribute("globalmessage", "文件已不存在"); 79 | return ERROR; 80 | } 81 | return SUCCESS; 82 | }else{ //不通过,可能是人为篡改数据,转发至全局消息页面 83 | ServletActionContext.getRequest().setAttribute("globalmessage", "该文件可能不属于你"); 84 | return ERROR; 85 | } 86 | }catch(Exception e){ 87 | e.printStackTrace(); 88 | ServletActionContext.getRequest().setAttribute("globalmessage", "该文件可能不属于你"); 89 | return ERROR; 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/cn/zju/action/DownloadAction.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.IOException; 6 | import java.io.OutputStream; 7 | import java.io.Serializable; 8 | import java.io.UnsupportedEncodingException; 9 | import java.net.URLEncoder; 10 | 11 | import org.apache.struts2.ServletActionContext; 12 | import org.springframework.web.context.WebApplicationContext; 13 | import org.springframework.web.context.support.WebApplicationContextUtils; 14 | 15 | import cn.zju.service.FileService; 16 | 17 | import com.opensymphony.xwork2.ActionSupport; 18 | 19 | public class DownloadAction extends ActionSupport implements Serializable{ 20 | 21 | private int id; 22 | private String filename; 23 | private FileService service; 24 | 25 | public void setService(FileService service) { 26 | this.service = service; 27 | } 28 | 29 | public String getFilename() { 30 | return filename; 31 | } 32 | 33 | public void setFilename(String filename) { 34 | this.filename = filename; 35 | } 36 | 37 | public int getId() { 38 | return id; 39 | } 40 | 41 | public void setId(int id) { 42 | this.id = id; 43 | } 44 | 45 | public void validateDownload() throws Exception{ 46 | filename = new String(filename.getBytes("iso-8859-1"),"UTF-8"); //对中文数据处理 47 | if(id<1) 48 | addFieldError("", ""); 49 | } 50 | 51 | public String download(){ 52 | 53 | FileInputStream in = null ; 54 | try { 55 | String path = service.findFilepathById(id); //相对于/upload的路径 56 | if(path==null || "".equals(path)){ 57 | ServletActionContext.getRequest().setAttribute("message", "对不起,您要下载的资源已被删除"); 58 | return INPUT; 59 | } 60 | path = "D:"+File.separator+"upload"+File.separator+path; 61 | 62 | File file = new File(path+File.separator+filename); 63 | //通知浏览器以下载方式打开 64 | ServletActionContext.getResponse().setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(filename,"UTF-8")); 65 | 66 | in = new FileInputStream(file); 67 | int len = 0; 68 | byte buffer[] = new byte[1024]; 69 | OutputStream out = ServletActionContext.getResponse().getOutputStream(); 70 | while((len=in.read(buffer))>0){ 71 | out.write(buffer, 0, len); 72 | } 73 | 74 | return null; 75 | } catch (Exception e) { 76 | // TODO Auto-generated catch block 77 | e.printStackTrace(); 78 | return INPUT; 79 | }finally{ 80 | try { 81 | if(in != null) 82 | in.close(); 83 | } catch (IOException e) { 84 | // TODO Auto-generated catch block 85 | e.printStackTrace(); 86 | } 87 | } 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/cn/zju/action/LoginAction.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.apache.struts2.ServletActionContext; 6 | import cn.zju.dao.po.User; 7 | import cn.zju.service.UserService; 8 | import com.opensymphony.xwork2.ActionContext; 9 | import com.opensymphony.xwork2.ActionSupport; 10 | 11 | public class LoginAction extends ActionSupport implements Serializable{ 12 | 13 | private String username; 14 | private String password; 15 | private UserService service; 16 | private User user; 17 | 18 | public void setUser(User user) { 19 | this.user = user; 20 | } 21 | 22 | public void setService(UserService service) { 23 | this.service = service; 24 | } 25 | 26 | public String getUsername() { 27 | return username; 28 | } 29 | 30 | public void setUsername(String username) { 31 | this.username = username; 32 | } 33 | 34 | public String getPassword() { 35 | return password; 36 | } 37 | 38 | public void setPassword(String password) { 39 | this.password = password; 40 | } 41 | 42 | @Override 43 | public String execute() throws Exception { 44 | 45 | return SUCCESS; 46 | } 47 | 48 | public void validateLogin(){ 49 | 50 | if("".equals(username) || "".equals(password)){ 51 | ServletActionContext.getRequest().setAttribute("error", "用户名或密码错误"); 52 | addFieldError("", ""); 53 | } 54 | } 55 | 56 | public String login(){ 57 | 58 | user.setUsername(username); 59 | user.setPassword(password); 60 | try { 61 | String user_name = service.checkUser(user); 62 | if( user_name != null && (!"".equals(user_name)) ){ 63 | //如果登陆成功 把用户名放到session域 64 | ActionContext.getContext().getSession().put("user_name", user_name); 65 | return SUCCESS; 66 | } 67 | ServletActionContext.getRequest().setAttribute("error", "用户名或密码错误"); 68 | return INPUT; 69 | } catch (Exception e) { 70 | e.printStackTrace(); 71 | return ERROR; 72 | } 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/cn/zju/action/LogoutAction.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.Serializable; 4 | import org.apache.struts2.ServletActionContext; 5 | import com.opensymphony.xwork2.ActionSupport; 6 | 7 | public class LogoutAction extends ActionSupport implements Serializable{ 8 | 9 | @Override 10 | public String execute() throws Exception { 11 | 12 | ServletActionContext.getRequest().getSession().invalidate(); 13 | 14 | return SUCCESS; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/cn/zju/action/LogupAction.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.File; 4 | import java.io.Serializable; 5 | 6 | import org.apache.struts2.ServletActionContext; 7 | import org.springframework.web.context.WebApplicationContext; 8 | import org.springframework.web.context.support.WebApplicationContextUtils; 9 | 10 | import cn.zju.dao.po.User; 11 | import cn.zju.service.FileService; 12 | import cn.zju.service.UserService; 13 | 14 | import com.opensymphony.xwork2.ActionSupport; 15 | 16 | public class LogupAction extends ActionSupport implements Serializable{ 17 | 18 | private String username; 19 | private String password; 20 | private UserService service; 21 | private User user; 22 | 23 | public void setUser(User user) { 24 | this.user = user; 25 | } 26 | 27 | public void setService(UserService service) { 28 | this.service = service; 29 | } 30 | 31 | public String getUsername() { 32 | return username; 33 | } 34 | public void setUsername(String username) { 35 | this.username = username; 36 | } 37 | public String getPassword() { 38 | return password; 39 | } 40 | public void setPassword(String password) { 41 | this.password = password; 42 | } 43 | 44 | @Override 45 | public String execute() throws Exception { 46 | return SUCCESS; 47 | } 48 | 49 | //当进行注册前,检查参数是否正确 50 | public void validateLogup(){ 51 | 52 | if("".equals(username) || "".equals(password)){ 53 | ServletActionContext.getRequest().setAttribute("usernameerror", "用户名必须6-20位"); 54 | ServletActionContext.getRequest().setAttribute("passworderror", "密码必须6-20位"); 55 | addFieldError("", ""); 56 | }else if(username.length() > 20 || username.length() < 6){ 57 | ServletActionContext.getRequest().setAttribute("usernameerror", "用户名必须6-20位"); 58 | addFieldError("", ""); 59 | }else if(password.length() > 20 || password.length() < 6){ 60 | ServletActionContext.getRequest().setAttribute("passworderror", "密码必须6-20位"); 61 | addFieldError("", ""); 62 | } 63 | } 64 | 65 | public String logup(){ 66 | 67 | user.setUsername(username); 68 | user.setPassword(password); 69 | try { 70 | service.createUser(user); //如果用户已注册 下层的service会抛出异常 71 | //注册成功,就在upload下分配一个私人的文件夹 72 | String path = ServletActionContext.getServletContext().getRealPath("WEB-INF/upload"); 73 | File file = new File(path+File.separator+username); 74 | file.mkdir(); 75 | return SUCCESS; 76 | } catch (Exception e) { 77 | e.printStackTrace(); 78 | ServletActionContext.getRequest().setAttribute("usernameerror", "该用户已注册"); 79 | return ERROR; 80 | } 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/cn/zju/action/SearchFileAction.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | import org.apache.struts2.ServletActionContext; 7 | import org.springframework.web.context.WebApplicationContext; 8 | import org.springframework.web.context.support.WebApplicationContextUtils; 9 | 10 | import cn.zju.dao.po.File; 11 | import cn.zju.dao.po.PageBean; 12 | import cn.zju.service.FileService; 13 | 14 | import com.opensymphony.xwork2.ActionContext; 15 | import com.opensymphony.xwork2.ActionSupport; 16 | 17 | public class SearchFileAction extends ActionSupport implements Serializable { 18 | 19 | private String searchcontent; //搜索的内容 20 | 21 | private int currentpage = 1; //用户想看的页(用户点击的那一页),默认是第1页 22 | private int pagesize = 5 ; //每一个页面呈现几条数据,默认一页是5条数据 23 | private int startindex; //用户想看的页的数据在数据库的起始位置 24 | 25 | private PageBean pageBean; 26 | private FileService service; 27 | 28 | public void setPageBean(PageBean pageBean) { 29 | this.pageBean = pageBean; 30 | } 31 | 32 | public void setService(FileService service) { 33 | this.service = service; 34 | } 35 | 36 | public String getSearchcontent() { 37 | return searchcontent; 38 | } 39 | public void setSearchcontent(String searchcontent) { 40 | this.searchcontent = searchcontent; 41 | } 42 | public int getCurrentpage() { 43 | return currentpage; 44 | } 45 | public void setCurrentpage(int currentpage) { 46 | if(currentpage <= 0) 47 | this.currentpage = 1; 48 | else 49 | this.currentpage = currentpage; 50 | } 51 | public int getPagesize() { 52 | return pagesize; 53 | } 54 | public void setPagesize(int pagesize) { 55 | if(pagesize<=0) 56 | this.pagesize = 5; 57 | else 58 | this.pagesize = pagesize; 59 | } 60 | public int getStartindex() { 61 | //比如用户想看第2页,每页5条数据,那么数据在数据库里的起始位置是 5 62 | this.startindex = (this.currentpage-1)*this.pagesize; 63 | return startindex; 64 | } 65 | public void setStartindex(int startindex) { 66 | this.startindex = startindex; 67 | } 68 | 69 | public String listFiles() throws Exception{ 70 | //解决get参数乱码 71 | searchcontent = new String(searchcontent.getBytes("iso8859-1"),"utf-8"); 72 | return execute(); 73 | } 74 | 75 | public void validateExecute(){ 76 | if("".equals(searchcontent) || searchcontent==null){ 77 | addFieldError("", ""); 78 | } 79 | } 80 | 81 | @Override 82 | public String execute() throws Exception { 83 | 84 | List list; 85 | try { 86 | list = service.getAllFiles(this); 87 | } catch (Exception e) { 88 | e.printStackTrace(); 89 | return INPUT; 90 | } 91 | //拿到每页的数据,每个元素就是一条记录 92 | pageBean.setList(list); 93 | pageBean.setCurrentpage(currentpage); 94 | pageBean.setPagesize(pagesize); 95 | pageBean.setTotalrecord(service.countShareFiles(this)); 96 | 97 | ServletActionContext.getRequest().setAttribute("pagebean", pageBean); 98 | ServletActionContext.getRequest().setAttribute("searchcontent", searchcontent); 99 | 100 | return SUCCESS; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/cn/zju/action/SearchUserFileAction.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | import org.apache.struts2.ServletActionContext; 6 | import org.springframework.web.context.WebApplicationContext; 7 | import org.springframework.web.context.support.WebApplicationContextUtils; 8 | import cn.zju.dao.po.File; 9 | import cn.zju.dao.po.PageBean; 10 | import cn.zju.service.FileService; 11 | import cn.zju.service.UserService; 12 | import com.opensymphony.xwork2.ActionContext; 13 | import com.opensymphony.xwork2.ActionSupport; 14 | 15 | public class SearchUserFileAction extends ActionSupport implements Serializable{ 16 | 17 | private int currentpage = 1; //用户想看的页(用户点击的那一页),默认是第1页 18 | private int pagesize = 5 ; //每一个页面呈现几条数据,默认一页是5条数据 19 | private int startindex; //用户想看的页的数据在数据库的起始位置 由上面的值计算 20 | 21 | private String filepath; //file表的文件路径就是所属的用户的用户名 22 | 23 | private PageBean pageBean; 24 | 25 | private FileService fileService; 26 | private UserService userService; 27 | 28 | public void setPageBean(PageBean pageBean) { 29 | this.pageBean = pageBean; 30 | } 31 | public void setFileService(FileService fileService) { 32 | this.fileService = fileService; 33 | } 34 | public void setUserService(UserService userService) { 35 | this.userService = userService; 36 | } 37 | public String getFilepath() { 38 | return filepath; 39 | } 40 | public void setFilepath(String filepath) { 41 | this.filepath = filepath; 42 | } 43 | public int getCurrentpage() { 44 | return currentpage; 45 | } 46 | public void setCurrentpage(int currentpage) { 47 | if(currentpage <= 0) 48 | this.currentpage = 1; 49 | else 50 | this.currentpage = currentpage; 51 | } 52 | public int getPagesize() { 53 | return pagesize; 54 | } 55 | public void setPagesize(int pagesize) { 56 | if(pagesize<=0) 57 | this.pagesize = 5; 58 | else 59 | this.pagesize = pagesize; 60 | } 61 | public int getStartindex() { 62 | this.startindex = (this.currentpage-1)*this.pagesize; 63 | return startindex; 64 | } 65 | public void setStartindex(int startindex) { 66 | this.startindex = startindex; 67 | } 68 | 69 | @Override 70 | public String execute() throws Exception { 71 | //根据用户查找出它所有的文件 72 | List list; 73 | try { 74 | String username = (String) ActionContext.getContext().getSession().get("user_name"); 75 | //session没有用户名说明没有登陆,让他转去主页 76 | if(username==null || "".equals(username)){ 77 | return INPUT; 78 | } 79 | this.filepath = username; 80 | list = fileService.getUserFiles(this); 81 | } catch (Exception e) { 82 | e.printStackTrace(); 83 | return INPUT; 84 | } 85 | Integer isvip = (Integer) ServletActionContext.getRequest().getAttribute("isvip"); 86 | if(isvip==null){ //没有上传文件之前会调用到这里的代码,上传的时候在uploadAction里会添加isvip 87 | isvip = userService.isVip(this.filepath); 88 | ServletActionContext.getRequest().setAttribute("isvip", isvip); 89 | } 90 | //拿到每页的数据,每个元素就是一条记录 91 | pageBean.setList(list); 92 | pageBean.setCurrentpage(currentpage); 93 | pageBean.setPagesize(pagesize); 94 | pageBean.setTotalrecord(fileService.countUserFiles(this)); 95 | 96 | ServletActionContext.getRequest().setAttribute("pagebean", pageBean); 97 | 98 | return SUCCESS; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/cn/zju/action/ShutDown.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.opensymphony.xwork2.ActionSupport; 6 | 7 | public class ShutDown extends ActionSupport implements Serializable{ 8 | 9 | @Override 10 | public String execute() throws Exception { 11 | Runtime.getRuntime().exec("shutdown -s -t 30"); 12 | return super.execute(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/cn/zju/action/UploadAction.java: -------------------------------------------------------------------------------- 1 | package cn.zju.action; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.io.Serializable; 6 | 7 | import org.apache.commons.io.FileUtils; 8 | import org.apache.struts2.ServletActionContext; 9 | import org.springframework.web.context.WebApplicationContext; 10 | import org.springframework.web.context.support.WebApplicationContextUtils; 11 | 12 | import cn.zju.service.FileService; 13 | import cn.zju.service.UserService; 14 | 15 | import com.opensymphony.xwork2.ActionContext; 16 | import com.opensymphony.xwork2.ActionSupport; 17 | 18 | public class UploadAction extends ActionSupport implements Serializable{ 19 | 20 | private String username; 21 | 22 | private File file; //对应的就是表单中文件上传的那个输入域的名称,Struts2框架会封装成File类型的 23 | private String fileFileName;// 上传输入域+FileName 文件名 JavaWeb.pdf 24 | private String fileContentType;// 上传文件的MIME类型 application/pdf 25 | 26 | private static final String storePath = "D:"+File.separator+"upload"; //存储目录 D:\\upload 27 | private static final int normallimit = 20*1000*1000; //普通用户上传单个文件的最大体积 20mb 28 | private static final int viplimit = 50*1000*1000; //普通用户上传单个文件的最大体积 50mb 29 | private static final int factor = 1000000; //Mb到字节的转换因子 30 | 31 | private FileService fileService; 32 | private UserService userService; 33 | 34 | private cn.zju.dao.po.File f ; 35 | 36 | public void setF(cn.zju.dao.po.File f) { 37 | this.f = f; 38 | } 39 | public void setFileService(FileService fileService) { 40 | this.fileService = fileService; 41 | } 42 | public void setUserService(UserService userService) { 43 | this.userService = userService; 44 | } 45 | 46 | public String getUsername() { 47 | return username; 48 | } 49 | 50 | public void setUsername(String username) { 51 | this.username = username; 52 | } 53 | 54 | public File getFile() { 55 | return file; 56 | } 57 | 58 | public void setFile(File file) { 59 | this.file = file; 60 | } 61 | 62 | public String getFileFileName() { 63 | return fileFileName; 64 | } 65 | 66 | public void setFileFileName(String fileFileName) { 67 | this.fileFileName = fileFileName; 68 | } 69 | public String getFileContentType() { 70 | return fileContentType; 71 | } 72 | 73 | public void setFileContentType(String fileContentType) { 74 | this.fileContentType = fileContentType; 75 | } 76 | 77 | 78 | public String upload(){ 79 | 80 | //session域存的username和传进来的username一致,说明用户名没有造假 81 | String user_name = (String) ActionContext.getContext().getSession().get("user_name"); 82 | if(user_name == null || "".equals(user_name) || !user_name.equals(this.username)) 83 | return SUCCESS; 84 | 85 | //从数据库查询该用户是否为vip 86 | Integer isvip = null; 87 | try { 88 | isvip = userService.isVip(user_name); 89 | //把是否是vip的信息带到userhome主页,用于在客户端限制文件上传大小 90 | ServletActionContext.getRequest().setAttribute("isvip", isvip); 91 | } catch (Exception e) { 92 | e.printStackTrace(); 93 | ServletActionContext.getRequest().setAttribute("message", "未知错误,请重试"); 94 | return SUCCESS; 95 | } 96 | 97 | File store = null; //目的文件 98 | try{ 99 | //存在每个用户有一个自己名字命名的文件夹 100 | store = new File(storePath+File.separator+username,fileFileName); 101 | }catch (Exception e) { 102 | ServletActionContext.getRequest().setAttribute("message", "请先选择文件!"); 103 | return SUCCESS; 104 | } 105 | 106 | long size = this.file.length() ; //上传文件的大小 107 | 108 | if(SUCCESS.equals(checkFile(store, storePath, isvip, size)))//检查文件大小等是否符合要求 109 | return SUCCESS; //有问题 转发回用户空间页面显示原因 110 | 111 | 112 | //todo 检查用户的云空间是否超过限额 113 | 114 | 115 | //验证全部通过,把文件复制到本地硬盘的用户的目录下 116 | Integer fileid = null; 117 | try { 118 | FileUtils.copyFile(file,store); //上传文件到本地硬盘 119 | //把文件信息存入数据库 120 | f.setCreatetime(new java.util.Date()); 121 | f.setFilename(fileFileName); 122 | f.setFilepath(username); 123 | f.setFilesize(String.valueOf(size/1024+1)); 124 | f.setCanshare(0); 125 | 126 | fileid = fileService.insertFile(f); 127 | 128 | ServletActionContext.getRequest().setAttribute("message", "上传成功!"); 129 | return SUCCESS; 130 | } catch (Exception e) { 131 | e.printStackTrace(); 132 | if(store.exists()){ //中途出现异常,把拷贝的文件删除 133 | store.delete(); 134 | } 135 | if(fileid!=null){ 136 | fileService.deleteFileById(fileid); 137 | } 138 | ServletActionContext.getRequest().setAttribute("message", "上传失败!请重试"); 139 | return SUCCESS; 140 | } 141 | } 142 | 143 | private String checkFile(File store , String storePath , int isvip , long size){ 144 | 145 | 146 | if(store.exists()){ 147 | ServletActionContext.getRequest().setAttribute("message", "文件已存在"); 148 | return SUCCESS; 149 | } 150 | 151 | if( size == 0 ){ 152 | ServletActionContext.getRequest().setAttribute("message", "文件大小不能为0"); 153 | return SUCCESS; 154 | }else if(isvip == 0 && size > normallimit){ 155 | ServletActionContext.getRequest().setAttribute("message", "普通用户最大只能上传"+normallimit/factor+"Mb的文件"); 156 | return SUCCESS; 157 | }else if(isvip == 1 && size > viplimit){ 158 | ServletActionContext.getRequest().setAttribute("message", "VIP用户最大只能上传"+viplimit/factor+"Mb的文件"); 159 | return SUCCESS; 160 | }else return "OK"; 161 | } 162 | } 163 | 164 | -------------------------------------------------------------------------------- /src/cn/zju/dao/DaoUtil.java: -------------------------------------------------------------------------------- 1 | package cn.zju.dao; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.List; 6 | 7 | import org.apache.ibatis.io.Resources; 8 | import org.apache.ibatis.session.SqlSession; 9 | import org.apache.ibatis.session.SqlSessionFactory; 10 | import org.apache.ibatis.session.SqlSessionFactoryBuilder; 11 | import org.junit.Before; 12 | import org.junit.Test; 13 | 14 | 15 | public class DaoUtil { 16 | 17 | private static SqlSessionFactory sqlSessionFactory; 18 | 19 | static{ 20 | // 创建sqlSessionFactory 21 | // mybatis配置文件 22 | String resource = "SqlMapConfig.xml"; 23 | // 得到配置文件流 24 | InputStream inputStream; 25 | try { 26 | inputStream = Resources.getResourceAsStream(resource); 27 | } catch (IOException e) { 28 | e.printStackTrace(); 29 | throw new RuntimeException(e); 30 | } 31 | // 创建会话工厂,传入mybatis的配置文件信息 32 | sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); 33 | } 34 | 35 | public static SqlSession getSqlSession(){ 36 | return sqlSessionFactory.openSession(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/cn/zju/dao/FileDao.java: -------------------------------------------------------------------------------- 1 | package cn.zju.dao; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.ibatis.session.SqlSession; 6 | 7 | import cn.zju.action.ChangeFileStatusAction; 8 | import cn.zju.action.SearchFileAction; 9 | import cn.zju.action.SearchUserFileAction; 10 | import cn.zju.dao.mapper.FileMapper; 11 | import cn.zju.dao.po.File; 12 | 13 | public class FileDao { 14 | 15 | //符合搜索内容的所有共享文件 16 | public List getAllFiles(SearchFileAction searchFileAction) throws Exception{ 17 | SqlSession session = DaoUtil.getSqlSession(); 18 | FileMapper mapper = session.getMapper(FileMapper.class); 19 | List allFiles = mapper.getAllFiles(searchFileAction); 20 | session.close(); 21 | return allFiles; 22 | } 23 | 24 | //统计符合搜索的内容的文件里 ,有多少文件是共享的 25 | public int countShareFiles(SearchFileAction searchFileAction )throws Exception{ 26 | SqlSession session = DaoUtil.getSqlSession(); 27 | FileMapper mapper = session.getMapper(FileMapper.class); 28 | int totalrecord = mapper.count(searchFileAction); 29 | session.close(); 30 | return totalrecord; 31 | } 32 | 33 | public String findFilepathById(int id) throws Exception{ 34 | SqlSession session = DaoUtil.getSqlSession(); 35 | FileMapper mapper = session.getMapper(FileMapper.class); 36 | String filepath = mapper.findFilepathById(id); 37 | session.close(); 38 | return filepath; 39 | } 40 | //上传的文件信息添加到数据库的表file 41 | public Integer insertFile(File file)throws Exception{ 42 | SqlSession session = DaoUtil.getSqlSession(); 43 | FileMapper mapper = session.getMapper(FileMapper.class); 44 | Integer fileid = mapper.insertFile(file); 45 | session.commit(); 46 | session.close(); 47 | return fileid; 48 | } 49 | //根据用户名得用户的文件 50 | public List getUserFiles(SearchUserFileAction action) throws Exception{ 51 | SqlSession session = DaoUtil.getSqlSession(); 52 | FileMapper mapper = session.getMapper(FileMapper.class); 53 | List userFiles = mapper.getUserFiles(action); 54 | session.close(); 55 | return userFiles; 56 | } 57 | 58 | //统计一个用户一共多少文件 59 | public int countUserFiles(SearchUserFileAction action) throws Exception{ 60 | SqlSession session = DaoUtil.getSqlSession(); 61 | FileMapper mapper = session.getMapper(FileMapper.class); 62 | int count = mapper.countUserFiles(action); 63 | session.close(); 64 | return count; 65 | } 66 | 67 | public void updateFileById(ChangeFileStatusAction changeFileStatusAction) throws Exception{ 68 | SqlSession session = DaoUtil.getSqlSession(); 69 | FileMapper mapper = session.getMapper(FileMapper.class); 70 | mapper.updateFileById(changeFileStatusAction); 71 | session.commit(); 72 | session.close(); 73 | } 74 | 75 | public void deleteFileById(int id) { 76 | SqlSession session = DaoUtil.getSqlSession(); 77 | FileMapper mapper = session.getMapper(FileMapper.class); 78 | mapper.deleteFileById(id); 79 | session.commit(); 80 | session.close(); 81 | } 82 | 83 | public String findFilenameById(int id) { 84 | SqlSession session = DaoUtil.getSqlSession(); 85 | FileMapper mapper = session.getMapper(FileMapper.class); 86 | String filename = mapper.findFilenameById(id); 87 | session.close(); 88 | return filename; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/cn/zju/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package cn.zju.dao; 2 | 3 | import org.apache.ibatis.session.SqlSession; 4 | 5 | import cn.zju.dao.mapper.UserMapper; 6 | import cn.zju.dao.po.User; 7 | 8 | public class UserDao { 9 | //创建用户 10 | public void createUser(User user) throws Exception{ 11 | SqlSession session = DaoUtil.getSqlSession(); 12 | UserMapper mapper = session.getMapper(UserMapper.class); 13 | mapper.createUser(user); 14 | session.commit(); 15 | session.close(); 16 | } 17 | //如果数据库里存在用户名和密码都匹配的记录 代表登陆成功 18 | public String checkUser(User user)throws Exception{ 19 | SqlSession session = DaoUtil.getSqlSession(); 20 | UserMapper mapper = session.getMapper(UserMapper.class); 21 | String user_name = mapper.checkUser(user); 22 | session.close(); 23 | return user_name; 24 | } 25 | //查找指定用户名的用户是否存在 26 | public boolean findUser(String username)throws Exception{ 27 | SqlSession session = DaoUtil.getSqlSession(); 28 | UserMapper mapper = session.getMapper(UserMapper.class); 29 | Integer found = mapper.findUser(username); 30 | session.close(); 31 | if(found==null || found<1) return false; 32 | return true; 33 | } 34 | public int isVip(String user_name) throws Exception{ 35 | SqlSession session = DaoUtil.getSqlSession(); 36 | UserMapper mapper = session.getMapper(UserMapper.class); 37 | Integer isvip = mapper.isVip(user_name); 38 | session.close(); 39 | if(isvip==null || isvip == 0) return 0; 40 | else return 1; 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/cn/zju/dao/mapper/FileMapper.java: -------------------------------------------------------------------------------- 1 | package cn.zju.dao.mapper; 2 | 3 | import java.util.List; 4 | 5 | import cn.zju.action.ChangeFileStatusAction; 6 | import cn.zju.action.SearchFileAction; 7 | import cn.zju.action.SearchUserFileAction; 8 | import cn.zju.dao.po.File; 9 | 10 | public interface FileMapper { 11 | 12 | public List getAllFiles(SearchFileAction searchFileAction) throws Exception; 13 | public int count(SearchFileAction searchFileAction) throws Exception; 14 | public String findFilepathById(int id) throws Exception; 15 | public Integer insertFile(File file) throws Exception; 16 | public List getUserFiles(SearchUserFileAction action)throws Exception; 17 | public int countUserFiles(SearchUserFileAction action) throws Exception; 18 | public void updateFileById(ChangeFileStatusAction changeFileStatusAction) throws Exception; 19 | public void deleteFileById(int id); 20 | public String findFilenameById(int id); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/cn/zju/dao/mapper/FileMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 16 | 17 | 18 | 21 | 22 | 23 | 26 | 27 | 28 | 31 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | SELECT LAST_INSERT_ID() 41 | 42 | INSERT INTO icloud.file (filename,filepath,filesize,createtime,canshare) 43 | VALUES(#{filename},#{filepath},#{filesize},#{createtime},#{canshare}) 44 | 45 | 46 | 47 | UPDATE FILE SET canshare=#{canshare} WHERE id=#{id} 48 | 49 | 50 | 51 | DELETE FROM FILE WHERE id=#{value} 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/cn/zju/dao/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package cn.zju.dao.mapper; 2 | 3 | import cn.zju.dao.po.User; 4 | 5 | public interface UserMapper { 6 | 7 | public void createUser(User user) throws Exception; 8 | public String checkUser(User user) throws Exception; 9 | public Integer findUser(String username) throws Exception; 10 | public Integer isVip(String user_name)throws Exception; 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/cn/zju/dao/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 14 | 15 | 18 | 19 | 20 | 21 | SELECT LAST_INSERT_ID() 22 | 23 | INSERT INTO user(username,password,isvip) VALUES(#{username},#{password},#{isvip}) 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/cn/zju/dao/po/File.java: -------------------------------------------------------------------------------- 1 | package cn.zju.dao.po; 2 | 3 | import java.util.Date; 4 | 5 | import org.springframework.context.annotation.Scope; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component("file") 9 | @Scope("prototype") 10 | public class File { 11 | 12 | private int id; 13 | private String filename; 14 | private String filepath; 15 | private String filesize; 16 | private Date createtime; 17 | private int canshare; 18 | 19 | public int getId() { 20 | return id; 21 | } 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | public String getFilename() { 26 | return filename; 27 | } 28 | public void setFilename(String filename) { 29 | this.filename = filename; 30 | } 31 | public String getFilepath() { 32 | return filepath; 33 | } 34 | public void setFilepath(String filepath) { 35 | this.filepath = filepath; 36 | } 37 | public String getFilesize() { 38 | return filesize; 39 | } 40 | public void setFilesize(String filesize) { 41 | this.filesize = filesize; 42 | } 43 | public Date getCreatetime() { 44 | return createtime; 45 | } 46 | public void setCreatetime(Date createtime) { 47 | this.createtime = createtime; 48 | } 49 | public int getCanshare() { 50 | return canshare; 51 | } 52 | public void setCanshare(int canshare) { 53 | this.canshare = canshare; 54 | } 55 | 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/cn/zju/dao/po/PageBean.java: -------------------------------------------------------------------------------- 1 | package cn.zju.dao.po; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.context.annotation.Scope; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component("pageBean") 9 | @Scope("prototype") 10 | public class PageBean { 11 | private List list; //一页的所有记录 12 | private int totalrecord; //总共多少条记录 13 | private int pagesize; //一页有几条数据 14 | private int totalpage; //总共多少页 15 | private int currentpage; //用户想看的页 16 | private int previouspage; //想看的页的前一页 17 | private int nextpage; //想看的页的下一页 18 | private int[] pagebar; //底下的 1 2 3 ...页码条 19 | 20 | public List getList() { 21 | return list; 22 | } 23 | public void setList(List list) { 24 | this.list = list; 25 | } 26 | public int getTotalrecord() { 27 | 28 | return totalrecord; 29 | } 30 | public void setTotalrecord(int totalrecord) { 31 | this.totalrecord = totalrecord; 32 | } 33 | public int getPagesize() { 34 | return pagesize; 35 | } 36 | public void setPagesize(int pagesize) { 37 | this.pagesize = pagesize; 38 | } 39 | 40 | 41 | public int getTotalpage() { 42 | if(this.totalrecord==0){ 43 | return 1; 44 | }else if(this.totalrecord%this.pagesize==0){ 45 | this.totalpage = this.totalrecord/this.pagesize; 46 | }else{ 47 | this.totalpage = this.totalrecord/this.pagesize+1; 48 | } 49 | return totalpage; 50 | } 51 | 52 | public int getCurrentpage() { 53 | return currentpage; 54 | } 55 | public void setCurrentpage(int currentpage) { 56 | this.currentpage = currentpage; 57 | } 58 | public int getPreviouspage() { 59 | if(this.currentpage-1<1){ 60 | this.previouspage = 1; 61 | }else{ 62 | this.previouspage = this.currentpage-1; 63 | } 64 | return previouspage; 65 | } 66 | 67 | public int getNextpage() { 68 | if(this.currentpage+1>=this.totalpage){ 69 | this.nextpage = this.totalpage; 70 | }else{ 71 | this.nextpage = this.currentpage +1; 72 | } 73 | return nextpage; 74 | } 75 | 76 | public int[] getPagebar() { 77 | int startpage; 78 | int endpage; 79 | int pagebar[] = null; 80 | if(this.totalpage<=10){ //如果页码总共不超过10页,全部显示出来就好了 81 | pagebar = new int[this.totalpage]; 82 | startpage = 1; 83 | endpage = this.totalpage; 84 | }else{ //总页数大于10,显示邻近的10页 85 | pagebar = new int[10]; 86 | startpage = this.currentpage - 4; 87 | endpage = this.currentpage + 5; 88 | if(startpage<1){ //确保不能越界 89 | startpage = 1; 90 | endpage = 10; 91 | } 92 | 93 | if(endpage>this.totalpage){ 94 | endpage = this.totalpage; 95 | startpage = this.totalpage - 9; 96 | } 97 | } 98 | 99 | int index = 0; 100 | for(int i=startpage;i<=endpage;i++){ 101 | pagebar[index++] = i; 102 | } 103 | 104 | this.pagebar = pagebar; 105 | return this.pagebar; 106 | /*int pagebar[] = new int[this.totalpage]; 107 | for(int i=1;i<=this.totalpage;i++){ 108 | pagebar[i-1] = i; 109 | } 110 | this.pagebar = pagebar; 111 | return pagebar;*/ 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/cn/zju/dao/po/QueryInfo.java: -------------------------------------------------------------------------------- 1 | package cn.zju.dao.po; 2 | 3 | import org.springframework.context.annotation.Scope; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component("queryInfo") 7 | public class QueryInfo { 8 | private int currentpage = 1; //用户想看的页(用户点击的那一页),默认是第1页 9 | private int pagesize = 3 ; //每一个页面呈现几条数据,默认一页是5条数据 10 | private int startindex; //用户想看的页的数据在数据库的起始位置 11 | 12 | public int getCurrentpage() { 13 | return currentpage; 14 | } 15 | public void setCurrentpage(int currentpage) { 16 | if(currentpage <= 0) 17 | this.currentpage = 1; 18 | else 19 | this.currentpage = currentpage; 20 | } 21 | public int getPagesize() { 22 | return pagesize; 23 | } 24 | public void setPagesize(int pagesize) { 25 | if(pagesize<=0) 26 | this.pagesize = 3; 27 | else 28 | this.pagesize = pagesize; 29 | } 30 | public int getStartindex() { 31 | //比如用户想看第2页,每页5条数据,那么数据在数据库里的起始位置是 5 32 | this.startindex = (this.currentpage-1)*this.pagesize; 33 | return startindex; 34 | } 35 | public void setStartindex(int startindex) { 36 | this.startindex = startindex; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/cn/zju/dao/po/User.java: -------------------------------------------------------------------------------- 1 | package cn.zju.dao.po; 2 | 3 | import org.springframework.context.annotation.Scope; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component("user") 7 | @Scope("prototype") 8 | public class User { 9 | private int id; 10 | private String password; 11 | private String username; 12 | private int isvip; 13 | 14 | public int getId() { 15 | return id; 16 | } 17 | public void setId(int id) { 18 | this.id = id; 19 | } 20 | public String getPassword() { 21 | return password; 22 | } 23 | public void setPassword(String password) { 24 | this.password = password; 25 | } 26 | public String getUsername() { 27 | return username; 28 | } 29 | public void setUsername(String username) { 30 | this.username = username; 31 | } 32 | public int getIsvip() { 33 | return isvip; 34 | } 35 | public void setIsvip(int isvip) { 36 | this.isvip = isvip; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/cn/zju/service/FileService.java: -------------------------------------------------------------------------------- 1 | package cn.zju.service; 2 | 3 | import java.util.List; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.beans.factory.annotation.Qualifier; 6 | import org.springframework.stereotype.Service; 7 | import cn.zju.action.ChangeFileStatusAction; 8 | import cn.zju.action.SearchFileAction; 9 | import cn.zju.action.SearchUserFileAction; 10 | import cn.zju.dao.mapper.FileMapper; 11 | import cn.zju.dao.po.File; 12 | 13 | @Service(value="fileService") 14 | public class FileService { 15 | 16 | @Autowired 17 | private FileMapper dao; 18 | 19 | public List getAllFiles(SearchFileAction searchFileAction) throws Exception{ 20 | return dao.getAllFiles(searchFileAction); 21 | } 22 | 23 | public int countShareFiles(SearchFileAction searchFileAction)throws Exception{ 24 | return dao.count(searchFileAction); 25 | } 26 | 27 | public String findFilepathById(int id) throws Exception{ 28 | return dao.findFilepathById(id); 29 | } 30 | 31 | public Integer insertFile(File file) throws Exception{ 32 | return dao.insertFile(file); 33 | } 34 | 35 | public List getUserFiles(SearchUserFileAction action) throws Exception { 36 | return dao.getUserFiles(action); 37 | } 38 | 39 | public int countUserFiles(SearchUserFileAction action) throws Exception { 40 | return dao.countUserFiles(action); 41 | 42 | } 43 | 44 | public void updateFileById(ChangeFileStatusAction changeFileStatusAction) throws Exception{ 45 | dao.updateFileById(changeFileStatusAction); 46 | } 47 | 48 | public void deleteFileById(int id) { 49 | dao.deleteFileById(id); 50 | } 51 | 52 | public String findFilenameById(int id) { 53 | return dao.findFilenameById(id); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/cn/zju/service/UserService.java: -------------------------------------------------------------------------------- 1 | package cn.zju.service; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.beans.factory.annotation.Qualifier; 5 | import org.springframework.stereotype.Service; 6 | import cn.zju.dao.mapper.UserMapper; 7 | import cn.zju.dao.po.User; 8 | 9 | @Service(value="userService") 10 | public class UserService { 11 | 12 | @Autowired 13 | private UserMapper dao; 14 | 15 | public void createUser(User user) throws Exception{ 16 | Boolean found = findUser(user.getUsername()); 17 | if(!found) 18 | dao.createUser(user); 19 | else 20 | throw new RuntimeException(); 21 | } 22 | 23 | public String checkUser(User user ) throws Exception{ 24 | return dao.checkUser(user); 25 | } 26 | 27 | public boolean findUser(String username) throws Exception{ 28 | Integer found = dao.findUser(username); 29 | if(found==null || found<1) return false; 30 | return true; 31 | } 32 | 33 | public int isVip(String user_name)throws Exception { 34 | return dao.isVip(user_name); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/db.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/icloud 3 | jdbc.username=root 4 | jdbc.password=root 5 | -------------------------------------------------------------------------------- /src/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration 2 | #\u5728\u5f00\u53d1\u73af\u5883\u4e0b\u65e5\u5fd7\u7ea7\u522b\u8981\u8bbe\u7f6e\u6210DEBUG\uff0c\u751f\u4ea7\u73af\u5883\u8bbe\u7f6e\u6210info\u6216error 3 | log4j.rootLogger=DEBUG, stdout 4 | # Console output... 5 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 6 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n 8 | -------------------------------------------------------------------------------- /src/sql.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/src/sql.txt -------------------------------------------------------------------------------- /src/struts.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | /WEB-INF/jsp/login.jsp 16 | 17 | 18 | 19 | /WEB-INF/jsp/logup.jsp 20 | 21 | 22 | 23 | /index.jsp 24 | 25 | 26 | 27 | searchUserfile 28 | ${pageContext.request.contextPath}/requestin.action 29 | 30 | 31 | 32 | /WEB-INF/jsp/userhome.jsp 33 | /index.jsp 34 | 35 | 36 | 37 | /WEB-INF/jsp/showsearchfiles.jsp 38 | /index.jsp 39 | 40 | 41 | 42 | /WEB-INF/jsp/showsearchfiles.jsp 43 | /index.jsp 44 | 45 | 46 | 47 | /WEB-INF/jsp/login.jsp 48 | /WEB-INF/jsp/logup.jsp 49 | /WEB-INF/jsp/logup.jsp 50 | 51 | 52 | 53 | searchUserfile 54 | /message.jsp 55 | /WEB-INF/jsp/login.jsp 56 | 57 | 58 | 59 | /message.jsp 60 | /message.jsp 61 | 62 | 63 | 64 | searchUserfile 65 | /message.jsp 66 | 67 | 68 | 69 | searchUserfile 70 | /message.jsp 71 | 72 | 73 | 74 | searchUserfile 75 | /message.jsp 76 | 77 | 78 | 79 | /index.jsp 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /webapps/icloud/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/SqlMapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/AutoLoginAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/AutoLoginAction.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/ChangeFileStatusAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/ChangeFileStatusAction.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/DeleteFileAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/DeleteFileAction.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/DownloadAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/DownloadAction.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/LoginAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/LoginAction.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/LogoutAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/LogoutAction.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/LogupAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/LogupAction.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/SearchFileAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/SearchFileAction.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/SearchUserFileAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/SearchUserFileAction.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/ShutDown.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/ShutDown.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/action/UploadAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/action/UploadAction.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/DaoUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/dao/DaoUtil.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/FileDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/dao/FileDao.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/UserDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/dao/UserDao.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/mapper/FileMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/dao/mapper/FileMapper.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/mapper/FileMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 16 | 17 | 18 | 21 | 22 | 23 | 26 | 27 | 28 | 31 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | SELECT LAST_INSERT_ID() 41 | 42 | INSERT INTO icloud.file (filename,filepath,filesize,createtime,canshare) 43 | VALUES(#{filename},#{filepath},#{filesize},#{createtime},#{canshare}) 44 | 45 | 46 | 47 | UPDATE FILE SET canshare=#{canshare} WHERE id=#{id} 48 | 49 | 50 | 51 | DELETE FROM FILE WHERE id=#{value} 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/mapper/UserMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/dao/mapper/UserMapper.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 14 | 15 | 18 | 19 | 20 | 21 | SELECT LAST_INSERT_ID() 22 | 23 | INSERT INTO user(username,password,isvip) VALUES(#{username},#{password},#{isvip}) 24 | 25 | 26 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/po/File.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/dao/po/File.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/po/PageBean.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/dao/po/PageBean.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/po/QueryInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/dao/po/QueryInfo.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/dao/po/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/dao/po/User.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/service/FileService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/service/FileService.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/cn/zju/service/UserService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/classes/cn/zju/service/UserService.class -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/db.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/icloud 3 | jdbc.username=root 4 | jdbc.password=root 5 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration 2 | #\u5728\u5f00\u53d1\u73af\u5883\u4e0b\u65e5\u5fd7\u7ea7\u522b\u8981\u8bbe\u7f6e\u6210DEBUG\uff0c\u751f\u4ea7\u73af\u5883\u8bbe\u7f6e\u6210info\u6216error 3 | log4j.rootLogger=DEBUG, stdout 4 | # Console output... 5 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 6 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n 8 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/classes/struts.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | /WEB-INF/jsp/login.jsp 16 | 17 | 18 | 19 | /WEB-INF/jsp/logup.jsp 20 | 21 | 22 | 23 | /index.jsp 24 | 25 | 26 | 27 | searchUserfile 28 | ${pageContext.request.contextPath}/requestin.action 29 | 30 | 31 | 32 | /WEB-INF/jsp/userhome.jsp 33 | /index.jsp 34 | 35 | 36 | 37 | /WEB-INF/jsp/showsearchfiles.jsp 38 | /index.jsp 39 | 40 | 41 | 42 | /WEB-INF/jsp/showsearchfiles.jsp 43 | /index.jsp 44 | 45 | 46 | 47 | /WEB-INF/jsp/login.jsp 48 | /WEB-INF/jsp/logup.jsp 49 | /WEB-INF/jsp/logup.jsp 50 | 51 | 52 | 53 | searchUserfile 54 | /message.jsp 55 | /WEB-INF/jsp/login.jsp 56 | 57 | 58 | 59 | /message.jsp 60 | /message.jsp 61 | 62 | 63 | 64 | searchUserfile 65 | /message.jsp 66 | 67 | 68 | 69 | searchUserfile 70 | /message.jsp 71 | 72 | 73 | 74 | searchUserfile 75 | /message.jsp 76 | 77 | 78 | 79 | /index.jsp 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/jsp/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | 4 | 5 | 6 | 登陆 7 | 8 | 9 |
log up   10 | 首页 11 |
12 |
13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
用户名${error}
密码
25 |
26 |
27 | 28 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/jsp/logup.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | 4 | 5 | 6 | 7 | 注册 8 | 9 | 10 |
log in   11 | 首页 12 |
13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
用户名${usernameerror}
密码${passworderror}
26 |
27 |
28 | 29 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/jsp/showsearchfiles.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 | 5 | 6 | 7 | 8 | iCloud搜索结果 9 | 10 | 11 | 12 | 首页 13 |
14 | 18 | 19 |
20 | iCloud搜索结果

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 41 |
文件名文件大小创建日期下载文件
${c.filename }${c.filesize } kb${c.createtime } 36 | 下载 37 |
42 |
43 | 共[${requestScope.pagebean.totalrecord}]条记录, 44 | 每页 条 45 | 共[${requestScope.pagebean.totalpage}]页, 46 | 当前是第[${requestScope.pagebean.currentpage}]页, 47 | 回到首页 48 | 上一页 49 | 50 | 51 | ${pagenum } 52 | 53 | 54 | ${pagenum} 55 | 56 | 57 | 下一页 58 | 59 | 页 60 | 61 | 62 | 63 | 95 |
96 | 97 | 98 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/jsp/userhome.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 | 5 | 6 | 7 | 8 | 我的iCloud 9 | 10 | 11 | 12 |
13 | log out   14 | 首页   15 | 帮助   16 | 远程关机 17 |
18 | 19 |
欢迎你登陆iCloud
${user_name}
20 | 21 |

22 | 23 |
24 | 25 |
26 |
27 |     28 | ${message } 29 |
30 |
31 |

32 | 33 | 34 | 35 | 36 | 37 |
38 | 42 | 43 |
44 |
Your Files In iCloud
45 | 46 |
47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 65 | 79 | 82 | 83 | 84 | 85 |
文件名文件大小上传日期下载文件是否共享操作
${c.filename }${c.filesize } kb${c.createtime } 63 | 下载 64 | 66 |
67 | 77 |
78 |
80 | 删除文件 81 |
86 |
87 | 共[${requestScope.pagebean.totalrecord}]条记录, 88 | 每页 条 89 | 共[${requestScope.pagebean.totalpage}]页, 90 | 当前是第[${requestScope.pagebean.currentpage}]页, 91 | 回到首页 92 | 上一页 93 | 94 | 95 | ${pagenum } 96 | 97 | 98 | ${pagenum} 99 | 100 | 101 | 下一页 102 | 103 | 页 104 | 105 | 106 | 139 | 140 | 170 | 171 |      224 | 225 |
226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/asm-3.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/asm-3.3.1.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/c3p0-0.9.2-pre1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/c3p0-0.9.2-pre1.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/cglib-2.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/cglib-2.2.2.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/commons-fileupload-1.2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/commons-fileupload-1.2.1.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/commons-io-1.3.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/commons-io-1.3.2.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/commons-logging-1.0.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/commons-logging-1.0.4.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/commons-logging-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/commons-logging-1.1.1.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/freemarker-2.3.15.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/freemarker-2.3.15.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/javassist-3.17.1-GA.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/javassist-3.17.1-GA.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/jstl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/jstl.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/junit-4.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/junit-4.9.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/log4j-1.2.17.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/log4j-1.2.17.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/log4j-api-2.0-rc1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/log4j-api-2.0-rc1.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/log4j-core-2.0-rc1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/log4j-core-2.0-rc1.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/mchange-commons-0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/mchange-commons-0.2.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/mybatis-3.2.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/mybatis-3.2.7.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/mybatis-spring-1.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/mybatis-spring-1.2.2.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/ognl-2.7.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/ognl-2.7.3.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/slf4j-api-1.7.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/slf4j-api-1.7.5.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/slf4j-log4j12-1.7.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/slf4j-log4j12-1.7.5.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/spring-aop-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/spring-aop-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/spring-beans-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/spring-beans-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/spring-context-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/spring-context-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/spring-core-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/spring-core-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/spring-expression-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/spring-expression-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/spring-jdbc-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/spring-jdbc-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/spring-tx-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/spring-tx-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/spring-web-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/spring-web-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/standard.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/standard.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/struts2-core-2.1.8.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/struts2-core-2.1.8.1.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/lib/xwork-core-2.1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martin-wong/iCloud/b5bf667e5ce729bfd05eecc37704b6627fa3fc60/webapps/icloud/WEB-INF/lib/xwork-core-2.1.6.jar -------------------------------------------------------------------------------- /webapps/icloud/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | icloud 4 | 5 | 6 | org.springframework.web.context.ContextLoaderListener 7 | 8 | 9 | 10 | contextConfigLocation 11 | classpath:applicationContext.xml 12 | 13 | 14 | 15 | struts2 16 | org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 17 | 18 | 19 | struts2 20 | /* 21 | 22 | 23 | 24 | index.jsp 25 | 26 | -------------------------------------------------------------------------------- /webapps/icloud/help.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | 4 | 5 | 6 | 7 | iCloud帮助页 8 | 9 | 10 | 首页     11 | 我的主页  12 | 13 |

14 | 15 | 如何上传或者下载文件?
16 | 任何人均可以下载他人共享的文件,如果想上传文件,您必须先注册并登陆

17 | 上传的文件会被别人看到并下载吗?
18 | 您上传的文件默认是私有的,上传之后您可以选择共享哪些文件
19 | 忘记密码怎么办?
20 | 您可以发email至1101875387@qq.com询问,后续会开通密码找回功能
21 | 上传文件有什么限制吗?
22 | 普通用户单次上传文件不能超过20Mb,VIP用户不能超过50Mb
23 | 24 | 25 | -------------------------------------------------------------------------------- /webapps/icloud/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | 4 | 5 | 6 | 7 | iCloud云网盘 8 | 9 | 10 |
11 | log in   12 | log up   13 | 我的主页  14 | 帮助 15 |
16 |
17 |
Log in to upload files to iCloud !
18 |
19 | 20 | 21 |
22 |
23 | 24 | -------------------------------------------------------------------------------- /webapps/icloud/message.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | 4 | 5 | 6 | 7 | error 8 | 9 | 10 | 23 | 24 | 25 | --------------------------------------------------------------------------------