Top Fields Constructors Methods
io.vertx.core.http.impl

public Class Http2ServerResponse

extends Object
implements HttpServerResponse, HttpResponse
Class Inheritance
All Implemented Interfaces
io.vertx.core.spi.observability.HttpResponse, io.vertx.core.http.HttpServerResponse, io.vertx.core.streams.WriteStream, io.vertx.core.streams.StreamBase
Imports
io.netty.buffer.ByteBuf, .Unpooled, io.netty.channel.ChannelHandlerContext, io.netty.handler.codec.http.HttpHeaderNames, .HttpResponseStatus, .HttpStatusClass, io.netty.handler.codec.http2.DefaultHttp2Headers, .Http2Headers, io.netty.util.internal.ObjectUtil, io.vertx.codegen.annotations.Nullable, io.vertx.core.*, io.vertx.core.buffer.Buffer, io.vertx.core.file.AsyncFile, io.vertx.core.http.Cookie, .HttpHeaders, .HttpMethod, .HttpServerResponse, .StreamPriority, .StreamResetException, io.vertx.core.http.impl.headers.Http2HeadersAdaptor, io.vertx.core.impl.future.PromiseInternal, io.vertx.core.net.HostAndPort, .NetSocket, io.vertx.core.spi.observability.HttpResponse, io.vertx.core.streams.ReadStream, java.util.Map.Entry, .Set

Author
Julien Viet

Field Summary

Modifier and TypeField and Description
private Handler<Void>
private boolean
private boolean
private Handler<Void>
private final Http2ServerConnection
private final String
private CookieJar
private final ChannelHandlerContext
private Handler<Void>
private boolean
private Handler<Void>
private Handler<Throwable>
private final Http2Headers
private Handler<Void>
private Http2HeadersAdaptor
private boolean
private Future<NetSocket>
private final boolean
private HttpResponseStatus
private String
private final Http2ServerStream
private Http2HeadersAdaptor
private Http2Headers

Constructor Summary

AccessConstructor and Description
public
Http2ServerResponse(Http2ServerConnection conn, Http2ServerStream stream, boolean push, String contentEncoding)

Method Summary

Modifier and TypeMethod and Description
public HttpServerResponse
addCookie(Cookie
the cookie
cookie
)

Implements io.vertx.core.http.HttpServerResponse.addCookie.

Add a cookie.

public HttpServerResponse
public long
private void
private boolean
checkSendHeaders(boolean end)

private boolean
checkSendHeaders(boolean end, boolean checkFlush)

private void
public void
close()

Implements io.vertx.core.http.HttpServerResponse.close.

Close the underlying TCP connection corresponding to the request.

public synchronized boolean
public HttpServerResponse
pack-priv CookieJar
public HttpServerResponse
public Future<Void>
end(String
the string to write before ending the response
chunk
)

Implements io.vertx.core.http.HttpServerResponse.end.

Same as end(Buffer) but writes a String in UTF-8 encoding before ending the response.

public void
end(String chunk, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpServerResponse.end.

Same as end(String) but with an handler called when the operation completes

public Future<Void>
end(String
the string to write before ending the response
chunk
,
String
the encoding to use
enc
)

Implements io.vertx.core.http.HttpServerResponse.end.

Same as end(Buffer) but writes a String with the specified encoding before ending the response.

public void
end(String chunk, String enc, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpServerResponse.end.

Same as end(String, String) but with an handler called when the operation completes

public Future<Void>
end(Buffer
the buffer to write before ending the response
chunk
)

Implements io.vertx.core.http.HttpServerResponse.end.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Same as end() but writes some data to the response body before ending.

public void
end(Buffer chunk, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpServerResponse.end.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Same as end(Buffer) but with an handler called when the operation completes

public Future<Void>
end()

Implements io.vertx.core.http.HttpServerResponse.end.

Ends the response.

public void
end(Handler<AsyncResult<Void>> handler)

Overrides default io.vertx.core.streams.WriteStream.end.

Implements io.vertx.core.streams.WriteStream.end.

Same as end() but with an handler called when the operation completes

private void
end(ByteBuf chunk, Handler<AsyncResult<Void>> handler)

Overrides default io.vertx.core.streams.WriteStream.end.

Same as end(T) but with an handler called when the operation completes

public boolean
public HttpServerResponse
public HttpServerResponse
public int
public String
pack-priv void
pack-priv void
pack-priv void
handleReset(long code)

pack-priv void
handlerWritabilityChanged(boolean writable)

public MultiMap
public HttpServerResponse
public boolean
public boolean
pack-priv boolean
private boolean
pack-priv Future<NetSocket>
private void
public Future<HttpServerResponse>
push(HttpMethod method, HostAndPort authority, String path, MultiMap headers)

Implements io.vertx.core.http.HttpServerResponse.push.

Same as push(HttpMethod, String, String, MultiMap, Handler) but with an handler called when the operation completes

public Future<HttpServerResponse>
push(HttpMethod
the method of the promised request
method
,
String
the host of the promised request
authority
,
String
the path of the promised request
path
,
MultiMap
the headers of the promised request
headers
)

Implements io.vertx.core.http.HttpServerResponse.push.

Push a response to the client.

public HttpServerResponse
putHeader(String
the header name
name
,
String
the header value.
value
)

Implements io.vertx.core.http.HttpServerResponse.putHeader.

Put an HTTP header

public HttpServerResponse
public HttpServerResponse
putHeader(String name, Iterable<String> values)

Implements io.vertx.core.http.HttpServerResponse.putHeader.

Like putHeader(String, String) but providing multiple values via a String Iterable

public HttpServerResponse
public HttpServerResponse
putTrailer(String
the trailer name
name
,
String
the trailer value
value
)

Implements io.vertx.core.http.HttpServerResponse.putTrailer.

Put an HTTP trailer

public HttpServerResponse
public HttpServerResponse
putTrailer(String name, Iterable<String> values)

Implements io.vertx.core.http.HttpServerResponse.putTrailer.

Like putTrailer(String, String) but providing multiple values via a String Iterable

public HttpServerResponse
public @Nullable Cookie
removeCookie(String
the name of the cookie
name
,
boolean invalidate)

Implements io.vertx.core.http.HttpServerResponse.removeCookie.

Remove a cookie from the cookie set.

public @Nullable Cookie
removeCookie(String
the name of the cookie
name
,
String
the domain of the cookie
domain
,
String
the path of the cookie
path
,
boolean invalidate)

Implements io.vertx.core.http.HttpServerResponse.removeCookie.

Remove a cookie from the cookie set.

public @Nullable Set<Cookie>
removeCookies(String
the name of the cookie
name
,
boolean
invalidate from the user agent
invalidate
)

Implements io.vertx.core.http.HttpServerResponse.removeCookies.

Remove all cookies from the cookie set.

public boolean
reset(long
the error code
code
)

Implements io.vertx.core.http.HttpServerResponse.reset.

Reset this response:

  • for HTTP/2, send an HTTP/2 reset frame with the specified error code
  • for HTTP/1.x, close the connection when the current response has not yet been sent
public Future<Void>
sendFile(String
path to the file to serve
filename
,
long
offset to start serving from
offset
,
long
the number of bytes to send
length
)

Implements io.vertx.core.http.HttpServerResponse.sendFile.

Ask the OS to stream a file as specified by filename directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system.

public HttpServerResponse
sendFile(String
path to the file to serve
filename
,
long
the offset to serve from
offset
,
long
length the number of bytes to send
length
,
Handler<AsyncResult<Void>>
handler that will be called on completion
resultHandler
)

Implements io.vertx.core.http.HttpServerResponse.sendFile.

Like sendFile(String, long, long) but providing a handler which will be notified once the file has been completely written to the wire.

public HttpServerResponse
setChunked(boolean chunked)

Implements io.vertx.core.http.HttpServerResponse.setChunked.

If chunked is true, this response will use HTTP chunked encoding, and each call to write to the body will correspond to a new HTTP chunk sent on the wire.

private void
public HttpServerResponse
setStatusCode(int statusCode)

Implements io.vertx.core.http.HttpServerResponse.setStatusCode.

Set the status code.

public HttpServerResponse
setStatusMessage(String statusMessage)

Implements io.vertx.core.http.HttpServerResponse.setStatusMessage.

Set the status message

public HttpServerResponse
setStreamPriority(StreamPriority
the priority for this request's stream
priority
)

Overrides default io.vertx.core.http.HttpServerResponse.setStreamPriority.

Sets the priority of the associated stream

This is not implemented for HTTP/1.x.

public HttpServerResponse
setWriteQueueMaxSize(int
the max size of the write stream
maxSize
)

Implements io.vertx.core.http.HttpServerResponse.setWriteQueueMaxSize.

Set the maximum size of the write queue to maxSize.

public int
public int
public MultiMap
public Future<Void>
write(Buffer
the data to write
chunk
)

Implements io.vertx.core.streams.WriteStream.write.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Write some data to the stream.

public void
write(Buffer chunk, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.streams.WriteStream.write.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Same as write(T) but with an handler called when the operation completes

public Future<Void>
write(String
the string to write
chunk
,
String
the encoding to use
enc
)

Implements io.vertx.core.http.HttpServerResponse.write.

Write a String to the response body, encoded using the encoding enc.

public void
write(String chunk, String enc, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpServerResponse.write.

Same as write(String, String) but with an handler called when the operation completes

public Future<Void>
write(String
the string to write
chunk
)

Implements io.vertx.core.http.HttpServerResponse.write.

Write a String to the response body, encoded in UTF-8.

public void
write(String chunk, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpServerResponse.write.

Same as write(String) but with an handler called when the operation completes

private Http2ServerResponse
write(ByteBuf
the data to write
chunk
)

Implements io.vertx.core.streams.WriteStream.write.

Write some data to the stream.

pack-priv void
write(ByteBuf chunk, boolean end, Handler<AsyncResult<Void>> handler)

public HttpServerResponse
writeContinue()

Implements io.vertx.core.http.HttpServerResponse.writeContinue.

Used to write an interim 100 Continue response to signify that the client should send the rest of the request.

public HttpServerResponse
writeCustomFrame(int
the 8-bit frame type
type
,
int
the 8-bit frame flags
flags
,
Buffer
the frame payload
payload
)

Implements io.vertx.core.http.HttpServerResponse.writeCustomFrame.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.

public Future<Void>
writeEarlyHints(MultiMap
headers to write
headers
)

Implements io.vertx.core.http.HttpServerResponse.writeEarlyHints.

Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.

public void
writeEarlyHints(MultiMap
headers to write
headers
,
Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpServerResponse.writeEarlyHints.

Same as writeEarlyHints(MultiMap) but with an handler called when the operation completes

public boolean
writeQueueFull()

Implements io.vertx.core.streams.WriteStream.writeQueueFull.

This will return true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait