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


Java TomcatEmbeddedServletContainerFactory.setPort方法代碼示例

本文整理匯總了Java中org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.setPort方法的典型用法代碼示例。如果您正苦於以下問題:Java TomcatEmbeddedServletContainerFactory.setPort方法的具體用法?Java TomcatEmbeddedServletContainerFactory.setPort怎麽用?Java TomcatEmbeddedServletContainerFactory.setPort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory的用法示例。


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

示例1: embeddedServletContainerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = (TomcatEmbeddedServletContainerFactory) container;
                
                
                RedisSessionHandlerValve valve = new RedisSessionHandlerValve();
                List<RedisSessionHandlerValve> valves = 
                		new ArrayList<RedisSessionHandlerValve>();
                valves.add(0, valve);
                tomcatEmbeddedServletContainerFactory.setContextValves(valves);
                tomcatEmbeddedServletContainerFactory.setPort(28080);    // Set the port of embeded tomcat as 28080 for default. 
 
                System.out.println("Enterring EmbeddedServletContainerCustomizer.customize()...");
                tomcatEmbeddedServletContainerFactory.addContextCustomizers(
                		new ServletContainerCustomizer());
            }
        }
    };
}
 
開發者ID:xiaowing,項目名稱:various_demos,代碼行數:24,代碼來源:Application.java

示例2: embeddedServletContainerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
    	@Value("${application.port}")
    	private int embeddedServletContainerListenPort;
    	
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = 
                		(TomcatEmbeddedServletContainerFactory) container;
                if (embeddedServletContainerListenPort <= 1024 ||  embeddedServletContainerListenPort > 65535) {
                	throw new IllegalArgumentException("The value of \"application.port\" in the properties file is invalid.");
                }
                
                tomcatEmbeddedServletContainerFactory.setPort(embeddedServletContainerListenPort);
            }
        }
    };
}
 
開發者ID:xiaowing,項目名稱:various_demos,代碼行數:21,代碼來源:EmbeddedTomcatConfig.java

示例3: servletContainer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainer() {
    final TomcatEmbeddedServletContainerFactory tomcatFactory = new TomcatEmbeddedServletContainerFactory();
    // tomcatFactory.setAddress(InetAddress.getLocalHost());// you can restrict localhost access
    tomcatFactory.setPort(8080);
    // ServletContainerInitializer

    final Connector connector = new Connector();
    connector.setPort(8443);
    connector.setSecure(true);
    connector.setScheme("https");
    connector.setProperty("SSLEnabled", "true");
    connector.setProperty("keystorePass", "spring");
    try {
        final ClassPathResource classPathResource = new ClassPathResource("keystore");
        System.err.println(classPathResource.getFile().getAbsolutePath());
        connector.setProperty("keystoreFile", classPathResource.getFile().getAbsolutePath());
    } catch (final Exception e) {
        System.err.println("Error while loading classpath resource " + e.getMessage());
    }

    tomcatFactory.addAdditionalTomcatConnectors(connector);
    return tomcatFactory;
}
 
開發者ID:tvajjala,項目名稱:interview-preparation,代碼行數:25,代碼來源:DispatchServletConfig.java

示例4: servletContainer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
/**
 * 定製方法二:注入EmbeddedServletContainerFactory
 * @return
 */
@Bean
public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
    factory.setPort(8083);
    factory.setSessionTimeout(10, TimeUnit.MINUTES);
    //優先級高於配置在/static/error文件夾裏麵的404.html頁麵
    factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error/403.html"));
    return factory;
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:14,代碼來源:CustomizationBean.java

示例5: servletContainer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
    factory.setPort(80);
    factory.setContextPath("/jersey");
    factory.setSessionTimeout(60, TimeUnit.MINUTES);
    return factory;
}
 
開發者ID:ranji1221,項目名稱:lemcloud,代碼行數:9,代碼來源:JerseyApplication.java

示例6: servletContainer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
    factory.setPort(80);
    factory.setContextPath("/liquid");
    factory.setSessionTimeout(60, TimeUnit.MINUTES);
    return factory;
}
 
開發者ID:ranji1221,項目名稱:lemcloud,代碼行數:9,代碼來源:LiquidApplication.java

示例7: containerFactory

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public TomcatEmbeddedServletContainerFactory containerFactory() {
	TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
	factory.setPort(SocketUtils.findAvailableTcpPort(40000));
	return factory;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:7,代碼來源:PublicMetricsAutoConfigurationTests.java

示例8: containerFactory

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public TomcatEmbeddedServletContainerFactory containerFactory() {
	TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
	factory.setPort(0);
	return factory;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:7,代碼來源:SecurityFilterAutoConfigurationEarlyInitializationTests.java

示例9: servletContainerFactory

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainerFactory() {
	TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = new TomcatEmbeddedServletContainerFactory();
	tomcatEmbeddedServletContainerFactory.setPort(0);
	return tomcatEmbeddedServletContainerFactory;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:7,代碼來源:WebSocketAutoConfigurationTests.java

示例10: embeddedServletContainer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory embeddedServletContainer() {
	TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
	factory.setPort(this.port);
	return factory;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:7,代碼來源:SpringApplicationIntegrationTestTests.java

示例11: servletContainer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainer() {
    final TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
    factory.setPort(11000);
    return factory;
}
 
開發者ID:vosmann,項目名稱:flechette,代碼行數:7,代碼來源:App.java

示例12: servletContainer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainer() {
    final TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
    factory.setPort(22000);
    return factory;
}
 
開發者ID:vosmann,項目名稱:flechette,代碼行數:7,代碼來源:App.java


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