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

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

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

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

import java.io.IOException;
import java.util.Locale;

import org.analogweb.Headers;
import org.analogweb.ReadableBuffer;
import org.analogweb.RequestPath;
import org.analogweb.core.AbstractRequestContext;

/**
 * @author snowgooseyk
 */
public class FullHttpRequestContext extends AbstractRequestContext {

	private final FullHttpRequest ex;

	public FullHttpRequestContext(FullHttpRequest ex, RequestPath requestPath,
			Locale defaultLocale) {
		super(requestPath, defaultLocale);
		this.ex = ex;
	}

	protected FullHttpRequest getFullHttpRequest() {
		return this.ex;
	}

	@Override
	public ReadableBuffer getRequestBody() throws IOException {
		return ByteBufReadableBuffer.readBuffer(getFullHttpRequest().content());
	}

	@Override
	public Headers getRequestHeaders() {
		return new FullHttpHeaders(getFullHttpRequest().headers());
	}

	@Override
	public String getRequestMethod() {
		return getFullHttpRequest().method().name();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy