Class Response


  • public class Response
    extends Common
    Represents the response side of the HTTP communication.
    Since:
    1.0.0
    Author:
    Marcin Grzejszczak, Tim Ysewyn
    • Constructor Detail

      • Response

        public Response()
      • Response

        public Response​(Response response)
    • Method Detail

      • status

        public void status​(int status)
        Allows to set the HTTP status.
        Parameters:
        status - HTTP status
      • status

        public void status​(DslProperty status)
        Allows to set the HTTP status.
        Parameters:
        status - HTTP status
      • body

        public void body​(Map<String,​Object> body)
        Allows set an HTTP body.
        Parameters:
        body - body to set
      • body

        public void body​(List body)
        Allows set an HTTP body.
        Parameters:
        body - body to set
      • body

        public void body​(Object bodyAsValue)
        Allows set an HTTP body.
        Parameters:
        bodyAsValue - body to set
      • fixedDelayMilliseconds

        public void fixedDelayMilliseconds​(int timeInMilliseconds)
        Allows to set a fixed delay of the response in milliseconds.
        Parameters:
        timeInMilliseconds - delay in millis
      • async

        public void async()
        Turns on the asynchronous mode for this contract. Used with MockMvc and the Servlet 3.0 features.
      • value

        public DslProperty value​(ServerDslProperty server)
        Allows to set a dynamic value for the given element.
        Parameters:
        server - server value
        Returns:
        dsl property
      • $

        public DslProperty $​(ServerDslProperty server)
        Allows to set a dynamic value for the given element.
        Parameters:
        server - server value
        Returns:
        dsl property
      • value

        public DslProperty value​(Pattern server)
        Allows to set a dynamic value for the given element.
        Parameters:
        server - server value
        Returns:
        dsl property
      • value

        public DslProperty value​(RegexProperty server)
        Allows to set a dynamic value for the given element.
        Parameters:
        server - server value
        Returns:
        dsl property
      • $

        public DslProperty $​(RegexProperty server)
        Allows to set a dynamic value for the given element.
        Parameters:
        server - server value
        Returns:
        dsl property
      • $

        public DslProperty $​(Pattern server)
        Allows to set a dynamic value for the given element.
        Parameters:
        server - server value
        Returns:
        dsl property
      • fromRequest

        public FromRequest fromRequest()
        Allows to reference entries from the request.
        Returns:
        from request object
      • getProperty

        public org.springframework.cloud.contract.spec.internal.Response.ServerPatternValueDslProperty getProperty()
      • setProperty

        public void setProperty​(org.springframework.cloud.contract.spec.internal.Response.ServerPatternValueDslProperty property)
      • setStatus

        public void setStatus​(DslProperty status)
      • setDelay

        public void setDelay​(DslProperty delay)
      • getHeaders

        public Headers getHeaders()
      • setHeaders

        public void setHeaders​(Headers headers)
      • getCookies

        public Cookies getCookies()
      • setCookies

        public void setCookies​(Cookies cookies)
      • getBody

        public Body getBody()
      • setBody

        public void setBody​(Body body)
      • getAsync

        public boolean getAsync()
      • isAsync

        public boolean isAsync()
      • setAsync

        public void setAsync​(boolean async)
      • CONTINUE

        public int CONTINUE()
      • SWITCHING_PROTOCOLS

        public int SWITCHING_PROTOCOLS()
      • PROCESSING

        public int PROCESSING()
      • CHECKPOINT

        public int CHECKPOINT()
      • OK

        public int OK()
      • CREATED

        public int CREATED()
      • ACCEPTED

        public int ACCEPTED()
      • NON_AUTHORITATIVE_INFORMATION

        public int NON_AUTHORITATIVE_INFORMATION()
      • NO_CONTENT

        public int NO_CONTENT()
      • RESET_CONTENT

        public int RESET_CONTENT()
      • PARTIAL_CONTENT

        public int PARTIAL_CONTENT()
      • MULTI_STATUS

        public int MULTI_STATUS()
      • ALREADY_REPORTED

        public int ALREADY_REPORTED()
      • IM_USED

        public int IM_USED()
      • MULTIPLE_CHOICES

        public int MULTIPLE_CHOICES()
      • MOVED_PERMANENTLY

        public int MOVED_PERMANENTLY()
      • FOUND

        public int FOUND()
      • SEE_OTHER

        public int SEE_OTHER()
      • NOT_MODIFIED

        public int NOT_MODIFIED()
      • TEMPORARY_REDIRECT

        public int TEMPORARY_REDIRECT()
      • PERMANENT_REDIRECT

        public int PERMANENT_REDIRECT()
      • BAD_REQUEST

        public int BAD_REQUEST()
      • UNAUTHORIZED

        public int UNAUTHORIZED()
      • PAYMENT_REQUIRED

        public int PAYMENT_REQUIRED()
      • FORBIDDEN

        public int FORBIDDEN()
      • NOT_FOUND

        public int NOT_FOUND()
      • METHOD_NOT_ALLOWED

        public int METHOD_NOT_ALLOWED()
      • NOT_ACCEPTABLE

        public int NOT_ACCEPTABLE()
      • PROXY_AUTHENTICATION_REQUIRED

        public int PROXY_AUTHENTICATION_REQUIRED()
      • REQUEST_TIMEOUT

        public int REQUEST_TIMEOUT()
      • CONFLICT

        public int CONFLICT()
      • GONE

        public int GONE()
      • LENGTH_REQUIRED

        public int LENGTH_REQUIRED()
      • PRECONDITION_FAILED

        public int PRECONDITION_FAILED()
      • PAYLOAD_TOO_LARGE

        public int PAYLOAD_TOO_LARGE()
      • URI_TOO_LONG

        public int URI_TOO_LONG()
      • UNSUPPORTED_MEDIA_TYPE

        public int UNSUPPORTED_MEDIA_TYPE()
      • REQUESTED_RANGE_NOT_SATISFIABLE

        public int REQUESTED_RANGE_NOT_SATISFIABLE()
      • EXPECTATION_FAILED

        public int EXPECTATION_FAILED()
      • I_AM_A_TEAPOT

        public int I_AM_A_TEAPOT()
      • UNPROCESSABLE_ENTITY

        public int UNPROCESSABLE_ENTITY()
      • LOCKED

        public int LOCKED()
      • FAILED_DEPENDENCY

        public int FAILED_DEPENDENCY()
      • UPGRADE_REQUIRED

        public int UPGRADE_REQUIRED()
      • PRECONDITION_REQUIRED

        public int PRECONDITION_REQUIRED()
      • TOO_MANY_REQUESTS

        public int TOO_MANY_REQUESTS()
      • REQUEST_HEADER_FIELDS_TOO_LARGE

        public int REQUEST_HEADER_FIELDS_TOO_LARGE()
      • UNAVAILABLE_FOR_LEGAL_REASONS

        public int UNAVAILABLE_FOR_LEGAL_REASONS()
      • INTERNAL_SERVER_ERROR

        public int INTERNAL_SERVER_ERROR()
      • NOT_IMPLEMENTED

        public int NOT_IMPLEMENTED()
      • BAD_GATEWAY

        public int BAD_GATEWAY()
      • SERVICE_UNAVAILABLE

        public int SERVICE_UNAVAILABLE()
      • GATEWAY_TIMEOUT

        public int GATEWAY_TIMEOUT()
      • HTTP_VERSION_NOT_SUPPORTED

        public int HTTP_VERSION_NOT_SUPPORTED()
      • VARIANT_ALSO_NEGOTIATES

        public int VARIANT_ALSO_NEGOTIATES()
      • INSUFFICIENT_STORAGE

        public int INSUFFICIENT_STORAGE()
      • LOOP_DETECTED

        public int LOOP_DETECTED()
      • BANDWIDTH_LIMIT_EXCEEDED

        public int BANDWIDTH_LIMIT_EXCEEDED()
      • NOT_EXTENDED

        public int NOT_EXTENDED()
      • NETWORK_AUTHENTICATION_REQUIRED

        public int NETWORK_AUTHENTICATION_REQUIRED()
      • hashCode

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

        public void headers​(Consumer<Headers> consumer)
        Allows to configure HTTP headers.
        Parameters:
        consumer - function to manipulate the URL
      • cookies

        public void cookies​(Consumer<Cookies> consumer)
        Allows to configure HTTP cookies.
        Parameters:
        consumer - function to manipulate the URL
      • bodyMatchers

        public void bodyMatchers​(Consumer<ResponseBodyMatchers> consumer)
        Allows to set matchers for the body.
        Parameters:
        consumer - function to manipulate the URL
      • headers

        public void headers​(@DelegatesTo(Headers.class)
                            groovy.lang.Closure consumer)
        Allows to configure HTTP headers.
        Parameters:
        consumer - function to manipulate the URL
      • cookies

        public void cookies​(@DelegatesTo(Cookies.class)
                            groovy.lang.Closure consumer)
        Allows to configure HTTP cookies.
        Parameters:
        consumer - function to manipulate the URL
      • bodyMatchers

        public void bodyMatchers​(@DelegatesTo(ResponseBodyMatchers.class)
                                 groovy.lang.Closure consumer)
        Allows to set matchers for the body.
        Parameters:
        consumer - function to manipulate the URL