为了账号安全,请及时绑定邮箱和手机立即绑定

没办法OPTIONS缓存


package com.imooc;


import java.io.IOException;


import javax.servlet.Filter;

import javax.servlet.FilterChain;

import javax.servlet.FilterConfig;

import javax.servlet.ServletException;

import javax.servlet.ServletRequest;

import javax.servlet.ServletResponse;

import javax.servlet.http.HttpServletResponse;


import org.springframework.boot.autoconfigure.web.ResourceProperties.Chain;


public class CrosFilter implements Filter {


@Override

public void destroy() {

// TODO Auto-generated method stub


}


@Override

public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)

throws IOException, ServletException {

// TODO Auto-generated method stub

HttpServletResponse res = (HttpServletResponse)arg1;

res.addHeader("Access-Control-Allow-Origin", "*");

res.addHeader("Access-Control-Allow-Methods", "*");

// res.addHeader("Access-Control-Allow-Headers", "Content-Type");

// res.addHeader("Access-Control-Max-Age", "3600");//单位是秒

arg2.doFilter(arg0,arg1);

}


@Override

public void init(FilterConfig arg0) throws ServletException {

// TODO Auto-generated method stub


}


}

得不到OPTIONS缓存

正在回答

1 回答

唉,手欠把disable cache打上勾了……已解决

1 回复 有任何疑惑可以回复我~
#1

空想白夜

同样的问题,前几章的视频是有打勾的¬_¬
2019-01-18 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

没办法OPTIONS缓存

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信