Class Request
- All Implemented Interfaces:
JsonSerializable,JsonUnknown
The Request interface contains information on a HTTP request related to the event. In client SDKs, this can be an outgoing request, or the request that rendered the current web page. On server SDKs, this could be the incoming web request that is being handled.
The data variable should only contain the request body (not the query string). It can either be a dictionary (for standard HTTP requests) or a raw request body.
### Ordered Maps
In the Request interface, several attributes can either be declared as string, object, or list of tuples. Sentry attempts to parse structured information from the string representation in such cases.
Sometimes, keys can be declared multiple times, or the order of elements matters. In such cases, use the tuple representation over a plain object.
Example of request headers as object:
```json { "content-type": "application/json", "accept": "application/json, application/xml" } ```
Example of the same headers as list of tuples:
```json [ ["content-type", "application/json"], ["accept", "application/json"], ["accept", "application/xml"] ] ```
Example of a fully populated request object:
```json { "request": { "method": "POST", "url": "http://absolute.uri/foo", "query_string": "query=foobar", "data": { "foo": "bar" }, "cookies": "PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;", "headers": { "content-type": "text/html" }, "env": { "REMOTE_ADDR": "192.168.0.1" } } } ```
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean@Nullable String@Nullable Long@Nullable String@Nullable ObjectgetData()getEnvs()@Nullable String@Nullable String@Nullable String@Nullable StringgetUrl()inthashCode()voidserialize(@NotNull ObjectWriter writer, @NotNull ILogger logger) voidsetApiTarget(@Nullable String apiTarget) voidsetBodySize(@Nullable Long bodySize) voidsetCookies(@Nullable String cookies) voidvoidvoidsetFragment(@Nullable String fragment) voidsetHeaders(@Nullable Map<String, String> headers) voidvoidvoidsetQueryString(@Nullable String queryString) voidsetUnknown(@Nullable Map<String, Object> unknown) void
-
Constructor Details
-
Request
public Request() -
Request
-
-
Method Details
-
getUrl
-
setUrl
-
getMethod
-
setMethod
-
getQueryString
-
setQueryString
-
getData
-
setData
-
getCookies
-
setCookies
-
getHeaders
-
setHeaders
-
getEnvs
-
setEnvs
-
getOthers
-
setOthers
-
getFragment
-
setFragment
-
getBodySize
-
setBodySize
-
equals
-
hashCode
public int hashCode() -
getUnknown
- Specified by:
getUnknownin interfaceJsonUnknown
-
setUnknown
- Specified by:
setUnknownin interfaceJsonUnknown
-
getApiTarget
-
setApiTarget
-
serialize
public void serialize(@NotNull @NotNull ObjectWriter writer, @NotNull @NotNull ILogger logger) throws IOException - Specified by:
serializein interfaceJsonSerializable- Throws:
IOException
-