use of org.apache.synapse.transport.netty.config.NettyConfiguration in project wso2-synapse by wso2.
the class RequestResponseUtils method getListenerConfig.
/**
* Returns Listener configuration instance populated with source configuration.
*
* @param sourceConfiguration source configuration
* @return transport listener configuration instance
*/
public static ListenerConfiguration getListenerConfig(SourceConfiguration sourceConfiguration, boolean sslEnabled) throws AxisFault {
ListenerConfiguration listenerConfiguration = new ListenerConfiguration();
listenerConfiguration.setPort(sourceConfiguration.getPort());
listenerConfiguration.setHost(sourceConfiguration.getHost());
listenerConfiguration.setVersion(sourceConfiguration.getProtocol());
NettyConfiguration globalConfig = NettyConfiguration.getInstance();
// Set Request validation limits.
boolean isRequestLimitsValidationEnabled = globalConfig.isRequestLimitsValidationEnabled();
if (isRequestLimitsValidationEnabled) {
setInboundMgsSizeValidationConfig(globalConfig.getMaxStatusLineLength(), globalConfig.getMaxHeaderSize(), globalConfig.getMaxEntityBodySize(), listenerConfiguration.getMsgSizeValidationConfig());
}
int idleTimeout = globalConfig.getSocketTimeout();
if (idleTimeout < 0) {
throw new AxisFault("Idle timeout cannot be negative. If you want to disable the " + "timeout please use value 0");
}
listenerConfiguration.setSocketIdleTimeout(idleTimeout);
// Pipelining is disabled all the time
listenerConfiguration.setPipeliningEnabled(false);
if (isHTTPTraceLoggerEnabled()) {
listenerConfiguration.setHttpTraceLogEnabled(true);
}
if (isHTTPAccessLoggerEnabled()) {
listenerConfiguration.setHttpAccessLogEnabled(true);
}
if (sslEnabled) {
return setSslConfig(sourceConfiguration.getInDescription(), listenerConfiguration, sourceConfiguration);
}
return listenerConfiguration;
}
use of org.apache.synapse.transport.netty.config.NettyConfiguration in project wso2-synapse by wso2.
the class HttpUtils method populatePoolingConfig.
public static void populatePoolingConfig(PoolConfiguration poolConfiguration) {
NettyConfiguration globalConf = NettyConfiguration.getInstance();
poolConfiguration.setMaxActivePerPool(globalConf.getConnectionPoolingMaxActiveConnections());
poolConfiguration.setMaxIdlePerPool(globalConf.getConnectionPoolingMaxIdleConnections());
poolConfiguration.setMaxWaitTime((long) globalConf.getConnectionPoolingWaitTime() * 1000);
}
Aggregations