资源简介
百度富文本编辑器UEditor示例,图片、视频、附件等上传可用。
代码片段和文件信息
package com.baidu.ueditor;
import com.baidu.ueditor.define.ActionMap;
import com.baidu.ueditor.define.AppInfo;
import com.baidu.ueditor.define.baseState;
import com.baidu.ueditor.define.State;
import com.baidu.ueditor.hunter.FileManager;
import com.baidu.ueditor.hunter.ImageHunter;
import com.baidu.ueditor.upload.Uploader;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
public class ActionEnter {
private HttpServletRequest request = null;
private String phyPath = null;
private String rootPath = null;
private String contextPath = null;
private String actionType = null;
private ConfigManager configManager = null;
public ActionEnter ( HttpServletRequest request String rootPath String phyPath ) {
this.request = request;
this.phyPath = phyPath;
this.rootPath = rootPath;
this.actionType = request.getParameter( “action“ );
this.contextPath = request.getContextPath();
this.configManager = ConfigManager.getInstance( this.phyPath this.rootPath this.contextPath request.getRequestURI() );
}
public String exec () {
String callbackName = this.request.getParameter(“callback“);
if ( callbackName != null ) {
if ( !validCallbackName( callbackName ) ) {
return new baseState( false AppInfo.ILLEGAL ).toJSONString();
}
return callbackName+“(“+this.invoke()+“);“;
} else {
return this.invoke();
}
}
public String invoke() {
if ( actionType == null || !ActionMap.mapping.containsKey( actionType ) ) {
return new baseState( false AppInfo.INVALID_ACTION ).toJSONString();
}
if ( this.configManager == null || !this.configManager.valid() ) {
return new baseState( false AppInfo.CONFIG_ERROR ).toJSONString();
}
State state = null;
int actionCode = ActionMap.getType( this.actionType );
Mapject> conf = null;
switch ( actionCode ) {
case ActionMap.CONFIG:
return this.configManager.getAllConfig().toString();
case ActionMap.UPLOAD_IMAGE:
case ActionMap.UPLOAD_SCRAWL:
case ActionMap.UPLOAD_VIDEO:
case ActionMap.UPLOAD_FILE:
conf = this.configManager.getConfig( actionCode );
state = new Uploader( request conf ).doExec();
break;
case ActionMap.CATCH_IMAGE:
conf = configManager.getConfig( actionCode );
String[] list = this.request.getParameterValues( (String)conf.get( “fieldName“ ) );
state = new ImageHunter( conf ).capture( list );
break;
case ActionMap.LIST_IMAGE:
case ActionMap.LIST_FILE:
conf = configManager.getConfig( actionCode );
int start = this.getStartIndex();
state = new FileManager( conf ).listFile( start );
break;
}
return state.toJSONString();
}
public int getStartIndex () {
String start = this.request.getParameter( “start“ );
try {
return Integer.parseInt( start );
} catch ( Exception e ) {
return 0;
}
}
/**
* callback参数验证
*/
public boolean validCallbackName ( String name )
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-07-08 01:07 ueddemo\
文件 2169 2018-07-08 01:06 ueddemo\.classpath
目录 0 2018-07-08 01:07 ueddemo\.idea\
目录 0 2018-07-08 01:07 ueddemo\.idea\artifacts\
文件 314 2018-07-07 22:40 ueddemo\.idea\artifacts\ueddemo_war.xm
文件 1069 2018-07-07 22:40 ueddemo\.idea\artifacts\ueddemo_war_exploded.xm
目录 0 2018-07-08 01:07 ueddemo\.idea\inspectionProfiles\
文件 1444 2018-07-07 22:38 ueddemo\.idea\inspectionProfiles\Project_Default.xm
文件 262 2018-07-07 22:38 ueddemo\.idea\misc.xm
文件 254 2018-07-07 22:38 ueddemo\.idea\modules.xm
文件 34486 2018-07-08 01:07 ueddemo\.idea\workspace.xm
目录 0 2014-08-25 16:45 ueddemo\.myeclipse\
文件 294 2014-08-25 14:51 ueddemo\.myme
文件 345 2018-07-08 01:06 ueddemo\.project
目录 0 2018-07-08 01:07 ueddemo\.settings\
文件 629 2014-08-25 14:52 ueddemo\.settings\org.eclipse.jdt.core.prefs
目录 0 2018-07-08 01:07 ueddemo\classes\
目录 0 2018-07-08 01:07 ueddemo\classes\artifacts\
目录 0 2018-07-08 01:07 ueddemo\src\
目录 0 2018-07-08 01:07 ueddemo\src\com\
目录 0 2018-07-08 01:07 ueddemo\src\com\baidu\
目录 0 2018-07-08 01:07 ueddemo\src\com\baidu\ueditor\
文件 3114 2018-07-08 00:11 ueddemo\src\com\baidu\ueditor\ActionEnter.java
文件 6604 2018-07-08 00:14 ueddemo\src\com\baidu\ueditor\ConfigManager.java
目录 0 2018-07-08 01:07 ueddemo\src\com\baidu\ueditor\define\
文件 1147 2018-07-06 22:59 ueddemo\src\com\baidu\ueditor\define\ActionMap.java
文件 77 2018-07-06 22:59 ueddemo\src\com\baidu\ueditor\define\ActionState.java
文件 2871 2018-07-06 22:59 ueddemo\src\com\baidu\ueditor\define\AppInfo.java
文件 1778 2018-07-06 22:59 ueddemo\src\com\baidu\ueditor\define\ba
文件 612 2018-07-06 22:59 ueddemo\src\com\baidu\ueditor\define\FileType.java
文件 442 2018-07-06 22:59 ueddemo\src\com\baidu\ueditor\define\MIMEType.java
............此处省略384个文件信息
- 上一篇:思讯美世家V3 注册机+免狗
- 下一篇:计算机毕业设计外文翻译
相关资源
- SX1280 demo代码
- MPC5125开发板原理、PCB的demo
- 蓝牙通讯文字、语音聊天demo
- Unity3D小DEMO源码
- LayaAIR 开发格斗游戏
- 炫酷九宫格抽奖demo
- 亚马逊接口demo直接能跑起来
- OpenGL Shading Language 橙宝书 源代码 De
- 爱普生打印demo
- 企业网银支付demo
- 基于Unity2017.3.0f3的音乐节拍demo
- 大华车牌识别DEMO
- DB2数据库连接demo
- WebRtc视频聊天demo包括多人聊天
- unity3D demo
- 光线追踪demo
- 使用IDEA对springboot+activiti开发demo和详
- Hi3516A官方SDK资料V100R001C01SPC030原理图
- TabLayout+ViewPager+Fragment实现分页滑动效
- demo(2).zip
- unity3d 赛车DEMO
- LJV7000 LabVIEW demo
- iOS 音频Demo本地,网络音频的与播放全
- QPdfiumDemo
- unity3d鱼类游动AI demo
- 海康威视摄像头调用Demo
- 百度地图DEMO ~ 百度地图DEMO
- RecyclerViewDemo
- 基于spring websocket实现广播及点对点推
- SuperSocket_demo
评论
共有 条评论