fckeditor_2.6.6 文件上传绝对路径的设置(每用户独立目录)

 

 

1、web.xml配置

 

<servlet>

<servlet-name>ConnectorServlet</servlet-name>

<servlet-class>

net.fckeditor.connector.ConnectorServlet

</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

 

<servlet-mapping>

<servlet-name>ConnectorServlet</servlet-name>

<!-- Do not wrap this line otherwise Glassfish will fail to load this file -->

<url-pattern>/common/js/fckeditor/editor/filemanager/connectors/*</url-pattern>

</servlet-mapping>

 

2、fckeditor.properties 文件配置

 

connector.userActionImpl=net.fckeditor.requestcycle.impl.EnabledUserAction

connector.userFilesAbsolutePath=/home/guo/userfiles

connector.userFilesPath=/home/guo/userfiles

fckeditor.basePath=/common/js/fckeditor          #fck在项目中的路径

 

3、修改以下类中方法源代码

 

3.1 

net.fckeditor.connector.impl.ContextConnector.java

 

protected String getRealUserFilesAbsolutePath(String userFilesAbsolutePath) {

return userFilesAbsolutePath;

}

 

3.2

net.fckeditor.handlers.RequestCycleHandler

 

public static String getUserFilesPath(final HttpServletRequest request) {
  String userCodePath = "";
  Object obj = request.getSession(true).getAttribute("user");
  if (obj!=null && obj instanceof TbSysUser) {
   TbSysUser user = (TbSysUser) request.getSession(true).getAttribute("user");
   userCodePath = "/"+user.getTsu001();
  }
  return userPathBuilder.getUserFilesPath(request)+userCodePath;
 }

 

public static String getUserFilesAbsolutePath(final HttpServletRequest request) {
  String userCodePath = "";
  Object obj = request.getSession(true).getAttribute("user");
  if (obj!=null && obj instanceof TbSysUser) {
   TbSysUser user = (TbSysUser) request.getSession(true).getAttribute("user");
   userCodePath = "/"+user.getTsu001();
  }
  return userPathBuilder.getUserFilesAbsolutePath(request)+userCodePath;
 }

 

4、在tomcat/conf/server.xml文件的<host>中添加如下内容 

<Context docBase="/home/guo/userfiles" path="/项目名称/home/guo/userfiles" reloadable="true"/>

 

 

你可能感兴趣的:(String,object,fckeditor,user,null,Glassfish)