public class

UrlRequestBuilderImpl

extends UrlRequest.Builder
java.lang.Object
   ↳ com.tencent.smtt.export.external.interfaces.UrlRequest.Builder
     ↳ com.tencent.smtt.sdk.UrlRequestBuilderImpl

Summary

[Expand]
Inherited Constants
From class com.tencent.smtt.export.external.interfaces.UrlRequest.Builder
Public Constructors
UrlRequestBuilderImpl(String url, UrlRequest.Callback callback, Executor executor)
Creates a builder for UrlRequest objects.
Public Methods
UrlRequestBuilderImpl addHeader(String header, String value)
Adds a request header.
UrlRequest build()
create UrlRequest
UrlRequestBuilderImpl disableCache()
Disables cache for the request.
UrlRequestBuilderImpl setDns(String host, String address)
set dns
UrlRequest.Builder setHttpMethod(String method)
Sets the HTTP method verb to use for this request.
UrlRequestBuilderImpl setPriority(int priority)
Sets priority of the request which should be one of the REQUEST_PRIORITY_* values.
UrlRequest.Builder setRequestBody(String body)
set requeset body
UrlRequest.Builder setRequestBodyBytes(byte[] body)
set requeset body
[Expand]
Inherited Methods
From class com.tencent.smtt.export.external.interfaces.UrlRequest.Builder
From class java.lang.Object

Public Constructors

public UrlRequestBuilderImpl (String url, UrlRequest.Callback callback, Executor executor)

Creates a builder for UrlRequest objects. All callbacks for generated UrlRequest objects will be invoked on executor's thread. executor must not run tasks on the current thread to prevent blocking networking operations and causing exceptions during shutdown.

Parameters
url URL for the generated requests.
callback callback object that gets invoked on different events.
executor Executor on which all callbacks will be invoked.

Public Methods

public UrlRequestBuilderImpl addHeader (String header, String value)

Adds a request header.

Parameters
header header name.
value header value.
Returns
  • the builder to facilitate chaining.

public UrlRequest build ()

create UrlRequest

Returns
  • null if not use X5core
Throws
NullPointerException if UrlRequest build fail

public UrlRequestBuilderImpl disableCache ()

Disables cache for the request. If context is not set up to use cache, this call has no effect.

Returns
  • the builder to facilitate chaining.

public UrlRequestBuilderImpl setDns (String host, String address)

set dns

Parameters
host host
address address

public UrlRequest.Builder setHttpMethod (String method)

Sets the HTTP method verb to use for this request.

The default when this method is not called is "GET" if the request has no body or "POST" if it does.

Parameters
method "GET", "HEAD", "DELETE", "POST" or "PUT".
Returns
  • the builder to facilitate chaining.

public UrlRequestBuilderImpl setPriority (int priority)

Sets priority of the request which should be one of the REQUEST_PRIORITY_* values. The request is given REQUEST_PRIORITY_MEDIUM priority if this method is not called.

Parameters
priority priority of the request which should be one of the REQUEST_PRIORITY_* values.
Returns
  • the builder to facilitate chaining.

public UrlRequest.Builder setRequestBody (String body)

set requeset body

Parameters
body string

public UrlRequest.Builder setRequestBodyBytes (byte[] body)

set requeset body

Parameters
body byte[]