Interface RequestGuard


@JavaScript(implementation="org.jboss.arquillian.graphene.guard.RequestGuardImpl") public interface RequestGuard

Allows to manually retrieve information from Request Guard on a page.

This method is used internally by:

Author:
Lukas Fryc
  • Method Details

    • getRequestType

      RequestType getRequestType()
      Returns:
      the last request type
    • getRequestState

      RequestState getRequestState()
      Returns:
      the state of last request
    • clearRequestDone

      RequestType clearRequestDone()
      Clears the request type cache and returns the last request type
      Returns:
      the last request type
    • filter

      void filter(String eval)

      Specifies JavaScript implementation of filter, which declares what requests will be guarded.

      If the provided expression evaluates to false, a request won't be guarded.

      In a 'eval' expression, you can use following contextual information:

      • this.url - an URL
      • this.method - GET/POST
      • this.async - boolean expression determines whether a request is async
      • this.body - a content of a request

      Note that some values might need processing, for example body might be escaped:

      E.g.: unescape(this.body).indexOf('javax.faces.source=f:poll') > 0

      The expression above will detect, whether a request body contains some string.

    • clearFilters

      void clearFilters()
      Clear all filters defined by filter(String).
    • setMaximumCallbackTimeout

      void setMaximumCallbackTimeout(int miliseconds)

      Specifies maximum timeout (in miliseconds) for asynchronous scheduled callbacks which will be guarded (default: 50 ms).

      Asynchronous scheduled callbacks are callbacks which are scheduled in XMLHttpRequests's onreadystatechange callback.

      Usually are those callbacks scheduled for timeouts <= 50 just to postpone updates of user interface out of XHR processing.

      Be aware that sometimes it is inappropriate to guard asynchronous scheduled callbacks - in this case you can set this value to -1 in order to guarding of scheduled callbacks at all.