mirror of https://github.com/rusefi/rusefi-1.git
refactoring
This commit is contained in:
parent
d08f2a4e0c
commit
ca03f9cf4d
|
@ -6,6 +6,7 @@ import org.takes.Take;
|
||||||
import org.takes.facets.fork.FkRegex;
|
import org.takes.facets.fork.FkRegex;
|
||||||
import org.takes.facets.fork.TkFork;
|
import org.takes.facets.fork.TkFork;
|
||||||
import org.takes.http.Exit;
|
import org.takes.http.Exit;
|
||||||
|
import org.takes.http.Front;
|
||||||
import org.takes.http.FtBasic;
|
import org.takes.http.FtBasic;
|
||||||
import org.takes.misc.Href;
|
import org.takes.misc.Href;
|
||||||
import org.takes.rq.RqHref;
|
import org.takes.rq.RqHref;
|
||||||
|
@ -18,32 +19,30 @@ import javax.json.JsonObject;
|
||||||
public class ServerSandbox {
|
public class ServerSandbox {
|
||||||
|
|
||||||
public static void main(final String... args) throws Exception {
|
public static void main(final String... args) throws Exception {
|
||||||
new FtBasic(
|
Take fork = new TkFork(
|
||||||
new TkFork(
|
new FkRegex("/list", new Take() {
|
||||||
new FkRegex("/list", new Take() {
|
@Override
|
||||||
@Override
|
public Response act(Request request) throws Exception {
|
||||||
public Response act(Request request) throws Exception {
|
Href href = new RqHref.Base(request).href();
|
||||||
Href href = new RqHref.Base(request).href();
|
|
||||||
// URI uri = href.uri();
|
// URI uri = href.uri();
|
||||||
Iterable<String> values = href.param("user");
|
Iterable<String> values = href.param("user");
|
||||||
String name = values.iterator().next();
|
String name = values.iterator().next();
|
||||||
|
|
||||||
|
|
||||||
JsonArray result = Json.createArrayBuilder()
|
JsonArray result = Json.createArrayBuilder()
|
||||||
.add(Json.createObjectBuilder().add("name", name))
|
.add(Json.createObjectBuilder().add("name", name))
|
||||||
.add(Json.createObjectBuilder().add("name", name))
|
.add(Json.createObjectBuilder().add("name", name))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
return new RsJson(result);
|
return new RsJson(result);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new FkRegex("/", "hello, world!")
|
new FkRegex("/", "hello, world!")
|
||||||
|
);
|
||||||
|
Front ftBasic = new FtBasic(fork, 8080);
|
||||||
), 8080
|
ftBasic.start(Exit.NEVER);
|
||||||
).start(Exit.NEVER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue