Class Request.Builder
- java.lang.Object
-
- org.schabi.newpipe.extractor.downloader.Request.Builder
-
- Enclosing class:
- Request
public static final class Request.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Request.Builder
addHeader(java.lang.String headerName, java.lang.String headerValue)
Request.Builder
addHeaders(java.lang.String headerName, java.util.List<java.lang.String> headerValueList)
Request.Builder
automaticLocalizationHeader(boolean automaticLocalizationHeaderToSet)
If localization headers should automatically be included in the request.Request
build()
Request.Builder
dataToSend(byte[] dataToSendToSet)
An optional byte array that will be sent when doing the request, very commonly used inPOST
requests.
The implementation should make note of some recommended headers (for example,Content-Length
in a post request).Request.Builder
get(java.lang.String urlToSet)
Request.Builder
head(java.lang.String urlToSet)
Request.Builder
headers(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headersToSet)
A list of headers that will be used in the request.
Any default headers that the implementation may have, should be overridden by these.Request.Builder
httpMethod(java.lang.String httpMethodToSet)
A http method (i.e.Request.Builder
localization(Localization localizationToSet)
A localization object that should be used when executing a request.
Usually theAccept-Language
will be set to this value (a helper method to do this easily:Request.getHeadersFromLocalization(Localization)
).Request.Builder
post(java.lang.String urlToSet, byte[] dataToSendToSet)
Request.Builder
setHeader(java.lang.String headerName, java.lang.String headerValue)
Request.Builder
setHeaders(java.lang.String headerName, java.util.List<java.lang.String> headerValueList)
Request.Builder
url(java.lang.String urlToSet)
The URL that is pointing to the wanted resource.
-
-
-
Method Detail
-
httpMethod
public Request.Builder httpMethod(java.lang.String httpMethodToSet)
A http method (i.e.GET, POST, HEAD
).
-
url
public Request.Builder url(java.lang.String urlToSet)
The URL that is pointing to the wanted resource.
-
headers
public Request.Builder headers(@Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headersToSet)
A list of headers that will be used in the request.
Any default headers that the implementation may have, should be overridden by these.
-
dataToSend
public Request.Builder dataToSend(byte[] dataToSendToSet)
An optional byte array that will be sent when doing the request, very commonly used inPOST
requests.
The implementation should make note of some recommended headers (for example,Content-Length
in a post request).
-
localization
public Request.Builder localization(Localization localizationToSet)
A localization object that should be used when executing a request.
Usually theAccept-Language
will be set to this value (a helper method to do this easily:Request.getHeadersFromLocalization(Localization)
).
-
automaticLocalizationHeader
public Request.Builder automaticLocalizationHeader(boolean automaticLocalizationHeaderToSet)
If localization headers should automatically be included in the request.
-
build
public Request build()
-
get
public Request.Builder get(java.lang.String urlToSet)
-
head
public Request.Builder head(java.lang.String urlToSet)
-
post
public Request.Builder post(java.lang.String urlToSet, @Nullable byte[] dataToSendToSet)
-
setHeaders
public Request.Builder setHeaders(java.lang.String headerName, java.util.List<java.lang.String> headerValueList)
-
addHeaders
public Request.Builder addHeaders(java.lang.String headerName, java.util.List<java.lang.String> headerValueList)
-
setHeader
public Request.Builder setHeader(java.lang.String headerName, java.lang.String headerValue)
-
addHeader
public Request.Builder addHeader(java.lang.String headerName, java.lang.String headerValue)
-
-