• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java JettyModule类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中io.bootique.jetty.JettyModule的典型用法代码示例。如果您正苦于以下问题:Java JettyModule类的具体用法?Java JettyModule怎么用?Java JettyModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

JettyModule类属于io.bootique.jetty包,在下文中一共展示了JettyModule类的36个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startApp

点赞 3

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
private void startApp(String config) {

        Module extensions = (binder) -> {
            JerseyModule.extend(binder).addResource(Resource.class);

            // TODO: this test is seriously dirty.. we don't start the client from Bootique,
            // yet we reuse Bootique Logback configuration for client logging.
            // so here we are turning off logging from the server....
            BQCoreModule.extend(binder)
                    .setLogLevel("org.eclipse.jetty.server", Level.OFF)
                    .setLogLevel("org.eclipse.jetty.util", Level.OFF);
        };

        Function<BQRuntime, Boolean> startupCheck = r -> r.getInstance(Server.class).isStarted();

        serverFactory.app("--server", "--config=src/test/resources/io/bootique/jersey/client/" + config)
                .modules(JettyModule.class, JerseyModule.class, LogbackModule.class)
                .module(extensions)
                .startupCheck(startupCheck)
                .start();
    }
 

开发者ID:bootique,
项目名称:bootique-jersey-client,
代码行数:22,
代码来源:HttpClientFactoryFactory_LoggingIT.java

示例2: testIgnorePaths

点赞 3

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testIgnorePaths() {
    app.app()
            .module(JettyModule.class)
            .module(TapestryModule.class)
            .module(b -> {
                TapestryModule.extend(b).addIgnoredPath("/ignored_by_tapestry/*");
                JettyModule.extend(b).useDefaultServlet();
            })
            .property("bq.tapestry.appPackage", "io.bootique.tapestry.testapp1")
            .property("bq.jetty.staticResourceBase", "classpath:docroot")
            .start();

    assertHtml("/", "Index", "[xyz]");
    assertHtml("/ignored_by_tapestry/static.html", "Static", "I am a static file");
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:17,
代码来源:TapestryModuleIT.java

示例3: testRun

点赞 3

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testRun() {

    CommandOutcome outcome = testFactory.app("-s")
            .module(b -> JettyModule.extend(b).addServlet(new TestServlet(), "x", "/"))
            .run();

    assertTrue(outcome.isSuccess());
    assertTrue(outcome.forkedToBackground());

    // testing that the server is in the operational state by the time ServerCommand exits...
    WebTarget base = ClientBuilder.newClient().target("http://localhost:8080");

    Response r = base.path("/").request().get();
    assertEquals(Response.Status.OK.getStatusCode(), r.getStatus());
    assertEquals("Hello World!", r.readEntity(String.class));
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:18,
代码来源:ServerCommandIT.java

示例4: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
    JettyModule.extend(binder).addMappedListener(new TypeLiteral<MappedListener<ShiroWebMDCCleaner>>() {
    });
    ShiroModule.extend(binder).addAuthListener(OnAuthMDCInitializer.class);
    ShiroWebModule.extend(binder).setFilter("mdc", SubjectMDCInitializer.class);
}
 

开发者ID:bootique,
项目名称:bootique-shiro,
代码行数:8,
代码来源:ShiroWebMDCModule.java

示例5: beforeClass

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {

    SERVER_APP_FACTORY.app("--server")
            .modules(JettyModule.class, JerseyModule.class)
            .module(b -> JerseyModule.extend(b).addResource(Resource.class))
            .run();
}
 

开发者ID:bootique,
项目名称:bootique-jersey-client,
代码行数:9,
代码来源:HttpHealthCheckIT.java

示例6: beforeClass

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {

    Module jersey = binder -> JerseyModule.extend(binder).addResource(Resource.class);

    SERVER_APP_FACTORY.app("--server")
            .modules(JettyModule.class, JerseyModule.class)
            .module(jersey)
            .run();
}
 

开发者ID:bootique,
项目名称:bootique-jersey-client,
代码行数:11,
代码来源:InstrumentedClientIT.java

示例7: startJetty

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@BeforeClass
public static void startJetty() {
    Module jersey = (binder) -> JerseyModule.extend(binder).addResource(Resource.class);
    Function<BQRuntime, Boolean> startupCheck = r -> r.getInstance(Server.class).isStarted();

    SERVER_APP = SERVER_APP_FACTORY.app("--server")
            .modules(JettyModule.class, JerseyModule.class)
            .module(jersey)
            .startupCheck(startupCheck)
            .start();
}
 

开发者ID:bootique,
项目名称:bootique-jersey-client,
代码行数:12,
代码来源:ProviderInjectionIT.java

示例8: beforeClass

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
    Module jersey = (binder) -> JerseyModule.extend(binder).addResource(Resource.class);
    Function<BQRuntime, Boolean> startupCheck = r -> r.getInstance(Server.class).isStarted();

    SERVER_APP = SERVER_APP_FACTORY.app("--server")
            .modules(JettyModule.class, JerseyModule.class)
            .module(jersey)
            .startupCheck(startupCheck)
            .start();
}
 

开发者ID:bootique,
项目名称:bootique-jersey-client,
代码行数:12,
代码来源:HttpClientFactoryFactoryIT.java

示例9: beforeClass

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws InterruptedException {

    Module jersey = (binder) -> JerseyModule.extend(binder).addResource(Resource.class);
    Function<BQRuntime, Boolean> startupCheck = r -> r.getInstance(Server.class).isStarted();

    SERVER_APP = SERVER_APP_FACTORY.app("--server")
            .modules(JettyModule.class, JerseyModule.class)
            .module(jersey)
            .startupCheck(startupCheck)
            .start();
}
 

开发者ID:bootique,
项目名称:bootique-jersey-client,
代码行数:13,
代码来源:CustomFeaturesIT.java

示例10: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
    TapestryModule.extend(binder).initAllExtensions().addTapestryModule(GuiceTapestryModule.class);
    TypeLiteral<MappedFilter<BQTapestryFilter>> tf = new TypeLiteral<MappedFilter<BQTapestryFilter>>() {
    };
    JettyModule.extend(binder).addMappedFilter(tf);

    // decrease default verbosity...
    BQCoreModule.extend(binder)
            .setLogLevel("org.apache.tapestry5.modules.TapestryModule.ComponentClassResolver", Level.WARNING)
            .setLogLevel("io.bootique.tapestry.filter.BQTapestryFilter", Level.WARNING);
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:13,
代码来源:TapestryModule.java

示例11: testGetRegistry_BeforeStart

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testGetRegistry_BeforeStart() {
    BQRuntime runtime = app.app()
            .module(JettyModule.class)
            .module(TapestryModule.class)
            .property("bq.tapestry.appPackage", "no.such.package")
            // create runtime, but do not start .. no registry yet
            .createRuntime();

    Optional<Registry> registry = runtime.getInstance(TapestryEnvironment.class).getRegistry();
    Assert.assertFalse(registry.isPresent());
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:13,
代码来源:TapestryServletEnvironmentIT.java

示例12: testGetRegistry

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testGetRegistry() {
    BQRuntime runtime = app.app()
            .module(JettyModule.class)
            .module(TapestryModule.class)
            .property("bq.tapestry.appPackage", "no.such.package")
            .start();

    Optional<Registry> registry = runtime.getInstance(TapestryEnvironment.class).getRegistry();
    Assert.assertTrue(registry.isPresent());
    assertNotNull(registry.get().getService(ComponentClassResolver.class));
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:13,
代码来源:TapestryServletEnvironmentIT.java

示例13: testPageRender_Index

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testPageRender_Index() {
    app.app()
            .module(JettyModule.class)
            .module(TapestryModule.class)
            .property("bq.tapestry.appPackage", "io.bootique.tapestry.testapp1")
            .start();

    assertHtml("/", "Index", "[xyz]");
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:11,
代码来源:TapestryModuleIT.java

示例14: testPageRender_Page2

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testPageRender_Page2() {
    app.app()
            .modules(JettyModule.class, TapestryModule.class)
            .property("bq.tapestry.appPackage", "io.bootique.tapestry.testapp1")
            .start();

    assertHtml("/page2", "I am wrapped", "[I am page2 body]");
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:10,
代码来源:TapestryModuleIT.java

示例15: testPageRender_T5_Injection

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testPageRender_T5_Injection() {
    app.app()
            .modules(JettyModule.class, TapestryModule.class)
            .property("bq.tapestry.appPackage", "io.bootique.tapestry.testapp2")
            .property("bq.tapestry.name", "testapp2")
            .start();

    assertHtml("/", "Index", "[III]");
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:11,
代码来源:TapestryModuleIT.java

示例16: testPageRender_T5_BQInjection

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testPageRender_T5_BQInjection() {
    app.app()
            .modules(JettyModule.class, TapestryModule.class, TestApp2BootiqueModule.class)
            .property("bq.tapestry.appPackage", "io.bootique.tapestry.testapp2")
            .property("bq.tapestry.name", "testapp2")
            .start();

    assertHtml("/bqservices", "BQServices", "{III}");
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:11,
代码来源:TapestryModuleIT.java

示例17: testPageRender_T5_BQInjection_Annotations

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testPageRender_T5_BQInjection_Annotations() {
    app.app("testarg", "testarg2")
            .modules(JettyModule.class, TapestryModule.class, TestApp2BootiqueModule.class)
            .property("bq.tapestry.appPackage", "io.bootique.tapestry.testapp2")
            .property("bq.tapestry.name", "testapp2")
            .start();

    assertHtml("/bqannotatedservices", "BQAnnotatedServices", "testarg_testarg2");
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:11,
代码来源:TapestryModuleIT.java

示例18: testPageRender_LibComponent

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testPageRender_LibComponent() {
    app.app()
            .module(JettyModule.class)
            .module(TapestryModule.class)
            .module(b -> TapestryModule.extend(b)
                    .addLibraryMapping(new LibraryMapping("lib", "io.bootique.tapestry.testlib1")))
            .property("bq.tapestry.appPackage", "io.bootique.tapestry.testapp2")
            .start();

    assertHtml("/bqpagewithlibcomponent", "Index with Lib", "<b>__val__</b>");
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:13,
代码来源:TapestryModuleIT.java

示例19: testPageRender_T5Modules

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testPageRender_T5Modules() {
    app.app()
            .module(JettyModule.class)
            .module(TapestryModule.class)
            .module(b -> TapestryModule.extend(b).addTapestryModule(TestApp3Module.class))
            .property("bq.tapestry.appPackage", "io.bootique.tapestry.testapp3")
            .start();

    assertHtml("/page1", "Testapp3 Page1", ":DeferredServiceImpl:");
}
 

开发者ID:bootique,
项目名称:bootique-tapestry,
代码行数:12,
代码来源:TapestryModuleIT.java

示例20: app

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public Builder app(String... args) {

    return super.app(args).module((binder) -> {
        JettyModule.extend(binder).addServlet(BomServlet.class).addFilter(BomFilter.class);
    });
}
 

开发者ID:bootique,
项目名称:bootique-bom,
代码行数:8,
代码来源:JettyApp.java

示例21: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
    JettyModule.extend(binder)
            .addMappedListener(new TypeLiteral<MappedListener<RequestTimer>>() {
            })
            .addMappedListener(new TypeLiteral<MappedListener<RequestMDCManager>>() {
            });

    HealthCheckModule.extend(binder).addHealthCheckGroup(JettyHealthCheckGroup.class);
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:11,
代码来源:InstrumentedJettyModule.java

示例22: startRuntime

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
private BQRuntime startRuntime(String config, Servlet servlet) {
    BQRuntime runtime = app.app("-s", "-c", config)
            .module(
            b -> JettyModule.extend(b).addServlet(servlet, "s1", "/*"))
            .createRuntime();

    runtime.run();
    return runtime;
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:10,
代码来源:ThreadPoolTester.java

示例23: testTlsConnector

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testTlsConnector() throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException {

    testFactory.app("-s", "-c", "classpath:io/bootique/jetty/server/HttpsConnector.yml")
            .autoLoadModules()
            .module(b -> JettyModule.extend(b).addServlet(ContentServlet.class))
            .run();

    Response r1HTTPS = createHttpsClient("testkeystore").request().get();
    assertEquals(Response.Status.OK.getStatusCode(), r1HTTPS.getStatus());
    assertEquals(OUT_CONTENT + "_true", r1HTTPS.readEntity(String.class));
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:13,
代码来源:HttpsConnectorIT.java

示例24: testTlsConnector_MultiCert

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testTlsConnector_MultiCert() throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException {

    testFactory.app("-s", "-c", "classpath:io/bootique/jetty/server/HttpsMultiCertConnector.yml")
            .autoLoadModules()
            .module(b -> JettyModule.extend(b).addServlet(ContentServlet.class))
            .run();

    // TODO: how do we verify that "jetty2" certificate was used, and noth "jetty1"?

    Response r1HTTPS = createHttpsClient("testmulticertkeystore").request().get();
    assertEquals(Response.Status.OK.getStatusCode(), r1HTTPS.getStatus());
    assertEquals(OUT_CONTENT + "_true", r1HTTPS.readEntity(String.class));
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:15,
代码来源:HttpsConnectorIT.java

示例25: testMaxFormContentSize

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testMaxFormContentSize() {

    testFactory.app("-s", "-c", "classpath:io/bootique/jetty/server/MaxFormSettingsIT_10b_request.yml")
            .autoLoadModules()
            .module(b -> JettyModule.extend(b).addServlet(ContentServlet.class))
            .run();

    Response belowThreshold = target
            .request()
            .post(Entity.entity("a=1234567", MediaType.APPLICATION_FORM_URLENCODED_TYPE));

    assertEquals(200, belowThreshold.getStatus());
    assertEquals("[1234567]", belowThreshold.readEntity(String.class));

    Response aboveThreshold = target
            .request()
            .post(Entity.entity("a=123456789", MediaType.APPLICATION_FORM_URLENCODED_TYPE));

    assertEquals(500, aboveThreshold.getStatus());

    // the size limit includes the full form with keys and "=" signs...
    Response atThreshold = target
            .request()
            .post(Entity.entity("a=12345678", MediaType.APPLICATION_FORM_URLENCODED_TYPE));

    assertEquals(200, atThreshold.getStatus());
    assertEquals("[12345678]", atThreshold.readEntity(String.class));
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:30,
代码来源:MaxFormSettingsIT.java

示例26: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {

    JettyModule.extend(binder).addMappedServlet(new TypeLiteral<MappedServlet<ServletContainer>>() {
    });

    JerseyModule.extend(binder).initAllExtensions();
}
 

开发者ID:bootique,
项目名称:bootique-jersey,
代码行数:9,
代码来源:JerseyModule.java

示例27: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
    extend(binder).initAllExtensions();
    JettyModule.extend(binder).addMappedFilter(new TypeLiteral<MappedFilter<ShiroFilter>>() {
    });
}
 

开发者ID:bootique,
项目名称:bootique-shiro,
代码行数:7,
代码来源:ShiroWebModule.java

示例28: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
    JettyModule.extend(binder).addMappedServlet(new TypeLiteral<MappedServlet<HealthCheckServlet>>() {
    });
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:6,
代码来源:JettyMetricsModule.java

示例29: overrides

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public Collection<Class<? extends Module>> overrides() {
	return Collections.singleton(JettyModule.class);
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:5,
代码来源:InstrumentedJettyModuleProvider.java

示例30: app

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
/**
 * @return a new instance of builder for the test runtime stack.
 * @since 0.20
 */
@Override
public Builder app(String... args) {
    Function<BQRuntime, Boolean> startupCheck = r -> r.getInstance(Server.class).isStarted();
    return new Builder(runtimes, args).startupCheck(startupCheck).modules(JettyModule.class);
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:10,
代码来源:JettyTestFactory.java

示例31: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
	TypeLiteral<MappedServlet<ServletCheckingState>> st = new TypeLiteral<MappedServlet<ServletCheckingState>>() {};
	JettyModule.extend(binder).addMappedServlet(st);
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:6,
代码来源:ServletEnvironmentIT.java

示例32: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
    JettyModule.extend(binder).addFilter(AnnotatedFilter.class);
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:5,
代码来源:AnnotatedFilterIT.java

示例33: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
    JettyModule.extend(binder).addServlet(AnnotatedServlet.class);
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:5,
代码来源:AnnotatedServletIT.java

示例34: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
    JettyModule.extend(binder).addServlet(NotAnnotatedServlet.class);
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:5,
代码来源:NotAnnotatedServletIT.java

示例35: configure

点赞 2

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
    JettyModule.extend(binder).addServlet(ContentServlet.class);
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:5,
代码来源:ServerFactoryConnectorsIT.java

示例36: testInitParametersPassed

点赞 1

import io.bootique.jetty.JettyModule; //导入依赖的package包/类
@Test
public void testInitParametersPassed() {

    BQRuntime runtime = testFactory.app("-s")
            .module(b -> JettyModule.extend(b).addServlet(new TestServlet(), "s1", "/*"))
            .createRuntime();

    runtime.run();

    WebTarget base = ClientBuilder.newClient().target("http://localhost:8080");

    Response r1 = base.path("/").request().get();
    assertEquals(Status.OK.getStatusCode(), r1.getStatus());

    assertEquals("test_servlet", r1.readEntity(String.class));

    MetricRegistry metrics = runtime.getInstance(MetricRegistry.class);

    Collection<Timer> timers = metrics.getTimers().values();
    assertEquals(1, timers.size());

    Timer timer = timers.iterator().next();
    assertEquals(1, timer.getCount());

    base.path("/").request().get().close();
    assertEquals(2, timer.getCount());
}
 

开发者ID:bootique,
项目名称:bootique-jetty,
代码行数:28,
代码来源:RequestTimerIT.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)