Class ZestExpressionProtocol

  • All Implemented Interfaces:
    ZestExpressionElement

    public class ZestExpressionProtocol
    extends ZestExpression
    A ZestExpression that checks if the last request has a given protocol (for example, HTTPS).

    The check is done in a case-insensitive manner. The expression returns false if no protocol was set (that is, null).

    Since:
    0.14.0
    • Constructor Detail

      • ZestExpressionProtocol

        public ZestExpressionProtocol()
        Constructs a ZestExpressionProtocol with no protocol.
      • ZestExpressionProtocol

        public ZestExpressionProtocol​(String protocol)
        Constructs a ZestExpressionProtocol with the given protocol.
        Parameters:
        protocol - the protocol that the request must have for the expression to return true.
      • ZestExpressionProtocol

        public ZestExpressionProtocol​(String protocol,
                                      boolean inverse)
        Constructs a ZestExpressionProtocol with the given protocol and inverse state.
        Parameters:
        protocol - the protocol that the request must have for the expression to return true.
        inverse - if the expression should be the inverse.
    • Method Detail

      • isTrue

        public boolean isTrue​(ZestRuntime runtime)
        Tells whether or not the last request matches the protocol set.
        Parameters:
        runtime - the runtime
        Returns:
        the boolean value of the expression without inverse flag
      • getProtocol

        public String getProtocol()
        Gets the protocol that the request must have.
        Returns:
        the protocol, might be null.
      • setProtocol

        public void setProtocol​(String protocol)
        Sets the protocol that the request must have.
        Parameters:
        protocol - the new protocol