APIdia Launch Partner
Top Inners Constructors Methods
jdk.internal.net.http

public final Class ResponseBodyHandlers

extends Object
Class Inheritance
Imports
java.io.IOException, .UncheckedIOException, java.net.URI, java.nio.file.Files, .OpenOption, .Path, .Paths, java.util.List, .Set, java.util.concurrent.CompletableFuture, .ConcurrentMap, java.util.function.Function, java.net.http.HttpRequest, .HttpResponse, .HttpResponse.BodyHandler, .HttpResponse.ResponseInfo, .HttpResponse.BodySubscriber, java.util.regex.Matcher, .Pattern, jdk.internal.net.http.ResponseSubscribers.PathSubscriber, jdk.internal.util.Exceptions

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
public static class
ResponseBodyHandlers.PushPromisesHandlerWithMap<T>

With push promise Map implementation

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ResponseBodyHandlersback to summary
private ResponseBodyHandlers()
jdk.internal.net.http back to summary

public Class ResponseBodyHandlers.FileDownloadBodyHandler

extends Object
implements HttpResponse.BodyHandler<Path>
Class Inheritance
  • java.lang.Object
  • jdk.internal.net.http.ResponseBodyHandlers.FileDownloadBodyHandler
All Implemented Interfaces
java.net.http.HttpResponse.BodyHandler

Field Summary

Modifier and TypeField and Description
private final Path
pack-priv static final String
DISPOSITION_TYPE

The "attachment" disposition-type and separator.

pack-priv static final Pattern
FILENAME

The "filename" parameter.

pack-priv static final Set<Character>
private final List<OpenOption>
pack-priv static final List<String>

Constructor Summary

AccessConstructor and Description
private
FileDownloadBodyHandler(Path directory, List<OpenOption> openOptions)

Method Summary

Modifier and TypeMethod and Description
pack-priv static boolean
public HttpResponse.BodySubscriber<Path>
apply(HttpResponse.ResponseInfo responseInfo)

Implements java.net.http.HttpResponse.BodyHandler.apply.

Returns a BodySubscriber considering the given response status code and headers.

public static ResponseBodyHandlers.FileDownloadBodyHandler
create(Path directory, List<OpenOption> openOptions)

Factory for creating FileDownloadBodyHandler.

pack-priv static boolean
pack-priv static boolean
isTokenText(char c)

pack-priv static String
pack-priv static String
pack-priv static String
pack-priv static final UncheckedIOException
pack-priv static final UncheckedIOException
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

directoryback to summary
private final Path directory
DISPOSITION_TYPEback to summary
pack-priv static final String DISPOSITION_TYPE

The "attachment" disposition-type and separator.

FILENAMEback to summary
pack-priv static final Pattern FILENAME

The "filename" parameter.

NOT_ALLOWED_IN_TOKENback to summary
pack-priv static final Set<Character> NOT_ALLOWED_IN_TOKEN
openOptionsback to summary
private final List<OpenOption> openOptions
PROHIBITEDback to summary
pack-priv static final List<String> PROHIBITED

Constructor Detail

FileDownloadBodyHandlerback to summary
private FileDownloadBodyHandler(Path directory, List<OpenOption> openOptions)

Method Detail

allowedInTokenback to summary
pack-priv static boolean allowedInToken(char c)
applyback to summary
public HttpResponse.BodySubscriber<Path> apply(HttpResponse.ResponseInfo responseInfo)

Implements java.net.http.HttpResponse.BodyHandler.apply.

Doc from java.net.http.HttpResponse.BodyHandler.apply.

Returns a BodySubscriber considering the given response status code and headers. This method is invoked before the actual response body bytes are read and its implementation must return a BodySubscriber to consume the response body bytes.

The response body can be discarded using one of discarding or replacing.

Annotations
@Override
createback to summary
public static ResponseBodyHandlers.FileDownloadBodyHandler create(Path directory, List<OpenOption> openOptions)

Factory for creating FileDownloadBodyHandler.

isQuotedStringTextback to summary
pack-priv static boolean isQuotedStringText(char c) throws UncheckedIOException
isTokenTextback to summary
pack-priv static boolean isTokenText(char c) throws UncheckedIOException
processFilenameback to summary
pack-priv static String processFilename(String src) throws UncheckedIOException
processQuotedStringback to summary
pack-priv static String processQuotedString(String src) throws UncheckedIOException
processTokenback to summary
pack-priv static String processToken(String src) throws UncheckedIOException
uncheckedback to summary
pack-priv static final UncheckedIOException unchecked(HttpResponse.ResponseInfo rinfo, String msg)
uncheckedback to summary
pack-priv static final UncheckedIOException unchecked(String msg)
jdk.internal.net.http back to summary

public Class ResponseBodyHandlers.PathBodyHandler

extends Object
implements HttpResponse.BodyHandler<Path>
Class Inheritance
All Implemented Interfaces
java.net.http.HttpResponse.BodyHandler

A Path body handler.

Field Summary

Modifier and TypeField and Description
private final Path
private final List<OpenOption>

Constructor Summary

AccessConstructor and Description
private
PathBodyHandler(Path file, List<OpenOption> openOptions)

Method Summary

Modifier and TypeMethod and Description
public HttpResponse.BodySubscriber<Path>
apply(HttpResponse.ResponseInfo responseInfo)

Implements java.net.http.HttpResponse.BodyHandler.apply.

Returns a BodySubscriber considering the given response status code and headers.

public static ResponseBodyHandlers.PathBodyHandler
create(Path file, List<OpenOption> openOptions)

Factory for creating PathBodyHandler.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fileback to summary
private final Path file
openOptionsback to summary
private final List<OpenOption> openOptions

Constructor Detail

PathBodyHandlerback to summary
private PathBodyHandler(Path file, List<OpenOption> openOptions)

Method Detail

applyback to summary
public HttpResponse.BodySubscriber<Path> apply(HttpResponse.ResponseInfo responseInfo)

Implements java.net.http.HttpResponse.BodyHandler.apply.

Doc from java.net.http.HttpResponse.BodyHandler.apply.

Returns a BodySubscriber considering the given response status code and headers. This method is invoked before the actual response body bytes are read and its implementation must return a BodySubscriber to consume the response body bytes.

The response body can be discarded using one of discarding or replacing.

Annotations
@Override
createback to summary
public static ResponseBodyHandlers.PathBodyHandler create(Path file, List<OpenOption> openOptions)

Factory for creating PathBodyHandler.

jdk.internal.net.http back to summary

public Class ResponseBodyHandlers.PushPromisesHandlerWithMap<T>

extends Object
implements HttpResponse.PushPromiseHandler<T>
Class Inheritance
  • java.lang.Object
  • jdk.internal.net.http.ResponseBodyHandlers.PushPromisesHandlerWithMap
All Implemented Interfaces
java.net.http.HttpResponse.PushPromiseHandler

With push promise Map implementation

Field Summary

Modifier and TypeField and Description
private final Function<HttpRequest, HttpResponse.BodyHandler<T>>
private final ConcurrentMap<HttpRequest, CompletableFuture<HttpResponse<T>>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
applyPushPromise(HttpRequest initiatingRequest, HttpRequest pushRequest, Function<HttpResponse.BodyHandler<T>, CompletableFuture<HttpResponse<T>>> acceptor)

Implements java.net.http.HttpResponse.PushPromiseHandler.applyPushPromise.

Notification of an incoming push promise.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pushPromiseHandlerback to summary
private final Function<HttpRequest, HttpResponse.BodyHandler<T>> pushPromiseHandler
pushPromisesMapback to summary
private final ConcurrentMap<HttpRequest, CompletableFuture<HttpResponse<T>>> pushPromisesMap

Constructor Detail

PushPromisesHandlerWithMapback to summary
public PushPromisesHandlerWithMap(Function<HttpRequest, HttpResponse.BodyHandler<T>> pushPromiseHandler, ConcurrentMap<HttpRequest, CompletableFuture<HttpResponse<T>>> pushPromisesMap)

Method Detail

applyPushPromiseback to summary
public void applyPushPromise(HttpRequest initiatingRequest, HttpRequest pushRequest, Function<HttpResponse.BodyHandler<T>, CompletableFuture<HttpResponse<T>>> acceptor)

Implements java.net.http.HttpResponse.PushPromiseHandler.applyPushPromise.

Doc from java.net.http.HttpResponse.PushPromiseHandler.applyPushPromise.

Notification of an incoming push promise.

This method is invoked once for each push promise received, up to the point where the response body of the initiating client-sent request has been fully received.

A push promise is accepted by invoking the given acceptor function. The acceptor function must be passed a non-null BodyHandler, that is to be used to handle the promise's response body. The acceptor function will return a CompletableFuture that completes with the promise's response.

If the acceptor function is not successfully invoked, then the push promise is rejected. The acceptor function will throw an IllegalStateException if invoked more than once.

This method is invoked for all HTTP/2 push promises and also by default for the first promise of all HTTP/3 push promises. If applyPushPromise(HttpRequest, HttpRequest, PushId, Function) is overridden, then this method is not directly invoked for HTTP/3 push promises.

Annotations
@Override