博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
配置类Configuration怎样使用
阅读量:5066 次
发布时间:2019-06-12

本文共 1799 字,大约阅读时间需要 5 分钟。

public class CorsConfiguration {

/**

* Wildcard representing <em>all</em> origins, methods, or headers.
*/
public static final String ALL = "*";

private static final List<HttpMethod> DEFAULT_METHODS;

static {

List<HttpMethod> rawMethods = new ArrayList<HttpMethod>(2);
rawMethods.add(HttpMethod.GET);
rawMethods.add(HttpMethod.HEAD);
DEFAULT_METHODS = Collections.unmodifiableList(rawMethods);
}

private List<String> allowedOrigins;

private List<String> allowedMethods;

private List<HttpMethod> resolvedMethods = DEFAULT_METHODS;

private List<String> allowedHeaders;

private List<String> exposedHeaders;

private Boolean allowCredentials;

private Long maxAge;

/**
* Construct a new {@code CorsConfiguration} instance with no cross-origin
* requests allowed for any origin by default.
* @see #applyPermitDefaultValues()
*/
public CorsConfiguration() {
}

/**

* Construct a new {@code CorsConfiguration} instance by copying all
* values from the supplied {@code CorsConfiguration}.
*/
public CorsConfiguration(CorsConfiguration other) {
this.allowedOrigins = other.allowedOrigins;
this.allowedMethods = other.allowedMethods;
this.resolvedMethods = other.resolvedMethods;
this.allowedHeaders = other.allowedHeaders;
this.exposedHeaders = other.exposedHeaders;
this.allowCredentials = other.allowCredentials;
this.maxAge = other.maxAge;
}

/**
Set<String> combined = new LinkedHashSet<String>(source);
return new ArrayList<String>(combined);
* Set the origins to allow, e.g. {@code "http://domain1.com"}.
* <p>The special value {@code "*"} allows all domains.
* <p>By default this is not set.
*/
public void setAllowedOrigins(List<String> allowedOrigins) {
this.allowedOrigins = (allowedOrigins != null ? new ArrayList<String>(allowedOrigins) : null);
}

转载于:https://www.cnblogs.com/panxuejun/p/7274947.html

你可能感兴趣的文章
Android UI事件处理
查看>>
Eclipse背景颜色修改
查看>>
使用TabLayout快速实现一个导航栏
查看>>
Web开发的那点事--业务层常用功能
查看>>
中国象棋程序的设计与实现(四)-- 一次“流产”的写书计划
查看>>
DFS BFS 总结
查看>>
浅谈 Python 的 with 语句
查看>>
利用Python语言Appium启动ios app
查看>>
深入理解JavaScript this
查看>>
C#获取引用组件的版本信息
查看>>
sqrt开平方算法解析
查看>>
模运算
查看>>
Android-Activity启动流程
查看>>
[.net]webform 版本冲突
查看>>
Cookie
查看>>
[JDK]找不到或无法加载主类 java
查看>>
(寒假CF)Choosing Symbol Pairs
查看>>
Android studio启动后卡在refreshing gradle project
查看>>
[转]Android中dp,px,sp概念梳理以及如何做到屏幕适配
查看>>
android MotionEvent中getX()和getRawX()的区别
查看>>