- All Superinterfaces:
ServerResponse
- All Known Implementing Classes:
ServerResponseBase
-
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()Commit the response.booleanWhether this request has an entity.booleanisNexted()Whether this request is nexted (ServerResponse.next()was called).reroutePrologue(HttpPrologue prologue) A new, rerouted prologue.booleanreset()Return true if the underlying response buffers and headers can be reset and a new response can be sent.default booleanReset an unsent response entity so it can be replaced.voidReset routing information (nexted, rerouted etc.).default booleanReturn true if the underlying response buffers can be reset and a new response can be sent.booleanShould we reroute this exchange.Methods inherited from interface io.helidon.webserver.http.ServerResponse
beforeSend, beforeTrailers, bytesWritten, contentLength, header, header, header, headers, isResponseHandled, isSent, next, outputStream, reroute, reroute, send, send, send, send, send, sink, status, status, status, streamFilter, streamResult, trailers, whenSent
-
Method Details
-
resetRouting
void resetRouting()Reset routing information (nexted, rerouted etc.). -
shouldReroute
boolean shouldReroute()Should we reroute this exchange.- Returns:
- whether rerouting was requested
-
reroutePrologue
A new, rerouted prologue.- Parameters:
prologue- current prologue- Returns:
- prologue to use when rerouting
-
isNexted
boolean isNexted()Whether this request is nexted (ServerResponse.next()was called).- Returns:
- if nexted
-
hasEntity
boolean hasEntity()Whether this request has an entity.- Returns:
- whether has entity
-
reset
boolean reset()Return true if the underlying response buffers and headers can be reset and a new response can be sent.- Returns:
trueif reset was successful and a new response can be created instead of the existing one,falseif reset failed and status and headers (and maybe entity bytes) were already sent
-
commit
void commit()Commit the response. This is mostly useful for output stream based responses, where we may want to delay closing the output stream to handle errors, when route uses try with resources. After this method is called, response cannot bereset(). -
resetStream
default boolean resetStream()Return true if the underlying response buffers can be reset and a new response can be sent.As opposed to
reset(), this method is not expected to reset headers already configured on the responseThis method calls
reset()by default.- Returns:
trueif reset was successful and a new response can be created instead of the existing one,falseif reset failed and status and headers (and maybe entity bytes) were already sent
-
resetEntity
default boolean resetEntity()Reset an unsent response entity so it can be replaced. The cleanup and preservation of response metadata depend on the implementation.This method is intended for Helidon infrastructure that replaces a failed response entity.
The HTTP/1 implementation preserves metadata unrelated to the entity, such as CORS, cookies, cache controls, and
Varyheaders. It resets entity buffers and removes framing, representation, validator, range, and trailer headers, as well as separate trailer state and headers rejected by response-header validation or HTTP/1 serialization. This method does not change the response status. An error handler that replaces the entity is responsible for configuring or deliberately retaining an appropriate status before sending the replacement response.For compatibility with existing
RoutingResponseimplementations, the default implementation callsresetStream(). This fallback does not guarantee removal of entity-specific headers or trailer state; implementations that need that cleanup must override this method.- Returns:
trueif reset was successful and a new entity can be created instead of the existing one,falseif reset failed and status and headers (and maybe entity bytes) were already sent
-