Class FromRequest


  • public class FromRequest
    extends Object
    Helper class to reference the request body parameters.
    Since:
    1.1.0
    Author:
    Marcin Grzejszczak
    • Constructor Detail

      • FromRequest

        public FromRequest()
    • Method Detail

      • url

        public DslProperty url()
        Returns:
        URL path and query.
      • query

        public DslProperty query​(String key)
        First value of a query parameter e.g. request.query.search.
        Parameters:
        key - key for the query param
        Returns:
        dsl property
      • query

        public DslProperty query​(String key,
                                 int index)
        nth value of a query parameter (zero indexed) e.g. request.query.search.[5].
        Parameters:
        key - key for the query param
        index - index of the query param
        Returns:
        dsl property
      • path

        public DslProperty path()
        URL path.
        Returns:
        dsl property
      • path

        public DslProperty path​(int index)
        nth value of a URL path (zero indexed) e.g. {{{ request.path.[2] }}}* @param index.
        Parameters:
        index - path index
        Returns:
        dsl property
      • header

        public DslProperty header​(String key)
        First value of a request header e.g. request.headers.X-Request-Id.
        Parameters:
        key - header key
        Returns:
        dsl property
      • header

        public DslProperty header​(String key,
                                  int index)
        nth value of a request header (zero indexed) e.g. request.headers.X-Request-Id.
        Parameters:
        key - header key
        index - header index
        Returns:
        dsl property
      • cookie

        public DslProperty cookie​(String key)
        Retruns the tempalte for retrieving the first value of a cookie with certain key.
        Parameters:
        key - cookie key
        Returns:
        dsl property
      • body

        public DslProperty body()
        Request body text (avoid for non-text bodies).
        Returns:
        dsl property
      • body

        public DslProperty body​(String jsonPath)
        Request body text for the given JsonPath.
        Parameters:
        jsonPath - json path body
        Returns:
        dsl property
      • rawUrl

        public DslProperty rawUrl()
        Unescaped URL path and query.
        Returns:
        dsl property
      • rawQuery

        public DslProperty rawQuery​(String key)
        Unescaped First value of a query parameter e.g. request.query.search.
        Parameters:
        key - query key
        Returns:
        dsl property
      • rawQuery

        public DslProperty rawQuery​(String key,
                                    int index)
        Unescaped nth value of a query parameter (zero indexed) e.g. request.query.search.[5].
        Parameters:
        key - query key
        index - query index
        Returns:
        dsl property
      • rawPath

        public DslProperty rawPath()
        Unescaped URL path.
        Returns:
        dsl property
      • rawPath

        public DslProperty rawPath​(int index)
        Unescaped nth value of a URL path (zero indexed) e.g. {{{ request.path.[2]. }}}*
        Parameters:
        index - path index
        Returns:
        dsl property
      • rawHeader

        public DslProperty rawHeader​(String key)
        Unescaped First value of a request header e.g. request.headers.X-Request-Id.
        Parameters:
        key - header key
        Returns:
        dsl property
      • rawHeader

        public DslProperty rawHeader​(String key,
                                     int index)
        Unescaped nth value of a request header (zero indexed) e.g. request.headers.X-Request-Id.
        Parameters:
        key - header key
        index - header index
        Returns:
        dsl property
      • rawCookie

        public DslProperty rawCookie​(String key)
        Unescaped Returns the template for retrieving the first value of a cookie with certain key.
        Parameters:
        key - cookie key
        Returns:
        dsl property
      • rawBody

        public DslProperty rawBody()
        Unescaped Request body text (avoid for non-text bodies).
        Returns:
        dsl property
      • rawBody

        public DslProperty rawBody​(String jsonPath)
        Unescaped Request body text for the given JsonPath.
        Parameters:
        jsonPath - json path body
        Returns:
        dsl property