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

org.webpieces.webserver.impl.ChannelCloser Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package org.webpieces.webserver.impl;

import javax.inject.Singleton;

import com.webpieces.hpack.api.dto.Http2Headers;
import com.webpieces.http2parser.api.dto.lib.Http2HeaderName;

@Singleton
public class ChannelCloser {

	public Void closeIfNeeded(Http2Headers request, ResponseOverrideSender channel) {
		String connHeader = request.getSingleHeaderValue(Http2HeaderName.CONNECTION);
		boolean close = false;
		if(!"keep-alive".equals(connHeader)) {
			close = true;
		} else
			close = false;
		
		if(close)
			channel.close();
		
		return null;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy