All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.analogweb.netty.FullHttpHeaders Maven / Gradle / Ivy

There is a newer version: 0.12.1
Show newest version
package org.analogweb.netty;

import io.netty.handler.codec.http.HttpHeaders;

import java.util.*;

import org.analogweb.Headers;

/**
 * @author y2k2mt
 */
public class FullHttpHeaders implements Headers {

    private final HttpHeaders source;
    private Map> mapEntry;

    public FullHttpHeaders(HttpHeaders headers) {
        this.source = headers;
    }

    @Override
    public boolean contains(String name) {
        return this.source.contains(name);
    }

    @Override
    public Map> toMap() {
        if (this.mapEntry == null) {
            Set names = this.source.names();
            HashMap> entries = new HashMap>();
            for (String name : this.source.names()) {
                entries.put(name, this.source.getAll(name));
            }
            this.mapEntry = Collections.unmodifiableMap(entries);
        }
        return this.mapEntry;
    }

    @Override
    public List getNames() {
        return new ArrayList(this.source.names());
    }

    @Override
    public List getValues(String name) {
        return this.source.getAll(name);
    }

    @Override
    public void putValue(String name, String value) {
        this.source.add(name, value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy