本文整理汇总了Java中org.glassfish.grizzly.http.server.NetworkListener.setMaxHttpHeaderSize方法的典型用法代码示例。如果您正苦于以下问题:Java NetworkListener.setMaxHttpHeaderSize方法的具体用法?Java NetworkListener.setMaxHttpHeaderSize怎么用?Java NetworkListener.setMaxHttpHeaderSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.glassfish.grizzly.http.server.NetworkListener
的用法示例。
在下文中一共展示了NetworkListener.setMaxHttpHeaderSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createListeners
import org.glassfish.grizzly.http.server.NetworkListener; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static List<NetworkListener> createListeners(List<Connector> connectors, CompressionConfig compression) {
List<NetworkListener> listeners = Lists.newArrayList();
for (Connector connector : connectors) {
final String host = (connector.getHost() == null) ? Connector.DEFAULT_NETWORK_HOST
: connector.getHost();
final int port = (connector.getPort() == -1) ? 80 : connector.getPort();
final NetworkListener listener = new NetworkListener(
StringUtils.defaultString(connector.getName(), DEFAULT_NETWORK_LISTENER_NAME),
host,
port);
listener.setSecure(connector.isSecureEnabled());
SSLEngineConfigurator sslEngineConfigurator = createSslEngineConfigurator(connector);
if (sslEngineConfigurator != null) {
listener.setSSLEngineConfig(sslEngineConfigurator);
if (connector.isSecureEnabled() && !connector.isAjpEnabled()) {
listener.registerAddOn(new Http2AddOn());
listener.registerAddOn(new SpdyAddOn());
}
}
if (connector.isAjpEnabled()) {
listener.registerAddOn(new AjpAddOn());
}
CompressionConfig compressionConfig = listener.getCompressionConfig();
CompressionConfig compressionCfg = createCompressionConfig(null, (Map) connector.getRawProperties());
if (compression != null) {
if (compressionCfg.getCompressionMode() == null) {
compressionCfg.setCompressionMode(compression.getCompressionMode());
}
if (compressionCfg.getCompressionMode() != CompressionConfig.CompressionMode.OFF) {
if (compressionCfg.getCompressionMinSize() < 512) {
compressionCfg.setCompressionMinSize(compression.getCompressionMinSize());
}
Set<String> mimeTypes = compressionCfg.getCompressibleMimeTypes();
Set<String> newTypes = Sets.newConcurrentHashSet(compression.getCompressibleMimeTypes());
newTypes.addAll(mimeTypes);
compressionCfg.setCompressibleMimeTypes(newTypes);
Set<String> agents = compressionCfg.getNoCompressionUserAgents();
Set<String> newAgents = Sets.newConcurrentHashSet(compression.getNoCompressionUserAgents());
newAgents.addAll(agents);
compressionCfg.setNoCompressionUserAgents(newAgents);
}
}
if (compressionCfg != null) {
compressionConfig.set(compressionCfg);
}
listener.setMaxHttpHeaderSize(98304);
listeners.add(listener);
}
return listeners;
}