UeController.java 1.16 KB
Newer Older
liqin's avatar
liqin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
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();
        }
    }

}