License and code format

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-08-26 21:27:37 -03:00
parent 236f1597a2
commit d41b528221
1 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,18 @@
/**
* Copyright 2019 The CloudEvents Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.cloudevents.v03.http;
import static java.util.stream.Collectors.toMap;
@ -10,6 +25,7 @@ import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicReference;
import io.cloudevents.fun.BinaryFormatAttributeMapper;
import io.cloudevents.v03.ContextAttributes;
/**
*
@ -41,11 +57,13 @@ public class BinaryFormatAttributeMapperImpl implements BinaryFormatAttributeMap
}
})
.filter(header -> header.getKey().startsWith(HEADER_PREFIX))
.map(header -> new SimpleEntry<>(header.getKey().substring(HEADER_PREFIX.length()), header.getValue()))
.map(header -> new SimpleEntry<>(header.getKey()
.substring(HEADER_PREFIX.length()), header.getValue()))
.map(header -> new SimpleEntry<>(header.getKey(), header.getValue().toString()))
.collect(toMap(Entry::getKey, Entry::getValue));
result.put("datacontenttype", ct.get().getValue().toString());
result.put(ContextAttributes.datacontenttype.name(),
ct.get().getValue().toString());
return result;
}