package cn.wisenergy.chnmuseum.party.web.controller; import com.baidu.ueditor.extend.UEActionEnter; import com.baidu.ueditor.extend.UeditorService; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; @RestController @RequestMapping(value = "/ueditor") public class UeController { @Resource(name = "ueditorServiceFastdfsImpl") private UeditorService ueditoreService; @RequestMapping("/dispatch") public void config(HttpServletRequest request, HttpServletResponse response, String action) { String rootPath = request.getSession().getServletContext().getRealPath("/"); try { String exec = new UEActionEnter(request, rootPath, this.ueditoreService).exec(); PrintWriter writer = response.getWriter(); writer.write(exec); writer.flush(); writer.close(); } catch (IOException e) { e.printStackTrace(); } } }