-
- All Implemented Interfaces:
-
com.bugsnag.android.JsonStream.Streamable
public final class Request extends AbstractHttpEntity implements JsonStream.Streamable
A Request represents an HTTP request that forms part of an Event.
-
-
Field Summary
Fields Modifier and Type Field Description private StringhttpMethodprivate StringhttpVersionprivate Stringurl
-
Constructor Summary
Constructors Constructor Description Request(String httpVersion, String httpMethod, String url)Constructs a new Request with the specified HTTP version, method, and URL.If the URL contains query parameters, they will be extracted and stored separately. Request(String httpMethod, String url)Constructs a new Request with the specified HTTP method and URL.The HTTP version will be set to null.If the URL contains query parameters, they will be extracted and stored separately.
-
Method Summary
Modifier and Type Method Description StringgetHttpMethod()Return the HTTP method for this request (e.g. voidsetHttpMethod(@Nullable() String httpMethod)Set the HTTP method for this request (e.g. StringgetHttpVersion()Return the HTTP version for this request (e.g. voidsetHttpVersion(@Nullable() String httpVersion)Set the HTTP version for this request (e.g. StringgetUrl()Return the URL for this request, excluding query parameters. voidsetUrl(@Nullable() String url)Set the URL for this request. voidaddQueryParameter(@NonNull() String name, @Nullable() String value)Add a query parameter to this reported request. voidremoveQueryParameter(@NonNull() String name)Remove the specified query parameter by name (case-sensitive). Set<String>getQueryParameterNames()Return the query parameter names that are set for this request. StringgetQueryParameter(@NonNull() String name)Return the query parameter value by name or null if the parameter is not present. voidtoStream(@NotNull() JsonStream writer)-
Methods inherited from class com.bugsnag.android.AbstractHttpEntity
addHeader, getBody, getBodyLength, getHeader, getHeaderNames, removeHeader, setBody, setBodyLength -
Methods inherited from class com.bugsnag.android.JsonStream.Streamable
toStream -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Request
Request(String httpVersion, String httpMethod, String url)
Constructs a new Request with the specified HTTP version, method, and URL.If the URL contains query parameters, they will be extracted and stored separately.- Parameters:
httpVersion- the HTTP version (e.g.httpMethod- the HTTP method (e.g.url- the request URL, optionally including query parameters, or null
-
Request
Request(String httpMethod, String url)
Constructs a new Request with the specified HTTP method and URL.The HTTP version will be set to null.If the URL contains query parameters, they will be extracted and stored separately.- Parameters:
httpMethod- the HTTP method (e.g.url- the request URL, optionally including query parameters, or null
-
-
Method Detail
-
getHttpMethod
@Nullable() String getHttpMethod()
Return the HTTP method for this request (e.g. "GET").
-
setHttpMethod
void setHttpMethod(@Nullable() String httpMethod)
Set the HTTP method for this request (e.g. "GET", "POST").
- Parameters:
httpMethod- the HTTP method name
-
getHttpVersion
@Nullable() String getHttpVersion()
Return the HTTP version for this request (e.g. "HTTP/1.1").
-
setHttpVersion
void setHttpVersion(@Nullable() String httpVersion)
Set the HTTP version for this request (e.g. "HTTP/1.1").
- Parameters:
httpVersion- the HTTP version
-
setUrl
void setUrl(@Nullable() String url)
Set the URL for this request. If the URL contains a query string, the query parameterswill be extracted and stored separately, and the URL will be set without the query string.
- Parameters:
url- the request URL, optionally including query parameters
-
addQueryParameter
void addQueryParameter(@NonNull() String name, @Nullable() String value)
Add a query parameter to this reported request.
- Parameters:
name- the name of the query parametervalue- the value of the query parameter
-
removeQueryParameter
void removeQueryParameter(@NonNull() String name)
Remove the specified query parameter by name (case-sensitive).
- Parameters:
name- the query parameter to remove
-
getQueryParameterNames
@NonNull() Set<String> getQueryParameterNames()
Return the query parameter names that are set for this request.
-
getQueryParameter
@Nullable() String getQueryParameter(@NonNull() String name)
Return the query parameter value by name or null if the parameter is not present.
- Parameters:
name- the query parameter name (case-sensitive)
-
toStream
void toStream(@NotNull() JsonStream writer)
-
-
-
-