Class McpAdmissionRejection.Builder
java.lang.Object
com.soklet.McpAdmissionRejection.Builder
- Enclosing class:
McpAdmissionRejection
Mutable builder for an immutable
McpAdmissionRejection.- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionAdds a validated application response header.build()Replaces the application response headers with a validated snapshot.jsonRpcError(@NonNull McpJsonRpcError jsonRpcError) statusCode(@NonNull Integer statusCode)
-
Method Details
-
statusCode
- Parameters:
statusCode- HTTP status from 400 through 599- Returns:
- this builder
- Throws:
NullPointerException- ifstatusCodeis null
-
jsonRpcError
- Parameters:
jsonRpcError- client-visible error @return this builder
-
headers
public @NonNull McpAdmissionRejection.Builder headers(@NonNull Map<@NonNull String, ? extends @NonNull List<@NonNull String>> headers) Replaces the application response headers with a validated snapshot. Passing an empty map clears all application response headers. Invalid replacement headers leave this builder's previous headers intact.- Parameters:
headers- application response headers- Returns:
- this builder
- Throws:
NullPointerException- if the map, a name, a value list, or a value is nullIllegalArgumentException- if the headers violate the safety rules or fixed bounds- See Also:
-
addHeader
public @NonNull McpAdmissionRejection.Builder addHeader(@NonNull String name, @NonNull String value) Adds a validated application response header. Reusing the exact name appends a value; a different case spelling of an existing name is rejected. Invalid additions leave this builder's previous headers intact.- Parameters:
name- header namevalue- header value- Returns:
- this builder
- Throws:
NullPointerException- if the name or value is nullIllegalArgumentException- if the addition violates the safety rules or fixed bounds- See Also:
-
build
- Returns:
- immutable rejection
-