Skip to main content
Version: 7.2405.x.x LTS

RequestFlags

RequestFlags support conditions and accept Pragma continue by default.

The RequestFlags are checked just at the beginning of the doFilter method of a filter or service method of a servlet. RequestFlags describe which RequestWrappers are needed for the given filter or servlet.

Syntax

[ALL] [NONE] [+/-GUESS_CONTENTTYPE] [+/-NEEDS_PARAMS][+/-NEEDS_COOKIES][+/-NEEDS_SET_COOKIES] [+/-HAS_RESPONSE_CONDITION] [+/-NEEDS_BUFFERED_BODY][+/-NEEDS_TIME_METER][+/-NEEDS_FORM_MULTIPARTS][+/-NEEDS_SWITCHING_PROTOCOLS][+/-NEEDS_REDIRECT][+/-NEEDS_GWT_PARSING] [+/-PRUNE_ACCEPT_ENCODING] [+/-NEEDS_JSON_PARSING]
  • 'ALL': Is the same as + with all other flags.
  • 'NONE': Is the same as - with all other flags.
  • '+': This means that the filter needs the wrapper(s) to fulfill this flag. For optimization, the wrapper will only be added if it has not yet been added by another filter in this chain.
  • '-': This means that this filter/servlet does not necessarily need those wrappers BUT they will not be removed if another filter has already added it (you can't remove a wrapper which is already in a chain).
  • 'GUESS_CONTENTTYPE': Wrappers needed to guess the content type.
  • 'NEEDS_PARAMS': Wrappers needed to get the parameters from the query, as well as the body, if the content type of the request is application/x-www-form-urlencoded (this requires body buffering).
  • 'NEEDS_COOKIES': Wrappers needed to get the cookies from the cookie header.
  • 'NEEDS_SET_COOKIES': Wrappers needed for some filters to be able to access cookies in the "Set-Cookie" headers with a special cookie API.
  • 'HAS_RESPONSE_CONDITION': Wrappers needed if the filter/servlet has to know the response headers via the request attribute bcx.servlet.response.Header.<headername>.
  • 'NEEDS_BUFFERED_BODY': Wrappers needed if the filter/servlet has to access the request body via the request attribute bcx.servlet.request.Body.
  • 'NEEDS_TIME_METER': Wrappers needed to count the time that is spent in the filter itself. An INFO message will be logged to the trace group NPPerfMeter if enabled.
  • 'NEEDS_FORM_MULTIPARTS': Wrappers needed to get the parts of a multipart request body. A multipart request body will only be parsed if the Content-Type header is set to "multipart/form-data". Usually there is no need to set this flag: Filters parsing the parts of a multipart request usually have this flag set by default.
  • 'NEEDS_SWITCHING_PROTOCOLS': This flag is needed for filters that cache the request body and are followed by a WebsocketServlet (or any other servlet that supports websockets). If this flag is missing, websocket connections will not work correctly. Filters that require this flag usually have it already set by default.
  • 'NEEDS_REDIRECT': You need to set this flag, if you want to change (or trace) all redirect responses in a LuaFilter. Without this flag, the LuaFilter will not "see" some redirect responses, for example, the ones triggered by a RewriteFilter. Note that currently you should set this flag for the LuaFilter only.
  • NEEDS_GWT_PARSING: Wrappers needed to get the parameters from a GWT body. The request body will only be parsed if the Content-Type header is "x-gwt-rpc". The GWT parameters can be accessed with the gwt.<index_of_param> syntax.
  • 'PRUNE_ACCEPT_ENCODING': Modify the Accept-Encoding header to make the backend encode its response in a format that besides the client, the Proxy can also handle. This is needed when a filter wants to read or modify the content of the backend's response. When there are no usable encoding formats, the proxy returns a 406 - Not Acceptable HTTP response. This flag is enabled by default for the InflateFilter and RewriteFilter. It is recommended to enable this flag when accessing the response body with the LuaFilter.
  • 'NEEDS_JSON_PARSING': Wrappers needed to get the parameters from a JSON body. The request body will only be parsed if the Content-Type header is "application/json". Sometimes a filter modified the incoming body, and one of the upcoming filter/servlets needs the new, parsed values. In this case, you can use the 'RESET_PARAMS' modifier flag to re-parse the incoming request. Requests of mime "application/json" will be parsed. The parameters will be set as follows:
NameValueParsed JSON
name1stringValueo.name1.v=stringValue
name2doubleValueo.name2.d=doubleValue
name3longValueo.name3.l=longValue
name4integerValueo.name4.n=integerValue
name5booleanValueo.name5.b=booleanValue
name6nullo.name6.z=null
array[ strVal, intVal ...]o.array.<idx>.<type>=<value>
object{ subname: boolVal, ... }o.object.o.<name>.<type>=<value>

Sample

  • ALL -HAS_RESPONSE_CONDITION Makes sure that all wrappers for all flags are set, except for the HAS_RESPONSE_CONDITION. For the HAS_RESPONSE_CONDITION, we do not care if the wrappers are already added or not.