Reverted Back to basicauth
This commit is contained in:
+5
-15
@@ -59,8 +59,7 @@ public class TemplateMergeService {
|
||||
public String compile(final Template template, final Map<String, Object> scopes) throws MalformedURLException, IOException {
|
||||
this.scopes = scopes;
|
||||
this.scopes.put("static", new TemplateFunctions());
|
||||
final String auth = ThreadLocalContextUtil.getAuthToken();
|
||||
setAuthToken(auth);
|
||||
|
||||
final MustacheFactory mf = new DefaultMustacheFactory();
|
||||
final Mustache mustache = mf.compile(new StringReader(template.getText()), template.getName());
|
||||
|
||||
@@ -129,7 +128,7 @@ public class TemplateMergeService {
|
||||
try {
|
||||
connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
if (this.authToken != null) {
|
||||
connection.setRequestProperty("Authorization", "Bearer " + this.authToken);
|
||||
connection.setRequestProperty("Authorization", "Basic " + this.authToken);
|
||||
}
|
||||
TrustModifier.relaxHostChecking(connection);
|
||||
|
||||
@@ -173,36 +172,27 @@ public class TemplateMergeService {
|
||||
@SuppressWarnings("unchecked")
|
||||
private void expandMapArrays(Object value) {
|
||||
if (value instanceof Map) {
|
||||
System.out.println(value);
|
||||
Map<String, Object> valueAsMap = (Map<String, Object>) value;
|
||||
//Map<String, Object> newValue = null;
|
||||
Map<String,Object> myNewMap = new HashMap<>();
|
||||
Map<String,Object> valueAsMap_second = new HashMap<>();
|
||||
for (Entry<String, Object> valueAsMapEntry : valueAsMap.entrySet()) {
|
||||
System.out.println(valueAsMapEntry);
|
||||
Object valueAsMapEntryValue = valueAsMapEntry.getValue();
|
||||
System.out.println(valueAsMapEntryValue);
|
||||
if (valueAsMapEntryValue instanceof Map) { // JSON Object
|
||||
expandMapArrays(valueAsMapEntryValue);
|
||||
System.out.println(valueAsMapEntryValue);
|
||||
} else if (valueAsMapEntryValue instanceof Iterable) { // JSON Array
|
||||
Iterable<Object> valueAsMapEntryValueIterable = (Iterable<Object>) valueAsMapEntryValue;
|
||||
System.out.println(valueAsMapEntryValue);
|
||||
String valueAsMapEntryKey = valueAsMapEntry.getKey();
|
||||
int i = 0;
|
||||
for (Object object : valueAsMapEntryValueIterable) {
|
||||
System.out.println(valueAsMapEntryValueIterable);
|
||||
myNewMap.put(valueAsMapEntryKey + "#" + i, object);
|
||||
//valueAsMap.putAll(myNewMap);
|
||||
|
||||
valueAsMap_second.put(valueAsMapEntryKey + "#" + i, object);
|
||||
++i;
|
||||
expandMapArrays(object);
|
||||
System.out.println(object);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
valueAsMap.putAll(myNewMap);
|
||||
valueAsMap.putAll(valueAsMap_second);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user