use of com.github.dreamhead.moco.internal.ActualHttpServer in project moco by dreamhead.
the class SessionSetting method newHttpServer.
public ActualHttpServer newHttpServer(final Optional<Integer> port, final MocoConfig[] configs) {
if (isResource()) {
ActualRestServer server = new ActualRestServer(port, Optional.<HttpsCertificate>absent(), log(), configs);
RestSetting[] settings = resource.getSettings();
server.resource(resource.getName(), head(settings), tail(settings));
return server;
}
ActualHttpServer server = ActualHttpServer.createLogServer(port, configs);
bindTo(server);
return server;
}
use of com.github.dreamhead.moco.internal.ActualHttpServer in project moco by dreamhead.
the class HttpServerParser method createServer.
@Override
protected HttpServer createServer(final ImmutableList<SessionSetting> sessionSettings, final Optional<Integer> port, final MocoConfig... configs) {
ActualHttpServer targetServer = ActualHttpServer.createLogServer(port, configs);
for (SessionSetting session : sessionSettings) {
logger.debug("Parse session: {}", session);
targetServer = targetServer.mergeServer(session.newHttpServer(port, configs));
}
return targetServer;
}
use of com.github.dreamhead.moco.internal.ActualHttpServer in project moco by dreamhead.
the class HttpServerParser method createServer.
@Override
protected HttpServer createServer(final ImmutableList<SessionSetting> sessionSettings, final int port, final MocoConfig... configs) {
ActualHttpServer targetServer = ActualHttpServer.createLogServer(port, configs);
for (SessionSetting session : sessionSettings) {
logger.debug("Parse session: {}", session);
targetServer = targetServer.mergeServer(session.newHttpServer(port, configs));
}
return targetServer;
}
use of com.github.dreamhead.moco.internal.ActualHttpServer in project moco by dreamhead.
the class MocoJsonRunner method jsonHttpsServer.
public static HttpsServer jsonHttpsServer(final Resource resource, final HttpsCertificate certificate) {
checkNotNull(certificate, "Certificate should not be null");
ActualHttpServer httpsServer = (ActualHttpServer) Moco.httpsServer(certificate);
return httpsServer.mergeServer((ActualHttpServer) parseHttpServer(checkNotNull(resource, "resource should not be null"), 0));
}
use of com.github.dreamhead.moco.internal.ActualHttpServer in project moco by dreamhead.
the class MocoJsonRunner method jsonHttpsServer.
public static HttpsServer jsonHttpsServer(final int port, final Resource resource, final HttpsCertificate certificate) {
checkArgument(port > 0, "Port must be greater than zero");
checkNotNull(certificate, "Certificate should not be null");
ActualHttpServer httpsServer = (ActualHttpServer) Moco.httpsServer(port, certificate);
return httpsServer.mergeServer((ActualHttpServer) parseHttpServer(checkNotNull(resource, "resource should not be null"), port));
}
Aggregations