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

colesico.framework.telehttp.HttpTeleWriter Maven / Gradle / Ivy

package colesico.framework.telehttp;

import colesico.framework.http.HttpContext;
import colesico.framework.http.HttpRequest;
import colesico.framework.http.HttpResponse;
import colesico.framework.teleapi.TeleWriter;

import javax.inject.Provider;

/**
 * Basic tel-writer for interaction over http
 * @param  value type
 * @param  writing context
 */
abstract public class HttpTeleWriter implements TeleWriter {

    protected final Provider httpContextProv;

    /**
     * Constructor for injection
     */
    public HttpTeleWriter(Provider httpContextProv) {
        this.httpContextProv = httpContextProv;
    }

    /**
     * Constructor for proxies
     */
    public HttpTeleWriter(HttpTeleWriter writer) {
        this.httpContextProv = writer.httpContextProv;
    }

    protected final HttpRequest getRequest() {
        return httpContextProv.get().getRequest();
    }

    protected final HttpResponse getResponse() {
        return httpContextProv.get().getResponse();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy