提交
This commit is contained in:
parent
1a7c7f2225
commit
85a8d27795
@ -1,20 +1,17 @@
|
|||||||
package cc.iteachyou.cms.common;
|
package cc.iteachyou.cms.common;
|
||||||
|
|
||||||
import java.io.IOException;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import java.io.PrintWriter;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
import java.io.Serializable;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import java.io.PrintWriter;
|
||||||
|
import java.io.Serializable;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* controller基类,实现将JSON格式结果的输出方法
|
* controller基类,实现将JSON格式结果的输出方法
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -33,9 +30,9 @@ public class BaseController implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从Session中取得用户信息
|
* 从Session中取得用户信息
|
||||||
|
*
|
||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
public Object getLoginUser() {
|
public Object getLoginUser() {
|
||||||
@ -49,6 +46,7 @@ public class BaseController implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 取得HttpServletRequest对象
|
* 取得HttpServletRequest对象
|
||||||
|
*
|
||||||
* @return HttpServletRequest对象
|
* @return HttpServletRequest对象
|
||||||
*/
|
*/
|
||||||
public HttpServletRequest getRequest() {
|
public HttpServletRequest getRequest() {
|
||||||
@ -57,6 +55,7 @@ public class BaseController implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 取得Response对象
|
* 取得Response对象
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public HttpServletResponse getResponse() {
|
public HttpServletResponse getResponse() {
|
||||||
@ -65,6 +64,7 @@ public class BaseController implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换字符串为json 格式
|
* 转换字符串为json 格式
|
||||||
|
*
|
||||||
* @param str 普通字符串
|
* @param str 普通字符串
|
||||||
*/
|
*/
|
||||||
public void outJsonString(String str) {
|
public void outJsonString(String str) {
|
||||||
@ -74,6 +74,7 @@ public class BaseController implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换字符串为json 格式,并设置ContentType为text/html
|
* 转换字符串为json 格式,并设置ContentType为text/html
|
||||||
|
*
|
||||||
* @param str 普通字符串
|
* @param str 普通字符串
|
||||||
*/
|
*/
|
||||||
public void outJson(Object obj) {
|
public void outJson(Object obj) {
|
||||||
@ -83,6 +84,7 @@ public class BaseController implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 输出字符串到页面
|
* 输出字符串到页面
|
||||||
|
*
|
||||||
* @param str 字符
|
* @param str 字符
|
||||||
*/
|
*/
|
||||||
public void outString(String str) {
|
public void outString(String str) {
|
||||||
@ -100,6 +102,7 @@ public class BaseController implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 输出xml文本串到页面
|
* 输出xml文本串到页面
|
||||||
|
*
|
||||||
* @param xmlStr xml串
|
* @param xmlStr xml串
|
||||||
*/
|
*/
|
||||||
public void outXMLString(String xmlStr) {
|
public void outXMLString(String xmlStr) {
|
||||||
|
@ -1,67 +1,29 @@
|
|||||||
package cc.iteachyou.cms.controller;
|
package cc.iteachyou.cms.controller;
|
||||||
|
|
||||||
import java.io.File;
|
import cc.iteachyou.cms.common.*;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
import com.wf.captcha.ArithmeticCaptcha;
|
|
||||||
import com.wf.captcha.utils.CaptchaUtil;
|
|
||||||
|
|
||||||
import cc.iteachyou.cms.common.BaseController;
|
|
||||||
import cc.iteachyou.cms.common.ExceptionEnum;
|
|
||||||
import cc.iteachyou.cms.common.ResponseResult;
|
|
||||||
import cc.iteachyou.cms.common.SearchEntity;
|
|
||||||
import cc.iteachyou.cms.common.StateCodeEnum;
|
|
||||||
import cc.iteachyou.cms.entity.Archives;
|
|
||||||
import cc.iteachyou.cms.entity.Attachment;
|
|
||||||
import cc.iteachyou.cms.entity.Category;
|
|
||||||
import cc.iteachyou.cms.entity.Field;
|
|
||||||
import cc.iteachyou.cms.entity.Form;
|
|
||||||
import cc.iteachyou.cms.entity.SearchRecord;
|
|
||||||
import cc.iteachyou.cms.entity.System;
|
import cc.iteachyou.cms.entity.System;
|
||||||
import cc.iteachyou.cms.entity.Theme;
|
import cc.iteachyou.cms.entity.*;
|
||||||
import cc.iteachyou.cms.exception.AdminGeneralException;
|
import cc.iteachyou.cms.exception.*;
|
||||||
import cc.iteachyou.cms.exception.CmsException;
|
import cc.iteachyou.cms.service.*;
|
||||||
import cc.iteachyou.cms.exception.FormParameterException;
|
|
||||||
import cc.iteachyou.cms.exception.TemplateNotFoundException;
|
|
||||||
import cc.iteachyou.cms.exception.TemplateReadException;
|
|
||||||
import cc.iteachyou.cms.exception.TransactionException;
|
|
||||||
import cc.iteachyou.cms.service.ArchivesService;
|
|
||||||
import cc.iteachyou.cms.service.AttachmentService;
|
|
||||||
import cc.iteachyou.cms.service.CategoryService;
|
|
||||||
import cc.iteachyou.cms.service.FieldService;
|
|
||||||
import cc.iteachyou.cms.service.FormService;
|
|
||||||
import cc.iteachyou.cms.service.SearchRecordService;
|
|
||||||
import cc.iteachyou.cms.service.SystemService;
|
|
||||||
import cc.iteachyou.cms.service.ThemeService;
|
|
||||||
import cc.iteachyou.cms.taglib.ParseEngine;
|
import cc.iteachyou.cms.taglib.ParseEngine;
|
||||||
import cc.iteachyou.cms.taglib.utils.URLUtils;
|
import cc.iteachyou.cms.taglib.utils.URLUtils;
|
||||||
import cc.iteachyou.cms.utils.FileConfiguration;
|
import cc.iteachyou.cms.utils.FileConfiguration;
|
||||||
import cc.iteachyou.cms.utils.StringUtil;
|
import cc.iteachyou.cms.utils.StringUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.wf.captcha.ArithmeticCaptcha;
|
||||||
|
import com.wf.captcha.utils.CaptchaUtil;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.*;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@ -90,6 +52,7 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页方法
|
* 首页方法
|
||||||
|
*
|
||||||
* @throws CmsException
|
* @throws CmsException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@ -141,6 +104,7 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 封面方法
|
* 封面方法
|
||||||
|
*
|
||||||
* @param typeid 栏目编码
|
* @param typeid 栏目编码
|
||||||
* @param visitUrl 访问URL
|
* @param visitUrl 访问URL
|
||||||
* @throws CmsException
|
* @throws CmsException
|
||||||
@ -210,6 +174,7 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表方法
|
* 列表方法
|
||||||
|
*
|
||||||
* @param typeid 栏目编码
|
* @param typeid 栏目编码
|
||||||
* @param visitUrl 访问URL
|
* @param visitUrl 访问URL
|
||||||
* @param pageNum 当前页
|
* @param pageNum 当前页
|
||||||
@ -287,6 +252,7 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章详情方法
|
* 文章详情方法
|
||||||
|
*
|
||||||
* @param id 文章ID
|
* @param id 文章ID
|
||||||
* @throws CmsException
|
* @throws CmsException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@ -381,6 +347,7 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章详情方法
|
* 文章详情方法
|
||||||
|
*
|
||||||
* @param id 文章ID
|
* @param id 文章ID
|
||||||
* @throws CmsException
|
* @throws CmsException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@ -407,6 +374,7 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 附件下载
|
* 附件下载
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @throws AdminGeneralException
|
* @throws AdminGeneralException
|
||||||
*/
|
*/
|
||||||
@ -444,6 +412,7 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索
|
* 搜索
|
||||||
|
*
|
||||||
* @param params
|
* @param params
|
||||||
* @throws CmsException
|
* @throws CmsException
|
||||||
*/
|
*/
|
||||||
@ -521,6 +490,7 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 前端投稿
|
* 前端投稿
|
||||||
|
*
|
||||||
* @param params
|
* @param params
|
||||||
* @return
|
* @return
|
||||||
* @throws CmsException
|
* @throws CmsException
|
||||||
@ -654,6 +624,7 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 输出字符串到页面
|
* 输出字符串到页面
|
||||||
|
*
|
||||||
* @param html 字符
|
* @param html 字符
|
||||||
*/
|
*/
|
||||||
public void outHtml(String html) {
|
public void outHtml(String html) {
|
||||||
@ -664,6 +635,7 @@ public class FrontController extends BaseController {
|
|||||||
httpServletResponse.setHeader("Cache-Control", "no-cache");
|
httpServletResponse.setHeader("Cache-Control", "no-cache");
|
||||||
httpServletResponse.setHeader("Cache-Control", "no-store");
|
httpServletResponse.setHeader("Cache-Control", "no-store");
|
||||||
httpServletResponse.setHeader("Pragma", "no-cache");
|
httpServletResponse.setHeader("Pragma", "no-cache");
|
||||||
|
httpServletResponse.setHeader("Cache-Control", "public");
|
||||||
httpServletResponse.setDateHeader("Expires", 0L);
|
httpServletResponse.setDateHeader("Expires", 0L);
|
||||||
httpServletResponse.getWriter().write(html);
|
httpServletResponse.getWriter().write(html);
|
||||||
httpServletResponse.flushBuffer();
|
httpServletResponse.flushBuffer();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user