Record Class ServletConnectionImpl
java.lang.Object
java.lang.Record
org.apache.tomcat.util.net.ServletConnectionImpl
- All Implemented Interfaces:
- ServletConnection
public record ServletConnectionImpl(String connectionId, String protocol, String protocolConnectionId, boolean secure)
extends Record
implements ServletConnection
- 
Constructor SummaryConstructorsConstructorDescriptionServletConnectionImpl(String connectionId, String protocol, String protocolConnectionId, boolean secure) Creates an instance of aServletConnectionImplrecord class.
- 
Method SummaryModifier and TypeMethodDescriptionReturns the value of theconnectionIdrecord component.final booleanIndicates whether some other object is "equal to" this one.Obtain a unique (within the lifetime of the JVM) identifier string for the network connection to the JVM that is being used for theServletRequestfrom which thisServletConnectionwas obtained.Obtain the name of the protocol as presented to the server after the removal, if present, of any TLS or similar encryption.Obtain the connection identifier for the network connection to the server that is being used for theServletRequestfrom which thisServletConnectionwas obtained as defined by the protocol in use.final inthashCode()Returns a hash code value for this object.booleanisSecure()Determine whether the incoming network connection to the server used encryption or not.protocol()Returns the value of theprotocolrecord component.Returns the value of theprotocolConnectionIdrecord component.booleansecure()Returns the value of thesecurerecord component.final StringtoString()Returns a string representation of this record class.
- 
Constructor Details- 
ServletConnectionImplpublic ServletConnectionImpl(String connectionId, String protocol, String protocolConnectionId, boolean secure) Creates an instance of aServletConnectionImplrecord class.- Parameters:
- connectionId- the value for the- connectionIdrecord component
- protocol- the value for the- protocolrecord component
- protocolConnectionId- the value for the- protocolConnectionIdrecord component
- secure- the value for the- securerecord component
 
 
- 
- 
Method Details- 
getConnectionIdDescription copied from interface:jakarta.servlet.ServletConnectionObtain a unique (within the lifetime of the JVM) identifier string for the network connection to the JVM that is being used for theServletRequestfrom which thisServletConnectionwas obtained.There is no defined format for this string. The format is implementation dependent. - Specified by:
- getConnectionIdin interface- ServletConnection
- Returns:
- A unique identifier for the network connection
 
- 
getProtocolDescription copied from interface:jakarta.servlet.ServletConnectionObtain the name of the protocol as presented to the server after the removal, if present, of any TLS or similar encryption. This may not be the same as the protocol seen by the application. For example, a reverse proxy may present AJP whereas the application will see HTTP 1.1.If the protocol has an entry in the IANA registry for ALPN names then the identification sequence, in string form, must be returned. Registered identification sequences MUST only be used for the associated protocol. Return values for other protocols are implementation dependent. Unknown protocols should return the string "unknown". - Specified by:
- getProtocolin interface- ServletConnection
- Returns:
- The name of the protocol presented to the server after decryption of TLS, or similar encryption, if any.
 
- 
getProtocolConnectionIdDescription copied from interface:jakarta.servlet.ServletConnectionObtain the connection identifier for the network connection to the server that is being used for theServletRequestfrom which thisServletConnectionwas obtained as defined by the protocol in use. Note that some protocols do not define such an identifier.Examples of protocol provided connection identifiers include: - HTTP 1.x
- None, so the empty string should be returned
- HTTP 2
- None, so the empty string should be returned
- HTTP 3
- The QUIC connection ID
- AJP
- None, so the empty string should be returned
 - Specified by:
- getProtocolConnectionIdin interface- ServletConnection
- Returns:
- The connection identifier if one is defined, otherwise an empty string
 
- 
isSecurepublic boolean isSecure()Description copied from interface:jakarta.servlet.ServletConnectionDetermine whether the incoming network connection to the server used encryption or not. Note that where a reverse proxy is used, the application may have a different view as to whether encryption is being used due to the use of headers likeX-Forwarded-Proto.- Specified by:
- isSecurein interface- ServletConnection
- Returns:
- trueif the incoming network connection used encryption, otherwise- false
 
- 
toString
- 
hashCode
- 
equalsIndicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes.
- 
connectionIdReturns the value of theconnectionIdrecord component.- Returns:
- the value of the connectionIdrecord component
 
- 
protocolReturns the value of theprotocolrecord component.- Returns:
- the value of the protocolrecord component
 
- 
protocolConnectionIdReturns the value of theprotocolConnectionIdrecord component.- Returns:
- the value of the protocolConnectionIdrecord component
 
- 
securepublic boolean secure()Returns the value of thesecurerecord component.- Returns:
- the value of the securerecord component
 
 
-