- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
...
private enum CSPTitle {
CONTENT_SECURITY_POLICY, X_CONTENT_SECURITY_POLICY, X_WEBKIT_CSP;
public String getName() {
return WordUtils.capitalizeFully(this.name(), new char[] { '_' }).replace('_', '-');
}
}
...
public Map<String, String> getHeaders(boolean disableXWebkitCspHeader, StringBuilder cspHeaderBodyBuilder){
Map<String, String> cspHeaders = new HashMap<>();
for (CSPTitle cspTitle : CSPTitle.values()) {
if (disableXWebkitCspHeader && CSPTitle.X_WEBKIT_CSP.equals(cspTitle)) {
continue;
}
String cspHeaderBody = cspHeaderBodyBuilder.toString();
if (CSPTitle.X_CONTENT_SECURITY_POLICY.equals(cspTitle)) {
cspHeaderBody = processXCSPHeader(cspHeaderBody);
}
cspHeaders.put(cspTitle.getName(), cspHeaderBody.trim());
}
return cspHeaders;
}
....
reizy 14.11.2017 21:13 # 0