當前位置: 首頁>>代碼示例>>Java>>正文


Java OptionMap類代碼示例

本文整理匯總了Java中org.xnio.OptionMap的典型用法代碼示例。如果您正苦於以下問題:Java OptionMap類的具體用法?Java OptionMap怎麽用?Java OptionMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OptionMap類屬於org.xnio包,在下文中一共展示了OptionMap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testCustomizeServletContainer

import org.xnio.OptionMap; //導入依賴的package包/類
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    webConfigurer.customize(container);
    assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
    assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
    assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
    if (container.getDocumentRoot() != null) {
        assertThat(container.getDocumentRoot().getPath()).isEqualTo(FilenameUtils.separatorsToSystem("target/www"));
    }

    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull();
}
 
開發者ID:oktadeveloper,項目名稱:jhipster-microservices-example,代碼行數:18,代碼來源:WebConfigurerTest.java

示例2: testCustomizeServletContainer

import org.xnio.OptionMap; //導入依賴的package包/類
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    webConfigurer.customize(container);
    assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
    assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
    assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
    if (container.getDocumentRoot() != null) {
        assertThat(container.getDocumentRoot().getPath()).isEqualTo(FilenameUtils.separatorsToSystem("build/www"));
    }

    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull();
}
 
開發者ID:michaelhoffmantech,項目名稱:patient-portal,代碼行數:18,代碼來源:WebConfigurerTest.java

示例3: testCustomizeServletContainer

import org.xnio.OptionMap; //導入依賴的package包/類
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    webConfigurer.customize(container);
    assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
    assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
    assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
    if (container.getDocumentRoot() != null) {
        assertThat(container.getDocumentRoot().getPath()).isEqualTo("target/www");
    }

    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull();
}
 
開發者ID:deepu105,項目名稱:spring-io,代碼行數:18,代碼來源:WebConfigurerTest.java

示例4: connect

import org.xnio.OptionMap; //導入依賴的package包/類
@Override
public void connect(final ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, final URI uri, final XnioWorker worker, final XnioSsl ssl, final Pool<ByteBuffer> bufferPool, final OptionMap options) {
    ChannelListener<StreamConnection> openListener = new ChannelListener<StreamConnection>() {
        @Override
        public void handleEvent(StreamConnection connection) {
            handleConnected(connection, listener, uri, ssl, bufferPool, options);
        }
    };
    IoFuture.Notifier<StreamConnection, Object> notifier = new IoFuture.Notifier<StreamConnection, Object>() {
        @Override
        public void notify(IoFuture<? extends StreamConnection> ioFuture, Object o) {
            if (ioFuture.getStatus() == IoFuture.Status.FAILED) {
                listener.failed(ioFuture.getException());
            }
        }
    };
    if(bindAddress == null) {
        worker.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 8009 : uri.getPort()), openListener, options).addNotifier(notifier, null);
    } else {
        worker.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 8009 : uri.getPort()), openListener, null, options).addNotifier(notifier, null);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:AjpClientProvider.java

示例5: connect

import org.xnio.OptionMap; //導入依賴的package包/類
public IoFuture<ClientConnection> connect(InetSocketAddress bindAddress, final URI uri, final XnioWorker worker, XnioSsl ssl, Pool<ByteBuffer> bufferPool, OptionMap options) {
    ClientProvider provider = getClientProvider(uri);
    final FutureResult<ClientConnection> result = new FutureResult<>();
    provider.connect(new ClientCallback<ClientConnection>() {
        @Override
        public void completed(ClientConnection r) {
            result.setResult(r);
        }

        @Override
        public void failed(IOException e) {
            result.setException(e);
        }
    }, bindAddress, uri, worker, ssl, bufferPool, options);
    return result.getIoFuture();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:UndertowClient.java

示例6: HttpClientConnection

import org.xnio.OptionMap; //導入依賴的package包/類
HttpClientConnection(final StreamConnection connection, final OptionMap options, final Pool<ByteBuffer> bufferPool) {
    this.options = options;
    this.connection = connection;
    this.pushBackStreamSourceConduit = new PushBackStreamSourceConduit(connection.getSourceChannel().getConduit());
    this.connection.getSourceChannel().setConduit(pushBackStreamSourceConduit);
    this.bufferPool = bufferPool;
    this.originalSinkConduit = connection.getSinkChannel().getConduit();

    connection.getCloseSetter().set(new ChannelListener<StreamConnection>() {

        public void handleEvent(StreamConnection channel) {
            HttpClientConnection.this.state |= CLOSED;
            ChannelListeners.invokeChannelListener(HttpClientConnection.this, closeSetter.get());
        }
    });
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:HttpClientConnection.java

示例7: connect

import org.xnio.OptionMap; //導入依賴的package包/類
@Override
public void connect(ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, URI uri, XnioIoThread ioThread, XnioSsl ssl, Pool<ByteBuffer> bufferPool, OptionMap options) {
    if (uri.getScheme().equals("https")) {
        if (ssl == null) {
            listener.failed(UndertowMessages.MESSAGES.sslWasNull());
            return;
        }
        if (bindAddress == null) {
            ssl.openSslConnection(ioThread, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, options), options).addNotifier(createNotifier(listener), null);
        } else {
            ssl.openSslConnection(ioThread, bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, options), options).addNotifier(createNotifier(listener), null);
        }
    } else {
        if (bindAddress == null) {
            ioThread.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options), options).addNotifier(createNotifier(listener), null);
        } else {
            ioThread.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options), null, options).addNotifier(createNotifier(listener), null);
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:21,代碼來源:HttpClientProvider.java

示例8: handleConnected

import org.xnio.OptionMap; //導入依賴的package包/類
private void handleConnected(final StreamConnection connection, final ClientCallback<ClientConnection> listener, final Pool<ByteBuffer> bufferPool, final OptionMap options) {
    if (options.get(UndertowOptions.ENABLE_SPDY, false) && connection instanceof SslConnection && SpdyClientProvider.isEnabled()) {
        try {
            SpdyClientProvider.handlePotentialSpdyConnection(connection, listener, bufferPool, options, new ChannelListener<SslConnection>() {
                @Override
                public void handleEvent(SslConnection channel) {
                    listener.completed(new HttpClientConnection(connection, options, bufferPool));
                }
            });
        } catch (Exception e) {
            listener.failed(new IOException(e));
        }
    } else {
        listener.completed(new HttpClientConnection(connection, options, bufferPool));
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:HttpClientProvider.java

示例9: getChannel

import org.xnio.OptionMap; //導入依賴的package包/類
private static Channel getChannel ( ConnectionProviderContextImpl context, ConnectionHandler ch, OptionMap options ) throws IOException {
    Channel c;
    FutureResult<Channel> chResult = new FutureResult<Channel>(context.getExecutor());
    ch.open("jmx", chResult, options);

    IoFuture<Channel> cFuture = chResult.getIoFuture();
    Status s2 = cFuture.await();
    if ( s2 == Status.FAILED ) {
        System.err.println("Cannot connect");
        if ( cFuture.getException() != null ) {
            throw new IOException("Connect failed", cFuture.getException());
        }
    }
    else if ( s2 != Status.DONE ) {
        cFuture.cancel();
        throw new IOException("Connect timeout");
    }

    c = cFuture.get();
    return c;
}
 
開發者ID:RickGray,項目名稱:ysoserial-plus,代碼行數:22,代碼來源:JBoss.java

示例10: AbstractServerConnection

import org.xnio.OptionMap; //導入依賴的package包/類
public AbstractServerConnection(StreamConnection channel, final Pool<ByteBuffer> bufferPool, final HttpHandler rootHandler, final OptionMap undertowOptions, final int bufferSize) {
    this.channel = channel;
    this.bufferPool = bufferPool;
    this.rootHandler = rootHandler;
    this.undertowOptions = undertowOptions;
    this.bufferSize = bufferSize;
    closeSetter = new CloseSetter();
    if (channel != null) {
        this.originalSinkConduit = channel.getSinkChannel().getConduit();
        this.originalSourceConduit = channel.getSourceChannel().getConduit();
        channel.setCloseListener(closeSetter);
    } else {
        this.originalSinkConduit = null;
        this.originalSourceConduit = null;
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:AbstractServerConnection.java

示例11: HttpServerConnection

import org.xnio.OptionMap; //導入依賴的package包/類
public HttpServerConnection(StreamConnection channel, final Pool<ByteBuffer> bufferPool, final HttpHandler rootHandler, final OptionMap undertowOptions, final int bufferSize) {
    super(channel, bufferPool, rootHandler, undertowOptions, bufferSize);
    if (channel instanceof SslChannel) {
        sslSessionInfo = new ConnectionSSLSessionInfo(((SslChannel) channel), this);
    }
    this.responseConduit = new HttpResponseConduit(channel.getSinkChannel().getConduit(), bufferPool);

    fixedLengthStreamSinkConduit = new ServerFixedLengthStreamSinkConduit(responseConduit, false, false);
    readDataStreamSourceConduit = new ReadDataStreamSourceConduit(channel.getSourceChannel().getConduit(), this);
    //todo: do this without an allocation
    addCloseListener(new CloseListener() {
        @Override
        public void closed(ServerConnection connection) {
            responseConduit.freeBuffers();
        }
    });
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:18,代碼來源:HttpServerConnection.java

示例12: SpdyOpenListener

import org.xnio.OptionMap; //導入依賴的package包/類
public SpdyOpenListener(final Pool<ByteBuffer> pool, final Pool<ByteBuffer> heapBufferPool, final OptionMap undertowOptions) {
    this.undertowOptions = undertowOptions;
    this.bufferPool = pool;
    Pooled<ByteBuffer> buf = pool.allocate();
    this.bufferSize = buf.getResource().remaining();
    buf.free();
    this.heapBufferPool = heapBufferPool;
    Pooled<ByteBuffer> buff = heapBufferPool.allocate();
    try {
        if (!buff.getResource().hasArray()) {
            throw UndertowMessages.MESSAGES.mustProvideHeapBuffer();
        }
    } finally {
        buff.free();
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:SpdyOpenListener.java

示例13: testCustomizeServletContainer

import org.xnio.OptionMap; //導入依賴的package包/類
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    webConfigurer.customize(container);
    assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
    assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
    assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");

    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull();
}
 
開發者ID:xm-online,項目名稱:xm-ms-config,代碼行數:15,代碼來源:WebConfigurerTest.java

示例14: testUndertowHttp2Enabled

import org.xnio.OptionMap; //導入依賴的package包/類
@Test
public void testUndertowHttp2Enabled() {
    props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    webConfigurer.customize(container);
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:11,代碼來源:WebConfigurerTest.java

示例15: ConnectionProviderContextImpl

import org.xnio.OptionMap; //導入依賴的package包/類
public ConnectionProviderContextImpl ( OptionMap opts, String endpointName ) throws IllegalArgumentException, IOException {
    this.instance = Xnio.getInstance();

    this.worker = this.instance.createWorker(opts);
    this.endpoint = Remoting.createEndpoint(endpointName, this.worker, opts);
    this.executor = Executors.newCachedThreadPool(new ThreadFactory() {

        public Thread newThread ( Runnable r ) {
            Thread t = new Thread(r, "Worker");
            t.setDaemon(true);
            return t;
        }
    });
}
 
開發者ID:RickGray,項目名稱:ysoserial-plus,代碼行數:15,代碼來源:JBoss.java


注:本文中的org.xnio.OptionMap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。