org.apache.coyote.AbstractProtocol Java Examples
The following examples show how to use
org.apache.coyote.AbstractProtocol.
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: TomcatWebServer.java From oxygen with Apache License 2.0 | 6 votes |
private void configConnector(Connector connector, TomcatConf tomcatConf) { connector.setURIEncoding(tomcatConf.getUriEncoding()); ProtocolHandler protocolHandler = connector.getProtocolHandler(); if (protocolHandler instanceof AbstractProtocol) { AbstractProtocol<?> handler = (AbstractProtocol<?>) protocolHandler; handler.setAcceptCount(tomcatConf.getAcceptCount()); handler.setMaxConnections(tomcatConf.getMaxConnections()); handler.setMinSpareThreads(tomcatConf.getMinSpareThreads()); handler.setMaxThreads(tomcatConf.getMaxThreads()); handler.setConnectionTimeout(tomcatConf.getConnectionTimeout()); if (handler instanceof AbstractHttp11Protocol) { AbstractHttp11Protocol<?> protocol = (AbstractHttp11Protocol<?>) handler; protocol.setMaxHttpHeaderSize(tomcatConf.getMaxHttpHeaderSize()); } } }
Example #2
Source File: SystemBootAutoConfiguration.java From super-cloudops with Apache License 2.0 | 6 votes |
/** * * Customization servlet container configuring. </br> * * @see {@link EmbeddedServletContainerAutoConfiguration} * * @return */ @Bean public EmbeddedServletContainerCustomizer customEmbeddedServletContainerCustomizer() { return container -> { // Tomcat container customization if (container instanceof TomcatEmbeddedServletContainerFactory) { TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container; tomcat.addConnectorCustomizers(connector -> { ProtocolHandler handler = connector.getProtocolHandler(); if (handler instanceof AbstractProtocol) { AbstractProtocol<?> protocol = (AbstractProtocol<?>) handler; /** * {@link org.apache.tomcat.util.net.NioEndpoint#startInternal()} * {@link org.apache.tomcat.util.net.NioEndpoint#createExecutor()} */ protocol.setExecutor(customTomcatExecutor(protocol)); } }); } else { log.warn("Skip using custom servlet container, EmbeddedServletContainer: {}", container); } }; }
Example #3
Source File: TomcatCustomServer.java From nano-framework with Apache License 2.0 | 5 votes |
@SuppressWarnings("rawtypes") protected void initConnector() { final TypeReference<ConnectorConf> type = new TypeReference<ConnectorConf>() { }; final ConnectorConf conf = new ConnectorConf(JSON.parseObject(context.getProperty(TOMCAT_CONNECTOR), type)); LOGGER.debug("{}", conf.toString()); final Connector connector = conf.init(); final Service service = getService(); final Executor executor = service.getExecutor(conf.getExecutor()); ((AbstractProtocol) connector.getProtocolHandler()).setExecutor(executor); setConnector(connector); service.addConnector(connector); }
Example #4
Source File: SystemBootAutoConfiguration.java From super-cloudops with Apache License 2.0 | 5 votes |
/** * Custom tomcat executor * * @param protocol * @return */ private Executor customTomcatExecutor(AbstractProtocol<?> protocol) { TaskThreadFactory tf = new TaskThreadFactory(protocol.getName() + "-exe-", true, protocol.getThreadPriority()); TaskQueue taskqueue = new TaskQueue(); Executor executor = new ThreadPoolExecutor(protocol.getMinSpareThreads(), protocol.getMaxThreads(), 60, TimeUnit.SECONDS, taskqueue, tf); taskqueue.setParent((ThreadPoolExecutor) executor); return executor; }
Example #5
Source File: AjpNioProtocol.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<NioChannel> getProtocol() { return proto; }
Example #6
Source File: AjpProtocol.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<Socket> getProtocol() { return proto; }
Example #7
Source File: AjpAprProtocol.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<Long> getProtocol() { return proto; }
Example #8
Source File: Http11Protocol.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<Socket> getProtocol() { return proto; }
Example #9
Source File: Http11NioProtocol.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<NioChannel> getProtocol() { return proto; }
Example #10
Source File: Http11AprProtocol.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<Long> getProtocol() { return proto; }
Example #11
Source File: AjpNioProtocol.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<NioChannel> getProtocol() { return proto; }
Example #12
Source File: AjpProtocol.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<Socket> getProtocol() { return proto; }
Example #13
Source File: AjpAprProtocol.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<Long> getProtocol() { return proto; }
Example #14
Source File: Http11Protocol.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<Socket> getProtocol() { return proto; }
Example #15
Source File: Http11NioProtocol.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<NioChannel> getProtocol() { return proto; }
Example #16
Source File: Http11AprProtocol.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Override protected AbstractProtocol<Long> getProtocol() { return proto; }
Example #17
Source File: HugeGraphStudio.java From hugegraph-studio with Apache License 2.0 | 4 votes |
/** * Run tomcat with configuration * * @param config the studio configuration * @throws Exception the exception */ public static void run(StudioServerConfig config) throws Exception { String address = config.getHttpBindAddress(); int port = config.getHttpPort(); validateHttpPort(address, port); String baseDir = config.getServerBasePath(); String uiDir = String.format("%s/%s", baseDir, config.getServerUIDirectory()); String apiWarFile = String.format("%s/%s", baseDir, config.getServerWarDirectory()); validatePathExists(new File(uiDir)); validateFileExists(new File(apiWarFile)); Tomcat tomcat = new Tomcat(); tomcat.setPort(config.getHttpPort()); ProtocolHandler ph = tomcat.getConnector().getProtocolHandler(); if (ph instanceof AbstractProtocol) { ((AbstractProtocol) ph).setAddress(InetAddress.getByName(address)); } tomcat.setHostname(address); StandardContext ui = configureUi(tomcat, uiDir); StandardContext api = configureWarFile(tomcat, apiWarFile, "/api"); tomcat.start(); server = tomcat.getServer(); while (!server.getState().equals(LifecycleState.STARTED)) { Thread.sleep(100L); } if (!ui.getState().equals(LifecycleState.STARTED)) { LOG.error("Studio-ui failed to start. " + "Please check logs for details"); System.exit(1); } if (!api.getState().equals(LifecycleState.STARTED)) { LOG.error("Studio-api failed to start. " + "Please check logs for details"); System.exit(1); } String upMessage = String.format("HugeGraphStudio is now running on: " + "http://%s:%d\n", address, port); LOG.info(upMessage); }