Java Code Examples for org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory#setPort()

The following examples show how to use org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory#setPort() . 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: CustomizationWebServerBean.java    From wind-im with Apache License 2.0 6 votes vote down vote up
@Override
public void customize(ConfigurableServletWebServerFactory server) {
	String adminAddress = ConfigHelper.getStringConfig(ConfigKey.SITE_ADMIN_ADDRESS);
	String adminPort = ConfigHelper.getStringConfig(ConfigKey.SITE_ADMIN_PORT);

	// set admin port
	if (StringUtils.isNumeric(adminPort)) {
		server.setPort(Integer.valueOf(adminPort));
	} else {
		server.setPort(8288);
	}

	// set admin address
	if (StringUtils.isNotEmpty(adminAddress)) {
		try {
			InetAddress address = InetAddress.getByName(adminAddress);
			server.setAddress(address);
		} catch (UnknownHostException e) {
		}
	}
	server.setContextPath("/akaxin");
}
 
Example 2
Source File: CustomizationWebServerBean.java    From openzaly with Apache License 2.0 6 votes vote down vote up
@Override
public void customize(ConfigurableServletWebServerFactory server) {
	String adminAddress = ConfigHelper.getStringConfig(ConfigKey.SITE_ADMIN_ADDRESS);
	String adminPort = ConfigHelper.getStringConfig(ConfigKey.SITE_ADMIN_PORT);

	// set admin port
	if (StringUtils.isNumeric(adminPort)) {
		server.setPort(Integer.valueOf(adminPort));
	} else {
		server.setPort(8288);
	}

	// set admin address
	if (StringUtils.isNotEmpty(adminAddress)) {
		try {
			InetAddress address = InetAddress.getByName(adminAddress);
			server.setAddress(address);
		} catch (UnknownHostException e) {
		}
	}
	server.setContextPath("/akaxin");
}
 
Example 3
Source File: CustomizationWebServerBean.java    From openzaly with Apache License 2.0 6 votes vote down vote up
@Override
public void customize(ConfigurableServletWebServerFactory server) {
	String adminAddress = ConfigHelper.getStringConfig(ConfigKey.SITE_ADMIN_ADDRESS);
	String adminPort = ConfigHelper.getStringConfig(ConfigKey.SITE_ADMIN_PORT);

	// set admin port
	if (StringUtils.isNumeric(adminPort)) {
		server.setPort(Integer.valueOf(adminPort));
	} else {
		server.setPort(8288);
	}

	// set admin address
	if (StringUtils.isNotEmpty(adminAddress)) {
		try {
			InetAddress address = InetAddress.getByName(adminAddress);
			server.setAddress(address);
		} catch (UnknownHostException e) {
		}
	}
	server.setContextPath("/akaxin");
}
 
Example 4
Source File: MyServletContainerCustomizationBean.java    From tutorials with MIT License 5 votes vote down vote up
@Override
public void customize(ConfigurableServletWebServerFactory container) {
    container.setPort(8084);
    container.setContextPath("/springbootapp");

    container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/400"));
    container.addErrorPages(new ErrorPage("/errorHaven"));
}
 
Example 5
Source File: WebServerFactoryConfig.java    From demo-projects with MIT License 4 votes vote down vote up
@Override
public void customize(ConfigurableServletWebServerFactory factory) {
    int port = SocketUtils.findAvailableTcpPort(minPort, maxPort);
    factory.setPort(port);
    System.getProperties().put("server.port", port);
}
 
Example 6
Source File: WebServerFactoryListenCustomizer.java    From Cleanstone with MIT License 4 votes vote down vote up
@Override
public void customize(ConfigurableServletWebServerFactory factory) {
    factory.setPort(webConfig.getServer().getPort());
    factory.setAddress(webConfig.getServer().getAddress());
}
 
Example 7
Source File: ServletConfig.java    From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void customize(ConfigurableServletWebServerFactory factory) {
	factory.setPort(Integer.valueOf(BotSettings.PORT.get()));
	factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/"));
}
 
Example 8
Source File: ServletConfig.java    From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void customize(ConfigurableServletWebServerFactory factory) {
	factory.setPort(Integer.valueOf(BotSettings.PORT.get()));
	factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/"));
}
 
Example 9
Source File: ServletConfig.java    From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void customize(ConfigurableServletWebServerFactory factory) {
	factory.setPort(Integer.valueOf(BotSettings.PORT.get()));
	factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/"));
}
 
Example 10
Source File: ServletConfig.java    From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void customize(ConfigurableServletWebServerFactory factory) {
	factory.setPort(Integer.valueOf(BotSettings.PORT.get()));
	factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/"));
}
 
Example 11
Source File: CustomContainer.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public void customize(ConfigurableServletWebServerFactory factory) {
    factory.setContextPath("");
    factory.setPort(8080);

}