/** * */ package com.matrix.system.common.actions; import com.matrix.component.ueditor.ActionEnter; import com.matrix.component.ueditor.UeditorProperties; import com.matrix.core.exception.GlobleException; import com.matrix.core.tools.LogUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; /** * 百度编辑器控制器 * * @author jiangyouyao * */ @Controller @RequestMapping(value = "admin/beditor") public class UeditorController { @Autowired UeditorProperties ueditorProperties; /** * 百度编辑器主入口方法 * * @author jiangyouyao * @email 512061637@qq.com * @date 2019年1月8日 * @param request * @param response */ @RequestMapping(value = "/config") public void config(HttpServletRequest request, HttpServletResponse response) { response.setContentType("application/json"); String rootPath = request.getSession().getServletContext().getRealPath("/"); try { String exec = new ActionEnter(request, rootPath,ueditorProperties).exec(); PrintWriter writer = response.getWriter(); writer.write(exec); writer.flush(); writer.close(); } catch (IOException e) { LogUtil.error("百度编辑器错误", e); throw new GlobleException("系统繁忙,请稍后再试"); } } }