Class Request

java.lang.Object
io.sentry.protocol.Request
All Implemented Interfaces:
JsonSerializable, JsonUnknown

public final class Request extends Object implements JsonUnknown, JsonSerializable
Http request information.

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" } } } ```

  • Constructor Details

    • Request

      public Request()
    • Request

      public Request(@NotNull @NotNull Request request)
  • Method Details

    • getUrl

      @Nullable public @Nullable String getUrl()
    • setUrl

      public void setUrl(@Nullable @Nullable String url)
    • getMethod

      @Nullable public @Nullable String getMethod()
    • setMethod

      public void setMethod(@Nullable @Nullable String method)
    • getQueryString

      @Nullable public @Nullable String getQueryString()
    • setQueryString

      public void setQueryString(@Nullable @Nullable String queryString)
    • getData

      @Nullable public @Nullable Object getData()
    • setData

      public void setData(@Nullable @Nullable Object data)
    • getCookies

      @Nullable public @Nullable String getCookies()
    • setCookies

      public void setCookies(@Nullable @Nullable String cookies)
    • getHeaders

      @Nullable public @Nullable Map<String,String> getHeaders()
    • setHeaders

      public void setHeaders(@Nullable @Nullable Map<String,String> headers)
    • getEnvs

      @Nullable public @Nullable Map<String,String> getEnvs()
    • setEnvs

      public void setEnvs(@Nullable @Nullable Map<String,String> env)
    • getOthers

      @Nullable public @Nullable Map<String,String> getOthers()
    • setOthers

      public void setOthers(@Nullable @Nullable Map<String,String> other)
    • getFragment

      @Nullable public @Nullable String getFragment()
    • setFragment

      public void setFragment(@Nullable @Nullable String fragment)
    • getBodySize

      @Nullable public @Nullable Long getBodySize()
    • setBodySize

      public void setBodySize(@Nullable @Nullable Long bodySize)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getUnknown

      @Nullable public @Nullable Map<String,Object> getUnknown()
      Specified by:
      getUnknown in interface JsonUnknown
    • setUnknown

      public void setUnknown(@Nullable @Nullable Map<String,Object> unknown)
      Specified by:
      setUnknown in interface JsonUnknown
    • getApiTarget

      @Nullable public @Nullable String getApiTarget()
    • setApiTarget

      public void setApiTarget(@Nullable @Nullable String apiTarget)
    • serialize

      public void serialize(@NotNull @NotNull ObjectWriter writer, @NotNull @NotNull ILogger logger) throws IOException
      Specified by:
      serialize in interface JsonSerializable
      Throws:
      IOException