package com.jscape.inet.http.protocol.messages;

import com.jscape.util.net.connection.MessageConnection;

import java.io.InputStream;

import static com.jscape.util.Parameters.assertNotNull;

/**
 * @author Alex Usun
 */
public abstract class RequestMessage<H extends RequestMessage.HandlerBase>
        extends Message {

    public final String protocolVersion;
    public final String uri;
    public final Header[] headers;
    public final InputStream body;

    public RequestMessage(String protocolVersion, String uri, Header[] headers, InputStream body) {
        assertNotNull(uri);
        this.uri = uri;

        assertNotNull(protocolVersion);
        this.protocolVersion = protocolVersion;

        assertNotNull(headers);
        this.headers = headers;

        assertNotNull(body);
        this.body = body;
    }

    public abstract void accept(H handler, MessageConnection<Message> connection);

    public interface HandlerBase {

    }
}
