Replace 'e.g.' with 'for example' in documentation and comments

Closes gh-33515
This commit is contained in:
Yanming Zhou
2024-09-26 14:03:46 +02:00
committed by Sam Brannen
parent e55fe9077f
commit 8941e2876e
722 changed files with 1290 additions and 1290 deletions

View File

@@ -58,7 +58,7 @@ public final class CloseStatus implements Serializable {
/**
* "1003 indicates that an endpoint is terminating the connection because it has
* received a type of data it cannot accept (e.g., an endpoint that understands only
* received a type of data it cannot accept (for example, an endpoint that understands only
* text data MAY send this if it receives a binary message)."
*/
public static final CloseStatus NOT_ACCEPTABLE = new CloseStatus(1003);
@@ -76,7 +76,7 @@ public final class CloseStatus implements Serializable {
/**
* "1006 is a reserved value and MUST NOT be set as a status code in a Close control
* frame by an endpoint. It is designated for use in applications expecting a status
* code to indicate that the connection was closed abnormally, e.g., without sending
* code to indicate that the connection was closed abnormally, for example, without sending
* or receiving a Close control frame."
*/
public static final CloseStatus NO_CLOSE_FRAME = new CloseStatus(1006);
@@ -84,14 +84,14 @@ public final class CloseStatus implements Serializable {
/**
* "1007 indicates that an endpoint is terminating the connection because it has
* received data within a message that was not consistent with the type of the message
* (e.g., non-UTF-8 [RFC3629] data within a text message)."
* (for example, non-UTF-8 [RFC3629] data within a text message)."
*/
public static final CloseStatus BAD_DATA = new CloseStatus(1007);
/**
* "1008 indicates that an endpoint is terminating the connection because it has
* received a message that violates its policy. This is a generic status code that can
* be returned when there is no other more suitable status code (e.g., 1003 or 1009)
* be returned when there is no other more suitable status code (for example, 1003 or 1009)
* or if there is a need to hide specific details about the policy."
*/
public static final CloseStatus POLICY_VIOLATION = new CloseStatus(1008);
@@ -135,14 +135,14 @@ public final class CloseStatus implements Serializable {
* "1015 is a reserved value and MUST NOT be set as a status code in a Close control
* frame by an endpoint. It is designated for use in applications expecting a status
* code to indicate that the connection was closed due to a failure to perform a TLS
* handshake (e.g., the server certificate can't be verified)."
* handshake (for example, the server certificate can't be verified)."
*/
public static final CloseStatus TLS_HANDSHAKE_FAILURE = new CloseStatus(1015);
/**
* A status code for use within the framework that indicates a session has
* become unreliable (e.g. timed out while sending a message) and extra
* care should be exercised, e.g. avoid sending any further data to the
* become unreliable (for example, timed out while sending a message) and extra
* care should be exercised, for example, avoid sending any further data to the
* client that may be done during normal shutdown.
* @since 4.0.3
*/

View File

@@ -41,7 +41,7 @@ import org.springframework.util.StringUtils;
* <a href="https://tools.ietf.org/html/rfc7230#section-3.2">RFC 7230 section 3.2</a></p>
*
* <p>Note that the order of extensions in HTTP headers defines their order of execution,
* e.g. extensions "foo, bar" will be executed as "bar(foo(message))".</p>
* for example, extensions "foo, bar" will be executed as "bar(foo(message))".</p>
*
* @author Brian Clozel
* @author Juergen Hoeller

View File

@@ -83,8 +83,8 @@ import org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler;
*
* <p>Registers the following {@link org.springframework.messaging.MessageChannel MessageChannels}:
* <ul>
* <li>"clientInboundChannel" for receiving messages from clients (e.g. WebSocket clients)
* <li>"clientOutboundChannel" for sending messages to clients (e.g. WebSocket clients)
* <li>"clientInboundChannel" for receiving messages from clients (for example, WebSocket clients)
* <li>"clientOutboundChannel" for sending messages to clients (for example, WebSocket clients)
* <li>"brokerChannel" for sending messages from within the application to the message broker
* </ul>
*

View File

@@ -48,7 +48,7 @@ import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
* The frequency of logging can be changed via {@link #setLoggingPeriod(long)}.
*
* <p>This class is declared as a Spring bean by the above configuration with the
* name "webSocketMessageBrokerStats" and can be easily exported to JMX, e.g. with
* name "webSocketMessageBrokerStats" and can be easily exported to JMX, for example, with
* the {@link org.springframework.jmx.export.MBeanExporter MBeanExporter}.
*
* @author Rossen Stoyanchev

View File

@@ -96,7 +96,7 @@ public class SockJsServiceRegistration {
}
/**
* Transports with no native cross-domain communication (e.g. "eventsource",
* Transports with no native cross-domain communication (for example, "eventsource",
* "htmlfile") must get a simple page from the "foreign" domain in an invisible
* {@code iframe} so that code in the {@code iframe} can run from a domain
* local to the SockJS server. Since the {@code iframe} needs to load the
@@ -135,7 +135,7 @@ public class SockJsServiceRegistration {
/**
* The SockJS protocol requires a server to respond to the initial "/info" request
* from clients with a "cookie_needed" boolean property that indicates whether the use
* of a JSESSIONID cookie is required for the application to function correctly, e.g.
* of a JSESSIONID cookie is required for the application to function correctly, for example,
* for load balancing or in Java Servlet containers for the use of an HTTP session.
*
* <p>This is especially important for IE 8,9 that support XDomainRequest -- a modified

View File

@@ -28,7 +28,7 @@ import org.springframework.messaging.simp.config.MessageBrokerRegistry;
/**
* Defines methods for configuring message handling with simple messaging
* protocols (e.g. STOMP) from WebSocket clients.
* protocols (for example, STOMP) from WebSocket clients.
*
* <p>Typically used to customize the configuration provided via
* {@link EnableWebSocketMessageBroker @EnableWebSocketMessageBroker}.
@@ -94,7 +94,7 @@ public interface WebSocketMessageBrokerConfigurer {
/**
* Configure the message converters to use when extracting the payload of
* messages in annotated methods and when sending messages (e.g. through the
* messages in annotated methods and when sending messages (for example, through the
* "broker" SimpMessagingTemplate).
* <p>The provided list, initially empty, can be used to add message converters
* while the boolean return value is used to determine if default message should

View File

@@ -151,7 +151,7 @@ public class WebSocketTransportRegistration {
* is established and before the first sub-protocol message is received.
* <p>This handler is for WebSocket connections that use a sub-protocol.
* Therefore, we expect the client to send at least one sub-protocol message
* in the beginning, or else we assume the connection isn't doing well, e.g.
* in the beginning, or else we assume the connection isn't doing well, for example,
* proxy issue, slow network, and can be closed.
* <p>By default this is set to {@code 60,000} (1 minute).
* @param timeToFirstMessage the maximum time allowed in milliseconds

View File

@@ -21,7 +21,7 @@ import org.springframework.web.socket.CloseStatus;
/**
* Raised when a WebSocket session has exceeded limits it has been configured
* for, e.g. timeout, buffer size, etc.
* for, for example, timeout, buffer size, etc.
*
* @author Rossen Stoyanchev
* @since 4.0.3

View File

@@ -25,7 +25,7 @@ import org.springframework.util.Assert;
/**
* A base class for events for a message received from a WebSocket client and
* parsed into a higher-level sub-protocol (e.g. STOMP).
* parsed into a higher-level sub-protocol (for example, STOMP).
*
* @author Rossen Stoyanchev
* @since 4.1

View File

@@ -23,7 +23,7 @@ import org.springframework.messaging.Message;
/**
* Event raised when a new WebSocket client using a Simple Messaging Protocol
* (e.g. STOMP) as the WebSocket sub-protocol issues a connect request.
* (for example, STOMP) as the WebSocket sub-protocol issues a connect request.
*
* <p>Note that this is not the same as the WebSocket session getting established
* but rather the client's first attempt to connect within the sub-protocol,

View File

@@ -25,7 +25,7 @@ import org.springframework.web.socket.CloseStatus;
/**
* Event raised when the session of a WebSocket client using a Simple Messaging
* Protocol (e.g. STOMP) as the WebSocket sub-protocol is closed.
* Protocol (for example, STOMP) as the WebSocket sub-protocol is closed.
*
* <p>Note that this event may be raised more than once for a single session and
* therefore event consumers should be idempotent and ignore a duplicate event.

View File

@@ -23,7 +23,7 @@ import org.springframework.messaging.Message;
/**
* Event raised when a new WebSocket client using a Simple Messaging Protocol
* (e.g. STOMP) sends a subscription request.
* (for example, STOMP) sends a subscription request.
*
* @author Rossen Stoyanchev
* @since 4.0.3

View File

@@ -23,7 +23,7 @@ import org.springframework.messaging.Message;
/**
* Event raised when a new WebSocket client using a Simple Messaging Protocol
* (e.g. STOMP) sends a request to remove a subscription.
* (for example, STOMP) sends a request to remove a subscription.
*
* @author Rossen Stoyanchev
* @since 4.0.3

View File

@@ -413,7 +413,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
session.sendMessage(new TextMessage(bytes));
}
catch (Throwable ex) {
// Could be part of normal workflow (e.g. browser tab closed)
// Could be part of normal workflow (for example, browser tab closed)
logger.debug("Failed to send STOMP ERROR to client", ex);
}
finally {
@@ -534,7 +534,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
throw ex;
}
catch (Throwable ex) {
// Could be part of normal workflow (e.g. browser tab closed)
// Could be part of normal workflow (for example, browser tab closed)
if (logger.isDebugEnabled()) {
logger.debug("Failed to send WebSocket message to client in session " + session.getId(), ex);
}

View File

@@ -34,7 +34,7 @@ public interface SubProtocolErrorHandler<P> {
* <p>Note that the STOMP protocol requires a server to close the connection
* after sending an ERROR frame. To prevent an ERROR frame from being sent,
* a handler could return {@code null} and send a notification message
* through the broker instead, e.g. via a user destination.
* through the broker instead, for example, via a user destination.
* @param clientMessage the client message related to the error, possibly
* {@code null} if error occurred while parsing a WebSocket message
* @param ex the cause for the error, never {@code null}
@@ -45,7 +45,7 @@ public interface SubProtocolErrorHandler<P> {
Message<P> handleClientMessageProcessingError(@Nullable Message<P> clientMessage, Throwable ex);
/**
* Handle errors sent from the server side to clients, e.g. errors from the
* Handle errors sent from the server side to clients, for example, errors from the
* {@link org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler
* "broke relay"} because connectivity failed or the external broker sent an
* error message, etc.

View File

@@ -232,7 +232,7 @@ public class SubProtocolWebSocketHandler
* is established and before the first sub-protocol message is received.
* <p>This handler is for WebSocket connections that use a sub-protocol.
* Therefore, we expect the client to send at least one sub-protocol message
* in the beginning, or else we assume the connection isn't doing well, e.g.
* in the beginning, or else we assume the connection isn't doing well, for example,
* proxy issue, slow network, and can be closed.
* <p>By default this is set to {@code 60,000} (1 minute).
* @param timeToFirstMessage the maximum time allowed in milliseconds
@@ -403,7 +403,7 @@ public class SubProtocolWebSocketHandler
}
}
catch (Exception ex) {
// Could be part of normal workflow (e.g. browser tab closed)
// Could be part of normal workflow (for example, browser tab closed)
if (logger.isDebugEnabled()) {
logger.debug("Failed to send message to client in " + session + ": " + message, ex);
}
@@ -497,7 +497,7 @@ public class SubProtocolWebSocketHandler
/**
* A higher-level protocol can use heartbeats to detect sessions that need to
* be cleaned up. However, if a WebSocket session is established, but messages
* can't flow (e.g. due to a proxy issue), then the higher level protocol is
* can't flow (for example, due to a proxy issue), then the higher level protocol is
* never successfully negotiated, and without heartbeats, sessions can hang.
* The method checks for sessions that have not received any messages 60
* seconds after the WebSocket session was established, and closes them.

View File

@@ -59,7 +59,7 @@ import org.springframework.web.socket.server.standard.WebSphereRequestUpgradeStr
*
* <p>Performs initial validation of the WebSocket handshake request - possibly rejecting it
* through the appropriate HTTP status code - while also allowing its subclasses to override
* various parts of the negotiation process (e.g. origin validation, sub-protocol negotiation,
* various parts of the negotiation process (for example, origin validation, sub-protocol negotiation,
* extensions negotiation, etc).
*
* <p>If the negotiation succeeds, the actual upgrade is delegated to a server-specific

View File

@@ -20,7 +20,7 @@ import org.springframework.lang.Nullable;
/**
* Indicates a serious failure that occurred in the SockJS implementation as opposed to
* in user code (e.g. IOException while writing to the response). When this exception
* in user code (for example, IOException while writing to the response). When this exception
* is raised, the SockJS session is typically closed.
*
* @author Rossen Stoyanchev

View File

@@ -49,7 +49,7 @@ import org.springframework.web.socket.sockjs.frame.SockJsFrame;
/**
* An XHR transport based on Jetty's {@link org.eclipse.jetty.client.HttpClient}.
*
* <p>When used for testing purposes (e.g. load testing) the {@code HttpClient}
* <p>When used for testing purposes (for example, load testing) the {@code HttpClient}
* properties must be set to allow a larger than usual number of connections and
* threads. For example:
*

View File

@@ -119,10 +119,10 @@ public class SockJsClient implements WebSocketClient, Lifecycle {
* The names of HTTP headers that should be copied from the handshake headers
* of each call to {@link SockJsClient#doHandshake(WebSocketHandler, WebSocketHttpHeaders, URI)}
* and also used with other HTTP requests issued as part of that SockJS
* connection, e.g. the initial info request, XHR send or receive requests.
* connection, for example, the initial info request, XHR send or receive requests.
* <p>By default if this property is not set, all handshake headers are also
* used for other HTTP requests. Set it if you want only a subset of handshake
* headers (e.g. auth headers) to be used for other HTTP requests.
* headers (for example, auth headers) to be used for other HTTP requests.
* @param httpHeaderNames the HTTP header names
*/
public void setHttpHeaderNames(@Nullable String... httpHeaderNames) {

View File

@@ -70,7 +70,7 @@ import org.springframework.web.socket.sockjs.frame.SockJsFrame;
*
* <p>Requires Undertow 1.3 or 1.4, including XNIO.
*
* <p>When used for testing purposes (e.g. load testing) or for specific use cases
* <p>When used for testing purposes (for example, load testing) or for specific use cases
* (like HTTPS configuration), a custom {@link OptionMap} should be provided:
*
* <pre class="code">

View File

@@ -55,7 +55,7 @@ import org.springframework.web.util.WebUtils;
/**
* An abstract base class for {@link SockJsService} implementations that provides SockJS
* path resolution and handling of static SockJS requests (e.g. "/info", "/iframe.html",
* path resolution and handling of static SockJS requests (for example, "/info", "/iframe.html",
* etc). Sub-classes must handle session URLs (i.e. transport-specific requests).
*
* <p>By default, only same origin requests are allowed. Use {@link #setAllowedOrigins}
@@ -143,7 +143,7 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
}
/**
* Transports with no native cross-domain communication (e.g. "eventsource",
* Transports with no native cross-domain communication (for example, "eventsource",
* "htmlfile") must get a simple page from the "foreign" domain in an invisible
* {@code iframe} so that code in the {@code iframe} can run from a domain
* local to the SockJS server. Since the {@code iframe} needs to load the
@@ -195,7 +195,7 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
/**
* The SockJS protocol requires a server to respond to an initial "/info" request from
* clients with a "cookie_needed" boolean property that indicates whether the use of a
* JSESSIONID cookie is required for the application to function correctly, e.g. for
* JSESSIONID cookie is required for the application to function correctly, for example, for
* load balancing or in Java Servlet containers for the use of an HTTP session.
* <p>This is especially important for IE 8,9 that support XDomainRequest -- a modified
* AJAX/XHR -- that can do requests across domains but does not send any cookies. In
@@ -509,7 +509,7 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
/**
* Ensure the path does not contain a file extension, either in the filename
* (e.g. "/jsonp.bat") or possibly after path parameters ("/jsonp;Setup.bat")
* (for example, "/jsonp.bat") or possibly after path parameters ("/jsonp;Setup.bat")
* which could be used for RFD exploits.
* <p>Since the last part of the path is expected to be a transport type, the
* presence of an extension would not work. All we need to do is check if

View File

@@ -289,7 +289,7 @@ public class TransportHandlingSockJsService extends AbstractSockJsService implem
if (logger.isDebugEnabled()) {
logger.debug("Session not found, sessionId=" + sessionId +
". The session may have been closed " +
"(e.g. missed heart-beat) while a message was coming in.");
"(for example, missed heart-beat) while a message was coming in.");
}
return;
}
@@ -392,7 +392,7 @@ public class TransportHandlingSockJsService extends AbstractSockJsService implem
}
}
catch (Throwable ex) {
// Could be part of normal workflow (e.g. browser tab closed)
// Could be part of normal workflow (for example, browser tab closed)
logger.debug("Failed to close " + session, ex);
}
}

View File

@@ -65,7 +65,7 @@ public abstract class AbstractHttpReceivingTransportHandler extends AbstractTran
catch (IOException ex) {
logger.error("Failed to read message", ex);
if (ex.getClass().getName().contains("Mapping")) {
// e.g. Jackson's JsonMappingException, indicating an incomplete payload
// for example, Jackson's JsonMappingException, indicating an incomplete payload
handleReadError(response, "Payload expected.", sockJsSession.getId());
}
else {

View File

@@ -38,7 +38,7 @@ import org.springframework.web.socket.sockjs.transport.session.WebSocketServerSo
* {@link WebSocketHandler}.
*
* <p>Methods in this class allow exceptions from the wrapped {@link WebSocketHandler} to
* propagate. However, any exceptions resulting from SockJS message handling (e.g. while
* propagate. However, any exceptions resulting from SockJS message handling (for example, while
* sending SockJS frames or heartbeat messages) are caught and treated as transport
* errors, i.e. routed to the
* {@link WebSocketHandler#handleTransportError(WebSocketSession, Throwable)

View File

@@ -190,7 +190,7 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
/**
* Handle the first request for receiving messages on a SockJS HTTP transport
* based session.
* <p>Long polling-based transports (e.g. "xhr", "jsonp") complete the request
* <p>Long polling-based transports (for example, "xhr", "jsonp") complete the request
* after writing the open frame. Streaming-based transports ("xhr_streaming",
* "eventsource", and "htmlfile") leave the response open longer for further
* streaming of message frames but will also close it eventually after some
@@ -229,7 +229,7 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
// Let "our" handler know before sending the open frame to the remote handler
delegateConnectionEstablished();
handleRequestInternal(request, response, true);
// Request might have been reset (e.g. polling sessions do after writing)
// Request might have been reset (for example, polling sessions do after writing)
this.readyToSend = isActive();
}
catch (Throwable ex) {
@@ -242,7 +242,7 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
/**
* Handle all requests, except the first one, to receive messages on a SockJS
* HTTP transport based session.
* <p>Long polling-based transports (e.g. "xhr", "jsonp") complete the request
* <p>Long polling-based transports (for example, "xhr", "jsonp") complete the request
* after writing any buffered message frames (or the next one). Streaming-based
* transports ("xhr_streaming", "eventsource", and "htmlfile") leave the
* response open longer for further streaming of message frames but will also
@@ -340,7 +340,7 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
control.complete();
}
catch (Throwable ex) {
// Could be part of normal workflow (e.g. browser tab closed)
// Could be part of normal workflow (for example, browser tab closed)
logger.debug("Failed to complete request: " + ex.getMessage());
}
}

View File

@@ -129,7 +129,7 @@
<xsd:attribute name="client-library-url" type="xsd:string">
<xsd:annotation>
<xsd:documentation source="java:org.springframework.web.socket.sockjs.support.AbstractSockJsService"><![CDATA[
Transports with no native cross-domain communication (e.g. "eventsource",
Transports with no native cross-domain communication (for example, "eventsource",
"htmlfile") must get a simple page from the "foreign" domain in an invisible
iframe so that code in the iframe can run from a domain local to the SockJS
server. Since the iframe needs to load the SockJS javascript client library,
@@ -161,7 +161,7 @@
<xsd:documentation source="java:org.springframework.web.socket.sockjs.support.AbstractSockJsService"><![CDATA[
The "cookie_needed" value in the response from the SockJs "/info" endpoint.
This property indicates whether the use of a JSESSIONID cookie is required for the application to function correctly,
e.g. for load balancing or in Java Servlet containers for the use of an HTTP session.
for example, for load balancing or in Java Servlet containers for the use of an HTTP session.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
@@ -280,7 +280,7 @@
<xsd:documentation source="java:org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler"><![CDATA[
The login for the shared "system" connection used to send messages to
the STOMP broker from within the application, i.e. messages not associated
with a specific client session (e.g. REST/HTTP request handling method).
with a specific client session (for example, REST/HTTP request handling method).
By default this is set to "guest".
]]></xsd:documentation>
</xsd:annotation>
@@ -290,7 +290,7 @@
<xsd:documentation source="java:org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler"><![CDATA[
The passcode for the shared "system" connection used to send messages to
the STOMP broker from within the application, i.e. messages not associated
with a specific client session (e.g. REST/HTTP request handling method).
with a specific client session (for example, REST/HTTP request handling method).
By default this is set to "guest".
]]></xsd:documentation>
</xsd:annotation>
@@ -545,7 +545,7 @@
<xsd:annotation>
<xsd:documentation><![CDATA[
Alternative to allowed-origins that supports origins declared via patterns,
e.g. "*.domain1.com".
for example, "*.domain1.com".
By default this is not set.
]]></xsd:documentation>
@@ -702,7 +702,7 @@
This handler is for WebSocket connections that use a sub-protocol.
Therefore, we expect the client to send at least one sub-protocol message
in the beginning, or else we assume the connection isn't doing well, e.g.
in the beginning, or else we assume the connection isn't doing well, for example,
proxy issue, slow network, and can be closed.
By default this is set to 60,000 (1 minute).
@@ -753,7 +753,7 @@
<xsd:annotation>
<xsd:documentation><![CDATA[
Alternative to allowed-origins that supports origins declared via patterns,
e.g. "*.domain1.com".
for example, "*.domain1.com".
By default this is not set.
]]></xsd:documentation>
@@ -849,7 +849,7 @@
<xsd:annotation>
<xsd:documentation><![CDATA[
Configure the message converters to use when extracting the payload of messages in annotated methods
and when sending messages (e.g. through the "broker" SimpMessagingTemplate.
and when sending messages (for example, through the "broker" SimpMessagingTemplate.
MessageConverter registrations provided here will take precedence over MessageConverter types registered by default.
Also see the register-defaults attribute if you want to turn off default registrations entirely.
]]></xsd:documentation>
@@ -885,14 +885,14 @@
<xsd:element name="client-inbound-channel" type="channel" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation><![CDATA[
The channel for receiving messages from clients (e.g. WebSocket clients).
The channel for receiving messages from clients (for example, WebSocket clients).
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="client-outbound-channel" type="channel" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation><![CDATA[
The channel for sending messages to clients (e.g. WebSocket clients).
The channel for sending messages to clients (for example, WebSocket clients).
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>