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

com.thoughtworks.webstub.StubServerFacade Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package com.thoughtworks.webstub;

import com.thoughtworks.webstub.dsl.HttpDsl;
import com.thoughtworks.webstub.server.HttpServer;
import com.thoughtworks.webstub.server.JettyHttpServer;
import com.thoughtworks.webstub.server.ServletContextHandler;
import com.thoughtworks.webstub.stub.HttpServerStub;

public class StubServerFacade implements HttpServer {
    public static StubServerFacade newServer(int port) {
        return new StubServerFacade(new JettyHttpServer(port));
    }

    private HttpServer httpServer;

    private StubServerFacade(HttpServer httpServer) {
        this.httpServer = httpServer;
    }

    public HttpDsl withContext(String contextRoot) {
        return new HttpDsl(new HttpServerStub(httpServer, contextRoot));
    }

    @Override
    public void start() {
        httpServer.start();
    }

    @Override
    public void stop() {
        httpServer.stop();
    }

    @Override
    public void addContext(ServletContextHandler contextHandler) {
        throw new UnsupportedOperationException();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy