Java 类org.glassfish.jersey.server.ApplicationHandler 实例源码

项目:Todo-Jersey-Spring-MyBatis    文件:SpringContextJerseyTest.java   
/**
 * An extending class must implement the {@link #configure()} method to
 * provide an application descriptor.
 *
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest() throws TestContainerException {
    ResourceConfig config = getResourceConfig(configure());
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));

    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:Todo-Jersey-Spring-MyBatis    文件:SpringContextJerseyTest.java   
/**
 * Construct a new instance with a test container factory.
 * <p/>
 * An extending class must implement the {@link #configure()} method to
 * provide an application descriptor.
 *
 * @param testContainerFactory the test container factory to use for testing.
 * @throws TestContainerException if the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest(TestContainerFactory testContainerFactory) {
    setTestContainerFactory(testContainerFactory);

    ResourceConfig config = getResourceConfig(configure());
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));
    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, testContainerFactory);
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:demo-restWS-spring-jersey-jpa2-hibernate    文件:SpringContextJerseyTest.java   
/**
 * An extending class must implement the {@link #configure()} method to
 * provide an application descriptor.
 *
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest() throws TestContainerException {
    ResourceConfig config = getResourceConfig(configure());
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));

    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:demo-restWS-spring-jersey-jpa2-hibernate    文件:SpringContextJerseyTest.java   
/**
 * Construct a new instance with a test container factory.
 * <p/>
 * An extending class must implement the {@link #configure()} method to
 * provide an application descriptor.
 *
 * @param testContainerFactory the test container factory to use for testing.
 * @throws TestContainerException if the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest(TestContainerFactory testContainerFactory) {
    setTestContainerFactory(testContainerFactory);

    ResourceConfig config = getResourceConfig(configure());
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));
    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, testContainerFactory);
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:jersey2-toolkit    文件:HibernateServiceRegistryFactoryTest.java   
/**
 * Test the application binder.
 */
@Test
public void testBinder() {

    ResourceConfig config = new ResourceConfig();
    config.register(TestFeature.class);

    // Make sure it's registered
    Assert.assertTrue(config.isRegistered(TestFeature.class));

    // Create a fake application.
    ApplicationHandler handler = new ApplicationHandler(config);
    ServiceRegistry serviceRegistry = handler
            .getServiceLocator().getService(ServiceRegistry.class);
    Assert.assertNotNull(serviceRegistry);

    // Make sure it's reading from the same place.
    Dialect d = new MetadataSources(serviceRegistry)
            .buildMetadata().getDatabase().getDialect();
    Assert.assertTrue(d instanceof H2Dialect);

    // Make sure it's a singleton...
    ServiceRegistry serviceRegistry2 = handler
            .getServiceLocator().getService(ServiceRegistry.class);
    Assert.assertSame(serviceRegistry, serviceRegistry2);
}
项目:baseline    文件:HttpServer.java   
public HttpServer(String serverIdentifier, HttpConfiguration http, Timer timer, ApplicationHandler applicationHandler) {
    PooledByteBufAllocator allocator = new PooledByteBufAllocator(http.isDirectMemoryBacked());

    this.serverIdentifier = serverIdentifier;
    this.host = http.getHost();
    this.port = http.getPort();
    this.requestProcessingExecutor = Executors.newFixedThreadPool(http.getNumRequestProcessingThreads(), Threads.newNamedThreadFactory(serverIdentifier + "-requests-%d"));
    this.bossEventLoopGroup = new NioEventLoopGroup(com.aerofs.baseline.http.Constants.DEFAULT_NUM_BOSS_THREADS, Threads.newNamedThreadFactory(serverIdentifier + "-nio-boss-%d"));
    this.workEventLoopGroup = new NioEventLoopGroup(http.getNumNetworkThreads(), Threads.newNamedThreadFactory(serverIdentifier + "-nio-work-%d"));
    this.bootstrap = new ServerBootstrap();
    this.bootstrap
            .group(bossEventLoopGroup, workEventLoopGroup)
            .channel(NioServerSocketChannel.class)
            .childHandler(new AcceptedChannelInitializer(http, applicationHandler, URI.create(String.format("http://%s:%s/", host, port)), requestProcessingExecutor, timer))
            .option(ALLOCATOR, allocator)
            .option(SO_BACKLOG, http.getMaxAcceptQueueSize())
            .childOption(AUTO_READ, false)
            .childOption(ALLOCATOR, allocator);
}
项目:demo-restWS-spring-jersey-tomcat-mybatis    文件:SpringContextJerseyTest.java   
/**
 * An extending class must implement the {@link #configure()} method to
 * provide an application descriptor.
 *
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest() throws TestContainerException {
    ResourceConfig config = getResourceConfig(configure());
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));

    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:demo-restWS-spring-jersey-tomcat-mybatis    文件:SpringContextJerseyTest.java   
/**
 * Construct a new instance with a test container factory.
 * <p/>
 * An extending class must implement the {@link #configure()} method to
 * provide an application descriptor.
 *
 * @param testContainerFactory the test container factory to use for testing.
 * @throws TestContainerException if the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest(TestContainerFactory testContainerFactory) {
    setTestContainerFactory(testContainerFactory);

    ResourceConfig config = getResourceConfig(configure());
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));
    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, testContainerFactory);
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:jped-parent-project    文件:CdiAwareInMemoryTestContainer.java   
/**
 * Constructor
 *
 * @param baseUri
 * @param context
 */
public CdiAwareInMemoryTestContainer(final URI baseUri, final DeploymentContext context) {
    this.baseUri = UriBuilder.fromUri(baseUri).path(context.getContextPath()).build();

    if (CdiAwareInMemoryTestContainer.LOGGER.isLoggable(Level.INFO)) {
        CdiAwareInMemoryTestContainer.LOGGER
                .info("Creating InMemoryTestContainer configured at the base URI " + this.baseUri);
    }

    // TODO: Hack is here...

    // HandlerWrapper cdiHandlerWrapper = new CdiAwareHandlerWrapper();
    // cdiHandlerWrapper.setHandler(this.server.getHandler());
    // this.server.setHandler(cdiHandlerWrapper);

    this.appHandler = new ApplicationHandler(context.getResourceConfig());
}
项目:minnal    文件:RouterTest.java   
@BeforeMethod
public void setup() {
    applicationMapping = mock(ApplicationMapping.class);
    request = mock(FullHttpRequest.class);
    response = mock(FullHttpResponse.class);
    when(request.getMethod()).thenReturn(HttpMethod.GET);
    when(request.getUri()).thenReturn("/test");
    when(request.headers()).thenReturn(new DefaultHttpHeaders());
    when(request.content()).thenReturn(mock(ByteBuf.class));
    when(request.getProtocolVersion()).thenReturn(HttpVersion.HTTP_1_1);
    when(response.getStatus()).thenReturn(HttpResponseStatus.PROCESSING);
    application = mock(Application.class);
    context = mock(MessageContext.class);
    router = spy(new Router(applicationMapping));
    doReturn(new ApplicationHandler()).when(router).getApplicationHandler(application);
    when(application.getPath()).thenReturn(URI.create("/app"));
    when(context.getRequest()).thenReturn(request);
    when(context.getResponse()).thenReturn(response);
    when(context.getApplication()).thenReturn(application);
    when(context.getBaseUri()).thenReturn(URI.create("http://localhost:8080"));
    when(applicationMapping.resolve(request)).thenReturn(application);
}
项目:demo-restWS-spring-jersey-tomcat-mybatis    文件:SpringContextJerseyTest.java   
/**
 * An extending class must implement the {@link #configure()} method to
 * provide an application descriptor.
 *
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest() throws TestContainerException {
    ResourceConfig config = getResourceConfig(configure());
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));

    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:demo-restWS-spring-jersey-tomcat-mybatis    文件:SpringContextJerseyTest.java   
/**
 * Construct a new instance with a test container factory.
 * <p/>
 * An extending class must implement the {@link #configure()} method to
 * provide an application descriptor.
 *
 * @param testContainerFactory the test container factory to use for testing.
 * @throws TestContainerException if the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest(TestContainerFactory testContainerFactory) {
    setTestContainerFactory(testContainerFactory);

    ResourceConfig config = getResourceConfig(configure());
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));
    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, testContainerFactory);
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:demo-restWS-spring-jersey-tomcat-mybatis    文件:SpringContextJerseyTest.java   
/**
 * Creates an instance of {@link Client}.
 * <p/>
 * Checks whether TestContainer provides ClientConfig instance and
 * if not, empty new {@link org.glassfish.jersey.client.ClientConfig} instance
 * will be used to create new client instance.
 * <p/>
 * This method is called exactly once when JerseyTest is created.
 *
 * @param tc                 instance of {@link TestContainer}
 * @param applicationHandler instance of {@link ApplicationHandler}
 * @return A Client instance.
 */
protected Client getClient(TestContainer tc, ApplicationHandler applicationHandler) {
    ClientConfig cc = tc.getClientConfig();

    if (cc == null) {
        cc = new ClientConfig();
    }

    //check if logging is required
    if (isEnabled(TestProperties.LOG_TRAFFIC)) {
        cc.register(new LoggingFilter(LOGGER, isEnabled(TestProperties.DUMP_ENTITY)));
    }

    configureClient(cc);

    return ClientBuilder.newClient(cc);
}
项目:aws-serverless-java-container    文件:JerseyLambdaContainerHandler.java   
/**
 * Private constructor for a LambdaContainer. Sets the application object, sets the ApplicationHandler,
 * and initializes the application using the <code>onStartup</code> method.
 * @param requestReader A request reader instance
 * @param responseWriter A response writer instance
 * @param securityContextWriter A security context writer object
 * @param exceptionHandler An exception handler
 * @param jaxRsApplication The JaxRs application
 */
public JerseyLambdaContainerHandler(RequestReader<RequestType, ContainerRequest> requestReader,
                                    ResponseWriter<JerseyResponseWriter, ResponseType> responseWriter,
                                    SecurityContextWriter<RequestType> securityContextWriter,
                                    ExceptionHandler<ResponseType> exceptionHandler,
                                    Application jaxRsApplication) {
    super(requestReader, responseWriter, securityContextWriter, exceptionHandler);

    this.jaxRsApplication = jaxRsApplication;
    this.applicationHandler = new ApplicationHandler(jaxRsApplication);

    applicationHandler.onStartup(this);
}
项目:aws-serverless-java-container    文件:JerseyLambdaContainerHandler.java   
/**
 * Shuts down and restarts the application handler in the current container. The <code>ApplicationHandler</code>
 * object is re-initialized with the <code>Application</code> object initially set in the <code>LambdaContainer.getInstance()</code>
 * call.
 */
public void reload() {
    applicationHandler.onShutdown(this);

    this.applicationHandler = new ApplicationHandler(jaxRsApplication);

    applicationHandler.onReload(this);
    applicationHandler.onStartup(this);
}
项目:aws-serverless-java-container    文件:JerseyLambdaContainerHandler.java   
/**
 * Restarts the application handler and configures a different <code>Application</code> object. The new application
 * resets the one currently configured in the container.
 * @param resourceConfig An initialized Application
 */
public void reload(ResourceConfig resourceConfig) {
    applicationHandler.onShutdown(this);

    this.jaxRsApplication = resourceConfig;
    this.applicationHandler = new ApplicationHandler(resourceConfig);

    applicationHandler.onReload(this);
    applicationHandler.onStartup(this);
}
项目:jrestless    文件:JRestlessHandlerContainerTest.java   
@Test
public void reload_ConfigGiven_ShouldReloadNewAppHandler() {
    ResourceConfig config = new ApplicationHandler().getConfiguration();
    ApplicationHandler newAppHandler = mock(ApplicationHandler.class);
    doReturn(newAppHandler).when(container).createNewApplicationHandler(any());
    container.reload(config);
    verify(newAppHandler, times(1)).onReload(container);
}
项目:jrestless    文件:JRestlessHandlerContainerTest.java   
@Test
public void reload_ConfigGiven_ShouldStartNewAppHandler() {
    ResourceConfig config = new ApplicationHandler().getConfiguration();
    ApplicationHandler newAppHandler = mock(ApplicationHandler.class);
    doReturn(newAppHandler).when(container).createNewApplicationHandler(any());
    container.reload(config);
    verify(newAppHandler, times(1)).onStartup(container);
}
项目:jrestless    文件:JRestlessHandlerContainerTest.java   
@Test
public void reload_ConfigGiven_ShouldResetAppHandler() {
    ResourceConfig config = new ApplicationHandler().getConfiguration();
    ApplicationHandler newAppHandler = mock(ApplicationHandler.class);
    doReturn(newAppHandler).when(container).createNewApplicationHandler(any());
    container.reload(config);
    assertSame(newAppHandler, container.getApplicationHandler());
}
项目:mosquito-report-api    文件:WithService.java   
protected <T> T getService(Class<T> clazz) {
    return new ApplicationHandler(configure().register(new GenericBinder<T>() {
        public Class<T> getType() {
            return clazz;
        }
    })).getServiceLocator().getService(clazz);
}
项目:Todo-Jersey-Spring-MyBatis    文件:SpringContextJerseyTest.java   
/**
 * Construct a new instance with an application descriptor that defines
 * how the test container is configured.
 *
 * @param jaxrsApplication an application describing how to configure the
 *                         test container.
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest(Application jaxrsApplication) throws TestContainerException {
    ResourceConfig config = getResourceConfig(jaxrsApplication);
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));
    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:Todo-Jersey-Spring-MyBatis    文件:SpringContextJerseyTest.java   
/**
 * Construct a new instance with an {@link Application} class.
 *
 * @param jaxrsApplicationClass an application describing how to configure the
 *                              test container.
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest(Class<? extends Application> jaxrsApplicationClass) throws TestContainerException {
    ResourceConfig config = ResourceConfig.forApplicationClass(jaxrsApplicationClass);
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));
    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:Todo-Jersey-Spring-MyBatis    文件:SpringContextJerseyTest.java   
private TestContainer getContainer(ApplicationHandler application, TestContainerFactory tcf) {
    if (application == null) {
        throw new IllegalArgumentException("The application cannot be null");
    }

    return tcf.create(getBaseUri(), application);
}
项目:tajo    文件:NettyRestServerListener.java   
@Override
public void onAfterShutdown(Object obj) {
  if (container instanceof NettyRestHandlerContainer) {
    NettyRestHandlerContainer restHandlerContainer = ((NettyRestHandlerContainer) container);
    ApplicationHandler applicationHandler = restHandlerContainer.getApplicationHandler();
    ContainerLifecycleListener lifecycleListener = ConfigHelper.getContainerLifecycleListener(applicationHandler);
    lifecycleListener.onShutdown(container);
  }
}
项目:tajo    文件:NettyRestServerListener.java   
@Override
public void onAfterStart(Object obj) {
  if (container instanceof NettyRestHandlerContainer) { 
    NettyRestHandlerContainer restHandlerContainer = ((NettyRestHandlerContainer) container);
    ApplicationHandler applicationHandler = restHandlerContainer.getApplicationHandler();
    ContainerLifecycleListener lifecycleListener = ConfigHelper.getContainerLifecycleListener(applicationHandler);
    lifecycleListener.onStartup(container);
  }
}
项目:tajo    文件:NettyRestHandlerContainerProvider.java   
@Override
public <T> T createContainer(Class<T> type, ApplicationHandler application) throws ProcessingException {
  if (type != NettyRestHandlerContainer.class && 
      (type == null || !ChannelHandler.class.isAssignableFrom(type))) {
    return null;
  }
  return type.cast(new NettyRestHandlerContainer(application));
}
项目:demo-restWS-spring-jersey-jpa2-hibernate    文件:SpringContextJerseyTest.java   
/**
 * Construct a new instance with an application descriptor that defines
 * how the test container is configured.
 *
 * @param jaxrsApplication an application describing how to configure the
 *                         test container.
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest(Application jaxrsApplication) throws TestContainerException {
    ResourceConfig config = getResourceConfig(jaxrsApplication);
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));
    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:demo-restWS-spring-jersey-jpa2-hibernate    文件:SpringContextJerseyTest.java   
/**
 * Construct a new instance with an {@link Application} class.
 *
 * @param jaxrsApplicationClass an application describing how to configure the
 *                              test container.
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest(Class<? extends Application> jaxrsApplicationClass) throws TestContainerException {
    ResourceConfig config = ResourceConfig.forApplicationClass(jaxrsApplicationClass);
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));
    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:demo-restWS-spring-jersey-jpa2-hibernate    文件:SpringContextJerseyTest.java   
private TestContainer getContainer(ApplicationHandler application, TestContainerFactory tcf) {
    if (application == null) {
        throw new IllegalArgumentException("The application cannot be null");
    }

    return tcf.create(getBaseUri(), application);
}
项目:jersey2-toolkit    文件:FileSystemManagerFactoryTest.java   
/**
 * Setup the application handler for this test.
 */
@Before
public void setup() {
    ResourceConfig config = new ResourceConfig();
    config.register(TestFeature.class);
    handler = new ApplicationHandler(config);
    locator = handler.getServiceLocator();
}
项目:jersey2-toolkit    文件:HibernateSessionFactoryTest.java   
/**
 * Setup the application handler for this test.
 */
@Before
public void setup() {
    ResourceConfig config = new ResourceConfig();
    config.register(TestFeature.class);
    handler = new ApplicationHandler(config);
    locator = handler.getServiceLocator();
}
项目:jersey2-toolkit    文件:FulltextSessionFactoryTest.java   
/**
 * Setup the application handler for this test.
 */
@Before
public void setup() {
    ResourceConfig config = new ResourceConfig();
    config.register(TestFeature.class);
    handler = new ApplicationHandler(config);
    locator = handler.getServiceLocator();
}
项目:jersey2-toolkit    文件:HibernateSessionFactoryFactoryTest.java   
/**
 * Setup the application handler for this test.
 */
@Before
public void setup() {
    ResourceConfig config = new ResourceConfig();
    config.register(TestFeature.class);
    handler = new ApplicationHandler(config);
    locator = handler.getServiceLocator();
}
项目:jersey2-toolkit    文件:FulltextSearchFactoryFactoryTest.java   
/**
 * Setup the application handler for this test.
 */
@Before
public void setup() {
    ResourceConfig config = new ResourceConfig();
    config.register(TestFeature.class);
    handler = new ApplicationHandler(config);
    locator = handler.getServiceLocator();
}
项目:divide    文件:WebContainerFactory.java   
@Override
public TestContainer create(URI baseUri, ApplicationHandler application) throws IllegalArgumentException {
    URI uri = UriBuilder.fromUri(baseUri).port(baseUri.getPort() + getCount()).build();
    System.out.println("Uri: " + uri);
    System.out.println("App: " + application.getConfiguration().getApplication().getClass().getName());

    return new MyTestContainer(uri, application);
}
项目:divide    文件:AuthServerHelper.java   
public void init(String url) throws Exception {
    URI uri = URI.create(url);
    ApplicationHandler h = new ApplicationHandler(TestApplication.class);
    WebContainerFactory factory = new WebContainerFactory();
    factory.enableEncrementPort(false);
    container = factory.create(uri,h);
    container.start();
}
项目:ameba    文件:ConfigHelper.java   
@Override
public void onShutdown(final Container container) {
    final ApplicationHandler handler = container.getApplicationHandler();
    final InjectionManager injectionManager = handler.getInjectionManager();

    // Call @PreDestroy method on Application.
    injectionManager.preDestroy(getWrappedApplication(handler.getConfiguration()));
    // Shutdown ServiceLocator.
    injectionManager.shutdown();
}
项目:baseline    文件:AcceptedChannelInitializer.java   
public AcceptedChannelInitializer(HttpConfiguration http, ApplicationHandler applicationHandler, URI baseUri, Executor applicationExecutor, io.netty.util.Timer timer) {
    this.http = http;
    this.applicationHandler = applicationHandler;
    this.baseUri = baseUri;
    this.applicationExecutor = applicationExecutor;
    this.timer = timer;
}
项目:demo-restWS-spring-jersey-tomcat-mybatis    文件:SpringContextJerseyTest.java   
/**
 * Construct a new instance with an application descriptor that defines
 * how the test container is configured.
 *
 * @param jaxrsApplication an application describing how to configure the
 *                         test container.
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest(Application jaxrsApplication) throws TestContainerException {
    ResourceConfig config = getResourceConfig(jaxrsApplication);
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));
    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
项目:demo-restWS-spring-jersey-tomcat-mybatis    文件:SpringContextJerseyTest.java   
/**
 * Construct a new instance with an {@link Application} class.
 *
 * @param jaxrsApplicationClass an application describing how to configure the
 *                              test container.
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest(Class<? extends Application> jaxrsApplicationClass) throws TestContainerException {
    ResourceConfig config = ResourceConfig.forApplicationClass(jaxrsApplicationClass);
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));
    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}