org.apache.catalina.connector.Connector.setProperty()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(333)

本文整理了Java中org.apache.catalina.connector.Connector.setProperty()方法的一些代码示例,展示了Connector.setProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connector.setProperty()方法的具体详情如下:
包路径:org.apache.catalina.connector.Connector
类名称:Connector
方法名:setProperty

Connector.setProperty介绍

[英]Set a configured property.
[中]设置已配置的属性。

代码示例

代码示例来源:origin: stackoverflow.com

@Component
public class TomcatCustomizer implements TomcatConnectorCustomizer {

 @Override
 public void customize(Connector connector) {
  connector.setProperty("compression", "on");
  // Add json and xml mime types, as they're not in the mimetype list by default
  connector.setProperty("compressableMimeType", "text/html,text/xml,text/plain,application/json,application/xml");
 }
}

代码示例来源:origin: SonarSource/sonarqube

private static void configureCompression(Connector connector) {
 connector.setProperty("compression", "on");
 connector.setProperty("compressionMinSize", "1024");
 connector.setProperty("compressableMimeType", "text/html,text/xml,text/plain,text/css,application/json,application/javascript");
}

代码示例来源:origin: SonarSource/sonarqube

private static void configurePool(Props props, Connector connector) {
 connector.setProperty("acceptorThreadCount", String.valueOf(2));
 connector.setProperty("minSpareThreads", String.valueOf(props.valueAsInt("sonar.web.http.minThreads", 5)));
 connector.setProperty("maxThreads", String.valueOf(props.valueAsInt("sonar.web.http.maxThreads", 50)));
 connector.setProperty("acceptCount", String.valueOf(props.valueAsInt("sonar.web.http.acceptCount", 25)));
}

代码示例来源:origin: apache/incubator-dubbo

tomcat.setBaseDir(baseDir);
tomcat.setPort(url.getPort());
tomcat.getConnector().setProperty(
    "maxThreads", String.valueOf(url.getParameter(Constants.THREADS_KEY, Constants.DEFAULT_THREADS)));
tomcat.getConnector().setProperty(
    "maxConnections", String.valueOf(url.getParameter(Constants.ACCEPTS_KEY, -1)));
tomcat.getConnector().setProperty("URIEncoding", "UTF-8");
tomcat.getConnector().setProperty("connectionTimeout", "60000");
tomcat.getConnector().setProperty("maxKeepAliveRequests", "-1");
tomcat.getConnector().setProtocol("org.apache.coyote.http11.Http11NioProtocol");

代码示例来源:origin: apache/incubator-dubbo

tomcat.setBaseDir(baseDir);
tomcat.setPort(url.getPort());
tomcat.getConnector().setProperty(
    "maxThreads", String.valueOf(url.getParameter(Constants.THREADS_KEY, Constants.DEFAULT_THREADS)));
tomcat.getConnector().setProperty(
    "maxConnections", String.valueOf(url.getParameter(Constants.ACCEPTS_KEY, -1)));
tomcat.getConnector().setProperty("URIEncoding", "UTF-8");
tomcat.getConnector().setProperty("connectionTimeout", "60000");
tomcat.getConnector().setProperty("maxKeepAliveRequests", "-1");
tomcat.getConnector().setProtocol("org.apache.coyote.http11.Http11NioProtocol");

代码示例来源:origin: SonarSource/sonarqube

private static Connector newHttpConnector(Props props) {
 // Not named "sonar.web.http.port" to keep backward-compatibility
 int port = props.valueAsInt("sonar.web.port", 9000);
 if (port < 0) {
  throw new IllegalStateException(format("HTTP port '%s' is invalid", port));
 }
 Connector connector = new Connector(HTTP_PROTOCOL);
 connector.setURIEncoding("UTF-8");
 connector.setProperty("address", props.value("sonar.web.host", "0.0.0.0"));
 connector.setProperty("socket.soReuseAddress", "true");
 configurePool(props, connector);
 configureCompression(connector);
 configureMaxHttpHeaderSize(connector);
 connector.setPort(port);
 connector.setMaxPostSize(MAX_POST_SIZE);
 return connector;
}

代码示例来源:origin: org.springframework.boot/spring-boot

protected void customizeConnector(Connector connector) {
  int port = (getPort() >= 0) ? getPort() : 0;
  connector.setPort(port);
  if (StringUtils.hasText(this.getServerHeader())) {
    connector.setAttribute("server", this.getServerHeader());
  }
  if (connector.getProtocolHandler() instanceof AbstractProtocol) {
    customizeProtocol((AbstractProtocol<?>) connector.getProtocolHandler());
  }
  if (getUriEncoding() != null) {
    connector.setURIEncoding(getUriEncoding().name());
  }
  // Don't bind to the socket prematurely if ApplicationContext is slow to start
  connector.setProperty("bindOnInit", "false");
  if (getSsl() != null && getSsl().isEnabled()) {
    customizeSsl(connector);
  }
  TomcatConnectorCustomizer compression = new CompressionConnectorCustomizer(
      getCompression());
  compression.customize(connector);
  for (TomcatConnectorCustomizer customizer : this.tomcatConnectorCustomizers) {
    customizer.customize(connector);
  }
}

代码示例来源:origin: org.springframework.boot/spring-boot

protected void customizeConnector(Connector connector) {
  int port = (getPort() >= 0) ? getPort() : 0;
  connector.setPort(port);
  if (StringUtils.hasText(this.getServerHeader())) {
    connector.setAttribute("server", this.getServerHeader());
  }
  if (connector.getProtocolHandler() instanceof AbstractProtocol) {
    customizeProtocol((AbstractProtocol<?>) connector.getProtocolHandler());
  }
  if (getUriEncoding() != null) {
    connector.setURIEncoding(getUriEncoding().name());
  }
  // Don't bind to the socket prematurely if ApplicationContext is slow to start
  connector.setProperty("bindOnInit", "false");
  if (getSsl() != null && getSsl().isEnabled()) {
    customizeSsl(connector);
  }
  TomcatConnectorCustomizer compression = new CompressionConnectorCustomizer(
      getCompression());
  compression.customize(connector);
  for (TomcatConnectorCustomizer customizer : this.tomcatConnectorCustomizers) {
    customizer.customize(connector);
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set a property on the protocol handler.
 *
 * @param name the property name
 * @param value the property value
 */
public void setAttribute(String name, Object value) {
  setProperty(name, String.valueOf(value));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the allowTrace flag, to disable or enable the TRACE HTTP method.
 *
 * @param allowTrace The new allowTrace flag
 */
public void setAllowTrace(boolean allowTrace) {
  this.allowTrace = allowTrace;
  setProperty("allowTrace", String.valueOf(allowTrace));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the maximum number of parameters (GET plus POST) that will be
 * automatically parsed by the container. A value of less than 0 means no
 * limit.
 *
 * @param maxParameterCount The new setting
 */
public void setMaxParameterCount(int maxParameterCount) {
  this.maxParameterCount = maxParameterCount;
  setProperty("maxParameterCount", String.valueOf(maxParameterCount));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the maximum size of a POST which will be automatically
 * parsed by the container.
 *
 * @param maxPostSize The new maximum size in bytes of a POST which will
 * be automatically parsed by the container
 */
public void setMaxPostSize(int maxPostSize) {
  this.maxPostSize = maxPostSize;
  setProperty("maxPostSize", String.valueOf(maxPostSize));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the maximum size of a POST which will be saved by the container
 * during authentication.
 *
 * @param maxSavePostSize The new maximum size in bytes of a POST which will
 * be saved by the container during authentication.
 */
public void setMaxSavePostSize(int maxSavePostSize) {
  this.maxSavePostSize = maxSavePostSize;
  setProperty("maxSavePostSize", String.valueOf(maxSavePostSize));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the proxy server port for this Connector.
 *
 * @param proxyPort The new proxy server port
 */
public void setProxyPort(int proxyPort) {
  this.proxyPort = proxyPort;
  setProperty("proxyPort", String.valueOf(proxyPort));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the redirect port number.
 *
 * @param redirectPort The redirect port number (non-SSL to SSL)
 */
public void setRedirectPort(int redirectPort) {
  this.redirectPort = redirectPort;
  setProperty("redirectPort", String.valueOf(redirectPort));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Enable the use of IP-based virtual hosting.
 *
 * @param useIPVHosts <code>true</code> if Hosts are identified by IP,
 *                    <code>false</code> if Hosts are identified by name.
 */
public void setUseIPVHosts(boolean useIPVHosts) {
  this.useIPVHosts = useIPVHosts;
  setProperty("useIPVHosts", String.valueOf(useIPVHosts));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the default timeout for async requests.
 *
 * @param asyncTimeout The new timeout in ms.
 */
public void setAsyncTimeout(long asyncTimeout) {
  this.asyncTimeout= asyncTimeout;
  setProperty("asyncTimeout", String.valueOf(asyncTimeout));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the port number on which we listen for requests.
 *
 * @param port The new port number
 */
public void setPort(int port) {
  setProperty("port", String.valueOf(port));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the secure connection flag that will be assigned to requests
 * received through this connector.
 *
 * @param secure The new secure connection flag
 */
public void setSecure(boolean secure) {
  this.secure = secure;
  setProperty("secure", Boolean.toString(secure));
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set if the entity body encoding should be used for the URI.
 *
 * @param useBodyEncodingForURI The new value for the flag.
 */
public void setUseBodyEncodingForURI(boolean useBodyEncodingForURI) {
  this.useBodyEncodingForURI = useBodyEncodingForURI;
  setProperty("useBodyEncodingForURI", String.valueOf(useBodyEncodingForURI));
}

相关文章

Connector类方法