Class WebGraphQlResponse
java.lang.Object
org.springframework.graphql.support.AbstractGraphQlResponse
org.springframework.graphql.support.DefaultExecutionGraphQlResponse
org.springframework.graphql.server.WebGraphQlResponse
- All Implemented Interfaces:
ExecutionGraphQlResponse, GraphQlResponse
GraphQlResponse implementation for server
handling over HTTP or over WebSocket.- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionWebGraphQlResponse(ExecutionGraphQlResponse response) Create an instance that wraps the givenExecutionGraphQlResponse. -
Method Summary
Modifier and TypeMethodDescriptionReturn the headers to be added to the HTTP response.transform(Consumer<WebGraphQlResponse.Builder> consumer) Transform the underlyingExecutionResultthrough aWebGraphQlResponse.Builderand return a new instance with the modified values.Methods inherited from class DefaultExecutionGraphQlResponse
getData, getErrors, getExecutionInput, getExecutionResult, getExtensions, isValid, toMap, toStringMethods inherited from class AbstractGraphQlResponse
fieldMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface GraphQlResponse
field
-
Constructor Details
-
WebGraphQlResponse
Create an instance that wraps the givenExecutionGraphQlResponse.- Parameters:
response- the response to wrap
-
-
Method Details
-
getResponseHeaders
Return the headers to be added to the HTTP response.By default, this is empty.
Note: This is for use with GraphQL over HTTP requests but not for GraphQL over WebSocket where the initial handshake HTTP request completes before queries begin.
-
transform
Transform the underlyingExecutionResultthrough aWebGraphQlResponse.Builderand return a new instance with the modified values.- Parameters:
consumer- callback to transform the result- Returns:
- the new response instance with the mutated
ExecutionResult
-