org.takes.http.Exit Java Examples

The following examples show how to use org.takes.http.Exit. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TakesApp.java    From tutorials with MIT License 6 votes vote down vote up
public static void main(final String... args) throws IOException, SQLException {
    new FtBasic(
        new TkFallback(
            new TkFork(
                new FkRegex("/", new TakesHelloWorld()),
                new FkRegex("/index", new TakesIndex()),
                new FkRegex("/contact", new TakesContact())
                ),
            new FbChain(
                new FbStatus(404, new RsText("Page Not Found")),
                new FbStatus(405, new RsText("Method Not Allowed")),
                new Fallback() {
                    @Override
                    public Opt<Response> route(final RqFallback req) {
                        return new Opt.Single<Response>(new RsText(req.throwable().getMessage()));
                    }
                })
            ), 6060
        ).start(Exit.NEVER);
}
 
Example #2
Source File: WebServerOperator.java    From java-operator-sdk with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
    log.info("WebServer Operator starting!");

    Config config = new ConfigBuilder().withNamespace(null).build();
    KubernetesClient client = new DefaultKubernetesClient(config);
    Operator operator = new Operator(client);
    operator.registerControllerForAllNamespaces(new WebServerController(client));

    new FtBasic(
            new TkFork(new FkRegex("/health", "ALL GOOD!")), 8080
    ).start(Exit.NEVER);
}
 
Example #3
Source File: MySQLSchemaOperator.java    From java-operator-sdk with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
    log.info("MySQL Schema Operator starting");

    Config config = new ConfigBuilder().withNamespace(null).build();
    KubernetesClient client = new DefaultKubernetesClient(config);
    Operator operator = new Operator(client);
    operator.registerControllerForAllNamespaces(new SchemaController(client));

    new FtBasic(
            new TkFork(new FkRegex("/health", "ALL GOOD!")), 8080
    ).start(Exit.NEVER);
}
 
Example #4
Source File: TkApp.java    From jpeek with MIT License 5 votes vote down vote up
/**
 * Main Java entry point.
 * @param args Command line args
 * @throws IOException If fails
 */
public static void main(final String... args) throws IOException {
    Sentry.init(
        new PropertiesOf(
            new ResourceOf(
                "org/jpeek/jpeek.properties"
            )
        ).value().getProperty("org.jpeek.sentry")
    );
    new FtCli(
        new TkApp(Files.createTempDirectory("jpeek")),
        args
    ).start(Exit.NEVER);
}
 
Example #5
Source File: Entrance.java    From jare with MIT License 5 votes vote down vote up
/**
 * Main entry point.
 * @param args Arguments
 * @throws IOException If fails
 */
public static void main(final String... args) throws IOException {
    Sentry.init(Manifests.read("Jare-SentryDsn"));
    final Base base = new CdBase(new DyBase());
    new Logs(
        base,
        new Region.Simple(
            Manifests.read("Jare-S3Key"),
            Manifests.read("Jare-S3Secret")
        ).bucket("logs.jare.io")
    );
    new FtCli(new TkApp(base), args).start(Exit.NEVER);
}
 
Example #6
Source File: App.java    From takes with MIT License 5 votes vote down vote up
/**
 * Entry point.
 * @param args Arguments
 * @throws IOException If fails
 */
public static void main(final String... args) throws IOException {
    new FtCli(
        new App(new File(System.getProperty("user.dir"))),
        args
    ).start(Exit.NEVER);
}