This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 01588cbad4 Add javadoc
01588cbad4 is described below
commit 01588cbad4c7934e13e850dc7d02fa5276cb3728
Author: remm <[email protected]>
AuthorDate: Thu Apr 2 15:24:41 2026 +0200
Add javadoc
---
.../org/apache/coyote/ajp/AbstractAjpProtocol.java | 120 ++++++++++++++++++++-
1 file changed, 116 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
index f1e517f1a1..3354eeebfa 100644
--- a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
+++ b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
@@ -43,6 +43,11 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
protected static final StringManager sm =
StringManager.getManager(AbstractAjpProtocol.class);
+ /**
+ * Creates a new AJP protocol handler.
+ *
+ * @param endpoint The endpoint for low-level network I/O
+ */
public AbstractAjpProtocol(AbstractEndpoint<S,?> endpoint) {
super(endpoint);
setConnectionTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
@@ -53,6 +58,11 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
}
+ /**
+ * Gets the name of the protocol.
+ *
+ * @return the protocol name
+ */
@Override
protected String getProtocolName() {
return "Ajp";
@@ -90,6 +100,11 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
private boolean ajpFlush = true;
+ /**
+ * Gets whether AJP flush packets are used.
+ *
+ * @return <code>true</code> if flush packets are used
+ */
public boolean getAjpFlush() {
return ajpFlush;
}
@@ -118,6 +133,11 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
return tomcatAuthentication;
}
+ /**
+ * Sets whether authentication should be done in Tomcat.
+ *
+ * @param tomcatAuthentication {@code true} if authentication should be
performed by Tomcat
+ */
public void setTomcatAuthentication(boolean tomcatAuthentication) {
this.tomcatAuthentication = tomcatAuthentication;
}
@@ -134,6 +154,11 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
return tomcatAuthorization;
}
+ /**
+ * Sets whether authorization should be done by Tomcat.
+ *
+ * @param tomcatAuthorization {@code true} if authorization should be
performed by Tomcat
+ */
public void setTomcatAuthorization(boolean tomcatAuthorization) {
this.tomcatAuthorization = tomcatAuthorization;
}
@@ -150,6 +175,11 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
this.secret = secret;
}
+ /**
+ * Gets the secret that must be included with every request.
+ *
+ * @return the secret
+ */
protected String getSecret() {
return secret;
}
@@ -157,10 +187,20 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
private boolean secretRequired = true;
+ /**
+ * Sets whether a secret is required with every request.
+ *
+ * @param secretRequired {@code true} if a secret is required
+ */
public void setSecretRequired(boolean secretRequired) {
this.secretRequired = secretRequired;
}
+ /**
+ * Gets whether a secret is required with every request.
+ *
+ * @return {@code true} if a secret is required
+ */
public boolean getSecretRequired() {
return secretRequired;
}
@@ -168,14 +208,29 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
private Pattern allowedRequestAttributesPattern;
+ /**
+ * Sets the pattern for allowed request attributes.
+ *
+ * @param allowedRequestAttributesPattern The regex pattern
+ */
public void setAllowedRequestAttributesPattern(String
allowedRequestAttributesPattern) {
this.allowedRequestAttributesPattern =
Pattern.compile(allowedRequestAttributesPattern);
}
+ /**
+ * Gets the pattern for allowed request attributes.
+ *
+ * @return the pattern string
+ */
public String getAllowedRequestAttributesPattern() {
return allowedRequestAttributesPattern.pattern();
}
+ /**
+ * Gets the compiled pattern for allowed request attributes.
+ *
+ * @return the pattern
+ */
protected Pattern getAllowedRequestAttributesPatternInternal() {
return allowedRequestAttributesPattern;
}
@@ -186,15 +241,30 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
*/
private int packetSize = Constants.MAX_PACKET_SIZE;
+ /**
+ * Gets the AJP packet size.
+ *
+ * @return the packet size
+ */
public int getPacketSize() {
return packetSize;
}
+ /**
+ * Sets the AJP packet size.
+ *
+ * @param packetSize The packet size (must be at least MAX_PACKET_SIZE)
+ */
public void setPacketSize(int packetSize) {
this.packetSize = Math.max(packetSize, Constants.MAX_PACKET_SIZE);
}
+ /**
+ * Gets the desired buffer size for AJP packets.
+ *
+ * @return the desired buffer size
+ */
@Override
public int getDesiredBufferSize() {
return getPacketSize() - Constants.SEND_HEAD_LEN;
@@ -203,42 +273,79 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
// --------------------------------------------- SSL is not supported in
AJP
+ /**
+ * Adds an SSL host configuration. AJP does not support SSL so this logs a
warning.
+ *
+ * @param sslHostConfig The SSL host configuration
+ */
@Override
public void addSslHostConfig(SSLHostConfig sslHostConfig) {
getLog().warn(sm.getString("ajpprotocol.noSSL",
sslHostConfig.getHostName()));
}
-
+ /**
+ * Adds an SSL host configuration. AJP does not support SSL so this logs a
warning.
+ *
+ * @param sslHostConfig The SSL host configuration
+ * @param replace Whether to replace existing configurations
+ */
@Override
public void addSslHostConfig(SSLHostConfig sslHostConfig, boolean replace)
{
getLog().warn(sm.getString("ajpprotocol.noSSL",
sslHostConfig.getHostName()));
}
-
+ /**
+ * Finds SSL host configurations. AJP does not support SSL so this always
returns an empty array.
+ *
+ * @return an empty array
+ */
@Override
public SSLHostConfig[] findSslHostConfigs() {
return new SSLHostConfig[0];
}
-
+ /**
+ * Adds an upgrade protocol. AJP does not support upgrade so this logs a
warning.
+ *
+ * @param upgradeProtocol The upgrade protocol
+ */
@Override
public void addUpgradeProtocol(UpgradeProtocol upgradeProtocol) {
getLog().warn(sm.getString("ajpprotocol.noUpgrade",
upgradeProtocol.getClass().getName()));
}
-
+ /**
+ * Finds upgrade protocols. AJP does not support upgrade so this always
returns an empty array.
+ *
+ * @return an empty array
+ */
@Override
public UpgradeProtocol[] findUpgradeProtocols() {
return new UpgradeProtocol[0];
}
+ /**
+ * Creates a new AJP processor.
+ *
+ * @return the processor
+ */
@Override
protected Processor createProcessor() {
return new AjpProcessor(this, getAdapter());
}
+ /**
+ * Creates an upgrade processor. AJP does not support upgrade so this
always throws.
+ *
+ * @param socket The socket wrapper
+ * @param upgradeToken The upgrade token
+ *
+ * @return never returns
+ *
+ * @throws IllegalStateException always
+ */
@Override
protected Processor createUpgradeProcessor(SocketWrapperBase<?> socket,
UpgradeToken upgradeToken) {
throw new IllegalStateException(
@@ -246,6 +353,11 @@ public abstract class AbstractAjpProtocol<S> extends
AbstractProtocol<S> {
}
+ /**
+ * Starts the AJP protocol handler. Validates that a secret is configured
if required.
+ *
+ * @throws Exception if start fails
+ */
@Override
public void start() throws Exception {
if (getSecretRequired()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]