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

robaho.net.httpserver.http2.hpack.HTTP2HeaderField Maven / Gradle / Ivy

Go to download

A zero dependency implements of the JDK httpserver designed for Virtual Threads. Includes websocket support.

There is a newer version: 1.0.11
Show newest version
package robaho.net.httpserver.http2.hpack;

public class HTTP2HeaderField {

	public String name;
	public String value;
    public String normalizedName;

    public HTTP2HeaderField() {
    }
    
    public HTTP2HeaderField(String name, String value) {
        this.name = name;
        this.value = value;
        this.normalizedName = normalize(name);
    }

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
        this.normalizedName = normalize(name);
	}
	public void setName(String name,String normalizedName) {
		this.name = name;
        this.normalizedName = normalizedName;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
    
    @Override
    public String toString() {
        return name + ": " + value;
    }

    public boolean isPseudoHeader() {
        return name.startsWith(":");
    }

    public static String normalize(String value) {
        if (value == null || value.isEmpty()) {
            return value;
        }
        return Character.toUpperCase(value.charAt(0)) + value.substring(1);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy