Search in sources :

Example 6 with HttpParser

use of org.webpieces.httpparser.api.HttpParser in project webpieces by deanhiller.

the class TestChunking method setup.

@Before
public void setup() {
    SimpleMeterRegistry metrics = new SimpleMeterRegistry();
    TwoPools pool = new TwoPools("client.bufferpool", metrics);
    HttpParser parser = HttpParserFactory.createParser("testParser", metrics, pool);
    httpClient = HttpClientFactory.createHttpClient("testClient", mockChanMgr, parser);
    mockChannel.setConnectFuture(XFuture.completedFuture(null));
    mockChanMgr.addTCPChannelToReturn(mockChannel);
    httpSocket = httpClient.createHttpSocket(new SocketListener());
}
Also used : TwoPools(org.webpieces.data.api.TwoPools) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) HttpParser(org.webpieces.httpparser.api.HttpParser) Before(org.junit.Before)

Example 7 with HttpParser

use of org.webpieces.httpparser.api.HttpParser in project webpieces by deanhiller.

the class HttpFrontendFactory method createFrontEnd.

/**
	 * 
	 * @param id Use for logging and also file recording names
	 * @param threadPoolSize The size of the threadpool, although all data comes in order as we
	 * use the SessionExecutorImpl found in webpieces
	 * 
	 * @return
	 */
public static HttpFrontendManager createFrontEnd(String id, int threadPoolSize, ScheduledExecutorService timer, BufferPool pool) {
    Executor executor = Executors.newFixedThreadPool(threadPoolSize, new NamedThreadFactory(id));
    ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
    ChannelManager chanMgr = factory.createMultiThreadedChanMgr(id, pool, executor);
    AsyncServerManager svrMgr = AsyncServerMgrFactory.createAsyncServer(chanMgr);
    HttpParser httpParser = HttpParserFactory.createParser(pool);
    HpackParser http2Parser = HpackParserFactory.createParser(pool, true);
    InjectionConfig injConfig = new InjectionConfig(http2Parser, new TimeImpl(), new Http2Config());
    Http2ServerEngineFactory svrEngineFactory = new Http2ServerEngineFactory(injConfig);
    return new FrontEndServerManagerImpl(svrMgr, timer, svrEngineFactory, httpParser);
}
Also used : HpackParser(com.webpieces.hpack.api.HpackParser) Executor(java.util.concurrent.Executor) ChannelManager(org.webpieces.nio.api.ChannelManager) NamedThreadFactory(org.webpieces.util.threading.NamedThreadFactory) Http2Config(com.webpieces.http2engine.api.client.Http2Config) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) HttpParser(org.webpieces.httpparser.api.HttpParser) AsyncServerManager(org.webpieces.asyncserver.api.AsyncServerManager) Http2ServerEngineFactory(com.webpieces.http2engine.api.server.Http2ServerEngineFactory) ChannelManagerFactory(org.webpieces.nio.api.ChannelManagerFactory) TimeImpl(com.webpieces.util.time.TimeImpl) FrontEndServerManagerImpl(org.webpieces.frontend2.impl.FrontEndServerManagerImpl)

Example 8 with HttpParser

use of org.webpieces.httpparser.api.HttpParser in project webpieces by deanhiller.

the class HttpFrontendFactory method createFrontEnd.

public static HttpFrontendManager createFrontEnd(ChannelManager chanMgr, ScheduledExecutorService timer, InjectionConfig injConfig) {
    BufferCreationPool pool = new BufferCreationPool();
    HttpParser httpParser = HttpParserFactory.createParser(pool);
    return createFrontEnd(chanMgr, timer, injConfig, httpParser);
}
Also used : HttpParser(org.webpieces.httpparser.api.HttpParser) BufferCreationPool(org.webpieces.data.api.BufferCreationPool)

Example 9 with HttpParser

use of org.webpieces.httpparser.api.HttpParser in project webpieces by deanhiller.

the class HttpClientFactory method createHttpClient.

public static HttpClient createHttpClient(int numThreads) {
    Executor executor = Executors.newFixedThreadPool(numThreads, new NamedThreadFactory("httpclient"));
    BufferCreationPool pool = new BufferCreationPool();
    HttpParser parser = HttpParserFactory.createParser(pool);
    ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
    ChannelManager mgr = factory.createMultiThreadedChanMgr("httpClientChanMgr", pool, executor);
    return createHttpClient(mgr, parser);
}
Also used : Executor(java.util.concurrent.Executor) ChannelManager(org.webpieces.nio.api.ChannelManager) NamedThreadFactory(org.webpieces.util.threading.NamedThreadFactory) HttpParser(org.webpieces.httpparser.api.HttpParser) BufferCreationPool(org.webpieces.data.api.BufferCreationPool) ChannelManagerFactory(org.webpieces.nio.api.ChannelManagerFactory)

Example 10 with HttpParser

use of org.webpieces.httpparser.api.HttpParser in project webpieces by deanhiller.

the class WebServerModule method providesAsyncServerMgr.

@Provides
@Singleton
public HttpFrontendManager providesAsyncServerMgr(ChannelManager chanMgr, ScheduledExecutorService timer, @Named(HttpFrontendFactory.HTTP2_ENGINE_THREAD_POOL) Executor executor1, BufferPool pool, Time time, WebServerConfig config) {
    HttpParser httpParser = HttpParserFactory.createParser(pool);
    HpackParser http2Parser = HpackParserFactory.createParser(pool, true);
    InjectionConfig injConfig = new InjectionConfig(http2Parser, time, config.getHttp2Config());
    return HttpFrontendFactory.createFrontEnd(chanMgr, timer, injConfig, httpParser);
}
Also used : HpackParser(com.webpieces.hpack.api.HpackParser) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) HttpParser(org.webpieces.httpparser.api.HttpParser) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

HttpParser (org.webpieces.httpparser.api.HttpParser)15 TwoPools (org.webpieces.data.api.TwoPools)6 HpackParser (com.webpieces.hpack.api.HpackParser)5 InjectionConfig (com.webpieces.http2engine.api.client.InjectionConfig)5 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)5 Executor (java.util.concurrent.Executor)5 ChannelManager (org.webpieces.nio.api.ChannelManager)5 ChannelManagerFactory (org.webpieces.nio.api.ChannelManagerFactory)5 NamedThreadFactory (org.webpieces.util.threading.NamedThreadFactory)5 Http2ServerEngineFactory (com.webpieces.http2engine.api.server.Http2ServerEngineFactory)3 BufferCreationPool (org.webpieces.data.api.BufferCreationPool)3 FrontEndServerManagerImpl (org.webpieces.frontend2.impl.FrontEndServerManagerImpl)3 Provides (com.google.inject.Provides)2 ByteBuffer (java.nio.ByteBuffer)2 Singleton (javax.inject.Singleton)2 Before (org.junit.Before)2 Test (org.junit.Test)2 AsyncServerManager (org.webpieces.asyncserver.api.AsyncServerManager)2 DataWrapper (org.webpieces.data.api.DataWrapper)2 DataWrapperGenerator (org.webpieces.data.api.DataWrapperGenerator)2