最后
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
最后写上我自己一直喜欢的一句名言:
世界上只有一种真正的英雄主义就是在认清生活真相之后仍然热爱它
return connectorController;
}
private LocalFsVolume createLocalFsVolume(String name, File rootDir)
{
LocalFsVolume localFsVolume = new LocalFsVolume();
localFsVolume.setName(name);
localFsVolume.setRootDir(rootDir);
return localFsVolume;
}
/**
* create a service factory
* @return
*/
protected StaticFsServiceFactory createServiceFactory(HttpServletRequest request)
{
StaticFsServiceFactory staticFsServiceFactory = new StaticFsServiceFactory();
FsService fsService = getFileService(request,request.getServletContext());
staticFsServiceFactory.setFsService(fsService);
return staticFsServiceFactory;
}
public void initConnectorServlet(HttpServletRequest request,HttpServletResponse resp) throws Exception
{
_connectorController = createConnectorController(request);
_connectorController.connector(request, resp);
}
@Override
public FsService getFileService(HttpServletRequest request, ServletContext servletContext) {
DefaultFsService fsService = new DefaultFsService();
fsService.setSecurityChecker(new FsSecurityCheckForAll());
DefaultFsServiceConfig serviceConfig = new DefaultFsServiceConfig();
serviceConfig.setTmbWidth(80);
fsService.setServiceConfig(serviceConfig);
UserV v = null;
SimpleUser u = ((SimpleUser) SecurityUtils.getSubject().getPrincipal());
if(u==null) {
v = getSessionAttr(request,Constants.WEIXIN_USER);
}else {
v = u.getUser();
}
String userName = v.getStr(“user_cn_name”);
fsService.addVolume(“A”,
createLocalFsVolume(userName, new File(“/tmp/”+userName)));
fsService.addVolume(“B”,
createLocalFsVolume(“Shared”, new File(“/tmp/share/”+userName)));
return fsService;
}
public T getSessionAttr(HttpServletRequest request,String key) {
HttpSession session = request.getSession(false);
return session != null ? (T)session.getAttribute(key) : null;
}
}
控制层收到请求后,实例化 MyServiceFactory 就可以完成目录连接,示例如下:
package cn.kunming.iss.front.controller;
import cn.kunming.iss.core.controller.base.BaseController;
import com.jfinal.aop.Clear;
import com.jfinal.ext.route.ControllerBind;
@Clear
@ControllerBind(controllerKey = “/elfinder-servlet/connector”, viewPath = “/front/task”)
public class ElfinderController extends BaseController {
public void index(){
MyServiceFactory factory = new MyServiceFactory();
try {
factory.initConnectorServlet(getRequest(),getResponse());
} catch (Exception e) {
e.printStackTrace();
}
}
public void dataBank(){
render(“data2.jsp”);
}
}
最后页面引入相应的js、css在初始化elfinder就可以了,页面初始化如下:
<%@ page contentType=“text/html;charset=UTF-8” language=“java” %>
<%@ taglib prefix=“c” uri=“http://java.sun.com/jsp/jstl/core”%>
<%@ taglib prefix=“fn” uri=“http://java.sun.com/jsp/jstl/functions”%>
<%@ taglib uri=“http://java.sun.com/jsp/jstl/fmt” prefix=“fmt” %>
<%@ taglib prefix=“tags” tagdir=“/WEB-INF/tags”%>
<%––%>
最后
整理面试题,不是让大家去只刷面试题,而是熟悉目前实际面试中常见的考察方式和知识点,做到心中有数,也可以用来自查及完善知识体系。
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
《前端基础面试题》,《前端校招面试题精编解析大全》,《前端面试题宝典》,《前端面试题:常用算法》
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
《前端基础面试题》,《前端校招面试题精编解析大全》,《前端面试题宝典》,《前端面试题:常用算法》
[外链图片转存中…(img-oPrVG8t1-1715873719123)]
[外链图片转存中…(img-0QwtyI1X-1715873719124)]
[外链图片转存中…(img-flXtq2nT-1715873719125)]