| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.common.R; |
| | | import com.zy.common.constant.MesConstant; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | |
| | | */ |
| | | public class Http { |
| | | |
| | | public static void response(HttpServletResponse response, String baseRes){ |
| | | public static void response(HttpServletResponse response, String baseRes) { |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.setContentType("application/json; charset=utf-8"); |
| | | try (PrintWriter out = response.getWriter()) { |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void cors(HttpServletResponse response) { |
| | | // 跨域设置 |
| | | response.setHeader("Access-Control-Max-Age", "3600"); |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "*"); |
| | | response.setHeader("Access-Control-Allow-Headers", "*"); |
| | | response.setHeader("Access-Control-Expose-Headers", MesConstant.TOKEN_HEADER_NAME); |
| | | } |
| | | |
| | | } |