Record Class SSEParserConfig
- Record Components:
maxLineLength- max bytes per raw SSE line (0 = disabled)maxBufferLines- maxdata:lines per event blockmaxBufferChars- max total characters across alldata:values per event
ServerSentEventParser limits.
All limits have safe defaults suitable for most deployments. Use the SSEParserConfig.Builder
to override individual values -- for example, to raise the per-event character budget
for agents that return large artifacts.
Enforcement semantics: maxLineLength is enforced at the
transport layer as a byte limit on raw UTF-8 data, before lines are decoded
to characters. For ASCII-only content (the common case for SSE/JSON-RPC), bytes and
characters are equivalent. For multi-byte UTF-8 content, the byte-level check is
stricter — a line of maxLineLength multi-byte characters may exceed the limit.
This is intentional: the byte-level enforcement prevents memory exhaustion from a
malicious unterminated line before it is fully materialised.
Security note: setting maxLineLength to 0 disables
the per-line memory protection entirely. Without this limit, a malicious server sending
a single unterminated line (no newline) can consume unbounded memory — maxBufferChars
only limits accumulated data: field values after lines have been decoded,
not the raw line itself. Only disable the per-line check when you trust the remote agent
or have other safeguards (e.g. a reverse proxy that enforces its own line-length limit).
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SSEParserConfigDefault configuration: 1 MB per-line and per-event character limit, 1 000 data lines per event. -
Constructor Summary
ConstructorsConstructorDescriptionSSEParserConfig(int maxLineLength, int maxBufferLines, int maxBufferChars) Creates an instance of aSSEParserConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic SSEParserConfig.Builderbuilder()Returns a newSSEParserConfig.Builderinitialized with theDEFAULTvalues.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxBufferCharsrecord component.intReturns the value of themaxBufferLinesrecord component.intReturns the value of themaxLineLengthrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT
Default configuration: 1 MB per-line and per-event character limit, 1 000 data lines per event.
-
-
Constructor Details
-
SSEParserConfig
public SSEParserConfig(int maxLineLength, int maxBufferLines, int maxBufferChars) Creates an instance of aSSEParserConfigrecord class.- Parameters:
maxLineLength- the value for themaxLineLengthrecord componentmaxBufferLines- the value for themaxBufferLinesrecord componentmaxBufferChars- the value for themaxBufferCharsrecord component
-
-
Method Details
-
builder
Returns a newSSEParserConfig.Builderinitialized with theDEFAULTvalues. -
toString
-
hashCode
-
equals
Indicates 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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
maxLineLength
public int maxLineLength()Returns the value of themaxLineLengthrecord component.- Returns:
- the value of the
maxLineLengthrecord component
-
maxBufferLines
public int maxBufferLines()Returns the value of themaxBufferLinesrecord component.- Returns:
- the value of the
maxBufferLinesrecord component
-
maxBufferChars
public int maxBufferChars()Returns the value of themaxBufferCharsrecord component.- Returns:
- the value of the
maxBufferCharsrecord component
-