📄 connector.java
字号:
/**
* Set the Container used for processing requests received by this
* Connector.
*
* @param container The new Container to use
*/
public void setContainer(Container container) {
this.container = container;
}
/**
* Return the "empty session path" flag.
*/
public boolean getEmptySessionPath() {
return (this.emptySessionPath);
}
/**
* Set the "empty session path" flag.
*
* @param emptySessionPath The new "empty session path" flag value
*/
public void setEmptySessionPath(boolean emptySessionPath) {
this.emptySessionPath = emptySessionPath;
setProperty("emptySessionPath", String.valueOf(emptySessionPath));
}
/**
* Return the "enable DNS lookups" flag.
*/
public boolean getEnableLookups() {
return (this.enableLookups);
}
/**
* Set the "enable DNS lookups" flag.
*
* @param enableLookups The new "enable DNS lookups" flag value
*/
public void setEnableLookups(boolean enableLookups) {
this.enableLookups = enableLookups;
setProperty("enableLookups", String.valueOf(enableLookups));
}
/**
* Return descriptive information about this Connector implementation.
*/
public String getInfo() {
return (info);
}
/**
* Return the mapper.
*/
public Mapper getMapper() {
return (mapper);
}
/**
* Return the maximum size of a POST which will be automatically
* parsed by the container.
*/
public int getMaxPostSize() {
return (maxPostSize);
}
/**
* 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;
}
/**
* Return the maximum size of a POST which will be saved by the container
* during authentication.
*/
public int getMaxSavePostSize() {
return (maxSavePostSize);
}
/**
* 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));
}
/**
* Return the port number on which we listen for requests.
*/
public int getPort() {
return (this.port);
}
/**
* Set the port number on which we listen for requests.
*
* @param port The new port number
*/
public void setPort(int port) {
this.port = port;
setProperty("port", String.valueOf(port));
}
/**
* Return the Coyote protocol handler in use.
*/
public String getProtocol() {
if ("org.apache.coyote.http11.Http11Protocol".equals
(getProtocolHandlerClassName())
|| "org.apache.coyote.http11.Http11AprProtocol".equals
(getProtocolHandlerClassName())) {
return "HTTP/1.1";
} else if ("org.apache.jk.server.JkCoyoteHandler".equals
(getProtocolHandlerClassName())
|| "org.apache.coyote.ajp.AjpAprProtocol".equals
(getProtocolHandlerClassName())) {
return "AJP/1.3";
}
return getProtocolHandlerClassName();
}
// ---------------------------------------------- APR Version Constants
private static final int TCN_REQUIRED_MAJOR = 1;
private static final int TCN_REQUIRED_MINOR = 1;
private static final int TCN_REQUIRED_PATCH = 3;
private static boolean aprInitialized = false;
// APR init support
private static synchronized void initializeAPR()
{
if (aprInitialized) {
return;
}
int major = 0;
int minor = 0;
int patch = 0;
try {
String methodName = "initialize";
Class paramTypes[] = new Class[1];
paramTypes[0] = String.class;
Object paramValues[] = new Object[1];
paramValues[0] = null;
Class clazz = Class.forName("org.apache.tomcat.jni.Library");
Method method = clazz.getMethod(methodName, paramTypes);
method.invoke(null, paramValues);
major = clazz.getField("TCN_MAJOR_VERSION").getInt(null);
minor = clazz.getField("TCN_MINOR_VERSION").getInt(null);
patch = clazz.getField("TCN_PATCH_VERSION").getInt(null);
} catch (Throwable t) {
return;
}
if ((major != TCN_REQUIRED_MAJOR) ||
(minor != TCN_REQUIRED_MINOR) ||
(patch < TCN_REQUIRED_PATCH)) {
try {
// Terminate the APR in case the version
// is below required.
String methodName = "terminate";
Method method = Class.forName("org.apache.tomcat.jni.Library")
.getMethod(methodName, (Class [])null);
method.invoke(null, (Object []) null);
} catch (Throwable t) {
// Ignore
}
return;
}
aprInitialized = true;
}
/**
* Set the Coyote protocol which will be used by the connector.
*
* @param protocol The Coyote protocol name
*/
public void setProtocol(String protocol) {
// Test APR support
initializeAPR();
if (aprInitialized) {
if ("HTTP/1.1".equals(protocol)) {
setProtocolHandlerClassName
("org.apache.coyote.http11.Http11AprProtocol");
} else if ("AJP/1.3".equals(protocol)) {
setProtocolHandlerClassName
("org.apache.coyote.ajp.AjpAprProtocol");
} else if (protocol != null) {
setProtocolHandlerClassName(protocol);
} else {
setProtocolHandlerClassName
("org.apache.coyote.http11.Http11AprProtocol");
}
} else {
if ("HTTP/1.1".equals(protocol)) {
setProtocolHandlerClassName
("org.apache.coyote.http11.Http11Protocol");
} else if ("AJP/1.3".equals(protocol)) {
setProtocolHandlerClassName
("org.apache.jk.server.JkCoyoteHandler");
} else if (protocol != null) {
setProtocolHandlerClassName(protocol);
}
}
}
/**
* Return the class name of the Coyote protocol handler in use.
*/
public String getProtocolHandlerClassName() {
return (this.protocolHandlerClassName);
}
/**
* Set the class name of the Coyote protocol handler which will be used
* by the connector.
*
* @param protocolHandlerClassName The new class name
*/
public void setProtocolHandlerClassName(String protocolHandlerClassName) {
this.protocolHandlerClassName = protocolHandlerClassName;
}
/**
* Return the protocol handler associated with the connector.
*/
public ProtocolHandler getProtocolHandler() {
return (this.protocolHandler);
}
/**
* Return the proxy server name for this Connector.
*/
public String getProxyName() {
return (this.proxyName);
}
/**
* Set the proxy server name for this Connector.
*
* @param proxyName The new proxy server name
*/
public void setProxyName(String proxyName) {
if(proxyName != null && proxyName.length() > 0) {
this.proxyName = proxyName;
setProperty("proxyName", proxyName);
} else {
this.proxyName = null;
removeProperty("proxyName");
}
}
/**
* Return the proxy server port for this Connector.
*/
public int getProxyPort() {
return (this.proxyPort);
}
/**
* 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));
}
/**
* Return the port number to which a request should be redirected if
* it comes in on a non-SSL port and is subject to a security constraint
* with a transport guarantee that requires SSL.
*/
public int getRedirectPort() {
return (this.redirectPort);
}
/**
* 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));
}
/**
* Return the scheme that will be assigned to requests received
* through this connector. Default value is "http".
*/
public String getScheme() {
return (this.scheme);
}
/**
* Set the scheme that will be assigned to requests received through
* this connector.
*
* @param scheme The new scheme
*/
public void setScheme(String scheme) {
this.scheme = scheme;
}
/**
* Return the secure connection flag that will be assigned to requests
* received through this connector. Default value is "false".
*/
public boolean getSecure() {
return (this.secure);
}
/**
* 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));
}
/**
* Return the character encoding to be used for the URI.
*/
public String getURIEncoding() {
return (this.URIEncoding);
}
/**
* Set the URI encoding to be used for the URI.
*
* @param URIEncoding The new URI character encoding.
*/
public void setURIEncoding(String URIEncoding) {
this.URIEncoding = URIEncoding;
setProperty("uRIEncoding", URIEncoding);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -