日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

JFinal整合CKFinder

發布時間:2023/12/9 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JFinal整合CKFinder 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2019獨角獸企業重金招聘Python工程師標準>>>

????使用JFinal對之前的系統進行重構,老系統使用了CKEditor+CKFinder編輯器,發現在web.xml中配置ConnectorServlet會被JFinalFilter過濾處理,而且使用JFinal之后也不想在web.xml中增加額外的配置,所以嘗試的寫了JFinal整合CKFinder的Handler,由于我對CKEditor+CKFinder不熟悉,可能整合的并不完整,這里只當參考,歡迎提供更好的解決方案~~

package com.jfinal.ext.handler;import java.util.Enumeration; import java.util.Properties;import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;import com.ckfinder.connector.ConnectorServlet; import com.hikvision.util.base.PropertiesKit; import com.jfinal.handler.Handler;public class CKFinderHandler extends Handler {private String visitPath = "/ckfinder/core/connector/java/connector";private ConnectorServlet servlet = new ConnectorServlet();private Properties properties;public CKFinderHandler() {}public CKFinderHandler(String cfgPath) {this.properties = PropertiesKit.loadPropertyFile(cfgPath);}public CKFinderHandler(String visitPath, String cfgPath){this.visitPath = visitPath;this.properties = PropertiesKit.loadPropertyFile(cfgPath);}@Overridepublic void handle(String target, final HttpServletRequest request, HttpServletResponse response, boolean[] isHandled){if (target.startsWith(visitPath)) {isHandled[0] = true;try {servlet.init(new ServletConfig(){@Overridepublic String getServletName() {return null; }@Overridepublic ServletContext getServletContext() {return request.getSession().getServletContext(); }@SuppressWarnings("rawtypes")@Overridepublic Enumeration getInitParameterNames() {return null; }@Overridepublic String getInitParameter(String name){return properties.getProperty(name);}});servlet.service(request, response);} catch (Exception e) {throw new RuntimeException(e);}}else {nextHandler.handle(target, request, response, isHandled);}} } @Override public void configHandler(Handlers me) {me.add(new CKFinderHandler("classes/ckfinder.properties")); }

ckfinder.properties

debug=false XMLConfig=/WEB-INF/config.xml

轉載于:https://my.oschina.net/u/866950/blog/130183

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的JFinal整合CKFinder的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。