예제 #1
0
 /**
  * 获取上传文件的根目录
  *
  * @return
  */
 public static String getUserfilesBaseDir() {
   String dir = getConfig("userfiles.basedir");
   if (StringUtils.isBlank(dir)) {
     try {
       dir = ServletContextFactory.getServletContext().getRealPath("/");
     } catch (Exception e) {
       return "";
     }
   }
   if (!dir.endsWith("/")) {
     dir += "/";
   }
   //		System.out.println("userfiles.basedir: " + dir);
   return dir;
 }
예제 #2
0
 /**
  * Runs command. Initialize, sets response and execute command.
  *
  * @param request request
  * @param response response
  * @param configuration1 connector configuration
  * @param params additional execute params.
  * @throws ConnectorException when error occured
  */
 public void runCommand(
     final HttpServletRequest request,
     final HttpServletResponse response,
     final IConfiguration configuration1,
     final Object... params)
     throws ConnectorException {
   this.initParams(request, configuration1, params);
   try {
     setResponseHeader(response, ServletContextFactory.getServletContext());
     execute(response.getOutputStream());
     response.getOutputStream().flush();
     response.getOutputStream().close();
   } catch (ConnectorException e) {
     throw e;
   } catch (IOException e) {
     throw new ConnectorException(Constants.Errors.CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED, e);
   } catch (Exception e) {
     throw new ConnectorException(Constants.Errors.CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED, e);
   }
 }