public class SimpleHttp extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
SimpleHttp.BasicAuthInterceptor
Intercepts requests and adds authentication headers to the request
|
static class |
SimpleHttp.SimpleHttpBuilder |
Constructor and Description |
---|
SimpleHttp(HttpSubScan scanDefn,
okhttp3.HttpUrl url,
File tempDir,
HttpProxyConfig proxyConfig,
CustomErrorContext errorContext,
Paginator paginator) |
Modifier and Type | Method and Description |
---|---|
static void |
addProxyInfo(okhttp3.OkHttpClient.Builder builder,
HttpProxyConfig proxyConfig)
Applies the proxy configuration to the OkHttp3 builder.
|
static SimpleHttp.SimpleHttpBuilder |
builder() |
void |
close() |
static String |
decodedURL(okhttp3.HttpUrl url)
Returns the URL-decoded URL.
|
static String |
getDefaultParameterValue(okhttp3.HttpUrl url,
String parameter)
This function is used to extract the default parameter supplied in a URL.
|
InputStream |
getInputStream()
Returns an InputStream based on the URL and config in the scanSpec.
|
int |
getResponseCode()
Gets the HTTP response code from the HTTP call.
|
String |
getResponseMessage()
Gets the HTTP response code from the HTTP call.
|
String |
getResponseProtocol()
Gets the HTTP response code from the HTTP call.
|
String |
getResponseURL()
Gets the HTTP response code from the HTTP call.
|
static List<String> |
getURLParameters(okhttp3.HttpUrl url)
APIs are sometimes structured with parameters in the URL itself.
|
static boolean |
hasURLParameters(okhttp3.HttpUrl url)
Returns true if the url has url parameters, as indicated by the presence of
{param} in a url.
|
static String |
mapURLParameters(okhttp3.HttpUrl url,
Map<String,String> filters)
Used for APIs which have parameters in the URL.
|
String |
url() |
public SimpleHttp(HttpSubScan scanDefn, okhttp3.HttpUrl url, File tempDir, HttpProxyConfig proxyConfig, CustomErrorContext errorContext, Paginator paginator)
public static SimpleHttp.SimpleHttpBuilder builder()
public String url()
public static void addProxyInfo(okhttp3.OkHttpClient.Builder builder, HttpProxyConfig proxyConfig)
builder
- The input OkHttp3 builderproxyConfig
- The proxy configurationpublic InputStream getInputStream()
public int getResponseCode()
public String getResponseMessage()
public String getResponseProtocol()
public String getResponseURL()
public static String decodedURL(okhttp3.HttpUrl url)
public static boolean hasURLParameters(okhttp3.HttpUrl url)
public static List<String> getURLParameters(okhttp3.HttpUrl url)
public static String getDefaultParameterValue(okhttp3.HttpUrl url, String parameter)
url
- The URL containing a default parameterparameter
- The parameter for which you need the valuepublic static String mapURLParameters(okhttp3.HttpUrl url, Map<String,String> filters)
url
- The HttpUrl containing URL Parametersfilters
- A CaseInsensitiveMap of filterspublic void close()
close
in interface AutoCloseable
Copyright © 1970 The Apache Software Foundation. All rights reserved.