java - servlet可以结合CROS实现ajax跨域访问吗?如何做?
大家讲道理
大家讲道理 2017-04-18 09:17:21
0
3
384

如题目中描述

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
PHPzhong

You don’t need to raise your hand to ask these questions...

http://www.open-open.com/lib/view/open1463878352785.html

Peter_Zhu

If it is servlet的话,那简简单单一个filter, it can be done, and someone has already done it, just use it: cors-filter.

If your problem is that you don’t understand cross-domain, then you have to read: Building public APIs and CORS

Peter_Zhu
public class CorsConfigurerAdapter extends WebMvcConfigurerAdapter{

  @Override
  public void addCorsMappings(CorsRegistry registry) {
    
    registry.addMapping("/api/*").allowedOrigins("*");
  }
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template