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
Modifier and TypeClassDescriptionstatic final class
static final class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
@Nullable String
@Nullable Long
@Nullable String
@Nullable Object
getData()
getEnvs()
@Nullable String
@Nullable String
@Nullable String
@Nullable String
getUrl()
int
hashCode()
void
serialize
(@NotNull ObjectWriter writer, @NotNull ILogger logger) void
setApiTarget
(@Nullable String apiTarget) void
setBodySize
(@Nullable Long bodySize) void
setCookies
(@Nullable String cookies) void
void
void
setFragment
(@Nullable String fragment) void
setHeaders
(@Nullable Map<String, String> headers) void
void
void
setQueryString
(@Nullable String queryString) void
setUnknown
(@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:
getUnknown
in interfaceJsonUnknown
-
setUnknown
- Specified by:
setUnknown
in interfaceJsonUnknown
-
getApiTarget
-
setApiTarget
-
serialize
public void serialize(@NotNull @NotNull ObjectWriter writer, @NotNull @NotNull ILogger logger) throws IOException - Specified by:
serialize
in interfaceJsonSerializable
- Throws:
IOException
-